KhronosGroup / KhronosGroup/glslang
Assertion `PureOperatorBuiltins == false' failed on use of texture2D
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
I know texture2D is deprecated, but glslangValidator asserts when its used. Here's an example:
texture2d.frag:
```glsl
#version 330 core
uniform sampler2D tex;
void main()
{
texture2D(tex, vec2(0));
}
```
```shell
$ glslangValidator -l -S frag texture2d.frag
glslangValidator: /usr/src/debug/glslang/glslang-14.1.0/glslang/MachineIndependent/ParseHelper.cpp:2846: void glslang::TParseContext::nonOpBuiltInCheck(const glslang::TSourceLoc&, const glslang::TFunction&, glslang::TIntermAggregate&): Assertion `PureOperatorBuiltins == false' failed.
Aborted (core dumped)
```
Backtrace:
```gdb
#5 0x00007ffff6c48c67 in __assert_fail (assertion=0x7ffff7dcb911 "PureOperatorBuiltins == false", file=0x7ffff7e06ff0 "/usr/src/debug/glslang/glslang-14.1.0/glslang/MachineIndependent/ParseHelper.cpp",
line=2846, function=0x7ffff7e089d0 "void glslang::TParseContext::nonOpBuiltInCheck(const glslang::TSourceLoc&, const glslang::TFunction&, glslang::TIntermAggregate&)") at assert.c:103
#6 0x00007ffff7d45ed8 in glslang::TParseContext::nonOpBuiltInCheck(glslang::TSourceLoc const&, glslang::TFunction const&, glslang::TIntermAggregate&) () from /usr/lib/libglslang.so.14
#7 0x00007ffff7d43ed9 in glslang::TParseContext::handleFunctionCall(glslang::TSourceLoc const&, glslang::TFunction*, TIntermNode*) () from /usr/lib/libglslang.so.14
#8 0x00007ffff7d9f74e in yyparse(glslang::TParseContext*) () from /usr/lib/libglslang.so.14
#9 0x00007ffff7d328d7 in glslang::TParseContext::parseShaderStrings(glslang::TPpContext&, glslang::TInputScanner&, bool) () from /usr/lib/libglslang.so.14
#10 0x00007ffff7db0503 in ?? () from /usr/lib/libglslang.so.14
#11 0x00007ffff7c2f0a1 in glslang::TShader::parse(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, glslang::TShader::Includer&) () from /usr/lib/libglslang.so.14
#12 0x000055555555eadc in ?? ()
#13 0x0000555555560a7c in ?? ()
#14 0x00007ffff6c39c88 in __libc_start_call_main (main=main@entry=0x5555555581a0, argc=argc@entry=5, argv=argv@entry=0x7fffffffdbe8) at ../sysdeps/nptl/libc_start_call_main.h:58
#15 0x00007ffff6c39d4c in __libc_start_main_impl (main=0x5555555581a0, argc=5, argv=0x7fffffffdbe8, init=, fini=, rtld_fini=, stack_end=0x7fffffffdbd8)
at ../csu/libc-start.c:360
#16 0x00005555555584d5 in ?? ()
```
OS: Arch Linux
```shell
$ glslangValidator -v
Glslang Version: 11:14.1.0
ESSL Version: OpenGL ES GLSL 3.20 glslang Khronos. 14.1.0
GLSL Version: 4.60 glslang Khronos. 14.1.0
SPIR-V Version 0x00010600, Revision 1
GLSL.std.450 Version 100, Revision 1
Khronos Tool ID 8
SPIR-V Generator Version 11
GL_KHR_vulkan_glsl version 100
ARB_GL_gl_spirv version 100
```
Contributor guide
Research direction
Reproduce the crash with the supplied texture2d.frag shader and glslangValidator command. Start in glslang/MachineIndependent/ParseHelper.cpp at nonOpBuiltInCheck(), using the reported assertion and backtrace as entry points. Done means the deprecated texture2D input is handled without triggering an assertion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100