(GLSL) Avoid memsets - good for about a +1fps speedup with simplified

ribbon on PowerPC Mac
This commit is contained in:
neville 2016-11-10 18:35:47 +01:00
parent 25c46aa7b2
commit 12804431db
2 changed files with 55 additions and 24 deletions

View File

@ -1054,7 +1054,8 @@ static void gl_glsl_set_params(void *data, void *shader_data,
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;
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;
@ -1139,7 +1140,14 @@ static void gl_glsl_set_params(void *data, void *shader_data,
attribs_size++;
attr++;
memcpy(buffer + size, info->coord, 8 * sizeof(GLfloat));
buffer[size ] = info->coord[0];
buffer[size + 1] = info->coord[1];
buffer[size + 2] = info->coord[2];
buffer[size + 3] = info->coord[3];
buffer[size + 4] = info->coord[4];
buffer[size + 5] = info->coord[5];
buffer[size + 6] = info->coord[6];
buffer[size + 7] = info->coord[7];
size += 8;
}
@ -1168,7 +1176,14 @@ static void gl_glsl_set_params(void *data, void *shader_data,
attribs_size++;
attr++;
memcpy(buffer + size, feedback_info->coord, 8 * sizeof(GLfloat));
buffer[size ] = feedback_info->coord[0];
buffer[size + 1] = feedback_info->coord[1];
buffer[size + 2] = feedback_info->coord[2];
buffer[size + 3] = feedback_info->coord[3];
buffer[size + 4] = feedback_info->coord[4];
buffer[size + 5] = feedback_info->coord[5];
buffer[size + 6] = feedback_info->coord[6];
buffer[size + 7] = feedback_info->coord[7];
size += 8;
}
@ -1197,7 +1212,14 @@ static void gl_glsl_set_params(void *data, void *shader_data,
attribs_size++;
attr++;
memcpy(buffer + size, fbo_info[i].coord, 8 * sizeof(GLfloat));
buffer[size ] = fbo_info[i].coord[0];
buffer[size + 1] = fbo_info[i].coord[1];
buffer[size + 2] = fbo_info[i].coord[2];
buffer[size + 3] = fbo_info[i].coord[3];
buffer[size + 4] = fbo_info[i].coord[4];
buffer[size + 5] = fbo_info[i].coord[5];
buffer[size + 6] = fbo_info[i].coord[6];
buffer[size + 7] = fbo_info[i].coord[7];
size += 8;
}
}
@ -1230,7 +1252,14 @@ static void gl_glsl_set_params(void *data, void *shader_data,
attribs_size++;
attr++;
memcpy(buffer + size, prev_info[i].coord, 8 * sizeof(GLfloat));
buffer[size ] = prev_info[i].coord[0];
buffer[size + 1] = prev_info[i].coord[1];
buffer[size + 2] = prev_info[i].coord[2];
buffer[size + 3] = prev_info[i].coord[3];
buffer[size + 4] = prev_info[i].coord[4];
buffer[size + 5] = prev_info[i].coord[5];
buffer[size + 6] = prev_info[i].coord[6];
buffer[size + 7] = prev_info[i].coord[7];
size += 8;
}
}
@ -1301,13 +1330,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,7 +1347,8 @@ 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;
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;