obs/gs/effect-parameter: Add support for sRGB texture inputs

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-11-25 06:23:09 +01:00
parent 22786005d6
commit 6f7c03fb28
2 changed files with 10 additions and 8 deletions

View file

@ -647,18 +647,20 @@ void streamfx::obs::gs::effect_parameter::get_default_matrix(matrix4& v)
} }
} }
void streamfx::obs::gs::effect_parameter::set_texture(std::shared_ptr<streamfx::obs::gs::texture> v) void streamfx::obs::gs::effect_parameter::set_texture(std::shared_ptr<streamfx::obs::gs::texture> v, bool srgb)
{ {
if (get_type() != type::Texture) set_texture(v->get_object(), srgb);
throw std::bad_cast();
gs_effect_set_texture(get(), v->get_object());
} }
void streamfx::obs::gs::effect_parameter::set_texture(gs_texture_t* v) void streamfx::obs::gs::effect_parameter::set_texture(gs_texture_t* v, bool srgb)
{ {
if (get_type() != type::Texture) if (get_type() != type::Texture)
throw std::bad_cast(); throw std::bad_cast();
gs_effect_set_texture(get(), v); if (!srgb) {
gs_effect_set_texture(get(), v);
} else {
gs_effect_set_texture_srgb(get(), v);
}
} }
void streamfx::obs::gs::effect_parameter::set_sampler(std::shared_ptr<streamfx::obs::gs::sampler> v) void streamfx::obs::gs::effect_parameter::set_sampler(std::shared_ptr<streamfx::obs::gs::sampler> v)

View file

@ -189,8 +189,8 @@ namespace streamfx::obs::gs {
void get_matrix(matrix4& v); void get_matrix(matrix4& v);
void get_default_matrix(matrix4& v); void get_default_matrix(matrix4& v);
void set_texture(std::shared_ptr<streamfx::obs::gs::texture> v); void set_texture(std::shared_ptr<streamfx::obs::gs::texture> v, bool srgb = false);
void set_texture(gs_texture_t* v); void set_texture(gs_texture_t* v, bool srgb = false);
void set_sampler(std::shared_ptr<streamfx::obs::gs::sampler> v); void set_sampler(std::shared_ptr<streamfx::obs::gs::sampler> v);
void set_sampler(gs_sampler_state* v); void set_sampler(gs_sampler_state* v);