glshim library updated. added changes from https://github.com/ptitSeb/glshim
This commit is contained in:
@@ -499,7 +499,7 @@ static renderlist_t *arrays_to_renderlist(renderlist_t *list, GLenum mode,
|
||||
GLsizei skip, GLsizei count) {
|
||||
if (! list)
|
||||
list = alloc_renderlist();
|
||||
//if (state.list.compiling) printf("arrary_to_renderlist while compiling list\n");
|
||||
//if (state.list.compiling) printf("arrary_to_renderlist while compiling list, skip=%d, count=%d\n", skip, count);
|
||||
list->mode = mode;
|
||||
list->mode_init = mode;
|
||||
list->len = count-skip;
|
||||
@@ -509,7 +509,7 @@ static renderlist_t *arrays_to_renderlist(renderlist_t *list, GLenum mode,
|
||||
list->vert = copy_gl_pointer_raw(&state.pointers.vertex, 3, skip, count, state.pointers.vertex.buffer); //TODO, what if size == 4
|
||||
}
|
||||
if (state.enable.color_array) {
|
||||
list->color = copy_gl_pointer(&state.pointers.color, 4, skip, count, state.pointers.color.buffer);
|
||||
list->color = copy_gl_pointer_color(&state.pointers.color, 4, skip, count, state.pointers.color.buffer);
|
||||
}
|
||||
if (state.enable.secondary_array/* && state.enable.color_array*/) {
|
||||
list->secondary = copy_gl_pointer(&state.pointers.secondary, 4, skip, count, state.pointers.secondary.buffer); // alpha chanel is always 0 for secondary...
|
||||
@@ -736,7 +736,7 @@ void glDrawArrays(GLenum mode, GLint first, GLsizei count) {
|
||||
list = state.list.active;
|
||||
NewStage(list, STAGE_DRAW);
|
||||
state.list.active = arrays_to_renderlist(list, mode, first, count+first);
|
||||
//state.list.active = extend_renderlist(list);
|
||||
end_renderlist(state.list.active);// = extend_renderlist(list);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -143,6 +143,12 @@ bool islistscompatible_renderlist(renderlist_t *a, renderlist_t *b) {
|
||||
return false;
|
||||
if (!a->set_texture && b->set_texture)
|
||||
return false;
|
||||
|
||||
// Check the size of a list, if it"s too big, don't merge...
|
||||
if ((a->len+b->len)>30000)
|
||||
return false;
|
||||
if ((a->ilen+b->ilen)>30000)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -156,7 +162,7 @@ void renderlist_createindices(renderlist_t *a) {
|
||||
a->ilen = ilen;
|
||||
}
|
||||
|
||||
#define vind(i) (ind)?ind[i]:i
|
||||
#define vind(a) (ind)?ind[(a)]:(a)
|
||||
|
||||
void renderlist_lineloop_lines(renderlist_t *a) {
|
||||
GLushort *ind = a->indices;
|
||||
@@ -224,14 +230,14 @@ void renderlist_quads_triangles(renderlist_t *a) {
|
||||
int len = (ind)? a->ilen:a->len;
|
||||
int ilen = len*3/2;
|
||||
a->indices = (GLushort*)malloc(ilen*sizeof(GLushort));
|
||||
for (int i = 0; i<len; i+=4) {
|
||||
a->indices[i*3/2+0] = vind(i+0);
|
||||
a->indices[i*3/2+1] = vind(i+1);
|
||||
a->indices[i*3/2+2] = vind(i+2);
|
||||
for (int i=0, j=0; i<len; i+=4, j+=6) {
|
||||
a->indices[j+0] = vind(i+0);
|
||||
a->indices[j+1] = vind(i+1);
|
||||
a->indices[j+2] = vind(i+2);
|
||||
|
||||
a->indices[i*3/2+3] = vind(i+0);
|
||||
a->indices[i*3/2+4] = vind(i+2);
|
||||
a->indices[i*3/2+5] = vind(i+3);
|
||||
a->indices[j+3] = vind(i+0);
|
||||
a->indices[j+4] = vind(i+2);
|
||||
a->indices[j+5] = vind(i+3);
|
||||
}
|
||||
a->ilen = ilen;
|
||||
if ((ind) && !a->shared_arrays) free(ind);
|
||||
@@ -511,7 +517,7 @@ void draw_renderlist(renderlist_t *list) {
|
||||
// go to 1st...
|
||||
while (list->prev) list = list->prev;
|
||||
// ok, go on now, draw everything
|
||||
//printf("draw_renderlist %p, gl_batch=%i, size=%i, next=%p\n", list, state.gl_batch, list->len, list->next);
|
||||
//printf("draw_renderlist %p, gl_batch=%i, size=%i, mode=0x%04X(0x%04X), ilen=%d, next=%p\n", list, state.gl_batch, list->len, list->mode, list->mode_init, list->ilen, list->next);
|
||||
LOAD_GLES(glDrawArrays);
|
||||
LOAD_GLES(glDrawElements);
|
||||
#ifdef USE_ES2
|
||||
@@ -1161,6 +1167,7 @@ void rlFogOp(renderlist_t *list, int op, const GLfloat* v) {
|
||||
list->fog_val[0] = v[0];
|
||||
list->fog_val[1] = v[1];
|
||||
list->fog_val[2] = v[2];
|
||||
list->fog_val[3] = v[3];
|
||||
}
|
||||
|
||||
void rlPushCall(renderlist_t *list, packed_call_t *data) {
|
||||
|
||||
@@ -117,7 +117,7 @@ typedef struct _renderlist_t {
|
||||
GLfloat matrix_val[16];
|
||||
|
||||
int fog_op;
|
||||
GLfloat fog_val[3];
|
||||
GLfloat fog_val[4];
|
||||
|
||||
khash_t(material) *material;
|
||||
khash_t(light) *light;
|
||||
|
||||
Reference in New Issue
Block a user