diff options
| author | Andre Weissflog <floooh@gmail.com> | 2025-08-02 16:10:01 +0200 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2025-08-02 16:10:01 +0200 |
| commit | 9eb91f7b8a64daf4422862f87cdf1fdcb8067110 (patch) | |
| tree | a1157f3527aefaaab2ce1344086dd71e5db88e37 | |
| parent | 83e7ecd771d1f84b2993bd9bcdb8ef4795e4072e (diff) | |
sokol_gfx.h gl: fix _sg_gl_begin_pass
| -rw-r--r-- | sokol_gfx.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sokol_gfx.h b/sokol_gfx.h index 730dadac..b7cbf966 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -9261,6 +9261,7 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_gles3(void) { _sg.features.mrt_independent_write_mask = false; _sg.features.compute = version >= 310; _sg.features.msaa_texture_bindings = false; + _sg.features.gl_texture_views = version >= 430; #if defined(__EMSCRIPTEN__) _sg.features.separate_buffer_types = true; #else @@ -10385,7 +10386,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_view(_sg_view_t* view, const sg_v _SG_GL_CHECK_ERROR(); if ((view->cmn.type == SG_VIEWTYPE_TEXTURE) && (_sg.features.gl_texture_views)) { const _sg_image_t* img = _sg_image_ref_ptr(&view->cmn.img.ref); - for (size_t slot; slot < img->cmn.num_slots; slot++) { + for (size_t slot = 0; slot < img->cmn.num_slots; slot++) { SOKOL_ASSERT(img->gl.tex[slot] != 0); const GLuint min_level = (GLuint)view->cmn.img.mip_level; const GLuint num_levels = (GLuint)view->cmn.img.mip_level_count; @@ -10554,8 +10555,8 @@ _SOKOL_PRIVATE void _sg_gl_begin_pass(const sg_pass* pass, const _sg_attachments const sg_swapchain* swapchain = &pass->swapchain; const sg_pass_action* action = &pass->action; - const bool is_swapchain_pass = !atts->empty; - const bool is_offscreen_pass = atts->empty; + const bool is_swapchain_pass = atts->empty; + const bool is_offscreen_pass = !atts->empty; // bind the render pass framebuffer // @@ -10622,7 +10623,7 @@ _SOKOL_PRIVATE void _sg_gl_begin_pass(const sg_pass* pass, const _sg_attachments glScissor(0, 0, _sg.cur_pass.dim.width, _sg.cur_pass.dim.height); // number of color attachments - const int num_color_atts = atts ? atts->num_color_views : 1; + const int num_color_atts = is_offscreen_pass ? atts->num_color_views : 1; // clear color and depth-stencil attachments if needed bool clear_any_color = false; |