Skip to content

Fix OpenGL ES 3.0 shader and renderer compatibility to resolve invalid operation errors#42

Merged
damacaa merged 9 commits intofeature/porting-to-opengl-es-3.0from
copilot/check-compiler-and-shaders
Apr 9, 2026
Merged

Fix OpenGL ES 3.0 shader and renderer compatibility to resolve invalid operation errors#42
damacaa merged 9 commits intofeature/porting-to-opengl-es-3.0from
copilot/check-compiler-and-shaders

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

  • Fix 1 - float_expr1.0 - float_expr in sdf_raymarching.frag line 171
  • Fix vec3(0, 1, 0)vec3(0.0, 1.0, 0.0) in sdf_raymarching.frag lines 138, 176
  • Fix vec4(..., 0)vec4(..., 0.0) in sdf_raymarching.frag line 268
  • Fix max(finalMaterialId, 0) int result in vec3(...)float(max(finalMaterialId, 0)) in sdf_distance.frag line 155
  • Fix vec4(..., 0)vec4(..., 0.0) in sdf_distance.frag line 283
  • Fix int literals in vec2(...) constructors in jump_flood_step.frag line 45

Copilot AI changed the title [WIP] Fix invalid operation errors after porting to OpenGL ES 3.0 Fix OpenGL ES 3.0 shader compatibility to resolve invalid operation errors Apr 8, 2026
Copilot AI requested a review from damacaa April 8, 2026 20:20
@damacaa damacaa marked this pull request as ready for review April 8, 2026 22:06
@damacaa damacaa self-requested a review April 8, 2026 22:06
Copy link
Copy Markdown
Owner

@damacaa damacaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[deck@steamdeck build]$ /home/deck/Documents/GitHub/weird-engine/examples/sample-scenes/build/WeirdSamples
Framebuffer is not complete!
terminate called without an active exception
Aborted (core dumped) /home/deck/Documents/GitHub/weird-engine/examples/sample-scenes/build/WeirdSamples
[deck@steamdeck build]$

istill get this error

- Depth texture: GL_FLOAT → GL_UNSIGNED_INT for GL_DEPTH_COMPONENT24
  (GLES 3.0 spec Table 3.2: GL_DEPTH_COMPONENT24 requires GL_UNSIGNED_INT)
- Color textures: GL_RGB/GL_RGBA (unsized) → GL_RGB8/GL_RGBA8 (sized)
  (sized formats are required to be color-renderable in GLES 3.0)
- RenderTarget: bare throw; → throw std::runtime_error(...)
  (throw; with no active exception calls std::terminate)"

Agent-Logs-Url: https://github.com/damacaa/weird-engine/sessions/1627aaa0-7640-46b2-84b4-71f4bbc2ef23

Co-authored-by: damacaa <49535803+damacaa@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 8, 2026

[deck@steamdeck build]$ /home/deck/Documents/GitHub/weird-engine/examples/sample-scenes/build/WeirdSamples
Framebuffer is not complete!
terminate called without an active exception...

Fixed in c64d1b3. Three issues were causing this:

  1. Root cause — invalid depth texture type: In GLES 3.0, GL_DEPTH_COMPONENT24 requires GL_UNSIGNED_INT as the pixel type, not GL_FLOAT. The invalid glTexImage2D call left the depth texture in a broken state, which then caused the framebuffer attachment to be incomplete.

  2. Crash on incomplete framebuffer: The throw; statement in RenderTarget::bindTextureToFrameBuffer was called with no active exception, which invokes std::terminate() — that's the "terminate called without an active exception" message. Changed to throw std::runtime_error("Framebuffer is not complete!").

  3. Unsized color formats: Changed GL_RGBGL_RGB8 and GL_RGBAGL_RGBA8 for Color/ColorAlpha/RetroColor texture types. Unsized internal formats are not guaranteed to be color-renderable as framebuffer attachments in GLES 3.0; the sized equivalents are required by the spec.

Copilot AI changed the title Fix OpenGL ES 3.0 shader compatibility to resolve invalid operation errors Fix OpenGL ES 3.0 shader and renderer compatibility to resolve invalid operation errors Apr 8, 2026
Copilot AI requested a review from damacaa April 8, 2026 22:15
…mpatibility

GL_OES_texture_buffer is unsupported on the Steam Deck GLES driver.
Replace all samplerBuffer usage with highp sampler2D:

- DataBuffer.h: remove GL_TEXTURE_BUFFER_OES/glTexBufferOES entirely;
  upload data via glTexImage2D (RGBA32F, width=count, height=1)
- geometry_instanced.vert: remove extension + precision samplerBuffer,
  samplerBuffer -> sampler2D, texelFetch(buf,i) -> texelFetch(buf,ivec2(i,0),0)
- sdf_distance.frag: same changes
- sdf_raymarching.frag: same changes (2 texelFetch sites)
- 2DSDFShaderGenerationSystem.h: update generated texelFetch calls to 2D form

Agent-Logs-Url: https://github.com/damacaa/weird-engine/sessions/ac95e021-5bc9-4833-8d4b-335e5fa8a0aa

Co-authored-by: damacaa <49535803+damacaa@users.noreply.github.com>
…marching.frag

GLSL ES does not allow implicit int-to-float conversion in arithmetic.
Line 171: `float delta = 1 - (...)` fails because `1` is an int literal.
Change to `1.0 - (...)` to satisfy the type system.

Agent-Logs-Url: https://github.com/damacaa/weird-engine/sessions/91d8b0d9-4c71-495b-a130-c7deda75cc2f

Co-authored-by: damacaa <49535803+damacaa@users.noreply.github.com>
- sdf_raymarching.frag: vec3(0,1,0) -> vec3(0.0,1.0,0.0) (lines 138, 176)
  and vec4(...,0) -> vec4(...,0.0) (line 268)
- sdf_distance.frag: max(int,0) in vec3 -> float(max(int,0)) (line 155)
  and vec4(...,0) -> vec4(...,0.0) (line 283)
- jump_flood_step.frag: all vec2(int,int) -> vec2(float,float) (line 45)

GLSL ES 3.0 forbids implicit int-to-float conversion in constructors
and arithmetic, causing shader compile errors on strict drivers (Steam Deck).

Agent-Logs-Url: https://github.com/damacaa/weird-engine/sessions/7a32c872-cb79-4f74-9697-af1cab89f5b9

Co-authored-by: damacaa <49535803+damacaa@users.noreply.github.com>
@damacaa damacaa merged commit e235f3b into feature/porting-to-opengl-es-3.0 Apr 9, 2026
@damacaa damacaa deleted the copilot/check-compiler-and-shaders branch April 9, 2026 21:01
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.

2 participants