mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Update diff.diff
This commit is contained in:
parent
12804431db
commit
21b309f52d
236
diff.diff
236
diff.diff
@ -1,149 +1,105 @@
|
|||||||
diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c
|
diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c
|
||||||
index 71201cc..41100a1 100644
|
index 203f0c6..6cb5f9a 100644
|
||||||
--- a/gfx/drivers_shader/shader_glsl.c
|
--- a/gfx/drivers_shader/shader_glsl.c
|
||||||
+++ b/gfx/drivers_shader/shader_glsl.c
|
+++ b/gfx/drivers_shader/shader_glsl.c
|
||||||
@@ -725,7 +725,7 @@ static void *gl_glsl_init(void *data, const char *path)
|
@@ -1330,15 +1330,13 @@ fallback:
|
||||||
config_file_t *conf = NULL;
|
|
||||||
const char *stock_vertex = NULL;
|
|
||||||
const char *stock_fragment = NULL;
|
|
||||||
- glsl_shader_data_t *glsl = (glsl_shader_data_t*)
|
|
||||||
+ glsl_shader_data_t *glsl = (glsl_shader_data_t*)
|
|
||||||
calloc(1, sizeof(glsl_shader_data_t));
|
|
||||||
|
|
||||||
if (!glsl)
|
|
||||||
@@ -991,8 +991,8 @@ static void gl_glsl_set_uniform_parameter(
|
|
||||||
struct uniform_info *param,
|
|
||||||
void *uniform_data)
|
|
||||||
{
|
|
||||||
- GLint location = 0;
|
|
||||||
- glsl_shader_data_t *glsl = (glsl_shader_data_t*)data;
|
|
||||||
+ GLint location = 0;
|
|
||||||
+ glsl_shader_data_t *glsl = (glsl_shader_data_t*)data;
|
|
||||||
|
|
||||||
if (!param)
|
|
||||||
return;
|
|
||||||
@@ -1052,15 +1052,16 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
|
||||||
GLfloat buffer[512];
|
|
||||||
struct glsl_attrib attribs[32];
|
|
||||||
float input_size[2], output_size[2], texture_size[2];
|
|
||||||
- unsigned texunit = 1;
|
|
||||||
- const struct shader_uniforms *uni = NULL;
|
|
||||||
- size_t size = 0, attribs_size = 0;
|
|
||||||
- const struct video_tex_info *info = (const struct video_tex_info*)_info;
|
|
||||||
- const struct video_tex_info *prev_info = (const struct video_tex_info*)_prev_info;
|
|
||||||
+ unsigned texunit = 1;
|
|
||||||
+ const struct shader_uniforms *uni = NULL;
|
|
||||||
+ size_t size = 0;
|
|
||||||
+ size_t attribs_size = 0;
|
|
||||||
+ const struct video_tex_info *info = (const struct video_tex_info*)_info;
|
|
||||||
+ const struct video_tex_info *prev_info = (const struct video_tex_info*)_prev_info;
|
|
||||||
const struct video_tex_info *feedback_info = (const struct video_tex_info*)_feedback_info;
|
|
||||||
- const struct video_tex_info *fbo_info = (const struct video_tex_info*)_fbo_info;
|
|
||||||
- struct glsl_attrib *attr = (struct glsl_attrib*)attribs;
|
|
||||||
- glsl_shader_data_t *glsl = (glsl_shader_data_t*)shader_data;
|
|
||||||
+ const struct video_tex_info *fbo_info = (const struct video_tex_info*)_fbo_info;
|
|
||||||
+ struct glsl_attrib *attr = (struct glsl_attrib*)attribs;
|
|
||||||
+ glsl_shader_data_t *glsl = (glsl_shader_data_t*)shader_data;
|
|
||||||
|
|
||||||
if (!glsl)
|
|
||||||
return;
|
|
||||||
@@ -1133,13 +1134,15 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
|
||||||
/* Pass texture coordinates. */
|
|
||||||
if (uni->orig.tex_coord >= 0)
|
|
||||||
{
|
|
||||||
+ unsigned y;
|
|
||||||
attr->loc = uni->orig.tex_coord;
|
|
||||||
attr->size = 2;
|
|
||||||
attr->offset = size * sizeof(GLfloat);
|
|
||||||
attribs_size++;
|
|
||||||
attr++;
|
|
||||||
|
|
||||||
- memcpy(buffer + size, info->coord, 8 * sizeof(GLfloat));
|
|
||||||
+ for (y = 0; y < 8; y++)
|
|
||||||
+ buffer[y + size] = info->coord[y];
|
|
||||||
size += 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1162,13 +1165,15 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
|
||||||
/* Pass texture coordinates. */
|
|
||||||
if (uni->feedback.tex_coord >= 0)
|
|
||||||
{
|
|
||||||
+ unsigned y;
|
|
||||||
attr->loc = uni->feedback.tex_coord;
|
|
||||||
attr->size = 2;
|
|
||||||
attr->offset = size * sizeof(GLfloat);
|
|
||||||
attribs_size++;
|
|
||||||
attr++;
|
|
||||||
|
|
||||||
- memcpy(buffer + size, feedback_info->coord, 8 * sizeof(GLfloat));
|
|
||||||
+ for (y = 0; y < 8; y++)
|
|
||||||
+ buffer[y + size] = feedback_info->coord[y];
|
|
||||||
size += 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1191,13 +1196,15 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
|
||||||
|
|
||||||
if (uni->pass[i].tex_coord >= 0)
|
|
||||||
{
|
|
||||||
+ unsigned y;
|
|
||||||
attr->loc = uni->pass[i].tex_coord;
|
|
||||||
attr->size = 2;
|
|
||||||
attr->offset = size * sizeof(GLfloat);
|
|
||||||
attribs_size++;
|
|
||||||
attr++;
|
|
||||||
|
|
||||||
- memcpy(buffer + size, fbo_info[i].coord, 8 * sizeof(GLfloat));
|
|
||||||
+ for (y = 0; y < 8; y++)
|
|
||||||
+ buffer[y + size] = fbo_info[i].coord[y];
|
|
||||||
size += 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1224,13 +1231,15 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
|
||||||
/* Pass texture coordinates. */
|
|
||||||
if (uni->prev[i].tex_coord >= 0)
|
|
||||||
{
|
|
||||||
+ unsigned y;
|
|
||||||
attr->loc = uni->prev[i].tex_coord;
|
|
||||||
attr->size = 2;
|
|
||||||
attr->offset = size * sizeof(GLfloat);
|
|
||||||
attribs_size++;
|
|
||||||
attr++;
|
|
||||||
|
|
||||||
- memcpy(buffer + size, prev_info[i].coord, 8 * sizeof(GLfloat));
|
|
||||||
+ for (y = 0; y < 8; y++)
|
|
||||||
+ buffer[y + size] = prev_info[i].coord[y];
|
|
||||||
size += 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1301,13 +1310,14 @@ fallback:
|
|
||||||
|
|
||||||
#define gl_glsl_set_coord_array(attr, coord1, coord2, coords, size, multiplier) \
|
#define gl_glsl_set_coord_array(attr, coord1, coord2, coords, size, multiplier) \
|
||||||
{ \
|
{ \
|
||||||
+ unsigned y; \
|
- unsigned y; \
|
||||||
attr->loc = coord1; \
|
- attr->loc = coord1; \
|
||||||
attr->size = multiplier; \
|
- attr->size = multiplier; \
|
||||||
attr->offset = size * sizeof(GLfloat); \
|
- attr->offset = size * sizeof(GLfloat); \
|
||||||
attribs_size++; \
|
- attribs_size++; \
|
||||||
attr++; \
|
- attr++; \
|
||||||
- memcpy(buffer + size, coord2, \
|
- for (y = 0; y < (multiplier * coords->vertices); y++) \
|
||||||
- multiplier * coords->vertices * sizeof(GLfloat)); \
|
- buffer[y + size] = coord2[y]; \
|
||||||
+ for (y = 0; y < (multiplier * coords->vertices); y++) \
|
- size += multiplier * coords->vertices; \
|
||||||
+ buffer[y + size] = coord2[y]; \
|
+ attr->loc = coord1; \
|
||||||
size += multiplier * coords->vertices; \
|
+ attr->size = multiplier; \
|
||||||
|
+ attr->offset = size * sizeof(GLfloat); \
|
||||||
|
+ attribs_size++; \
|
||||||
|
+ glBufferSubData(GL_ARRAY_BUFFER, attr->offset, multiplier * coords->vertices * sizeof(GLfloat), coord2); \
|
||||||
|
+ size += multiplier * coords->vertices; \
|
||||||
|
+ attr++; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1317,10 +1327,11 @@ static bool gl_glsl_set_coords(void *handle_data, void *shader_data, const struc
|
static bool gl_glsl_set_coords(void *handle_data, void *shader_data, const struct video_coords *coords)
|
||||||
GLfloat short_buffer[4 * (2 + 2 + 4 + 2)];
|
@@ -1357,35 +1355,56 @@ static bool gl_glsl_set_coords(void *handle_data, void *shader_data, const struc
|
||||||
GLfloat *buffer;
|
|
||||||
struct glsl_attrib attribs[4];
|
|
||||||
- size_t attribs_size = 0, size = 0;
|
|
||||||
- struct glsl_attrib *attr = NULL;
|
|
||||||
+ size_t attribs_size = 0;
|
|
||||||
+ size_t size = 0;
|
|
||||||
+ struct glsl_attrib *attr = NULL;
|
|
||||||
const struct shader_uniforms *uni = NULL;
|
|
||||||
- glsl_shader_data_t *glsl = (glsl_shader_data_t*)shader_data;
|
|
||||||
+ glsl_shader_data_t *glsl = (glsl_shader_data_t*)shader_data;
|
|
||||||
|
|
||||||
if (!glsl || !glsl->shader->modern || !coords)
|
|
||||||
goto fallback;
|
goto fallback;
|
||||||
|
|
||||||
|
buffer = short_buffer;
|
||||||
|
- if (coords->vertices > 4)
|
||||||
|
- buffer = (GLfloat*)calloc(coords->vertices *
|
||||||
|
- (2 + 2 + 4 + 2), sizeof(*buffer));
|
||||||
|
-
|
||||||
|
- if (!buffer)
|
||||||
|
- goto fallback;
|
||||||
|
|
||||||
|
attr = attribs;
|
||||||
|
uni = &glsl->uniforms[glsl->active_idx];
|
||||||
|
|
||||||
|
- if (uni->tex_coord >= 0)
|
||||||
|
- gl_glsl_set_coord_array(attr, uni->tex_coord, coords->tex_coord, coords, size, 2);
|
||||||
|
+ glBindBuffer(GL_ARRAY_BUFFER, glsl->vbo[glsl->active_idx].vbo_primary);
|
||||||
|
+ {
|
||||||
|
+ size_t i;
|
||||||
|
+ size_t elems = 0;
|
||||||
|
|
||||||
|
- if (uni->vertex_coord >= 0)
|
||||||
|
- gl_glsl_set_coord_array(attr, uni->vertex_coord, coords->vertex, coords, size, 2);
|
||||||
|
+ elems += (uni->color >= 0) * 4;
|
||||||
|
+ elems += (uni->tex_coord >= 0) * 2;
|
||||||
|
+ elems += (uni->vertex_coord >= 0) * 2;
|
||||||
|
+ elems += (uni->lut_tex_coord >= 0) * 2;
|
||||||
|
|
||||||
|
- if (uni->color >= 0)
|
||||||
|
- gl_glsl_set_coord_array(attr, uni->color, coords->color, coords, size, 4);
|
||||||
|
+ elems *= coords->vertices;
|
||||||
|
|
||||||
|
- if (uni->lut_tex_coord >= 0)
|
||||||
|
- gl_glsl_set_coord_array(attr, uni->lut_tex_coord, coords->lut_tex_coord, coords, size, 2);
|
||||||
|
+ if (elems) {
|
||||||
|
|
||||||
|
- if (size)
|
||||||
|
- gl_glsl_set_attribs(glsl,
|
||||||
|
- glsl->vbo[glsl->active_idx].vbo_primary,
|
||||||
|
- &glsl->vbo[glsl->active_idx].buffer_primary,
|
||||||
|
- &glsl->vbo[glsl->active_idx].size_primary,
|
||||||
|
- buffer, size,
|
||||||
|
- attribs, attribs_size);
|
||||||
|
+ glBufferData(GL_ARRAY_BUFFER, elems * sizeof(GLfloat), NULL, GL_STREAM_DRAW);
|
||||||
|
+
|
||||||
|
+ if (uni->tex_coord >= 0)
|
||||||
|
+ gl_glsl_set_coord_array(attr, uni->tex_coord, coords->tex_coord, coords, size, 2);
|
||||||
|
+
|
||||||
|
+ if (uni->vertex_coord >= 0)
|
||||||
|
+ gl_glsl_set_coord_array(attr, uni->vertex_coord, coords->vertex, coords, size, 2);
|
||||||
|
+
|
||||||
|
+ if (uni->color >= 0)
|
||||||
|
+ gl_glsl_set_coord_array(attr, uni->color, coords->color, coords, size, 4);
|
||||||
|
+
|
||||||
|
+ if (uni->lut_tex_coord >= 0)
|
||||||
|
+ gl_glsl_set_coord_array(attr, uni->lut_tex_coord, coords->lut_tex_coord, coords, size, 2);
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < attribs_size; i++)
|
||||||
|
+ {
|
||||||
|
+ GLint loc = attribs[i].loc;
|
||||||
|
+
|
||||||
|
+ if (glsl->attribs.index < ARRAY_SIZE(glsl->attribs.elems))
|
||||||
|
+ {
|
||||||
|
+ glEnableVertexAttribArray(loc);
|
||||||
|
+ glVertexAttribPointer(loc, attribs[i].size, GL_FLOAT, GL_FALSE, 0,
|
||||||
|
+ (const GLvoid*)(uintptr_t)attribs[i].offset);
|
||||||
|
+ glsl->attribs.elems[glsl->attribs.index++] = loc;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ RARCH_WARN("Attrib array buffer was overflown!\n");
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
if (buffer != short_buffer)
|
||||||
|
free(buffer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user