From a3072833494a27ec0531b997c99ef14967b35cac Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Fri, 19 Jan 2018 07:00:46 +0100 Subject: [PATCH] gs-effect: Allow directly assigning OBS GS objects --- source/gs-effect.cpp | 12 ++++++++++++ source/gs-effect.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/source/gs-effect.cpp b/source/gs-effect.cpp index f69a2e8b..bc1d0b52 100644 --- a/source/gs-effect.cpp +++ b/source/gs-effect.cpp @@ -251,8 +251,20 @@ void GS::EffectParameter::SetTexture(std::shared_ptr v) { gs_effect_set_texture(m_param, v->GetObject()); } +void GS::EffectParameter::SetTexture(gs_texture_t* v) { + if (GetType() != Type::Texture) + throw std::bad_cast(); + gs_effect_set_texture(m_param, v); +} + void GS::EffectParameter::SetSampler(std::shared_ptr v) { if (GetType() != Type::Texture) throw std::bad_cast(); gs_effect_set_next_sampler(m_param, v->GetObject()); } + +void GS::EffectParameter::SetSampler(gs_sampler_state* v) { + if (GetType() != Type::Texture) + throw std::bad_cast(); + gs_effect_set_next_sampler(m_param, v); +} diff --git a/source/gs-effect.h b/source/gs-effect.h index fbccb833..0b51550e 100644 --- a/source/gs-effect.h +++ b/source/gs-effect.h @@ -77,7 +77,9 @@ namespace GS { void SetIntegerArray(int32_t v[], size_t sz); void SetMatrix(matrix4& v); void SetTexture(std::shared_ptr v); + void SetTexture(gs_texture_t* v); void SetSampler(std::shared_ptr v); + void SetSampler(gs_sampler_state* v); private: gs_eparam_t* m_param;