-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenGL error running 'Hello World' code #227
Comments
I'm getting the same issue on a M1 Mac |
Seeing the same thing on a rented A10 |
Based on the jit_render.py code, the OpenGL shader validation error on M1 Macs is occurring in the texture binding and program compilation process. Here are the key issues and required changes:
def forward_pass(self, renderer, V, P, cam_pos, flags, program_flags, screen_size, color_list=None, reflection_mat=np.identity(4, np.float32), floor_tex=0):
# Need to track and limit texture units
active_texture = lighting_texture # Could exceed M1's 16 texture unit limit
@njit
def bind_lighting(pid, flags, light, shadow_map, light_matrix, ambient_light, gl):
active_texture = 0
# Need to ensure texture unit doesn't exceed 15 (0-15 range for M1) Required changes:
MAX_TEXTURE_UNITS = 16 # M1 Mac limit
@njit
def bind_lighting(pid, flags, light, shadow_map, light_matrix, ambient_light, gl):
active_texture = 0
# Track used texture units
used_units = set()
for i in range(n):
if active_texture >= MAX_TEXTURE_UNITS:
break
# Assign texture units ensuring no conflicts
texture_unit = active_texture % MAX_TEXTURE_UNITS
used_units.add(texture_unit)
active_texture += 1
@njit
def forward_pass(...):
# Track sampler types per texture unit
sampler_types = {}
for id in idx:
if active_texture >= MAX_TEXTURE_UNITS:
break
# Ensure different sampler types use different units
texture_unit = active_texture % MAX_TEXTURE_UNITS
if texture_unit not in sampler_types:
sampler_types[texture_unit] = set()
def _validate_texture_units(self):
# Ensure total texture units don't exceed M1 limit
total_units = (
len(self.shadow_map) + # Shadow maps
sum(1 for tex in self.textures if tex[0]) # Material textures
)
if total_units > MAX_TEXTURE_UNITS:
raise ValueError(f"Total texture units ({total_units}) exceeds M1 Mac limit (16)") These changes would:
The error occurs because the current implementation doesn't properly manage texture units within the M1's constraints. |
Hiya! I'm getting:
File "/home//.local/lib/python3.10/site-packages/OpenGL/GL/shaders.py", line 196, in compileProgram
program.check_validate()
File "/home//.local/lib/python3.10/site-packages/OpenGL/GL/shaders.py", line 105, in check_validate
raise RuntimeError(
RuntimeError: Validation failure (0): b'active samplers with a different type refer to the same texture image unit'
Error when running the Hello World code on CPU:
Any pointers on how to fix it?
The text was updated successfully, but these errors were encountered: