Remove 'shader' param from shader param functions
parent
27010a2f56
commit
caf8ca9ba8
|
@ -168,7 +168,7 @@ void gs_shader::BuildConstantBuffer()
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < params.size(); i++)
|
||||
shader_setdefault(this, ¶ms[i]);
|
||||
shader_setdefault(¶ms[i]);
|
||||
}
|
||||
|
||||
void gs_shader::Compile(const char *shaderString, const char *file,
|
||||
|
@ -276,16 +276,6 @@ sparam_t shader_getparambyname(shader_t shader, const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void shader_getparaminfo(shader_t shader, sparam_t param,
|
||||
struct shader_param_info *info)
|
||||
{
|
||||
if (!param || !shader)
|
||||
return;
|
||||
|
||||
info->name = param->name.c_str();
|
||||
info->type = param->type;
|
||||
}
|
||||
|
||||
sparam_t shader_getviewprojmatrix(shader_t shader)
|
||||
{
|
||||
if (shader->type != SHADER_VERTEX)
|
||||
|
@ -302,8 +292,17 @@ sparam_t shader_getworldmatrix(shader_t shader)
|
|||
return static_cast<gs_vertex_shader*>(shader)->world;
|
||||
}
|
||||
|
||||
static inline void shader_setval_inline(gs_shader *shader, shader_param *param,
|
||||
const void *data, size_t size)
|
||||
void shader_getparaminfo(sparam_t param, struct shader_param_info *info)
|
||||
{
|
||||
if (!param)
|
||||
return;
|
||||
|
||||
info->name = param->name.c_str();
|
||||
info->type = param->type;
|
||||
}
|
||||
|
||||
static inline void shader_setval_inline(shader_param *param, const void *data,
|
||||
size_t size)
|
||||
{
|
||||
assert(param);
|
||||
if (!param)
|
||||
|
@ -319,64 +318,61 @@ static inline void shader_setval_inline(gs_shader *shader, shader_param *param,
|
|||
}
|
||||
}
|
||||
|
||||
void shader_setbool(shader_t shader, sparam_t param, bool val)
|
||||
void shader_setbool(sparam_t param, bool val)
|
||||
{
|
||||
shader_setval_inline(shader, param, &val, sizeof(bool));
|
||||
shader_setval_inline(param, &val, sizeof(bool));
|
||||
}
|
||||
|
||||
void shader_setfloat(shader_t shader, sparam_t param, float val)
|
||||
void shader_setfloat(sparam_t param, float val)
|
||||
{
|
||||
shader_setval_inline(shader, param, &val, sizeof(float));
|
||||
shader_setval_inline(param, &val, sizeof(float));
|
||||
}
|
||||
|
||||
void shader_setint(shader_t shader, sparam_t param, int val)
|
||||
void shader_setint(sparam_t param, int val)
|
||||
{
|
||||
shader_setval_inline(shader, param, &val, sizeof(int));
|
||||
shader_setval_inline(param, &val, sizeof(int));
|
||||
}
|
||||
|
||||
void shader_setmatrix3(shader_t shader, sparam_t param,
|
||||
const struct matrix3 *val)
|
||||
void shader_setmatrix3(sparam_t param, const struct matrix3 *val)
|
||||
{
|
||||
struct matrix4 mat;
|
||||
matrix4_from_matrix3(&mat, val);
|
||||
shader_setval_inline(shader, param, &mat, sizeof(matrix4));
|
||||
shader_setval_inline(param, &mat, sizeof(matrix4));
|
||||
}
|
||||
|
||||
void shader_setmatrix4(shader_t shader, sparam_t param,
|
||||
const struct matrix4 *val)
|
||||
void shader_setmatrix4(sparam_t param, const struct matrix4 *val)
|
||||
{
|
||||
shader_setval_inline(shader, param, val, sizeof(matrix4));
|
||||
shader_setval_inline(param, val, sizeof(matrix4));
|
||||
}
|
||||
|
||||
void shader_setvec2(shader_t shader, sparam_t param, const struct vec2 *val)
|
||||
void shader_setvec2(sparam_t param, const struct vec2 *val)
|
||||
{
|
||||
shader_setval_inline(shader, param, val, sizeof(vec2));
|
||||
shader_setval_inline(param, val, sizeof(vec2));
|
||||
}
|
||||
|
||||
void shader_setvec3(shader_t shader, sparam_t param, const struct vec3 *val)
|
||||
void shader_setvec3(sparam_t param, const struct vec3 *val)
|
||||
{
|
||||
shader_setval_inline(shader, param, val, sizeof(float) * 3);
|
||||
shader_setval_inline(param, val, sizeof(float) * 3);
|
||||
}
|
||||
|
||||
void shader_setvec4(shader_t shader, sparam_t param, const struct vec4 *val)
|
||||
void shader_setvec4(sparam_t param, const struct vec4 *val)
|
||||
{
|
||||
shader_setval_inline(shader, param, val, sizeof(vec4));
|
||||
shader_setval_inline(param, val, sizeof(vec4));
|
||||
}
|
||||
|
||||
void shader_settexture(shader_t shader, sparam_t param, texture_t val)
|
||||
void shader_settexture(sparam_t param, texture_t val)
|
||||
{
|
||||
shader_setval_inline(shader, param, &val, sizeof(texture_t));
|
||||
shader_setval_inline(param, &val, sizeof(texture_t));
|
||||
}
|
||||
|
||||
void shader_setval(shader_t shader, sparam_t param, const void *val,
|
||||
size_t size)
|
||||
void shader_setval(sparam_t param, const void *val, size_t size)
|
||||
{
|
||||
shader_setval_inline(shader, param, val, size);
|
||||
shader_setval_inline(param, val, size);
|
||||
}
|
||||
|
||||
void shader_setdefault(shader_t shader, sparam_t param)
|
||||
void shader_setdefault(sparam_t param)
|
||||
{
|
||||
if (param->defaultValue.size())
|
||||
shader_setval_inline(shader, param, param->defaultValue.data(),
|
||||
shader_setval_inline(param, param->defaultValue.data(),
|
||||
param->defaultValue.size());
|
||||
}
|
||||
|
|
|
@ -379,7 +379,7 @@ void gs_device::UpdateViewProjMatrix()
|
|||
matrix4_transpose(&curViewProjMatrix, &curViewProjMatrix);
|
||||
|
||||
if (curVertexShader->viewProj)
|
||||
shader_setmatrix4(curVertexShader, curVertexShader->viewProj,
|
||||
shader_setmatrix4(curVertexShader->viewProj,
|
||||
&curViewProjMatrix);
|
||||
}
|
||||
|
||||
|
|
|
@ -338,26 +338,6 @@ sparam_t shader_getparambyname(shader_t shader, const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline bool matching_shader(shader_t shader, sparam_t sparam)
|
||||
{
|
||||
if (shader != sparam->shader) {
|
||||
blog(LOG_ERROR, "Shader and shader parameter do not match");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void shader_getparaminfo(shader_t shader, sparam_t param,
|
||||
struct shader_param_info *info)
|
||||
{
|
||||
if (!matching_shader(shader, param))
|
||||
return;
|
||||
|
||||
info->type = param->type;
|
||||
info->name = param->name;
|
||||
}
|
||||
|
||||
sparam_t shader_getviewprojmatrix(shader_t shader)
|
||||
{
|
||||
return shader->viewproj;
|
||||
|
@ -368,91 +348,81 @@ sparam_t shader_getworldmatrix(shader_t shader)
|
|||
return shader->world;
|
||||
}
|
||||
|
||||
void shader_setbool(shader_t shader, sparam_t param, bool val)
|
||||
void shader_getparaminfo(sparam_t param, struct shader_param_info *info)
|
||||
{
|
||||
if (matching_shader(shader, param)) {
|
||||
glProgramUniform1i(shader->program, param->param, (GLint)val);
|
||||
gl_success("glProgramUniform1i");
|
||||
}
|
||||
info->type = param->type;
|
||||
info->name = param->name;
|
||||
}
|
||||
|
||||
void shader_setfloat(shader_t shader, sparam_t param, float val)
|
||||
void shader_setbool(sparam_t param, bool val)
|
||||
{
|
||||
if (matching_shader(shader, param)) {
|
||||
glProgramUniform1f(shader->program, param->param, val);
|
||||
gl_success("glProgramUniform1f");
|
||||
}
|
||||
struct gs_shader *shader = param->shader;
|
||||
glProgramUniform1i(shader->program, param->param, (GLint)val);
|
||||
gl_success("glProgramUniform1i");
|
||||
}
|
||||
|
||||
void shader_setint(shader_t shader, sparam_t param, int val)
|
||||
void shader_setfloat(sparam_t param, float val)
|
||||
{
|
||||
if (matching_shader(shader, param)) {
|
||||
glProgramUniform1i(shader->program, param->param, val);
|
||||
gl_success("glProgramUniform1i");
|
||||
}
|
||||
struct gs_shader *shader = param->shader;
|
||||
glProgramUniform1f(shader->program, param->param, val);
|
||||
gl_success("glProgramUniform1f");
|
||||
}
|
||||
|
||||
void shader_setmatrix3(shader_t shader, sparam_t param,
|
||||
const struct matrix3 *val)
|
||||
void shader_setint(sparam_t param, int val)
|
||||
{
|
||||
struct gs_shader *shader = param->shader;
|
||||
glProgramUniform1i(shader->program, param->param, val);
|
||||
gl_success("glProgramUniform1i");
|
||||
}
|
||||
|
||||
void shader_setmatrix3(sparam_t param, const struct matrix3 *val)
|
||||
{
|
||||
struct gs_shader *shader = param->shader;
|
||||
struct matrix4 mat;
|
||||
matrix4_from_matrix3(&mat, val);
|
||||
|
||||
if (matching_shader(shader, param)) {
|
||||
glProgramUniformMatrix4fv(shader->program, param->param, 1,
|
||||
false, mat.x.ptr);
|
||||
gl_success("glProgramUniformMatrix4fv");
|
||||
}
|
||||
glProgramUniformMatrix4fv(shader->program, param->param, 1,
|
||||
false, mat.x.ptr);
|
||||
gl_success("glProgramUniformMatrix4fv");
|
||||
}
|
||||
|
||||
void shader_setmatrix4(shader_t shader, sparam_t param,
|
||||
const struct matrix4 *val)
|
||||
void shader_setmatrix4(sparam_t param, const struct matrix4 *val)
|
||||
{
|
||||
if (matching_shader(shader, param)) {
|
||||
glProgramUniformMatrix4fv(shader->program, param->param, 1,
|
||||
false, val->x.ptr);
|
||||
gl_success("glProgramUniformMatrix4fv");
|
||||
}
|
||||
struct gs_shader *shader = param->shader;
|
||||
glProgramUniformMatrix4fv(shader->program, param->param, 1,
|
||||
false, val->x.ptr);
|
||||
gl_success("glProgramUniformMatrix4fv");
|
||||
}
|
||||
|
||||
void shader_setvec2(shader_t shader, sparam_t param,
|
||||
const struct vec2 *val)
|
||||
void shader_setvec2(sparam_t param, const struct vec2 *val)
|
||||
{
|
||||
if (matching_shader(shader, param)) {
|
||||
glProgramUniform2fv(shader->program, param->param, 1, val->ptr);
|
||||
gl_success("glProgramUniform2fv");
|
||||
}
|
||||
struct gs_shader *shader = param->shader;
|
||||
glProgramUniform2fv(shader->program, param->param, 1, val->ptr);
|
||||
gl_success("glProgramUniform2fv");
|
||||
}
|
||||
|
||||
void shader_setvec3(shader_t shader, sparam_t param,
|
||||
const struct vec3 *val)
|
||||
void shader_setvec3(sparam_t param, const struct vec3 *val)
|
||||
{
|
||||
if (matching_shader(shader, param)) {
|
||||
glProgramUniform3fv(shader->program, param->param, 1, val->ptr);
|
||||
gl_success("glProgramUniform3fv");
|
||||
}
|
||||
struct gs_shader *shader = param->shader;
|
||||
glProgramUniform3fv(shader->program, param->param, 1, val->ptr);
|
||||
gl_success("glProgramUniform3fv");
|
||||
}
|
||||
|
||||
void shader_setvec4(shader_t shader, sparam_t param,
|
||||
const struct vec4 *val)
|
||||
void shader_setvec4(sparam_t param, const struct vec4 *val)
|
||||
{
|
||||
if (matching_shader(shader, param)) {
|
||||
glProgramUniform4fv(shader->program, param->param, 1, val->ptr);
|
||||
gl_success("glProgramUniform4fv");
|
||||
}
|
||||
struct gs_shader *shader = param->shader;
|
||||
glProgramUniform4fv(shader->program, param->param, 1, val->ptr);
|
||||
gl_success("glProgramUniform4fv");
|
||||
}
|
||||
|
||||
void shader_settexture(shader_t shader, sparam_t param, texture_t val)
|
||||
void shader_settexture(sparam_t param, texture_t val)
|
||||
{
|
||||
if (matching_shader(shader, param))
|
||||
param->texture = val;
|
||||
param->texture = val;
|
||||
}
|
||||
|
||||
static void shader_setval_data(shader_t shader, sparam_t param,
|
||||
const void *val, int count)
|
||||
static void shader_setval_data(sparam_t param, const void *val, int count)
|
||||
{
|
||||
if (!matching_shader(shader, param))
|
||||
return;
|
||||
struct gs_shader *shader = param->shader;
|
||||
|
||||
if (param->type == SHADER_PARAM_BOOL ||
|
||||
param->type == SHADER_PARAM_INT) {
|
||||
|
@ -494,17 +464,13 @@ void shader_update_textures(struct gs_shader *shader)
|
|||
}
|
||||
}
|
||||
|
||||
void shader_setval(shader_t shader, sparam_t param, const void *val,
|
||||
size_t size)
|
||||
void shader_setval(sparam_t param, const void *val, size_t size)
|
||||
{
|
||||
int count = param->array_count;
|
||||
size_t expected_size = 0;
|
||||
if (!count)
|
||||
count = 1;
|
||||
|
||||
if (!matching_shader(shader, param))
|
||||
return;
|
||||
|
||||
switch ((uint32_t)param->type) {
|
||||
case SHADER_PARAM_FLOAT: expected_size = sizeof(float); break;
|
||||
case SHADER_PARAM_BOOL:
|
||||
|
@ -528,13 +494,12 @@ void shader_setval(shader_t shader, sparam_t param, const void *val,
|
|||
}
|
||||
|
||||
if (param->type == SHADER_PARAM_TEXTURE)
|
||||
shader_settexture(shader, param, *(texture_t*)val);
|
||||
shader_settexture(param, *(texture_t*)val);
|
||||
else
|
||||
shader_setval_data(shader, param, val, count);
|
||||
shader_setval_data(param, val, count);
|
||||
}
|
||||
|
||||
void shader_setdefault(shader_t shader, sparam_t param)
|
||||
void shader_setdefault(sparam_t param)
|
||||
{
|
||||
shader_setval(shader, param, param->def_value.array,
|
||||
param->def_value.num);
|
||||
shader_setval(param, param->def_value.array, param->def_value.num);
|
||||
}
|
||||
|
|
|
@ -873,7 +873,7 @@ static void update_viewproj_matrix(struct gs_device *device)
|
|||
matrix4_transpose(&device->cur_viewproj, &device->cur_viewproj);
|
||||
|
||||
if (vs->viewproj)
|
||||
shader_setmatrix4(vs, vs->viewproj, &device->cur_viewproj);
|
||||
shader_setmatrix4(vs->viewproj, &device->cur_viewproj);
|
||||
}
|
||||
|
||||
static inline bool check_shader_pipeline_validity(device_t device)
|
||||
|
|
|
@ -104,7 +104,7 @@ static void upload_shader_params(shader_t shader, struct darray *pass_params,
|
|||
continue;
|
||||
}
|
||||
|
||||
shader_setval(shader, sparam, eparam->cur_val.array,
|
||||
shader_setval(sparam, eparam->cur_val.array,
|
||||
eparam->cur_val.num);
|
||||
}
|
||||
}
|
||||
|
@ -178,9 +178,9 @@ static inline void clear_tex_params(shader_t shader, struct darray *in_params)
|
|||
struct pass_shaderparam *param = params+i;
|
||||
struct shader_param_info info;
|
||||
|
||||
shader_getparaminfo(shader, param->sparam, &info);
|
||||
shader_getparaminfo(param->sparam, &info);
|
||||
if (info.type == SHADER_PARAM_TEXTURE)
|
||||
shader_settexture(shader, param->sparam, NULL);
|
||||
shader_settexture(param->sparam, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -149,9 +149,9 @@ bool load_graphics_imports(struct gs_exports *exports, void *module,
|
|||
GRAPHICS_IMPORT(shader_numparams);
|
||||
GRAPHICS_IMPORT(shader_getparambyidx);
|
||||
GRAPHICS_IMPORT(shader_getparambyname);
|
||||
GRAPHICS_IMPORT(shader_getparaminfo);
|
||||
GRAPHICS_IMPORT(shader_getviewprojmatrix);
|
||||
GRAPHICS_IMPORT(shader_getworldmatrix);
|
||||
GRAPHICS_IMPORT(shader_getparaminfo);
|
||||
GRAPHICS_IMPORT(shader_setbool);
|
||||
GRAPHICS_IMPORT(shader_setfloat);
|
||||
GRAPHICS_IMPORT(shader_setint);
|
||||
|
|
|
@ -177,28 +177,21 @@ struct gs_exports {
|
|||
int (*shader_numparams)(shader_t shader);
|
||||
sparam_t (*shader_getparambyidx)(shader_t shader, uint32_t param);
|
||||
sparam_t (*shader_getparambyname)(shader_t shader, const char *name);
|
||||
void (*shader_getparaminfo)(shader_t shader, sparam_t param,
|
||||
struct shader_param_info *info);
|
||||
sparam_t (*shader_getviewprojmatrix)(shader_t shader);
|
||||
sparam_t (*shader_getworldmatrix)(shader_t shader);
|
||||
void (*shader_setbool)(shader_t shader, sparam_t param, bool val);
|
||||
void (*shader_setfloat)(shader_t shader, sparam_t param, float val);
|
||||
void (*shader_setint)(shader_t shader, sparam_t param, int val);
|
||||
void (*shader_setmatrix3)(shader_t shader, sparam_t param,
|
||||
const struct matrix3 *val);
|
||||
void (*shader_setmatrix4)(shader_t shader, sparam_t param,
|
||||
const struct matrix4 *val);
|
||||
void (*shader_setvec2)(shader_t shader, sparam_t param,
|
||||
const struct vec2 *val);
|
||||
void (*shader_setvec3)(shader_t shader, sparam_t param,
|
||||
const struct vec3 *val);
|
||||
void (*shader_setvec4)(shader_t shader, sparam_t param,
|
||||
const struct vec4 *val);
|
||||
void (*shader_settexture)(shader_t shader, sparam_t param,
|
||||
texture_t val);
|
||||
void (*shader_setval)(shader_t shader, sparam_t param, const void *val,
|
||||
size_t size);
|
||||
void (*shader_setdefault)(shader_t shader, sparam_t param);
|
||||
void (*shader_getparaminfo)(sparam_t param,
|
||||
struct shader_param_info *info);
|
||||
void (*shader_setbool)(sparam_t param, bool val);
|
||||
void (*shader_setfloat)(sparam_t param, float val);
|
||||
void (*shader_setint)(sparam_t param, int val);
|
||||
void (*shader_setmatrix3)(sparam_t param, const struct matrix3 *val);
|
||||
void (*shader_setmatrix4)(sparam_t param, const struct matrix4 *val);
|
||||
void (*shader_setvec2)(sparam_t param, const struct vec2 *val);
|
||||
void (*shader_setvec3)(sparam_t param, const struct vec3 *val);
|
||||
void (*shader_setvec4)(sparam_t param, const struct vec4 *val);
|
||||
void (*shader_settexture)(sparam_t param, texture_t val);
|
||||
void (*shader_setval)(sparam_t param, const void *val, size_t size);
|
||||
void (*shader_setdefault)(sparam_t param);
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* OSX/Cocoa specific functions */
|
||||
|
|
|
@ -1509,15 +1509,6 @@ sparam_t shader_getparambyname(shader_t shader, const char *name)
|
|||
return graphics->exports.shader_getparambyname(shader, name);
|
||||
}
|
||||
|
||||
void shader_getparaminfo(shader_t shader, sparam_t param,
|
||||
struct shader_param_info *info)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
|
||||
graphics->exports.shader_getparaminfo(shader, param, info);
|
||||
}
|
||||
|
||||
sparam_t shader_getviewprojmatrix(shader_t shader)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
|
@ -1534,98 +1525,100 @@ sparam_t shader_getworldmatrix(shader_t shader)
|
|||
return graphics->exports.shader_getworldmatrix(shader);
|
||||
}
|
||||
|
||||
void shader_setbool(shader_t shader, sparam_t param, bool val)
|
||||
void shader_getparaminfo(sparam_t param, struct shader_param_info *info)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_setbool(shader, param, val);
|
||||
graphics->exports.shader_getparaminfo(param, info);
|
||||
}
|
||||
|
||||
void shader_setfloat(shader_t shader, sparam_t param, float val)
|
||||
void shader_setbool(sparam_t param, bool val)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_setfloat(shader, param, val);
|
||||
graphics->exports.shader_setbool(param, val);
|
||||
}
|
||||
|
||||
void shader_setint(shader_t shader, sparam_t param, int val)
|
||||
void shader_setfloat(sparam_t param, float val)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_setint(shader, param, val);
|
||||
graphics->exports.shader_setfloat(param, val);
|
||||
}
|
||||
|
||||
void shader_setmatrix3(shader_t shader, sparam_t param,
|
||||
const struct matrix3 *val)
|
||||
void shader_setint(sparam_t param, int val)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_setmatrix3(shader, param, val);
|
||||
graphics->exports.shader_setint(param, val);
|
||||
}
|
||||
|
||||
void shader_setmatrix4(shader_t shader, sparam_t param,
|
||||
const struct matrix4 *val)
|
||||
void shader_setmatrix3(sparam_t param, const struct matrix3 *val)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_setmatrix4(shader, param, val);
|
||||
graphics->exports.shader_setmatrix3(param, val);
|
||||
}
|
||||
|
||||
void shader_setvec2(shader_t shader, sparam_t param,
|
||||
const struct vec2 *val)
|
||||
void shader_setmatrix4(sparam_t param, const struct matrix4 *val)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_setvec2(shader, param, val);
|
||||
graphics->exports.shader_setmatrix4(param, val);
|
||||
}
|
||||
|
||||
void shader_setvec3(shader_t shader, sparam_t param,
|
||||
const struct vec3 *val)
|
||||
void shader_setvec2(sparam_t param, const struct vec2 *val)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_setvec3(shader, param, val);
|
||||
graphics->exports.shader_setvec2(param, val);
|
||||
}
|
||||
|
||||
void shader_setvec4(shader_t shader, sparam_t param,
|
||||
const struct vec4 *val)
|
||||
void shader_setvec3(sparam_t param, const struct vec3 *val)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_setvec4(shader, param, val);
|
||||
graphics->exports.shader_setvec3(param, val);
|
||||
}
|
||||
|
||||
void shader_settexture(shader_t shader, sparam_t param, texture_t val)
|
||||
void shader_setvec4(sparam_t param, const struct vec4 *val)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_settexture(shader, param, val);
|
||||
graphics->exports.shader_setvec4(param, val);
|
||||
}
|
||||
|
||||
void shader_setval(shader_t shader, sparam_t param, const void *val,
|
||||
size_t size)
|
||||
void shader_settexture(sparam_t param, texture_t val)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_setval(shader, param, val, size);
|
||||
graphics->exports.shader_settexture(param, val);
|
||||
}
|
||||
|
||||
void shader_setdefault(shader_t shader, sparam_t param)
|
||||
void shader_setval(sparam_t param, const void *val, size_t size)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !shader || !param) return;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_setdefault(shader, param);
|
||||
graphics->exports.shader_setval(param, val, size);
|
||||
}
|
||||
|
||||
void shader_setdefault(sparam_t param)
|
||||
{
|
||||
graphics_t graphics = thread_graphics;
|
||||
if (!graphics || !param) return;
|
||||
|
||||
graphics->exports.shader_setdefault(param);
|
||||
}
|
||||
|
||||
void texture_destroy(texture_t tex)
|
||||
|
|
|
@ -295,29 +295,22 @@ EXPORT void shader_destroy(shader_t shader);
|
|||
EXPORT int shader_numparams(shader_t shader);
|
||||
EXPORT sparam_t shader_getparambyidx(shader_t shader, uint32_t param);
|
||||
EXPORT sparam_t shader_getparambyname(shader_t shader, const char *name);
|
||||
EXPORT void shader_getparaminfo(shader_t shader, sparam_t param,
|
||||
struct shader_param_info *info);
|
||||
|
||||
EXPORT sparam_t shader_getviewprojmatrix(shader_t shader);
|
||||
EXPORT sparam_t shader_getworldmatrix(shader_t shader);
|
||||
|
||||
EXPORT void shader_setbool(shader_t shader, sparam_t param, bool val);
|
||||
EXPORT void shader_setfloat(shader_t shader, sparam_t param, float val);
|
||||
EXPORT void shader_setint(shader_t shader, sparam_t param, int val);
|
||||
EXPORT void shader_setmatrix3(shader_t shader, sparam_t param,
|
||||
const struct matrix3 *val);
|
||||
EXPORT void shader_setmatrix4(shader_t shader, sparam_t param,
|
||||
const struct matrix4 *val);
|
||||
EXPORT void shader_setvec2(shader_t shader, sparam_t param,
|
||||
const struct vec2 *val);
|
||||
EXPORT void shader_setvec3(shader_t shader, sparam_t param,
|
||||
const struct vec3 *val);
|
||||
EXPORT void shader_setvec4(shader_t shader, sparam_t param,
|
||||
const struct vec4 *val);
|
||||
EXPORT void shader_settexture(shader_t shader, sparam_t param, texture_t val);
|
||||
EXPORT void shader_setval(shader_t shader, sparam_t param, const void *val,
|
||||
size_t size);
|
||||
EXPORT void shader_setdefault(shader_t shader, sparam_t param);
|
||||
EXPORT void shader_getparaminfo(sparam_t param, struct shader_param_info *info);
|
||||
EXPORT void shader_setbool(sparam_t param, bool val);
|
||||
EXPORT void shader_setfloat(sparam_t param, float val);
|
||||
EXPORT void shader_setint(sparam_t param, int val);
|
||||
EXPORT void shader_setmatrix3(sparam_t param, const struct matrix3 *val);
|
||||
EXPORT void shader_setmatrix4(sparam_t param, const struct matrix4 *val);
|
||||
EXPORT void shader_setvec2(sparam_t param, const struct vec2 *val);
|
||||
EXPORT void shader_setvec3(sparam_t param, const struct vec3 *val);
|
||||
EXPORT void shader_setvec4(sparam_t param, const struct vec4 *val);
|
||||
EXPORT void shader_settexture(sparam_t param, texture_t val);
|
||||
EXPORT void shader_setval(sparam_t param, const void *val, size_t size);
|
||||
EXPORT void shader_setdefault(sparam_t param);
|
||||
|
||||
/* ---------------------------------------------------
|
||||
* effect functions
|
||||
|
|
Loading…
Reference in New Issue