Skip to content

Commit

Permalink
sokol_gfx.h: allow draws without resource bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Apr 4, 2024
1 parent 6549864 commit c2c709b
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions sokol_gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -5781,7 +5781,6 @@ typedef struct {
} swapchain;
} cur_pass;
sg_pipeline cur_pipeline;
bool apply_bindings_called;
bool next_draw_valid;
#if defined(SOKOL_DEBUG)
sg_log_item validate_error;
Expand Down Expand Up @@ -18150,7 +18149,6 @@ SOKOL_API_IMPL void sg_apply_pipeline(sg_pipeline pip_id) {
SOKOL_ASSERT(_sg.valid);
SOKOL_ASSERT(_sg.cur_pass.in_pass);
_sg_stats_add(num_apply_pipeline, 1);
_sg.apply_bindings_called = false;
if (!_sg_validate_apply_pipeline(pip_id)) {
_sg.next_draw_valid = false;
return;
Expand All @@ -18173,7 +18171,6 @@ SOKOL_API_IMPL void sg_apply_bindings(const sg_bindings* bindings) {
SOKOL_ASSERT(bindings);
SOKOL_ASSERT((bindings->_start_canary == 0) && (bindings->_end_canary==0));
_sg_stats_add(num_apply_bindings, 1);
_sg.apply_bindings_called = true;
if (!_sg_validate_apply_bindings(bindings)) {
_sg.next_draw_valid = false;
return;
Expand Down Expand Up @@ -18327,20 +18324,12 @@ SOKOL_API_IMPL void sg_draw(int base_element, int num_elements, int num_instance
SOKOL_ASSERT(num_elements >= 0);
SOKOL_ASSERT(num_instances >= 0);
_sg_stats_add(num_draw, 1);
#if defined(SOKOL_DEBUG)
if (!_sg.apply_bindings_called) {
_SG_WARN(DRAW_WITHOUT_BINDINGS);
}
#endif
if (!_sg.cur_pass.valid) {
return;
}
if (!_sg.next_draw_valid) {
return;
}
if (!_sg.apply_bindings_called) {
return;
}
/* attempting to draw with zero elements or instances is not technically an
error, but might be handled as an error in the backend API (e.g. on Metal)
*/
Expand Down

0 comments on commit c2c709b

Please sign in to comment.