Gawain : Add workaround to fix bad sync of the program_in_use flag.

This commit is contained in:
Clément Foucault 2017-10-02 22:16:50 +02:00
parent c548c76804
commit 2bd36338d3
3 changed files with 12 additions and 0 deletions

View File

@ -65,6 +65,7 @@ int GWN_batch_vertbuf_add_ex(Gwn_Batch*, Gwn_VertBuf*, bool own_vbo);
GWN_batch_vertbuf_add_ex(batch, verts, false)
void GWN_batch_program_set(Gwn_Batch*, GLuint program, const Gwn_ShaderInterface*);
void GWN_batch_program_unset(Gwn_Batch*);
// Entire batch draws with one shader program, but can be redrawn later with another program.
// Vertex shader's inputs must be compatible with the batch's vertex format.

View File

@ -110,6 +110,14 @@ void GWN_batch_program_set(Gwn_Batch* batch, GLuint program, const Gwn_ShaderInt
GWN_batch_program_use_begin(batch); // hack! to make Batch_Uniform* simpler
}
// fclem : hack !
// we need this because we don't want to unbind the shader between drawcalls
// but we still want the correct shader to be bound outside the draw manager
void GWN_batch_program_unset(Gwn_Batch* batch)
{
batch->program_in_use = false;
}
static void Batch_update_program_bindings(Gwn_Batch* batch)
{
// disable all as a precaution

View File

@ -1809,6 +1809,9 @@ static void draw_geometry_execute(DRWShadingGroup *shgroup, Gwn_Batch *geom)
else {
GWN_batch_draw_stupid(geom);
}
/* XXX this just tells gawain we are done with the shader.
* This does not unbind the shader. */
GWN_batch_program_unset(geom);
}
static void draw_geometry(DRWShadingGroup *shgroup, Gwn_Batch *geom, const float (*obmat)[4], ID *ob_data)