mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-14 07:45:06 +00:00
gfx/shader: Optional sRGB support for inputs
This commit is contained in:
parent
93a20c7dd4
commit
1816e29862
2 changed files with 7 additions and 7 deletions
|
@ -52,7 +52,7 @@ streamfx::gfx::shader::shader::shader(obs_source_t* self, shader_mode mode)
|
||||||
|
|
||||||
_have_current_params(false), _time(0), _time_loop(0), _loops(0), _random(), _random_seed(0),
|
_have_current_params(false), _time(0), _time_loop(0), _loops(0), _random(), _random_seed(0),
|
||||||
|
|
||||||
_rt_up_to_date(false), _rt(std::make_shared<streamfx::obs::gs::rendertarget>(GS_RGBA, GS_ZS_NONE))
|
_rt_up_to_date(false), _rt(std::make_shared<streamfx::obs::gs::rendertarget>(GS_RGBA_UNORM, GS_ZS_NONE))
|
||||||
{
|
{
|
||||||
// Initialize random values.
|
// Initialize random values.
|
||||||
_random.seed(static_cast<unsigned long long>(_random_seed));
|
_random.seed(static_cast<unsigned long long>(_random_seed));
|
||||||
|
@ -545,7 +545,7 @@ void streamfx::gfx::shader::shader::set_size(uint32_t w, uint32_t h)
|
||||||
_base_height = h;
|
_base_height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void streamfx::gfx::shader::shader::set_input_a(std::shared_ptr<streamfx::obs::gs::texture> tex)
|
void streamfx::gfx::shader::shader::set_input_a(std::shared_ptr<streamfx::obs::gs::texture> tex, bool srgb)
|
||||||
{
|
{
|
||||||
if (!_shader)
|
if (!_shader)
|
||||||
return;
|
return;
|
||||||
|
@ -558,14 +558,14 @@ void streamfx::gfx::shader::shader::set_input_a(std::shared_ptr<streamfx::obs::g
|
||||||
for (auto& name : params) {
|
for (auto& name : params) {
|
||||||
if (streamfx::obs::gs::effect_parameter el = _shader.get_parameter(name.data()); el != nullptr) {
|
if (streamfx::obs::gs::effect_parameter el = _shader.get_parameter(name.data()); el != nullptr) {
|
||||||
if (el.get_type() == streamfx::obs::gs::effect_parameter::type::Texture) {
|
if (el.get_type() == streamfx::obs::gs::effect_parameter::type::Texture) {
|
||||||
el.set_texture(tex);
|
el.set_texture(tex, srgb);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void streamfx::gfx::shader::shader::set_input_b(std::shared_ptr<streamfx::obs::gs::texture> tex)
|
void streamfx::gfx::shader::shader::set_input_b(std::shared_ptr<streamfx::obs::gs::texture> tex, bool srgb)
|
||||||
{
|
{
|
||||||
if (!_shader)
|
if (!_shader)
|
||||||
return;
|
return;
|
||||||
|
@ -578,7 +578,7 @@ void streamfx::gfx::shader::shader::set_input_b(std::shared_ptr<streamfx::obs::g
|
||||||
for (auto& name : params) {
|
for (auto& name : params) {
|
||||||
if (streamfx::obs::gs::effect_parameter el = _shader.get_parameter(name.data()); el != nullptr) {
|
if (streamfx::obs::gs::effect_parameter el = _shader.get_parameter(name.data()); el != nullptr) {
|
||||||
if (el.get_type() == streamfx::obs::gs::effect_parameter::type::Texture) {
|
if (el.get_type() == streamfx::obs::gs::effect_parameter::type::Texture) {
|
||||||
el.set_texture(tex);
|
el.set_texture(tex, srgb);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,9 +122,9 @@ namespace streamfx::gfx {
|
||||||
public:
|
public:
|
||||||
void set_size(uint32_t w, uint32_t h);
|
void set_size(uint32_t w, uint32_t h);
|
||||||
|
|
||||||
void set_input_a(std::shared_ptr<streamfx::obs::gs::texture> tex);
|
void set_input_a(std::shared_ptr<streamfx::obs::gs::texture> tex, bool srgb = false);
|
||||||
|
|
||||||
void set_input_b(std::shared_ptr<streamfx::obs::gs::texture> tex);
|
void set_input_b(std::shared_ptr<streamfx::obs::gs::texture> tex, bool srgb = false);
|
||||||
|
|
||||||
void set_transition_time(float_t t);
|
void set_transition_time(float_t t);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue