OPTIONAL:
...this is how ANGLE handles depth bias: https://github.com/google/angle/blob/8c5b69cbaa1084d42d2fd68e2781a78bd6dc6015/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp#L177
Sokol could use improved error reporting. Right now, I just get an uninformative assert failure, and have to dig into the code to figure out what failed. A function which converts backend error codes to strings would be useful.
What assert where you hitting? The idea is that you should get a validation error message when the API is used incorrectly, but there are places where validations don't happen yet. But if there are 'popular asserts' then there should be a validation check in front, which would result in a human readable error message (like these: https://github.com/floooh/sokol/blob/1a7d1484e2231924fd9abb287c8ee9469016d8ae/sokol_gfx.h#L7742)
Having invalid shader code or valid shader code but wrong types for uniform gives me this assert: Assertion failed: (shd && shd->slot.state == SG_RESOURCESTATE_VALID), function sg_init_pipeline, file ./sokol/sokol_gfx.h, line 8520.
There also needs to be error checking at the end of _sg_apply_uniform_block, and _sg_draw. glUniformMatrix4fv failed for me, but I got an error in sg_end_pass because that's where the next _SG_GL_CHECK_ERROR was.
hmm, currently looking into the shader compilation problem, and I'm getting a validation layer error, not the assertion later in sg_init_pipeline():
ERROR: 0:7: Use of undeclared identifier 'gl_Pxxxosition'
sg_pipeline_desc.shader missing or invalid
^^^^ VALIDATION FAILED, TERMINATING ^^^^
Assertion failed: (0), function _sg_validate_end, file /Users/floh/projects/sokol/sokol_gfx.h, line 7876.
Did you override any of the SOKOL_VALIDATE_xxx() macros by chance?
I think I was mistaken when I said I get the error for invalid shader code. I didn't check for that. But I did get the assert when using wrong types for uniform.
Try wrong types for uniform variables, i.e. have vec4 in shader code, but specify SG_UNIFORMTYPE_MAT4 to sokol, for a uniform.
Ok, I'll check if I can somehow improve error reporting for this case. In any case, thanks for the feedback :)