-
Notifications
You must be signed in to change notification settings - Fork 330
Description
Describe the bug
Compute shaders don't seem to support usampler2D, making it difficult to work in image formats that use unsigned integers. This occurs when trying to load a usampler2D uniform through a compute shader, even after using all of the correct types (uint, uvecn, etc...).
Here's a Python traceback for reference:
Traceback (most recent call last):
File "C:\Users\user\source\repos\compute_shader_test_7\compute_shader_test_7\compute_shader_test_7.py", line 33, in
program = pyglet.graphics.shader.ComputeShaderProgram(compute_src)
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pyglet\graphics\shader.py", line 1534, in init
self._uniforms = _introspect_uniforms(self._id, True)
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pyglet\graphics\shader.py", line 999, in _introspect_uniforms
uniforms[u_name] = _Uniform(program_id, u_name, u_type, u_size, loc, have_dsa)
File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pyglet\graphics\shader.py", line 483, in init
gl_type, gl_setter_legacy, gl_setter_dsa, length = _uniform_setters[uniform_type]
KeyError: 36963
System Information:
Platform
platform: Windows-10-10.0.19045-SP0
release: 10
machine: AMD64
Python
implementation: CPython
sys.version: 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
sys.maxint: 9223372036854775807
os.getcwd(): C:\Users\user\source\repos\compute shader test 3
pyglet
pyglet.version: 2.0.20
pyglet.compat_platform: win32
pyglet.file: C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pyglet_init_.py
pyglet.options['audio'] = ('xaudio2', 'directsound', 'openal', 'pulse', 'silent')
pyglet.options['debug_font'] = False
pyglet.options['debug_gl'] = True
pyglet.options['debug_gl_trace'] = False
pyglet.options['debug_gl_trace_args'] = False
pyglet.options['debug_gl_shaders'] = False
pyglet.options['debug_graphics_batch'] = False
pyglet.options['debug_lib'] = False
pyglet.options['debug_media'] = False
pyglet.options['debug_texture'] = False
pyglet.options['debug_trace'] = False
pyglet.options['debug_trace_args'] = False
pyglet.options['debug_trace_depth'] = 1
pyglet.options['debug_trace_flush'] = True
pyglet.options['debug_win32'] = False
pyglet.options['debug_input'] = False
pyglet.options['debug_x11'] = False
pyglet.options['shadow_window'] = True
pyglet.options['vsync'] = None
pyglet.options['xsync'] = True
pyglet.options['xlib_fullscreen_override_redirect'] = False
pyglet.options['search_local_libs'] = True
pyglet.options['win32_gdi_font'] = False
pyglet.options['headless'] = False
pyglet.options['headless_device'] = 0
pyglet.options['win32_disable_shaping'] = False
pyglet.options['dw_legacy_naming'] = False
pyglet.options['win32_disable_xinput'] = False
pyglet.options['com_mta'] = False
pyglet.options['osx_alt_loop'] = False
pyglet.options['shader_bind_management'] = True
pyglet.window
display: <pyglet.canvas.win32.Win32Display object at 0x00000167A03D8F40>
screens[0]: Win32Screen(x=0, y=0, width=1600, height=900)
config['double_buffer'] = 1
config['stereo'] = 0
config['buffer_size'] = 32
config['aux_buffers'] = 0
config['sample_buffers'] = 0
config['samples'] = 0
config['red_size'] = 8
config['green_size'] = 8
config['blue_size'] = 8
config['alpha_size'] = 8
config['depth_size'] = 24
config['stencil_size'] = 8
config['accum_red_size'] = 16
config['accum_green_size'] = 16
config['accum_blue_size'] = 16
config['accum_alpha_size'] = 16
config['major_version'] = 3
config['minor_version'] = 3
config['forward_compatible'] = None
config['opengl_api'] = 'gl'
config['debug'] = None
context: Win32ARBContext(id=1544549091168, share=Win32Context(id=1544581648144, share=None))
window.context._info
gl_info.get_version(): (3, 3)
gl_info.get_vendor(): Intel
gl_info.get_renderer(): Intel(R) HD Graphics 4400
pyglet.gl.glx_info
GLX not available.
pyglet.media
audio driver: <pyglet.media.drivers.xaudio2.adaptation.XAudio2Driver object at 0x00000167A034D8B0>
pyglet.media.ffmpeg
FFmpeg not available.
pyglet.media.drivers.openal
OpenAL not available.
pyglet.input.wintab
WinTab not available.
I'm also using OpenGL version 4.3, if that helps. GPU is Intel HD Graphics 4400, CPU is Intel Core i5-4300U @ 1.90 GHz.
How To Reproduce
Here's a link to some code that caused the problem for me: https://github.com/raphaelBeekmeyer/pyglet/blob/main/bugged_shader_code
The code is supposed to take in an array of values, encode them to an R32UI format, pass them through the compute shader as a sampler, add 12 to each value, output to an image, decode the image back into an array and print the result.