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());
}
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) {
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);
}

View File

@ -77,7 +77,9 @@ namespace GS {
void SetIntegerArray(int32_t v[], size_t sz);
void SetMatrix(matrix4& 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(gs_sampler_state* v);
private:
gs_eparam_t* m_param;