55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
// AUTOGENERATED COPYRIGHT HEADER START
|
|
// Copyright (C) 2018-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
|
|
|
#include "gs-sampler.hpp"
|
|
#include "obs/gs/gs-helper.hpp"
|
|
|
|
#include "warning-disable.hpp"
|
|
#include <stdexcept>
|
|
#include "warning-enable.hpp"
|
|
|
|
streamfx::obs::gs::sampler::~sampler()
|
|
{
|
|
auto gctx = streamfx::obs::gs::context();
|
|
if (_state) {
|
|
gs_samplerstate_destroy(_state);
|
|
}
|
|
}
|
|
|
|
streamfx::obs::gs::sampler::sampler()
|
|
{
|
|
auto gctx = streamfx::obs::gs::context();
|
|
_info = {GS_FILTER_LINEAR, GS_ADDRESS_WRAP, GS_ADDRESS_WRAP, GS_ADDRESS_WRAP, 1, 0};
|
|
_state = gs_samplerstate_create(&_info);
|
|
}
|
|
|
|
streamfx::obs::gs::sampler::sampler(gs_sampler_info si)
|
|
{
|
|
auto gctx = streamfx::obs::gs::context();
|
|
_info = si;
|
|
_state = gs_samplerstate_create(&_info);
|
|
}
|
|
|
|
gs_sampler_info streamfx::obs::gs::sampler::pool::as_key(streamfx::obs::gs::sampler* to_hash)
|
|
{
|
|
return as_key(to_hash->info());
|
|
}
|
|
|
|
gs_sampler_info streamfx::obs::gs::sampler::pool::as_key(gs_sampler_info to_hash)
|
|
{
|
|
return to_hash;
|
|
}
|
|
|
|
static std::shared_ptr<streamfx::obs::gs::sampler::pool> loader_instance;
|
|
|
|
static auto loader = streamfx::component(
|
|
"core::gs::sampler",
|
|
[]() { // Initializer
|
|
loader_instance = streamfx::obs::gs::sampler::pool::instance();
|
|
},
|
|
[]() { // Finalizer
|
|
loader_instance.reset();
|
|
},
|
|
{});
|