2013-09-30 19:37:13 -07:00
|
|
|
/******************************************************************************
|
|
|
|
Copyright (C) 2013 by Hugh Bailey <obs.jim@gmail.com>
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2013-12-02 21:24:38 -08:00
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
2013-09-30 19:37:13 -07:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#include "effect.h"
|
|
|
|
#include "graphics-internal.h"
|
|
|
|
#include "vec2.h"
|
|
|
|
#include "vec3.h"
|
|
|
|
#include "vec4.h"
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_destroy(gs_effect_t *effect)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
|
|
|
if (effect) {
|
|
|
|
effect_free(effect);
|
|
|
|
bfree(effect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-26 15:25:59 -07:00
|
|
|
gs_technique_t *gs_effect_get_technique(const gs_effect_t *effect,
|
|
|
|
const char *name)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-02-23 21:39:33 -08:00
|
|
|
if (!effect) return NULL;
|
2013-09-30 19:37:13 -07:00
|
|
|
|
2014-02-23 21:39:33 -08:00
|
|
|
for (size_t i = 0; i < effect->techniques.num; i++) {
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_effect_technique *tech = effect->techniques.array+i;
|
2013-09-30 19:37:13 -07:00
|
|
|
if (strcmp(tech->name, name) == 0)
|
|
|
|
return tech;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-11-19 17:32:05 -08:00
|
|
|
gs_technique_t *gs_effect_get_current_technique(const gs_effect_t *effect)
|
|
|
|
{
|
|
|
|
if (!effect) return NULL;
|
|
|
|
|
|
|
|
return effect->cur_technique;
|
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
size_t gs_technique_begin(gs_technique_t *tech)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-02-23 21:39:33 -08:00
|
|
|
if (!tech) return 0;
|
|
|
|
|
2013-09-30 19:37:13 -07:00
|
|
|
tech->effect->cur_technique = tech;
|
|
|
|
tech->effect->graphics->cur_effect = tech->effect;
|
|
|
|
|
2013-10-17 17:21:42 -07:00
|
|
|
return tech->passes.num;
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_technique_end(gs_technique_t *tech)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-02-23 21:39:33 -08:00
|
|
|
if (!tech) return;
|
|
|
|
|
2013-09-30 19:37:13 -07:00
|
|
|
struct gs_effect *effect = tech->effect;
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_effect_param *params = effect->params.array;
|
2013-09-30 19:37:13 -07:00
|
|
|
size_t i;
|
|
|
|
|
|
|
|
gs_load_vertexshader(NULL);
|
|
|
|
gs_load_pixelshader(NULL);
|
|
|
|
|
|
|
|
tech->effect->cur_technique = NULL;
|
|
|
|
tech->effect->graphics->cur_effect = NULL;
|
|
|
|
|
|
|
|
for (i = 0; i < effect->params.num; i++) {
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_effect_param *param = params+i;
|
2013-09-30 19:37:13 -07:00
|
|
|
|
|
|
|
da_free(param->cur_val);
|
|
|
|
param->changed = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void reset_params(struct darray *shaderparams)
|
|
|
|
{
|
|
|
|
struct pass_shaderparam *params = shaderparams->array;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
for (i = 0; i < shaderparams->num; i++)
|
|
|
|
params[i].eparam->changed = false;
|
|
|
|
}
|
|
|
|
|
2014-06-25 19:54:07 -07:00
|
|
|
static void upload_shader_params(struct darray *pass_params, bool changed_only)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
|
|
|
struct pass_shaderparam *params = pass_params->array;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
for (i = 0; i < pass_params->num; i++) {
|
|
|
|
struct pass_shaderparam *param = params+i;
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_effect_param *eparam = param->eparam;
|
2014-09-25 17:44:05 -07:00
|
|
|
gs_sparam_t *sparam = param->sparam;
|
2013-09-30 19:37:13 -07:00
|
|
|
|
|
|
|
if (changed_only && !eparam->changed)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!eparam->cur_val.num) {
|
|
|
|
if (eparam->default_val.num)
|
|
|
|
da_copy(eparam->cur_val, eparam->default_val);
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-08-07 23:42:07 -07:00
|
|
|
gs_shader_set_val(sparam, eparam->cur_val.array,
|
2013-09-30 19:37:13 -07:00
|
|
|
eparam->cur_val.num);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void upload_parameters(struct gs_effect *effect,
|
|
|
|
bool changed_only)
|
|
|
|
{
|
|
|
|
struct darray *vshader_params, *pshader_params;
|
|
|
|
|
|
|
|
if (!effect->cur_pass)
|
|
|
|
return;
|
|
|
|
|
|
|
|
vshader_params = &effect->cur_pass->vertshader_params.da;
|
|
|
|
pshader_params = &effect->cur_pass->pixelshader_params.da;
|
|
|
|
|
2014-06-25 19:54:07 -07:00
|
|
|
upload_shader_params(vshader_params, changed_only);
|
|
|
|
upload_shader_params(pshader_params, changed_only);
|
2013-09-30 19:37:13 -07:00
|
|
|
reset_params(vshader_params);
|
|
|
|
reset_params(pshader_params);
|
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_update_params(gs_effect_t *effect)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-02-23 21:39:33 -08:00
|
|
|
if (effect)
|
|
|
|
upload_parameters(effect, true);
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
bool gs_technique_begin_pass(gs_technique_t *tech, size_t idx)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_effect_pass *passes;
|
|
|
|
struct gs_effect_pass *cur_pass;
|
2013-09-30 19:37:13 -07:00
|
|
|
|
2014-02-23 21:39:33 -08:00
|
|
|
if (!tech || idx >= tech->passes.num)
|
2013-09-30 19:37:13 -07:00
|
|
|
return false;
|
|
|
|
|
|
|
|
passes = tech->passes.array;
|
|
|
|
cur_pass = passes+idx;
|
|
|
|
|
|
|
|
tech->effect->cur_pass = cur_pass;
|
|
|
|
gs_load_vertexshader(cur_pass->vertshader);
|
|
|
|
gs_load_pixelshader(cur_pass->pixelshader);
|
|
|
|
upload_parameters(tech->effect, false);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
bool gs_technique_begin_pass_by_name(gs_technique_t *tech,
|
2013-09-30 19:37:13 -07:00
|
|
|
const char *name)
|
|
|
|
{
|
2014-02-23 21:39:33 -08:00
|
|
|
if (!tech)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < tech->passes.num; i++) {
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_effect_pass *pass = tech->passes.array+i;
|
2013-09-30 19:37:13 -07:00
|
|
|
if (strcmp(pass->name, name) == 0) {
|
2014-08-07 23:42:07 -07:00
|
|
|
gs_technique_begin_pass(tech, i);
|
2013-09-30 19:37:13 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-06-25 19:54:07 -07:00
|
|
|
static inline void clear_tex_params(struct darray *in_params)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
|
|
|
struct pass_shaderparam *params = in_params->array;
|
|
|
|
|
2014-02-23 21:39:33 -08:00
|
|
|
for (size_t i = 0; i < in_params->num; i++) {
|
2013-09-30 19:37:13 -07:00
|
|
|
struct pass_shaderparam *param = params+i;
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_shader_param_info info;
|
2013-09-30 19:37:13 -07:00
|
|
|
|
2014-08-07 23:42:07 -07:00
|
|
|
gs_shader_get_param_info(param->sparam, &info);
|
|
|
|
if (info.type == GS_SHADER_PARAM_TEXTURE)
|
|
|
|
gs_shader_set_texture(param->sparam, NULL);
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_technique_end_pass(gs_technique_t *tech)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-02-23 21:39:33 -08:00
|
|
|
if (!tech) return;
|
|
|
|
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_effect_pass *pass = tech->effect->cur_pass;
|
2013-09-30 19:37:13 -07:00
|
|
|
if (!pass)
|
|
|
|
return;
|
|
|
|
|
2014-06-25 19:54:07 -07:00
|
|
|
clear_tex_params(&pass->vertshader_params.da);
|
|
|
|
clear_tex_params(&pass->pixelshader_params.da);
|
2013-09-30 19:37:13 -07:00
|
|
|
tech->effect->cur_pass = NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-26 15:25:59 -07:00
|
|
|
size_t gs_effect_get_num_params(const gs_effect_t *effect)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-02-23 21:39:33 -08:00
|
|
|
return effect ? effect->params.num : 0;
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-26 15:25:59 -07:00
|
|
|
gs_eparam_t *gs_effect_get_param_by_idx(const gs_effect_t *effect, size_t param)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-02-23 21:39:33 -08:00
|
|
|
if (!effect) return NULL;
|
2013-09-30 19:37:13 -07:00
|
|
|
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_effect_param *params = effect->params.array;
|
2013-09-30 19:37:13 -07:00
|
|
|
if (param >= effect->params.num)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return params+param;
|
|
|
|
}
|
|
|
|
|
2014-09-26 15:25:59 -07:00
|
|
|
gs_eparam_t *gs_effect_get_param_by_name(const gs_effect_t *effect,
|
|
|
|
const char *name)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-02-23 21:39:33 -08:00
|
|
|
if (!effect) return NULL;
|
|
|
|
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_effect_param *params = effect->params.array;
|
2013-09-30 19:37:13 -07:00
|
|
|
|
2014-02-23 21:39:33 -08:00
|
|
|
for (size_t i = 0; i < effect->params.num; i++) {
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_effect_param *param = params+i;
|
2013-09-30 19:37:13 -07:00
|
|
|
|
|
|
|
if (strcmp(param->name, name) == 0)
|
|
|
|
return param;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-26 15:25:59 -07:00
|
|
|
gs_eparam_t *gs_effect_get_viewproj_matrix(const gs_effect_t *effect)
|
2013-10-17 17:21:42 -07:00
|
|
|
{
|
2014-06-25 20:29:46 -07:00
|
|
|
return effect ? effect->view_proj : NULL;
|
2013-10-17 17:21:42 -07:00
|
|
|
}
|
|
|
|
|
2014-09-26 15:25:59 -07:00
|
|
|
gs_eparam_t *gs_effect_get_world_matrix(const gs_effect_t *effect)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-06-25 20:29:46 -07:00
|
|
|
return effect ? effect->world : NULL;
|
|
|
|
}
|
2014-02-23 21:39:33 -08:00
|
|
|
|
2014-09-26 15:25:59 -07:00
|
|
|
void gs_effect_get_param_info(const gs_eparam_t *param,
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_effect_param_info *info)
|
2014-06-25 20:29:46 -07:00
|
|
|
{
|
|
|
|
if (!param)
|
2013-10-17 17:21:42 -07:00
|
|
|
return;
|
|
|
|
|
2013-09-30 19:37:13 -07:00
|
|
|
info->name = param->name;
|
|
|
|
info->type = param->type;
|
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
static inline void effect_setval_inline(gs_eparam_t *param,
|
2013-09-30 19:37:13 -07:00
|
|
|
const void *data, size_t size)
|
|
|
|
{
|
Revamp API and start using doxygen
The API used to be designed in such a way to where it would expect
exports for each individual source/output/encoder/etc. You would export
functions for each and it would automatically load those functions based
on a specific naming scheme from the module.
The idea behind this was that I wanted to limit the usage of structures
in the API so only functions could be used. It was an interesting idea
in theory, but this idea turned out to be flawed in a number of ways:
1.) Requiring exports to create sources/outputs/encoders/etc meant that
you could not create them by any other means, which meant that
things like faruton's .net plugin would become difficult.
2.) Export function declarations could not be checked, therefore if you
created a function with the wrong parameters and parameter types,
the compiler wouldn't know how to check for that.
3.) Required overly complex load functions in libobs just to handle it.
It makes much more sense to just have a load function that you call
manually. Complexity is the bane of all good programs.
4.) It required that you have functions of specific names, which looked
and felt somewhat unsightly.
So, to fix these issues, I replaced it with a more commonly used API
scheme, seen commonly in places like kernels and typical C libraries
with abstraction. You simply create a structure that contains the
callback definitions, and you pass it to a function to register that
definition (such as obs_register_source), which you call in the
obs_module_load of the module.
It will also automatically check the structure size and ensure that it
only loads the required values if the structure happened to add new
values in an API change.
The "main" source file for each module must include obs-module.h, and
must use OBS_DECLARE_MODULE() within that source file.
Also, started writing some doxygen documentation in to the main library
headers. Will add more detailed documentation as I go.
2014-02-12 07:04:50 -08:00
|
|
|
bool size_changed;
|
2013-10-17 17:21:42 -07:00
|
|
|
|
Revamp API and start using doxygen
The API used to be designed in such a way to where it would expect
exports for each individual source/output/encoder/etc. You would export
functions for each and it would automatically load those functions based
on a specific naming scheme from the module.
The idea behind this was that I wanted to limit the usage of structures
in the API so only functions could be used. It was an interesting idea
in theory, but this idea turned out to be flawed in a number of ways:
1.) Requiring exports to create sources/outputs/encoders/etc meant that
you could not create them by any other means, which meant that
things like faruton's .net plugin would become difficult.
2.) Export function declarations could not be checked, therefore if you
created a function with the wrong parameters and parameter types,
the compiler wouldn't know how to check for that.
3.) Required overly complex load functions in libobs just to handle it.
It makes much more sense to just have a load function that you call
manually. Complexity is the bane of all good programs.
4.) It required that you have functions of specific names, which looked
and felt somewhat unsightly.
So, to fix these issues, I replaced it with a more commonly used API
scheme, seen commonly in places like kernels and typical C libraries
with abstraction. You simply create a structure that contains the
callback definitions, and you pass it to a function to register that
definition (such as obs_register_source), which you call in the
obs_module_load of the module.
It will also automatically check the structure size and ensure that it
only loads the required values if the structure happened to add new
values in an API change.
The "main" source file for each module must include obs-module.h, and
must use OBS_DECLARE_MODULE() within that source file.
Also, started writing some doxygen documentation in to the main library
headers. Will add more detailed documentation as I go.
2014-02-12 07:04:50 -08:00
|
|
|
if (!param) {
|
2014-02-28 19:07:56 -08:00
|
|
|
blog(LOG_ERROR, "effect_setval_inline: invalid param");
|
Revamp API and start using doxygen
The API used to be designed in such a way to where it would expect
exports for each individual source/output/encoder/etc. You would export
functions for each and it would automatically load those functions based
on a specific naming scheme from the module.
The idea behind this was that I wanted to limit the usage of structures
in the API so only functions could be used. It was an interesting idea
in theory, but this idea turned out to be flawed in a number of ways:
1.) Requiring exports to create sources/outputs/encoders/etc meant that
you could not create them by any other means, which meant that
things like faruton's .net plugin would become difficult.
2.) Export function declarations could not be checked, therefore if you
created a function with the wrong parameters and parameter types,
the compiler wouldn't know how to check for that.
3.) Required overly complex load functions in libobs just to handle it.
It makes much more sense to just have a load function that you call
manually. Complexity is the bane of all good programs.
4.) It required that you have functions of specific names, which looked
and felt somewhat unsightly.
So, to fix these issues, I replaced it with a more commonly used API
scheme, seen commonly in places like kernels and typical C libraries
with abstraction. You simply create a structure that contains the
callback definitions, and you pass it to a function to register that
definition (such as obs_register_source), which you call in the
obs_module_load of the module.
It will also automatically check the structure size and ensure that it
only loads the required values if the structure happened to add new
values in an API change.
The "main" source file for each module must include obs-module.h, and
must use OBS_DECLARE_MODULE() within that source file.
Also, started writing some doxygen documentation in to the main library
headers. Will add more detailed documentation as I go.
2014-02-12 07:04:50 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!data) {
|
2014-02-28 19:07:56 -08:00
|
|
|
blog(LOG_ERROR, "effect_setval_inline: invalid data");
|
Revamp API and start using doxygen
The API used to be designed in such a way to where it would expect
exports for each individual source/output/encoder/etc. You would export
functions for each and it would automatically load those functions based
on a specific naming scheme from the module.
The idea behind this was that I wanted to limit the usage of structures
in the API so only functions could be used. It was an interesting idea
in theory, but this idea turned out to be flawed in a number of ways:
1.) Requiring exports to create sources/outputs/encoders/etc meant that
you could not create them by any other means, which meant that
things like faruton's .net plugin would become difficult.
2.) Export function declarations could not be checked, therefore if you
created a function with the wrong parameters and parameter types,
the compiler wouldn't know how to check for that.
3.) Required overly complex load functions in libobs just to handle it.
It makes much more sense to just have a load function that you call
manually. Complexity is the bane of all good programs.
4.) It required that you have functions of specific names, which looked
and felt somewhat unsightly.
So, to fix these issues, I replaced it with a more commonly used API
scheme, seen commonly in places like kernels and typical C libraries
with abstraction. You simply create a structure that contains the
callback definitions, and you pass it to a function to register that
definition (such as obs_register_source), which you call in the
obs_module_load of the module.
It will also automatically check the structure size and ensure that it
only loads the required values if the structure happened to add new
values in an API change.
The "main" source file for each module must include obs-module.h, and
must use OBS_DECLARE_MODULE() within that source file.
Also, started writing some doxygen documentation in to the main library
headers. Will add more detailed documentation as I go.
2014-02-12 07:04:50 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_changed = param->cur_val.num != size;
|
2013-10-17 17:21:42 -07:00
|
|
|
|
2013-09-30 19:37:13 -07:00
|
|
|
if (size_changed)
|
|
|
|
da_resize(param->cur_val, size);
|
|
|
|
|
|
|
|
if (size_changed || memcmp(param->cur_val.array, data, size) != 0) {
|
|
|
|
memcpy(param->cur_val.array, data, size);
|
|
|
|
param->changed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_set_bool(gs_eparam_t *param, bool val)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-06-25 20:29:46 -07:00
|
|
|
effect_setval_inline(param, &val, sizeof(bool));
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_set_float(gs_eparam_t *param, float val)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-06-25 20:29:46 -07:00
|
|
|
effect_setval_inline(param, &val, sizeof(float));
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_set_int(gs_eparam_t *param, int val)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-06-25 20:29:46 -07:00
|
|
|
effect_setval_inline(param, &val, sizeof(int));
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_set_matrix4(gs_eparam_t *param, const struct matrix4 *val)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-06-25 20:29:46 -07:00
|
|
|
effect_setval_inline(param, val, sizeof(struct matrix4));
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_set_vec2(gs_eparam_t *param, const struct vec2 *val)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-06-25 20:29:46 -07:00
|
|
|
effect_setval_inline(param, val, sizeof(struct vec2));
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_set_vec3(gs_eparam_t *param, const struct vec3 *val)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-06-25 20:29:46 -07:00
|
|
|
effect_setval_inline(param, val, sizeof(float) * 3);
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_set_vec4(gs_eparam_t *param, const struct vec4 *val)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-06-25 20:29:46 -07:00
|
|
|
effect_setval_inline(param, val, sizeof(struct vec4));
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_set_texture(gs_eparam_t *param, gs_texture_t *val)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-09-25 17:44:05 -07:00
|
|
|
effect_setval_inline(param, &val, sizeof(gs_texture_t*));
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_set_val(gs_eparam_t *param, const void *val, size_t size)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-06-25 20:29:46 -07:00
|
|
|
effect_setval_inline(param, val, size);
|
2013-09-30 19:37:13 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void gs_effect_set_default(gs_eparam_t *param)
|
2013-09-30 19:37:13 -07:00
|
|
|
{
|
2014-06-25 20:29:46 -07:00
|
|
|
effect_setval_inline(param, param->default_val.array,
|
2013-09-30 19:37:13 -07:00
|
|
|
param->default_val.num);
|
|
|
|
}
|