Sokol: Road to v1.0

Created on 22 Oct 2017  路  7Comments  路  Source: floooh/sokol

  • [x] validation for sg_update_buffer()
  • [x] validation for sg_update_image()
  • [x] WebGL2->WebGL fallback
  • [ ] 10-10-10-2 vertex format inconsistency (D3D11 only has unsigned format)
  • [x] remove scissor_test_enabled, must be always enabled (Metal doesn't have that)
  • [x] reset scissor rect to full render target size at start of pass
  • [x] depth-bias stuff, need to check if there's a common ground for GL, D3D11, Metal
  • [x] depth_clip_enabled(?) not supported by GLES2/WebGL or GLES3/WebGL2
  • [x] antialiased_line_enabled(?) not supported on Metal, and with many caveats on D3D11
  • [x] max_anisotropy (sampler state, so needs to go into sg_image_desc)
  • [x] sampler state min_lod, max_lod, mip_lod_bias(?) mip_lod_bias as render state is only in D3D11, min_lod/max_lod is not in GLES2/WebGL (just ignore it there)
  • [x] allow use of externally created "native" D3D11, GL and Metal buffer and image resources
  • [x] Metal samples for iOS

OPTIONAL:

  • [ ] RaspberryPi2 samples
1.0

All 7 comments

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 :)

Was this page helpful?
0 / 5 - 0 ratings