Skip to content

Commit

Permalink
Merge pull request #1185 from floooh/issue1184_glsl_warning
Browse files Browse the repository at this point in the history
sokol_gfx.h gl: better warnings on 'x not found in shader'
  • Loading branch information
floooh authored Jan 12, 2025
2 parents 3b0cf41 + 05a7340 commit 02728b7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sokol_gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -3685,8 +3685,9 @@ typedef struct sg_frame_stats {
_SG_LOGITEM_XMACRO(GL_ARRAY_TEXTURES_NOT_SUPPORTED, "array textures not supported (gl)") \
_SG_LOGITEM_XMACRO(GL_SHADER_COMPILATION_FAILED, "shader compilation failed (gl)") \
_SG_LOGITEM_XMACRO(GL_SHADER_LINKING_FAILED, "shader linking failed (gl)") \
_SG_LOGITEM_XMACRO(GL_VERTEX_ATTRIBUTE_NOT_FOUND_IN_SHADER, "vertex attribute not found in shader (gl)") \
_SG_LOGITEM_XMACRO(GL_IMAGE_SAMPLER_NAME_NOT_FOUND_IN_SHADER, "image-sampler name not found in shader (gl)") \
_SG_LOGITEM_XMACRO(GL_VERTEX_ATTRIBUTE_NOT_FOUND_IN_SHADER, "vertex attribute not found in shader; NOTE: may be caused by GL driver's GLSL compiler removing unused globals") \
_SG_LOGITEM_XMACRO(GL_UNIFORMBLOCK_NAME_NOT_FOUND_IN_SHADER, "uniform block name not found in shader; NOTE: may be caused by GL driver's GLSL compiler removing unused globals") \
_SG_LOGITEM_XMACRO(GL_IMAGE_SAMPLER_NAME_NOT_FOUND_IN_SHADER, "image-sampler name not found in shader; NOTE: may be caused by GL driver's GLSL compiler removing unused globals") \
_SG_LOGITEM_XMACRO(GL_FRAMEBUFFER_STATUS_UNDEFINED, "framebuffer completeness check failed with GL_FRAMEBUFFER_UNDEFINED (gl)") \
_SG_LOGITEM_XMACRO(GL_FRAMEBUFFER_STATUS_INCOMPLETE_ATTACHMENT, "framebuffer completeness check failed with GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT (gl)") \
_SG_LOGITEM_XMACRO(GL_FRAMEBUFFER_STATUS_INCOMPLETE_MISSING_ATTACHMENT, "framebuffer completeness check failed with GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT (gl)") \
Expand Down Expand Up @@ -8768,6 +8769,10 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_shader(_sg_shader_t* shd, const s
u->offset = (uint16_t) cur_uniform_offset;
SOKOL_ASSERT(u_desc->glsl_name);
u->gl_loc = glGetUniformLocation(gl_prog, u_desc->glsl_name);
if (u->gl_loc == -1) {
_SG_WARN(GL_UNIFORMBLOCK_NAME_NOT_FOUND_IN_SHADER);
_SG_LOGMSG(GL_UNIFORMBLOCK_NAME_NOT_FOUND_IN_SHADER, u_desc->glsl_name);
}
cur_uniform_offset += u_size;
ub->num_uniforms++;
}
Expand Down Expand Up @@ -8806,7 +8811,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_gl_create_shader(_sg_shader_t* shd, const s
shd->gl.tex_slot[img_smp_index] = (int8_t)gl_tex_slot++;
} else {
shd->gl.tex_slot[img_smp_index] = -1;
_SG_ERROR(GL_IMAGE_SAMPLER_NAME_NOT_FOUND_IN_SHADER);
_SG_WARN(GL_IMAGE_SAMPLER_NAME_NOT_FOUND_IN_SHADER);
_SG_LOGMSG(GL_IMAGE_SAMPLER_NAME_NOT_FOUND_IN_SHADER, img_smp_desc->glsl_name);
}
}
Expand Down

0 comments on commit 02728b7

Please sign in to comment.