forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d7e83c
commit 06b5f48
Showing
1 changed file
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
diff --git a/gfx/drivers_shader/shader_glsl.c b/gfx/drivers_shader/shader_glsl.c | ||
index 71201cc..41100a1 100644 | ||
--- a/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) | ||
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) \ | ||
{ \ | ||
+ unsigned y; \ | ||
attr->loc = coord1; \ | ||
attr->size = multiplier; \ | ||
attr->offset = size * sizeof(GLfloat); \ | ||
attribs_size++; \ | ||
attr++; \ | ||
- memcpy(buffer + size, coord2, \ | ||
- multiplier * coords->vertices * sizeof(GLfloat)); \ | ||
+ for (y = 0; y < (multiplier * coords->vertices); y++) \ | ||
+ buffer[y + size] = coord2[y]; \ | ||
size += multiplier * coords->vertices; \ | ||
} | ||
|
||
@@ -1317,10 +1327,11 @@ static bool gl_glsl_set_coords(void *handle_data, void *shader_data, const struc | ||
GLfloat short_buffer[4 * (2 + 2 + 4 + 2)]; | ||
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; |