mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-11 06:15:05 +00:00
gfx-shader: Better logging, and ViewSize parameter
This commit is contained in:
parent
3e02857d39
commit
3062d3b331
1 changed files with 14 additions and 1 deletions
|
@ -64,7 +64,8 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} catch (const std::exception&) {
|
} catch (const std::exception& ex) {
|
||||||
|
P_LOG_ERROR("Loading shader '%s' failed with error: %s", file.c_str(), ex.what());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,6 +164,9 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
P_LOG_ERROR("Loading shader '%s' failed with error: %s", file.c_str(), ex.what());
|
||||||
|
return false;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -382,6 +386,7 @@ void gfx::shader::shader::render()
|
||||||
kv.second->assign();
|
kv.second->assign();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Time: (Current Time), (Zero), (Zero), (Random Value)
|
||||||
if (gs::effect_parameter el = _shader.get_parameter("Time"); el != nullptr) {
|
if (gs::effect_parameter el = _shader.get_parameter("Time"); el != nullptr) {
|
||||||
if (el.get_type() == gs::effect_parameter::type::Float4) {
|
if (el.get_type() == gs::effect_parameter::type::Float4) {
|
||||||
el.set_float4(
|
el.set_float4(
|
||||||
|
@ -391,6 +396,14 @@ void gfx::shader::shader::render()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ViewSize: (Width), (Height), (1.0 / Width), (1.0 / Height)
|
||||||
|
if (auto el = _shader.get_parameter("ViewSize"); el != nullptr) {
|
||||||
|
if (el.get_type() == gs::effect_parameter::type::Float4) {
|
||||||
|
el.set_float4(static_cast<float_t>(width()), static_cast<float_t>(height()),
|
||||||
|
1.0f / static_cast<float_t>(width()), 1.0f / static_cast<float_t>(height()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (gs_effect_loop(_shader.get_object(), _shader_tech.c_str())) {
|
while (gs_effect_loop(_shader.get_object(), _shader_tech.c_str())) {
|
||||||
gs_draw_sprite(nullptr, 0, szw, szh);
|
gs_draw_sprite(nullptr, 0, szw, szh);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue