Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link

##Bug##

Bug

At the end of cg_spritebatch_draw(), this line:

b->idx++;

should be:

b->idx = idx;

Otherwise you will clobber most of your vertex data on each new sprite. Also, this will cause your program to flush at 1/36 the rate that it should be flushing (maybe the cause of your performance problem).

##Flush confusion##

Flush confusion

I'm not sure how to compare your batched version with your "unrolled" version because it looks like your unrolled version flushes the vertex buffer after each sprite. I'm not even sure that is what you intended to do because lines like this:

 glDrawElements(GL_TRIANGLES, sc * cg_sprite_get_vert_count(),
 GL_UNSIGNED_SHORT, 0);

make it seem like you want to draw all of the sprites (sc) at once instead of just one. Perhaps you could clarify what your code is attempting to do in each of the two versions.

##Bug##

At the end of cg_spritebatch_draw(), this line:

b->idx++;

should be:

b->idx = idx;

Otherwise you will clobber most of your vertex data on each new sprite. Also, this will cause your program to flush at 1/36 the rate that it should be flushing (maybe the cause of your performance problem).

##Flush confusion##

I'm not sure how to compare your batched version with your "unrolled" version because it looks like your unrolled version flushes the vertex buffer after each sprite. I'm not even sure that is what you intended to do because lines like this:

 glDrawElements(GL_TRIANGLES, sc * cg_sprite_get_vert_count(),
 GL_UNSIGNED_SHORT, 0);

make it seem like you want to draw all of the sprites (sc) at once instead of just one. Perhaps you could clarify what your code is attempting to do in each of the two versions.

Bug

At the end of cg_spritebatch_draw(), this line:

b->idx++;

should be:

b->idx = idx;

Otherwise you will clobber most of your vertex data on each new sprite. Also, this will cause your program to flush at 1/36 the rate that it should be flushing (maybe the cause of your performance problem).

Flush confusion

I'm not sure how to compare your batched version with your "unrolled" version because it looks like your unrolled version flushes the vertex buffer after each sprite. I'm not even sure that is what you intended to do because lines like this:

 glDrawElements(GL_TRIANGLES, sc * cg_sprite_get_vert_count(),
 GL_UNSIGNED_SHORT, 0);

make it seem like you want to draw all of the sprites (sc) at once instead of just one. Perhaps you could clarify what your code is attempting to do in each of the two versions.

edited body
Source Link
JS1
  • 28.8k
  • 3
  • 41
  • 83

##Bug##

At the end of cg_spritebatch_draw(), this line:

b->idx++;

should be:

b->idx = idx;

Otherwise you will clobber most of your vertex data on each new sprite. Also, this will cause your program to flush at 1/36 the rate that it should be flushing (maybe the cause ifof your performance problem).

##Flush confusion##

I'm not sure how to compare your batched version with your "unrolled" version because it looks like your unrolled version flushes the vertex buffer after each sprite. I'm not even sure that is what you intended to do because lines like this:

 glDrawElements(GL_TRIANGLES, sc * cg_sprite_get_vert_count(),
 GL_UNSIGNED_SHORT, 0);

make it seem like you want to draw all of the sprites (sc) at once instead of just one. Perhaps you could clarify what your code is attempting to do in each of the two versions.

##Bug##

At the end of cg_spritebatch_draw(), this line:

b->idx++;

should be:

b->idx = idx;

Otherwise you will clobber most of your vertex data on each new sprite. Also, this will cause your program to flush at 1/36 the rate that it should be flushing (maybe the cause if your performance problem).

##Flush confusion##

I'm not sure how to compare your batched version with your "unrolled" version because it looks like your unrolled version flushes the vertex buffer after each sprite. I'm not even sure that is what you intended to do because lines like this:

 glDrawElements(GL_TRIANGLES, sc * cg_sprite_get_vert_count(),
 GL_UNSIGNED_SHORT, 0);

make it seem like you want to draw all of the sprites (sc) at once instead of just one. Perhaps you could clarify what your code is attempting to do in each of the two versions.

##Bug##

At the end of cg_spritebatch_draw(), this line:

b->idx++;

should be:

b->idx = idx;

Otherwise you will clobber most of your vertex data on each new sprite. Also, this will cause your program to flush at 1/36 the rate that it should be flushing (maybe the cause of your performance problem).

##Flush confusion##

I'm not sure how to compare your batched version with your "unrolled" version because it looks like your unrolled version flushes the vertex buffer after each sprite. I'm not even sure that is what you intended to do because lines like this:

 glDrawElements(GL_TRIANGLES, sc * cg_sprite_get_vert_count(),
 GL_UNSIGNED_SHORT, 0);

make it seem like you want to draw all of the sprites (sc) at once instead of just one. Perhaps you could clarify what your code is attempting to do in each of the two versions.

Source Link
JS1
  • 28.8k
  • 3
  • 41
  • 83

##Bug##

At the end of cg_spritebatch_draw(), this line:

b->idx++;

should be:

b->idx = idx;

Otherwise you will clobber most of your vertex data on each new sprite. Also, this will cause your program to flush at 1/36 the rate that it should be flushing (maybe the cause if your performance problem).

##Flush confusion##

I'm not sure how to compare your batched version with your "unrolled" version because it looks like your unrolled version flushes the vertex buffer after each sprite. I'm not even sure that is what you intended to do because lines like this:

 glDrawElements(GL_TRIANGLES, sc * cg_sprite_get_vert_count(),
 GL_UNSIGNED_SHORT, 0);

make it seem like you want to draw all of the sprites (sc) at once instead of just one. Perhaps you could clarify what your code is attempting to do in each of the two versions.

lang-c

AltStyle によって変換されたページ (->オリジナル) /