gs-effect: Allow directly assigning OBS GS objects

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2018-01-19 07:00:46 +01:00
parent 0565065c2b
commit a307283349
2 changed files with 14 additions and 0 deletions

View file

@ -251,8 +251,20 @@ void GS::EffectParameter::SetTexture(std::shared_ptr<GS::Texture> v) {
gs_effect_set_texture(m_param, v->GetObject()); 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<GS::Sampler> v) { void GS::EffectParameter::SetSampler(std::shared_ptr<GS::Sampler> v) {
if (GetType() != Type::Texture) if (GetType() != Type::Texture)
throw std::bad_cast(); throw std::bad_cast();
gs_effect_set_next_sampler(m_param, v->GetObject()); 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);
}

View file

@ -77,7 +77,9 @@ namespace GS {
void SetIntegerArray(int32_t v[], size_t sz); void SetIntegerArray(int32_t v[], size_t sz);
void SetMatrix(matrix4& v); void SetMatrix(matrix4& v);
void SetTexture(std::shared_ptr<GS::Texture> v); void SetTexture(std::shared_ptr<GS::Texture> v);
void SetTexture(gs_texture_t* v);
void SetSampler(std::shared_ptr<GS::Sampler> v); void SetSampler(std::shared_ptr<GS::Sampler> v);
void SetSampler(gs_sampler_state* v);
private: private:
gs_eparam_t* m_param; gs_eparam_t* m_param;