Add 'enabled' attribute to uniform_params

This commit is contained in:
twinaphex 2016-04-13 04:21:17 +02:00
parent c3f77efb2c
commit bf39033bc3
2 changed files with 47 additions and 28 deletions

View File

@ -55,7 +55,7 @@ static void cg_uniform_set_parameter(void *data, void *uniform_data)
struct uniform_info *param = (struct uniform_info*)data;
CGparameter *cg_param = (CGparameter*)uniform_data;
if (!param)
if (!param || !param->enabled)
return;
switch (param->type)
@ -276,24 +276,28 @@ static void gl_cg_set_texture_info(
cgGLEnableTextureParameter(param);
}
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_params[0].result.f.v0 = info->input_size[0];
uniform_params[0].result.f.v1 = info->input_size[1];
uniform_data[0] = params->vid_size_v;
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_params[1].result.f.v0 = info->input_size[0];
uniform_params[1].result.f.v1 = info->input_size[1];
uniform_data[1] = params->vid_size_f;
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_params[2].result.f.v0 = info->tex_size[0];
uniform_params[2].result.f.v1 = info->tex_size[1];
uniform_data[2] = params->tex_size_v;
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_params[3].result.f.v0 = info->tex_size[0];
uniform_params[3].result.f.v1 = info->tex_size[1];
uniform_data[3] = params->tex_size_f;
for (i = 0; i < 4; i++)
@ -334,42 +338,50 @@ static void gl_cg_set_params(void *data, void *shader_data,
return;
/* Set frame. */
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_params[0].result.f.v0 = width;
uniform_params[0].result.f.v1 = height;
uniform_data[0] = cg_data->prg[cg_data->active_idx].vid_size_f;
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_params[1].result.f.v0 = tex_width;
uniform_params[1].result.f.v1 = tex_height;
uniform_data[1] = cg_data->prg[cg_data->active_idx].tex_size_f;
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_params[2].result.f.v0 = out_width;
uniform_params[2].result.f.v1 = out_height;
uniform_data[2] = cg_data->prg[cg_data->active_idx].out_size_f;
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_params[3].result.f.v0 = state_manager_frame_is_reversed() ? -1.0 : 1.0;
uniform_data[3] = cg_data->prg[cg_data->active_idx].frame_dir_f;
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_params[4].result.f.v0 = width;
uniform_params[4].result.f.v1 = height;
uniform_data[4] = cg_data->prg[cg_data->active_idx].vid_size_v;
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_params[5].result.f.v0 = tex_width;
uniform_params[5].result.f.v1 = tex_height;
uniform_data[5] = cg_data->prg[cg_data->active_idx].tex_size_v;
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_params[6].result.f.v0 = out_width;
uniform_params[6].result.f.v1 = out_height;
uniform_data[6] = cg_data->prg[cg_data->active_idx].out_size_v;
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_params[7].result.f.v0 = state_manager_frame_is_reversed() ? -1.0 : 1.0;
uniform_data[7] = cg_data->prg[cg_data->active_idx].frame_dir_v;
uniform_count += 8;
@ -380,12 +392,14 @@ static void gl_cg_set_params(void *data, void *shader_data,
if (modulo)
frame_count %= modulo;
uniform_params[8].enabled = true;
uniform_params[8].type = UNIFORM_1F;
uniform_params[8].result.f.v0 = (float)frame_count;
uniform_params[8].result.f.v0 = (float)frame_count;
uniform_data[8] = cg_data->prg[cg_data->active_idx].frame_cnt_f;
uniform_params[9].enabled = true;
uniform_params[9].type = UNIFORM_1F;
uniform_params[9].result.f.v0 = (float)frame_count;
uniform_params[9].result.f.v0 = (float)frame_count;
uniform_data[9] = cg_data->prg[cg_data->active_idx].frame_cnt_v;
uniform_count += 2;
@ -445,11 +459,13 @@ static void gl_cg_set_params(void *data, void *shader_data,
pragma_cg_params[1] = cgGetNamedParameter(
cg_data->prg[cg_data->active_idx].fprg, cg_data->shader->parameters[i].id);
uniform_params[0].enabled = true;
uniform_params[0].type = UNIFORM_1F;
uniform_params[0].result.f.v0 = cg_data->shader->parameters[i].current;
uniform_params[0].result.f.v0 = cg_data->shader->parameters[i].current;
uniform_params[1].enabled = true;
uniform_params[1].type = UNIFORM_1F;
uniform_params[1].result.f.v0 = cg_data->shader->parameters[i].current;
uniform_params[1].result.f.v0 = cg_data->shader->parameters[i].current;
cg_uniform_set_parameter(&pragma_params[i], &pragma_cg_params[i]);
}
@ -475,11 +491,13 @@ static void gl_cg_set_params(void *data, void *shader_data,
pragma_cg_params[1] = cgGetNamedParameter(
cg_data->prg[cg_data->active_idx].fprg, tracker_info[i].id);
uniform_params[0].enabled = true;
uniform_params[0].type = UNIFORM_1F;
uniform_params[0].result.f.v0 = tracker_info[i].value;
uniform_params[1].enabled = true;
uniform_params[1].type = UNIFORM_1F;
uniform_params[1].result.f.v0 = tracker_info[i].value;
uniform_params[1].result.f.v0 = tracker_info[i].value;
cg_uniform_set_parameter(&state_params[i], &pragma_cg_params[i]);
}

View File

@ -92,6 +92,7 @@ enum shader_uniform_type
struct uniform_info
{
enum shader_uniform_type type;
bool enabled;
struct
{