Fixed bug #6401 - back-end can choose the order the triangles when rendering rects, attempt to fix small glitch rendering.
parent
285cbf6fdd
commit
3d99d31026
|
@ -552,6 +552,7 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou
|
||||||
const int num_indices = 6 * count;
|
const int num_indices = 6 * count;
|
||||||
const int size_indices = 4;
|
const int size_indices = 4;
|
||||||
int cur_indice = 0;
|
int cur_indice = 0;
|
||||||
|
const int *rect_indice_list = renderer->rect_indice_list;
|
||||||
|
|
||||||
for (i = 0; i < count; ++i) {
|
for (i = 0; i < count; ++i) {
|
||||||
float minx, miny, maxx, maxy;
|
float minx, miny, maxx, maxy;
|
||||||
|
@ -570,12 +571,12 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou
|
||||||
*ptr_xy++ = minx;
|
*ptr_xy++ = minx;
|
||||||
*ptr_xy++ = maxy;
|
*ptr_xy++ = maxy;
|
||||||
|
|
||||||
*ptr_indices++ = cur_indice + 0;
|
*ptr_indices++ = cur_indice + rect_indice_list[0];
|
||||||
*ptr_indices++ = cur_indice + 1;
|
*ptr_indices++ = cur_indice + rect_indice_list[1];
|
||||||
*ptr_indices++ = cur_indice + 2;
|
*ptr_indices++ = cur_indice + rect_indice_list[2];
|
||||||
*ptr_indices++ = cur_indice + 0;
|
*ptr_indices++ = cur_indice + rect_indice_list[3];
|
||||||
*ptr_indices++ = cur_indice + 2;
|
*ptr_indices++ = cur_indice + rect_indice_list[4];
|
||||||
*ptr_indices++ = cur_indice + 3;
|
*ptr_indices++ = cur_indice + rect_indice_list[5];
|
||||||
cur_indice += 4;
|
cur_indice += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1062,6 +1063,16 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
|
||||||
renderer->dpi_scale.x = 1.0f;
|
renderer->dpi_scale.x = 1.0f;
|
||||||
renderer->dpi_scale.y = 1.0f;
|
renderer->dpi_scale.y = 1.0f;
|
||||||
|
|
||||||
|
/* Default value, if not specified by the renderer back-end */
|
||||||
|
if (renderer->rect_indice_list[0] == 0 && renderer->rect_indice_list[1] == 0) {
|
||||||
|
renderer->rect_indice_list[0] = 0;
|
||||||
|
renderer->rect_indice_list[1] = 1;
|
||||||
|
renderer->rect_indice_list[2] = 2;
|
||||||
|
renderer->rect_indice_list[3] = 0;
|
||||||
|
renderer->rect_indice_list[4] = 2;
|
||||||
|
renderer->rect_indice_list[5] = 3;
|
||||||
|
}
|
||||||
|
|
||||||
/* new textures start at zero, so we start at 1 so first render doesn't flush by accident. */
|
/* new textures start at zero, so we start at 1 so first render doesn't flush by accident. */
|
||||||
renderer->render_command_generation = 1;
|
renderer->render_command_generation = 1;
|
||||||
|
|
||||||
|
@ -3523,7 +3534,7 @@ SDL_RenderCopyF(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
float uv[8];
|
float uv[8];
|
||||||
const int uv_stride = 2 * sizeof (float);
|
const int uv_stride = 2 * sizeof (float);
|
||||||
const int num_vertices = 4;
|
const int num_vertices = 4;
|
||||||
const int indices[6] = {0, 1, 2, 0, 2, 3};
|
const int *indices = renderer->rect_indice_list;
|
||||||
const int num_indices = 6;
|
const int num_indices = 6;
|
||||||
const int size_indices = 4;
|
const int size_indices = 4;
|
||||||
float minu, minv, maxu, maxv;
|
float minu, minv, maxu, maxv;
|
||||||
|
@ -3671,7 +3682,7 @@ SDL_RenderCopyExF(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
float uv[8];
|
float uv[8];
|
||||||
const int uv_stride = 2 * sizeof (float);
|
const int uv_stride = 2 * sizeof (float);
|
||||||
const int num_vertices = 4;
|
const int num_vertices = 4;
|
||||||
const int indices[6] = {0, 1, 2, 0, 2, 3};
|
const int *indices = renderer->rect_indice_list;
|
||||||
const int num_indices = 6;
|
const int num_indices = 6;
|
||||||
const int size_indices = 4;
|
const int size_indices = 4;
|
||||||
float minu, minv, maxu, maxv;
|
float minu, minv, maxu, maxv;
|
||||||
|
|
|
@ -248,6 +248,9 @@ struct SDL_Renderer
|
||||||
/* The method of drawing lines */
|
/* The method of drawing lines */
|
||||||
SDL_RenderLineMethod line_method;
|
SDL_RenderLineMethod line_method;
|
||||||
|
|
||||||
|
/* List of triangle indices to draw rects */
|
||||||
|
int rect_indice_list[6];
|
||||||
|
|
||||||
/* Remainder from scaled relative motion */
|
/* Remainder from scaled relative motion */
|
||||||
float xrel;
|
float xrel;
|
||||||
float yrel;
|
float yrel;
|
||||||
|
|
|
@ -1932,6 +1932,13 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_UYVY;
|
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_UYVY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
renderer->rect_indice_list[0] = 0;
|
||||||
|
renderer->rect_indice_list[1] = 1;
|
||||||
|
renderer->rect_indice_list[2] = 3;
|
||||||
|
renderer->rect_indice_list[3] = 1;
|
||||||
|
renderer->rect_indice_list[4] = 3;
|
||||||
|
renderer->rect_indice_list[5] = 2;
|
||||||
|
|
||||||
if (SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object")) {
|
if (SDL_GL_ExtensionSupported("GL_EXT_framebuffer_object")) {
|
||||||
data->GL_EXT_framebuffer_object_supported = SDL_TRUE;
|
data->GL_EXT_framebuffer_object_supported = SDL_TRUE;
|
||||||
data->glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)
|
data->glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC)
|
||||||
|
|
Loading…
Reference in New Issue