mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-27 13:53:01 +00:00
gs: Fix commit eb1612c6ee
This commit is contained in:
parent
90563e6b31
commit
27744f8b2a
2 changed files with 81 additions and 74 deletions
|
@ -18,3 +18,77 @@
|
|||
*/
|
||||
|
||||
#include "gs-helper.h"
|
||||
|
||||
gs_effect_param* gs_effect_get_param(gs_effect_t* effect, const char* name) {
|
||||
gs_effect_param* p = gs_effect_get_param_by_name(effect, name);
|
||||
if (!p)
|
||||
P_LOG_ERROR("Failed to find parameter %s in effect.", name);
|
||||
return p;
|
||||
}
|
||||
|
||||
bool gs_set_param_int(gs_effect_t* effect, const char* name, int value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_int(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set value %d for parameter %s in"
|
||||
" effect.", value, name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gs_set_param_float(gs_effect_t* effect, const char* name, float value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_float(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set value %f for parameter %s in"
|
||||
" effect.", value, name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gs_set_param_float2(gs_effect_t* effect, const char* name, vec2* value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_vec2(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set value {%f,%f} for parameter %s"
|
||||
" in effect.", value->x, value->y, name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gs_set_param_float3(gs_effect_t* effect, const char* name, vec3* value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_vec3(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set value {%f,%f,%f} for parameter"
|
||||
"%s in effect.", value->x, value->y, value->z, name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gs_set_param_float4(gs_effect_t* effect, const char* name, vec4* value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_vec4(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set value {%f,%f,%f,%f} for"
|
||||
" parameter %s in effect.", value->x, value->y, value->z,
|
||||
value->w, name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gs_set_param_texture(gs_effect_t* effect, const char* name, gs_texture_t* value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_texture(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set texture for"
|
||||
" parameter %s in effect.", name);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,77 +27,10 @@ extern "C" {
|
|||
#pragma warning (pop)
|
||||
}
|
||||
|
||||
|
||||
gs_effect_param* gs_effect_get_param(gs_effect_t* effect, const char* name) {
|
||||
gs_effect_param* p = gs_effect_get_param_by_name(effect, name);
|
||||
if (!p)
|
||||
P_LOG_ERROR("Failed to find parameter %s in effect.", name);
|
||||
return p;
|
||||
}
|
||||
|
||||
bool gs_set_param_int(gs_effect_t* effect, const char* name, int value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_int(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set value %d for parameter %s in"
|
||||
" effect.", value, name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gs_set_param_float(gs_effect_t* effect, const char* name, float value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_float(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set value %f for parameter %s in"
|
||||
" effect.", value, name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gs_set_param_float2(gs_effect_t* effect, const char* name, vec2* value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_vec2(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set value {%f,%f} for parameter %s"
|
||||
" in effect.", value->x, value->y, name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gs_set_param_float3(gs_effect_t* effect, const char* name, vec3* value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_vec3(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set value {%f,%f,%f} for parameter"
|
||||
"%s in effect.", value->x, value->y, value->z, name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gs_set_param_float4(gs_effect_t* effect, const char* name, vec4* value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_vec4(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set value {%f,%f,%f,%f} for"
|
||||
" parameter %s in effect.", value->x, value->y, value->z,
|
||||
value->w, name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gs_set_param_texture(gs_effect_t* effect, const char* name, gs_texture_t* value) {
|
||||
gs_effect_param* p = nullptr;
|
||||
if (nullptr != (p = gs_effect_get_param(effect, name))) {
|
||||
gs_effect_set_texture(p, value);
|
||||
return true;
|
||||
}
|
||||
P_LOG_ERROR("Failed to set texture for"
|
||||
" parameter %s in effect.", name);
|
||||
return false;
|
||||
}
|
||||
gs_effect_param* gs_effect_get_param(gs_effect_t* effect, const char* name);
|
||||
bool gs_set_param_int(gs_effect_t* effect, const char* name, int value);
|
||||
bool gs_set_param_float(gs_effect_t* effect, const char* name, float value);
|
||||
bool gs_set_param_float2(gs_effect_t* effect, const char* name, vec2* value);
|
||||
bool gs_set_param_float3(gs_effect_t* effect, const char* name, vec3* value);
|
||||
bool gs_set_param_float4(gs_effect_t* effect, const char* name, vec4* value);
|
||||
bool gs_set_param_texture(gs_effect_t* effect, const char* name, gs_texture_t* value);
|
||||
|
|
Loading…
Reference in a new issue