Skip to content

gl_shader: do not require GL_ARB_texture_float in shader - #1746

Merged
illwieckz merged 1 commit into
masterfrom
illwieckz/vertex-shader-header
Aug 15, 2025
Merged

illwieckz merged 1 commit into
masterfrom
illwieckz/vertex-shader-header

Conversation

@illwieckz

Copy link
Copy Markdown
Member

Do not require GL_ARB_texture_float in vertex shader, this is a vertex-only extension.

This is only for convenience, I get this error on both Mesa radeonsi and llvmpipe drivers when I downgrade the GL/GLSL version to test GLSL 1.20, using MESA_GL_VERSION_OVERRIDE=2.1 MESA_GLSL_VERSION_OVERRIDE=120 environment variables:

Warn: Source for shader program deformVertexes_0:
   0: #version 120 
   1: 
   2: #extension GL_ARB_gpu_shader5 : require
   3: #define HAVE_ARB_gpu_shader5 1
   4: #extension GL_ARB_shading_language_420pack : require
   5: #define HAVE_ARB_shading_language_420pack 1
   6: #extension GL_ARB_texture_float : require
   7: #define HAVE_ARB_texture_float 1
------------------^-------------------
0:7(12): error: extension `GL_ARB_texture_float' unsupported in vertex shader

I haven't got this error on actual GL 2.1 / GLSL 1.20 hardware I recently tested (Nvidia, Intel).

There may be other extensions that may be specific to fragment shaders, but they are probably just missing or unused with such GL version so I didn't faced other errors.

While moving other fragment-specific extensions to the fragment-specific list may be better, for “purity” and “just in case” concerns, it is actually not required to make the shaders buildable again on such test bed, so it's not in the scope of this PR.

Do not require GL_ARB_texture_float in shader.

This syntax may not be supported.
Comment thread src/engine/renderer/gl_shader.cpp Outdated
@illwieckz
illwieckz force-pushed the illwieckz/vertex-shader-header branch from 594ab28 to b7e8b15 Compare August 12, 2025 21:06
@illwieckz

Copy link
Copy Markdown
Member Author

I now consider it a driver bug. Now that I fixed the stupid double-return, it now complains that GL_ARB_texture_float is not supported in a fragment shader…

Warn: Source for shader program generic:
   0: #version 120 
   1: 
   2: #extension GL_ARB_gpu_shader5 : require
   3: #define HAVE_ARB_gpu_shader5 1
   4: #extension GL_ARB_shading_language_420pack : require
   5: #define HAVE_ARB_shading_language_420pack 1
   6: #extension GL_ARB_texture_gather : require
   7: #define HAVE_ARB_texture_gather 1
   8: #define HAVE_ARB_texture_rg 1
   9: #extension GL_ARB_uniform_buffer_object : require
  10: #define HAVE_ARB_uniform_buffer_object 1
  11: #extension GL_ARB_shader_storage_buffer_object : require
  12: #define HAVE_ARB_shader_storage_buffer_object 1
  13: #extension GL_ARB_texture_float : require
  14: #define HAVE_ARB_texture_float 1
------------------^-------------------
0:14(12): error: extension `GL_ARB_texture_float' unsupported in fragment shader

@slipher

slipher commented Aug 13, 2025

Copy link
Copy Markdown
Member

Maybe that extension name just shouldn't appear in GLSL directives? https://registry.khronos.org/OpenGL/extensions/ARB/ARB_texture_float.txt doesn't say anything about #extension, whereas, for example, https://registry.khronos.org/OpenGL/extensions/ARB/ARB_gpu_shader5.txt says

Shaders using the new functionality provided by this extension should enable thisfunctionality via the construct
#extension GL_ARB_gpu_shader5 : require (or enable)

@VReaperV

VReaperV commented Aug 13, 2025 •

Copy link
Copy Markdown
Contributor

I think slipher is right. Especially given that the specification says OpenGL 1.1 or EXT_texture is required, and 1.1 doesn't have shaders to begin with (excepting the use of the shader extensions, but the spec for GL_ARB_texture_float doesn't mention those).

@illwieckz illwieckz changed the title gl_shader: do not require GL_ARB_texture_float in vertex shader gl_shader: do not require GL_ARB_texture_float in shader Aug 14, 2025
@illwieckz
illwieckz force-pushed the illwieckz/vertex-shader-header branch from b7e8b15 to 92544a2 Compare August 14, 2025 17:33
@illwieckz

illwieckz commented Aug 14, 2025 •

Copy link
Copy Markdown
Member Author

OK, if I'm right, the current change prevents the require instruction to be printed.

At least it fixes the problem on my end.

@slipher

slipher commented Aug 15, 2025

Copy link
Copy Markdown
Member

LGTM

@illwieckz
illwieckz merged commit da191b2 into master Aug 15, 2025
8 checks passed
@illwieckz
illwieckz deleted the illwieckz/vertex-shader-header branch August 15, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants