mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
glsl: Add compiler support for ARB_shader_texture_lod.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Tested-by: Marek Olšák <maraeo@gmail.com>
This commit is contained in:
parent
1d4eb8d5d8
commit
5a3a242a8f
6 changed files with 188 additions and 0 deletions
64
src/glsl/builtins/profiles/ARB_shader_texture_lod.frag
Normal file
64
src/glsl/builtins/profiles/ARB_shader_texture_lod.frag
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* The existing isotropic vertex texture functions are added to the
|
||||
* built-in functions for fragment shaders.
|
||||
*/
|
||||
vec4 texture1DLod (sampler1D sampler, float coord, float lod);
|
||||
vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod);
|
||||
vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod);
|
||||
vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod);
|
||||
vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);
|
||||
vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);
|
||||
vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod);
|
||||
vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod);
|
||||
vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod);
|
||||
vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod);
|
||||
vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod);
|
||||
vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod);
|
||||
vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod);
|
||||
|
||||
/* New anisotropic texture functions, providing explicit derivatives: */
|
||||
vec4 texture1DGradARB (sampler1D sampler,
|
||||
float P, float dPdx, float dPdy);
|
||||
vec4 texture1DProjGradARB (sampler1D sampler,
|
||||
vec2 P, float dPdx, float dPdy);
|
||||
vec4 texture1DProjGradARB (sampler1D sampler,
|
||||
vec4 P, float dPdx, float dPdy);
|
||||
|
||||
vec4 texture2DGradARB (sampler2D sampler,
|
||||
vec2 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 texture2DProjGradARB (sampler2D sampler,
|
||||
vec3 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 texture2DProjGradARB (sampler2D sampler,
|
||||
vec4 P, vec2 dPdx, vec2 dPdy);
|
||||
|
||||
vec4 texture3DGradARB (sampler3D sampler,
|
||||
vec3 P, vec3 dPdx, vec3 dPdy);
|
||||
vec4 texture3DProjGradARB (sampler3D sampler,
|
||||
vec4 P, vec3 dPdx, vec3 dPdy);
|
||||
|
||||
vec4 textureCubeGradARB (samplerCube sampler,
|
||||
vec3 P, vec3 dPdx, vec3 dPdy);
|
||||
|
||||
vec4 shadow1DGradARB (sampler1DShadow sampler,
|
||||
vec3 P, float dPdx, float dPdy);
|
||||
vec4 shadow1DProjGradARB (sampler1DShadow sampler,
|
||||
vec4 P, float dPdx, float dPdy);
|
||||
|
||||
vec4 shadow2DGradARB (sampler2DShadow sampler,
|
||||
vec3 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 shadow2DProjGradARB (sampler2DShadow sampler,
|
||||
vec4 P, vec2 dPdx, vec2 dPdy);
|
||||
|
||||
#ifdef GL_ARB_texture_rectangle
|
||||
vec4 texture2DRectGradARB (sampler2DRect sampler,
|
||||
vec2 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 texture2DRectProjGradARB(sampler2DRect sampler,
|
||||
vec3 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 texture2DRectProjGradARB(sampler2DRect sampler,
|
||||
vec4 P, vec2 dPdx, vec2 dPdy);
|
||||
|
||||
vec4 shadow2DRectGradARB (sampler2DRectShadow sampler,
|
||||
vec3 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 shadow2DRectProjGradARB (sampler2DRectShadow sampler,
|
||||
vec4 P, vec2 dPdx, vec2 dPdy);
|
||||
#endif
|
||||
46
src/glsl/builtins/profiles/ARB_shader_texture_lod.vert
Normal file
46
src/glsl/builtins/profiles/ARB_shader_texture_lod.vert
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/* New anisotropic texture functions, providing explicit derivatives: */
|
||||
vec4 texture1DGradARB (sampler1D sampler,
|
||||
float P, float dPdx, float dPdy);
|
||||
vec4 texture1DProjGradARB (sampler1D sampler,
|
||||
vec2 P, float dPdx, float dPdy);
|
||||
vec4 texture1DProjGradARB (sampler1D sampler,
|
||||
vec4 P, float dPdx, float dPdy);
|
||||
|
||||
vec4 texture2DGradARB (sampler2D sampler,
|
||||
vec2 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 texture2DProjGradARB (sampler2D sampler,
|
||||
vec3 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 texture2DProjGradARB (sampler2D sampler,
|
||||
vec4 P, vec2 dPdx, vec2 dPdy);
|
||||
|
||||
vec4 texture3DGradARB (sampler3D sampler,
|
||||
vec3 P, vec3 dPdx, vec3 dPdy);
|
||||
vec4 texture3DProjGradARB (sampler3D sampler,
|
||||
vec4 P, vec3 dPdx, vec3 dPdy);
|
||||
|
||||
vec4 textureCubeGradARB (samplerCube sampler,
|
||||
vec3 P, vec3 dPdx, vec3 dPdy);
|
||||
|
||||
vec4 shadow1DGradARB (sampler1DShadow sampler,
|
||||
vec3 P, float dPdx, float dPdy);
|
||||
vec4 shadow1DProjGradARB (sampler1DShadow sampler,
|
||||
vec4 P, float dPdx, float dPdy);
|
||||
|
||||
vec4 shadow2DGradARB (sampler2DShadow sampler,
|
||||
vec3 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 shadow2DProjGradARB (sampler2DShadow sampler,
|
||||
vec4 P, vec2 dPdx, vec2 dPdy);
|
||||
|
||||
#ifdef GL_ARB_texture_rectangle
|
||||
vec4 texture2DRectGradARB (sampler2DRect sampler,
|
||||
vec2 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 texture2DRectProjGradARB(sampler2DRect sampler,
|
||||
vec3 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 texture2DRectProjGradARB(sampler2DRect sampler,
|
||||
vec4 P, vec2 dPdx, vec2 dPdy);
|
||||
|
||||
vec4 shadow2DRectGradARB (sampler2DRectShadow sampler,
|
||||
vec3 P, vec2 dPdx, vec2 dPdy);
|
||||
vec4 shadow2DRectProjGradARB (sampler2DRectShadow sampler,
|
||||
vec4 P, vec2 dPdx, vec2 dPdy);
|
||||
#endif
|
||||
|
|
@ -369,6 +369,70 @@ def generate_texture_functions(fs):
|
|||
generate_sigs("", "tex", "2DArrayShadow")
|
||||
end_function(fs, "shadow2DArray")
|
||||
|
||||
# ARB_shader_texture_lod extension
|
||||
start_function("texture1DGradARB")
|
||||
generate_fiu_sigs("txd", "1D")
|
||||
end_function(fs, "texture1DGradARB")
|
||||
|
||||
start_function("texture2DGradARB")
|
||||
generate_fiu_sigs("txd", "2D")
|
||||
end_function(fs, "texture2DGradARB")
|
||||
|
||||
start_function("texture3DGradARB")
|
||||
generate_fiu_sigs("txd", "3D")
|
||||
end_function(fs, "texture3DGradARB")
|
||||
|
||||
start_function("textureCubeGradARB")
|
||||
generate_fiu_sigs("txd", "Cube")
|
||||
end_function(fs, "textureCubeGradARB")
|
||||
|
||||
start_function("texture1DProjGradARB")
|
||||
generate_fiu_sigs("txd", "1D", True)
|
||||
generate_fiu_sigs("txd", "1D", True, 2)
|
||||
end_function(fs, "texture1DProjGradARB")
|
||||
|
||||
start_function("texture2DProjGradARB")
|
||||
generate_fiu_sigs("txd", "2D", True)
|
||||
generate_fiu_sigs("txd", "2D", True, 1)
|
||||
end_function(fs, "texture2DProjGradARB")
|
||||
|
||||
start_function("texture3DProjGradARB")
|
||||
generate_fiu_sigs("txd", "3D", True)
|
||||
end_function(fs, "texture3DProjGradARB")
|
||||
|
||||
start_function("shadow1DGradARB")
|
||||
generate_sigs("", "txd", "1DShadow", False, 1)
|
||||
end_function(fs, "shadow1DGradARB")
|
||||
|
||||
start_function("shadow1DProjGradARB")
|
||||
generate_sigs("", "txd", "1DShadow", True, 1)
|
||||
end_function(fs, "shadow1DProjGradARB")
|
||||
|
||||
start_function("shadow2DGradARB")
|
||||
generate_sigs("", "txd", "2DShadow", False)
|
||||
end_function(fs, "shadow2DGradARB")
|
||||
|
||||
start_function("shadow2DProjGradARB")
|
||||
generate_sigs("", "txd", "2DShadow", True)
|
||||
end_function(fs, "shadow2DProjGradARB")
|
||||
|
||||
start_function("texture2DRectGradARB")
|
||||
generate_sigs("", "txd", "2DRect")
|
||||
end_function(fs, "texture2DRectGradARB")
|
||||
|
||||
start_function("texture2DRectProjGradARB")
|
||||
generate_sigs("", "txd", "2DRect", True)
|
||||
generate_sigs("", "txd", "2DRect", True, 1)
|
||||
end_function(fs, "texture2DRectProjGradARB")
|
||||
|
||||
start_function("shadow2DRectGradARB")
|
||||
generate_sigs("", "txd", "2DRectShadow", False)
|
||||
end_function(fs, "shadow2DRectGradARB")
|
||||
|
||||
start_function("shadow2DRectProjGradARB")
|
||||
generate_sigs("", "txd", "2DRectShadow", True)
|
||||
end_function(fs, "shadow2DRectProjGradARB")
|
||||
|
||||
# Deprecated (110/120 style) functions with silly names:
|
||||
start_function("texture1D")
|
||||
generate_sigs("", "tex", "1D")
|
||||
|
|
|
|||
|
|
@ -1128,6 +1128,10 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
|
|||
|
||||
if (extensions->ARB_explicit_attrib_location)
|
||||
add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1);
|
||||
|
||||
if (extensions->ARB_shader_texture_lod)
|
||||
add_builtin_define(parser, "GL_ARB_shader_texture_lod", 1);
|
||||
|
||||
if (extensions->AMD_conservative_depth)
|
||||
add_builtin_define(parser, "GL_AMD_conservative_depth", 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -240,6 +240,14 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
|
|||
state->EXT_texture_array_warn = (ext_mode == extension_warn);
|
||||
|
||||
unsupported = !state->extensions->EXT_texture_array;
|
||||
} else if (strcmp(name, "GL_ARB_shader_texture_lod") == 0) {
|
||||
/* Force ARB_texture_rectangle to be on so sampler2DRects are defined */
|
||||
state->ARB_texture_rectangle_enable = true;
|
||||
|
||||
state->ARB_shader_texture_lod_enable = (ext_mode != extension_disable);
|
||||
state->ARB_shader_texture_lod_warn = (ext_mode == extension_warn);
|
||||
|
||||
unsupported = !state->extensions->ARB_shader_texture_lod;
|
||||
} else if (strcmp(name, "GL_ARB_shader_stencil_export") == 0) {
|
||||
state->ARB_shader_stencil_export_enable = (ext_mode != extension_disable);
|
||||
state->ARB_shader_stencil_export_warn = (ext_mode == extension_warn);
|
||||
|
|
|
|||
|
|
@ -168,6 +168,8 @@ struct _mesa_glsl_parse_state {
|
|||
unsigned ARB_texture_rectangle_warn:1;
|
||||
unsigned EXT_texture_array_enable:1;
|
||||
unsigned EXT_texture_array_warn:1;
|
||||
unsigned ARB_shader_texture_lod_enable:1;
|
||||
unsigned ARB_shader_texture_lod_warn:1;
|
||||
unsigned ARB_shader_stencil_export_enable:1;
|
||||
unsigned ARB_shader_stencil_export_warn:1;
|
||||
unsigned AMD_conservative_depth_enable:1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue