mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-21 02:08:16 +00:00
(Shaders) Get rid of third parameter
This commit is contained in:
parent
4ae92cfc4b
commit
52d6a21e55
@ -115,11 +115,6 @@ typedef struct cg_shader_data
|
||||
CGcontext cgCtx;
|
||||
} cg_shader_data_t;
|
||||
|
||||
struct uniform_cg
|
||||
{
|
||||
CGparameter loc;
|
||||
};
|
||||
|
||||
#define gl_cg_set_coord_array(param, cg, ptr, len) \
|
||||
{ \
|
||||
cgGLSetParameterPointer(param, len, GL_FLOAT, 0, ptr); \
|
||||
@ -139,8 +134,7 @@ struct uniform_cg
|
||||
|
||||
static void gl_cg_set_uniform_parameter(
|
||||
void *data,
|
||||
struct uniform_info *param,
|
||||
void *uniform_data)
|
||||
struct uniform_info *param)
|
||||
{
|
||||
CGparameter location;
|
||||
cg_shader_data_t *cg = (cg_shader_data_t*)data;
|
||||
@ -170,8 +164,7 @@ static void gl_cg_set_uniform_parameter(
|
||||
}
|
||||
else
|
||||
{
|
||||
struct uniform_cg *cg_param = (struct uniform_cg*)uniform_data;
|
||||
location = cg_param->loc;
|
||||
location = param->location;
|
||||
}
|
||||
|
||||
switch (param->type)
|
||||
@ -292,42 +285,38 @@ static void gl_cg_set_texture_info(
|
||||
const struct video_tex_info *info)
|
||||
{
|
||||
unsigned i;
|
||||
struct uniform_cg uniform_data[4];
|
||||
struct uniform_info uniform_params[4] = {{0}};
|
||||
CGparameter param = params->tex;
|
||||
|
||||
cg_gl_set_texture_parameter(param, info->tex);
|
||||
|
||||
uniform_params[0].location = 0;
|
||||
uniform_params[0].enabled = true;
|
||||
uniform_params[0].type = UNIFORM_2F;
|
||||
uniform_params[0].result.f.v0 = info->input_size[0];
|
||||
uniform_params[0].result.f.v1 = info->input_size[1];
|
||||
uniform_data[0].loc = params->vid_size_v;
|
||||
uniform_params[0].location = params->vid_size_v;
|
||||
|
||||
uniform_params[1].location = 1;
|
||||
uniform_params[1].enabled = true;
|
||||
uniform_params[1].type = UNIFORM_2F;
|
||||
uniform_params[1].result.f.v0 = info->input_size[0];
|
||||
uniform_params[1].result.f.v1 = info->input_size[1];
|
||||
uniform_data[1].loc = params->vid_size_f;
|
||||
uniform_params[1].location = params->vid_size_f;
|
||||
|
||||
uniform_params[2].location = 2;
|
||||
uniform_params[2].enabled = true;
|
||||
uniform_params[2].type = UNIFORM_2F;
|
||||
uniform_params[2].result.f.v0 = info->tex_size[0];
|
||||
uniform_params[2].result.f.v1 = info->tex_size[1];
|
||||
uniform_data[2].loc = params->tex_size_v;
|
||||
uniform_params[2].location = params->tex_size_v;
|
||||
|
||||
uniform_params[3].location = 3;
|
||||
uniform_params[3].enabled = true;
|
||||
uniform_params[3].type = UNIFORM_2F;
|
||||
uniform_params[3].result.f.v0 = info->tex_size[0];
|
||||
uniform_params[3].result.f.v1 = info->tex_size[1];
|
||||
uniform_data[3].loc = params->tex_size_f;
|
||||
uniform_params[3].location = params->tex_size_f;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[i], &uniform_data[i]);
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[i]);
|
||||
|
||||
if (params->coord)
|
||||
gl_cg_set_coord_array(params->coord, cg, info->coord, 2);
|
||||
@ -345,9 +334,7 @@ static void gl_cg_set_params(void *data, void *shader_data,
|
||||
unsigned fbo_info_cnt)
|
||||
{
|
||||
unsigned i;
|
||||
struct uniform_cg uniform_data[10];
|
||||
struct uniform_info uniform_params[10] = {{0}};
|
||||
unsigned uniform_count = 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;
|
||||
@ -360,61 +347,59 @@ static void gl_cg_set_params(void *data, void *shader_data,
|
||||
return;
|
||||
|
||||
/* Set frame. */
|
||||
uniform_params[0].location = 0;
|
||||
uniform_params[0].enabled = true;
|
||||
uniform_params[0].type = UNIFORM_2F;
|
||||
uniform_params[0].result.f.v0 = width;
|
||||
uniform_params[0].result.f.v1 = height;
|
||||
uniform_data[0].loc = cg->prg[cg->active_idx].vid_size_f;
|
||||
uniform_params[0].location = cg->prg[cg->active_idx].vid_size_f;
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[0]);
|
||||
|
||||
uniform_params[1].location = 1;
|
||||
uniform_params[1].enabled = true;
|
||||
uniform_params[1].type = UNIFORM_2F;
|
||||
uniform_params[1].result.f.v0 = tex_width;
|
||||
uniform_params[1].result.f.v1 = tex_height;
|
||||
uniform_data[1].loc = cg->prg[cg->active_idx].tex_size_f;
|
||||
uniform_params[1].location = cg->prg[cg->active_idx].tex_size_f;
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[1]);
|
||||
|
||||
uniform_params[2].location = 2;
|
||||
uniform_params[2].enabled = true;
|
||||
uniform_params[2].type = UNIFORM_2F;
|
||||
uniform_params[2].result.f.v0 = out_width;
|
||||
uniform_params[2].result.f.v1 = out_height;
|
||||
uniform_data[2].loc = cg->prg[cg->active_idx].out_size_f;
|
||||
uniform_params[2].location = cg->prg[cg->active_idx].out_size_f;
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[2]);
|
||||
|
||||
uniform_params[3].location = 3;
|
||||
uniform_params[3].enabled = true;
|
||||
uniform_params[3].type = UNIFORM_1F;
|
||||
uniform_params[3].result.f.v0 = state_manager_frame_is_reversed() ? -1.0 : 1.0;
|
||||
uniform_data[3].loc = cg->prg[cg->active_idx].frame_dir_f;
|
||||
uniform_params[3].location = cg->prg[cg->active_idx].frame_dir_f;
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[3]);
|
||||
|
||||
uniform_params[4].location = 4;
|
||||
uniform_params[4].enabled = true;
|
||||
uniform_params[4].type = UNIFORM_2F;
|
||||
uniform_params[4].result.f.v0 = width;
|
||||
uniform_params[4].result.f.v1 = height;
|
||||
uniform_data[4].loc = cg->prg[cg->active_idx].vid_size_v;
|
||||
uniform_params[4].location = cg->prg[cg->active_idx].vid_size_v;
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[4]);
|
||||
|
||||
uniform_params[5].location = 5;
|
||||
uniform_params[5].enabled = true;
|
||||
uniform_params[5].type = UNIFORM_2F;
|
||||
uniform_params[5].result.f.v0 = tex_width;
|
||||
uniform_params[5].result.f.v1 = tex_height;
|
||||
uniform_data[5].loc = cg->prg[cg->active_idx].tex_size_v;
|
||||
uniform_params[5].location = cg->prg[cg->active_idx].tex_size_v;
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[5]);
|
||||
|
||||
uniform_params[6].location = 6;
|
||||
uniform_params[6].enabled = true;
|
||||
uniform_params[6].type = UNIFORM_2F;
|
||||
uniform_params[6].result.f.v0 = out_width;
|
||||
uniform_params[6].result.f.v1 = out_height;
|
||||
uniform_data[6].loc = cg->prg[cg->active_idx].out_size_v;
|
||||
uniform_params[6].location = cg->prg[cg->active_idx].out_size_v;
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[6]);
|
||||
|
||||
uniform_params[7].location = 7;
|
||||
uniform_params[7].enabled = true;
|
||||
uniform_params[7].type = UNIFORM_1F;
|
||||
uniform_params[7].result.f.v0 = state_manager_frame_is_reversed() ? -1.0 : 1.0;
|
||||
uniform_data[7].loc = cg->prg[cg->active_idx].frame_dir_v;
|
||||
|
||||
uniform_count += 8;
|
||||
uniform_params[7].location = cg->prg[cg->active_idx].frame_dir_v;
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[7]);
|
||||
|
||||
if (cg->prg[cg->active_idx].frame_cnt_f || cg->prg[cg->active_idx].frame_cnt_v)
|
||||
{
|
||||
@ -422,24 +407,20 @@ static void gl_cg_set_params(void *data, void *shader_data,
|
||||
if (modulo)
|
||||
frame_count %= modulo;
|
||||
|
||||
uniform_params[8].location = 8;
|
||||
uniform_params[8].enabled = true;
|
||||
uniform_params[8].type = UNIFORM_1F;
|
||||
uniform_params[8].result.f.v0 = (float)frame_count;
|
||||
uniform_data[8].loc = cg->prg[cg->active_idx].frame_cnt_f;
|
||||
uniform_params[8].location = cg->prg[cg->active_idx].frame_cnt_f;
|
||||
|
||||
uniform_params[9].location = 9;
|
||||
uniform_params[9].enabled = true;
|
||||
uniform_params[9].type = UNIFORM_1F;
|
||||
uniform_params[9].result.f.v0 = (float)frame_count;
|
||||
uniform_data[9].loc = cg->prg[cg->active_idx].frame_cnt_v;
|
||||
uniform_params[9].location = cg->prg[cg->active_idx].frame_cnt_v;
|
||||
|
||||
uniform_count += 2;
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[8]);
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[9]);
|
||||
}
|
||||
|
||||
for (i = 0; i < uniform_count; i++)
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[i], &uniform_data[i]);
|
||||
|
||||
/* Set lookup textures. */
|
||||
for (i = 0; i < cg->shader->luts; i++)
|
||||
{
|
||||
@ -482,11 +463,10 @@ static void gl_cg_set_params(void *data, void *shader_data,
|
||||
uniform_params[j].lookup.enable = true;
|
||||
uniform_params[j].lookup.idx = cg->active_idx;
|
||||
uniform_params[j].lookup.ident = cg->shader->parameters[i].id;
|
||||
uniform_params[j].location = j;
|
||||
uniform_params[j].enabled = true;
|
||||
uniform_params[j].type = UNIFORM_1F;
|
||||
uniform_params[j].result.f.v0 = cg->shader->parameters[i].current;
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[j], NULL);
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[j]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -513,11 +493,10 @@ static void gl_cg_set_params(void *data, void *shader_data,
|
||||
uniform_params[j].lookup.enable = true;
|
||||
uniform_params[j].lookup.idx = cg->active_idx;
|
||||
uniform_params[j].lookup.ident = tracker_info[i].id;
|
||||
uniform_params[j].location = j;
|
||||
uniform_params[j].enabled = true;
|
||||
uniform_params[j].type = UNIFORM_1F;
|
||||
uniform_params[j].result.f.v0 = tracker_info[i].value;
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[j], NULL);
|
||||
gl_cg_set_uniform_parameter(cg, &uniform_params[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -950,8 +950,7 @@ error:
|
||||
|
||||
static void gl_glsl_set_uniform_parameter(
|
||||
void *data,
|
||||
struct uniform_info *param,
|
||||
void *uniform_data)
|
||||
struct uniform_info *param)
|
||||
{
|
||||
GLint location = 0;
|
||||
glsl_shader_data_t *glsl = (glsl_shader_data_t*)data;
|
||||
@ -1090,7 +1089,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
||||
uniform_count++;
|
||||
|
||||
for (i = 0; i < uniform_count; i++)
|
||||
gl_glsl_set_uniform_parameter(glsl, &uniform_params[i], NULL);
|
||||
gl_glsl_set_uniform_parameter(glsl, &uniform_params[i]);
|
||||
|
||||
/* Set lookup textures. */
|
||||
for (i = 0; i < glsl->shader->luts; i++)
|
||||
@ -1108,7 +1107,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
||||
lut_uniform.type = UNIFORM_1I;
|
||||
lut_uniform.result.integer.v0 = texunit;
|
||||
|
||||
gl_glsl_set_uniform_parameter(glsl, &lut_uniform, NULL);
|
||||
gl_glsl_set_uniform_parameter(glsl, &lut_uniform);
|
||||
texunit++;
|
||||
}
|
||||
|
||||
@ -1130,7 +1129,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
||||
orig_tex_uniform.type = UNIFORM_1I;
|
||||
orig_tex_uniform.result.integer.v0 = texunit;
|
||||
|
||||
gl_glsl_set_uniform_parameter(glsl, &orig_tex_uniform, NULL);
|
||||
gl_glsl_set_uniform_parameter(glsl, &orig_tex_uniform);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, info->tex);
|
||||
texunit++;
|
||||
@ -1155,7 +1154,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
if (orig_uniforms[j].enabled)
|
||||
gl_glsl_set_uniform_parameter(glsl, &orig_uniforms[j], NULL);
|
||||
gl_glsl_set_uniform_parameter(glsl, &orig_uniforms[j]);
|
||||
}
|
||||
|
||||
/* Pass texture coordinates. */
|
||||
@ -1184,7 +1183,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
||||
feedback_texture_param.type = UNIFORM_1I;
|
||||
feedback_texture_param.result.integer.v0 = texunit;
|
||||
|
||||
gl_glsl_set_uniform_parameter(glsl, &feedback_texture_param, NULL);
|
||||
gl_glsl_set_uniform_parameter(glsl, &feedback_texture_param);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, feedback_info->tex);
|
||||
texunit++;
|
||||
@ -1209,7 +1208,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
if (feedback_uniforms[j].enabled)
|
||||
gl_glsl_set_uniform_parameter(glsl, &feedback_uniforms[j], NULL);
|
||||
gl_glsl_set_uniform_parameter(glsl, &feedback_uniforms[j]);
|
||||
}
|
||||
|
||||
/* Pass texture coordinates. */
|
||||
@ -1263,7 +1262,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
if (fbo_tex_params[j].enabled)
|
||||
gl_glsl_set_uniform_parameter(glsl, &fbo_tex_params[j], NULL);
|
||||
gl_glsl_set_uniform_parameter(glsl, &fbo_tex_params[j]);
|
||||
}
|
||||
|
||||
if (uni->pass[i].tex_coord >= 0)
|
||||
@ -1318,7 +1317,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
if (prev_tex_params[j].enabled)
|
||||
gl_glsl_set_uniform_parameter(glsl, &prev_tex_params[j], NULL);
|
||||
gl_glsl_set_uniform_parameter(glsl, &prev_tex_params[j]);
|
||||
}
|
||||
|
||||
/* Pass texture coordinates. */
|
||||
@ -1356,7 +1355,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
||||
pragma_param.type = UNIFORM_1F;
|
||||
pragma_param.result.f.v0 = glsl->shader->parameters[i].current;
|
||||
|
||||
gl_glsl_set_uniform_parameter(glsl, &pragma_param, NULL);
|
||||
gl_glsl_set_uniform_parameter(glsl, &pragma_param);
|
||||
}
|
||||
|
||||
/* Set state parameters. */
|
||||
@ -1381,7 +1380,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
|
||||
state_param.type = UNIFORM_1F;
|
||||
state_param.result.f.v0 = state_info[i].value;
|
||||
|
||||
gl_glsl_set_uniform_parameter(glsl, &state_param, NULL);
|
||||
gl_glsl_set_uniform_parameter(glsl, &state_param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,8 +65,7 @@ void hlsl_set_proj_matrix(void *data, XMMATRIX rotation_value)
|
||||
|
||||
static void hlsl_set_uniform_parameter(
|
||||
void *data,
|
||||
struct uniform_info *param,
|
||||
void *uniform_data)
|
||||
struct uniform_info *param)
|
||||
{
|
||||
hlsl_shader_data_t *hlsl = (hlsl_shader_data_t*)data;
|
||||
|
||||
|
@ -76,8 +76,7 @@ static void shader_null_set_params(void *data, void *shader_data,
|
||||
|
||||
static void shader_null_set_uniform_parameter(
|
||||
void *data,
|
||||
struct uniform_info *param,
|
||||
void *uniform_data)
|
||||
struct uniform_info *param)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -136,8 +136,7 @@ bool video_shader_driver_set_parameter(struct uniform_info *param)
|
||||
{
|
||||
if (!current_shader || !param)
|
||||
return false;
|
||||
current_shader->set_uniform_parameter(shader_data,
|
||||
param, NULL);
|
||||
current_shader->set_uniform_parameter(shader_data, param);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -149,8 +149,7 @@ typedef struct shader_backend
|
||||
const void *prev_info,
|
||||
const void *feedback_info,
|
||||
const void *fbo_info, unsigned fbo_info_cnt);
|
||||
void (*set_uniform_parameter)(void *data, struct uniform_info *param,
|
||||
void *uniform_data);
|
||||
void (*set_uniform_parameter)(void *data, struct uniform_info *param);
|
||||
bool (*compile_program)(void *data, unsigned idx,
|
||||
void *program_data, struct shader_program_info *program_info);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user