mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-10 22:05:06 +00:00
project: Remove use of P_INITIALIZER
Does not support cross-platform very well and breaks on Apple for no apparent reason. Add resolution scale to shader filter.
This commit is contained in:
parent
9ace96285d
commit
f27320c6c9
14 changed files with 90 additions and 97 deletions
|
@ -99,13 +99,6 @@ static std::map<std::string, local_blur_subtype_t> list_of_subtypes = {
|
||||||
{"zoom", {::gfx::blur::type::Zoom, S_BLUR_SUBTYPE_ZOOM}},
|
{"zoom", {::gfx::blur::type::Zoom, S_BLUR_SUBTYPE_ZOOM}},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initializer & Finalizer
|
|
||||||
P_INITIALIZER(filterBlurFactoryInitializer)
|
|
||||||
{
|
|
||||||
initializer_functions.push_back([] { filter::blur::blur_factory::initialize(); });
|
|
||||||
finalizer_functions.push_back([] { filter::blur::blur_factory::finalize(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::shared_ptr<filter::blur::blur_factory> factory_instance = nullptr;
|
static std::shared_ptr<filter::blur::blur_factory> factory_instance = nullptr;
|
||||||
|
|
||||||
void filter::blur::blur_factory::initialize()
|
void filter::blur::blur_factory::initialize()
|
||||||
|
|
|
@ -73,12 +73,6 @@
|
||||||
#define MODE_LOG Log
|
#define MODE_LOG Log
|
||||||
#define MODE_LOG10 Log10
|
#define MODE_LOG10 Log10
|
||||||
|
|
||||||
// Initializer & Finalizer
|
|
||||||
P_INITIALIZER(FilterColorGradeInit)
|
|
||||||
{
|
|
||||||
initializer_functions.push_back([] { filter::color_grade::color_grade_factory::initialize(); });
|
|
||||||
finalizer_functions.push_back([] { filter::color_grade::color_grade_factory::finalize(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* get_name(void*)
|
const char* get_name(void*)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,13 +27,6 @@
|
||||||
#define ST_RATIO "Filter.Displacement.Ratio"
|
#define ST_RATIO "Filter.Displacement.Ratio"
|
||||||
#define ST_SCALE "Filter.Displacement.Scale"
|
#define ST_SCALE "Filter.Displacement.Scale"
|
||||||
|
|
||||||
// Initializer & Finalizer
|
|
||||||
P_INITIALIZER(FilterDisplacementInit)
|
|
||||||
{
|
|
||||||
initializer_functions.push_back([] { filter::displacement::displacement_factory::initialize(); });
|
|
||||||
finalizer_functions.push_back([] { filter::displacement::displacement_factory::finalize(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::shared_ptr<filter::displacement::displacement_factory> factory_instance = nullptr;
|
static std::shared_ptr<filter::displacement::displacement_factory> factory_instance = nullptr;
|
||||||
|
|
||||||
void filter::displacement::displacement_factory::initialize()
|
void filter::displacement::displacement_factory::initialize()
|
||||||
|
|
|
@ -45,12 +45,6 @@ static std::pair<filter::dynamic_mask::channel, const char*> channel_translation
|
||||||
{filter::dynamic_mask::channel::Alpha, S_CHANNEL_ALPHA},
|
{filter::dynamic_mask::channel::Alpha, S_CHANNEL_ALPHA},
|
||||||
};
|
};
|
||||||
|
|
||||||
P_INITIALIZER(FilterDynamicMaskInit)
|
|
||||||
{
|
|
||||||
initializer_functions.push_back([] { filter::dynamic_mask::dynamic_mask_factory::initialize(); });
|
|
||||||
finalizer_functions.push_back([] { filter::dynamic_mask::dynamic_mask_factory::finalize(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::shared_ptr<filter::dynamic_mask::dynamic_mask_factory> factory_instance = nullptr;
|
static std::shared_ptr<filter::dynamic_mask::dynamic_mask_factory> factory_instance = nullptr;
|
||||||
|
|
||||||
void filter::dynamic_mask::dynamic_mask_factory::initialize()
|
void filter::dynamic_mask::dynamic_mask_factory::initialize()
|
||||||
|
|
|
@ -64,13 +64,6 @@
|
||||||
#define ST_SDF_SCALE "Filter.SDFEffects.SDF.Scale"
|
#define ST_SDF_SCALE "Filter.SDFEffects.SDF.Scale"
|
||||||
#define ST_SDF_THRESHOLD "Filter.SDFEffects.SDF.Threshold"
|
#define ST_SDF_THRESHOLD "Filter.SDFEffects.SDF.Threshold"
|
||||||
|
|
||||||
// Initializer & Finalizer
|
|
||||||
P_INITIALIZER(filterShadowFactoryInitializer)
|
|
||||||
{
|
|
||||||
initializer_functions.push_back([] { filter::sdf_effects::sdf_effects_factory::initialize(); });
|
|
||||||
finalizer_functions.push_back([] { filter::sdf_effects::sdf_effects_factory::finalize(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::shared_ptr<filter::sdf_effects::sdf_effects_factory> factory_instance = nullptr;
|
static std::shared_ptr<filter::sdf_effects::sdf_effects_factory> factory_instance = nullptr;
|
||||||
|
|
||||||
void filter::sdf_effects::sdf_effects_factory::initialize()
|
void filter::sdf_effects::sdf_effects_factory::initialize()
|
||||||
|
|
|
@ -22,12 +22,10 @@
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
#define ST "Filter.Shader"
|
#define ST "Filter.Shader"
|
||||||
|
#define ST_SCALE_LOCKED "Filter.Shader.Scale.Locked"
|
||||||
P_INITIALIZER(FilterShaderInit)
|
#define ST_SCALE_SCALE "Filter.Shader.Scale.Scale"
|
||||||
{
|
#define ST_SCALE_WIDTH "Filter.Shader.Scale.Width"
|
||||||
initializer_functions.push_back([] { filter::shader::shader_factory::initialize(); });
|
#define ST_SCALE_HEIGHT "Filter.Shader.Scale.Height"
|
||||||
finalizer_functions.push_back([] { filter::shader::shader_factory::finalize(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::shared_ptr<filter::shader::shader_factory> factory_instance = nullptr;
|
static std::shared_ptr<filter::shader::shader_factory> factory_instance = nullptr;
|
||||||
|
|
||||||
|
@ -50,6 +48,10 @@ static void get_defaults(obs_data_t* data)
|
||||||
{
|
{
|
||||||
obs_data_set_default_string(data, S_SHADER_FILE, obs_module_file("shaders/filter/example.effect"));
|
obs_data_set_default_string(data, S_SHADER_FILE, obs_module_file("shaders/filter/example.effect"));
|
||||||
obs_data_set_default_string(data, S_SHADER_TECHNIQUE, "Draw");
|
obs_data_set_default_string(data, S_SHADER_TECHNIQUE, "Draw");
|
||||||
|
obs_data_set_default_bool(data, ST_SCALE_LOCKED, true);
|
||||||
|
obs_data_set_default_double(data, ST_SCALE_SCALE, 1.0);
|
||||||
|
obs_data_set_default_double(data, ST_SCALE_WIDTH, 1.0);
|
||||||
|
obs_data_set_default_double(data, ST_SCALE_HEIGHT, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
filter::shader::shader_factory::shader_factory()
|
filter::shader::shader_factory::shader_factory()
|
||||||
|
@ -207,16 +209,30 @@ filter::shader::shader_instance::~shader_instance() {}
|
||||||
|
|
||||||
uint32_t filter::shader::shader_instance::width()
|
uint32_t filter::shader::shader_instance::width()
|
||||||
{
|
{
|
||||||
return _width;
|
return _swidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t filter::shader::shader_instance::height()
|
uint32_t filter::shader::shader_instance::height()
|
||||||
{
|
{
|
||||||
return _height;
|
return _sheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void filter::shader::shader_instance::properties(obs_properties_t* props)
|
void filter::shader::shader_instance::properties(obs_properties_t* props)
|
||||||
{
|
{
|
||||||
|
auto p = obs_properties_add_bool(props, ST_SCALE_LOCKED, D_TRANSLATE(ST_SCALE_LOCKED));
|
||||||
|
obs_property_set_modified_callback(p, [](obs_properties_t* props, obs_property_t* property, obs_data_t* settings) {
|
||||||
|
obs_property_set_visible(obs_properties_get(props, ST_SCALE_SCALE),
|
||||||
|
obs_data_get_bool(settings, ST_SCALE_LOCKED));
|
||||||
|
obs_property_set_visible(obs_properties_get(props, ST_SCALE_WIDTH),
|
||||||
|
!obs_data_get_bool(settings, ST_SCALE_LOCKED));
|
||||||
|
obs_property_set_visible(obs_properties_get(props, ST_SCALE_HEIGHT),
|
||||||
|
!obs_data_get_bool(settings, ST_SCALE_LOCKED));
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
obs_properties_add_float(props, ST_SCALE_SCALE, D_TRANSLATE(ST_SCALE_SCALE), 0.01, 5.0, 0.01);
|
||||||
|
obs_properties_add_float(props, ST_SCALE_WIDTH, D_TRANSLATE(ST_SCALE_WIDTH), 0.01, 5.0, 0.01);
|
||||||
|
obs_properties_add_float(props, ST_SCALE_HEIGHT, D_TRANSLATE(ST_SCALE_HEIGHT), 0.01, 5.0, 0.01);
|
||||||
|
|
||||||
_fx->properties(props);
|
_fx->properties(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,6 +243,13 @@ void filter::shader::shader_instance::load(obs_data_t* data)
|
||||||
|
|
||||||
void filter::shader::shader_instance::update(obs_data_t* data)
|
void filter::shader::shader_instance::update(obs_data_t* data)
|
||||||
{
|
{
|
||||||
|
_scale_locked = obs_data_get_bool(data, ST_SCALE_LOCKED);
|
||||||
|
if (_scale_locked) {
|
||||||
|
_hscale = _wscale = obs_data_get_double(data, ST_SCALE_SCALE);
|
||||||
|
} else {
|
||||||
|
_wscale = obs_data_get_double(data, ST_SCALE_WIDTH);
|
||||||
|
_hscale = obs_data_get_double(data, ST_SCALE_HEIGHT);
|
||||||
|
}
|
||||||
_fx->update(data);
|
_fx->update(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,6 +271,10 @@ bool filter::shader::shader_instance::valid_param(std::shared_ptr<gs::effect_par
|
||||||
return false;
|
return false;
|
||||||
if (strcmpi(param->get_name().c_str(), "ImageSource_Texel") == 0)
|
if (strcmpi(param->get_name().c_str(), "ImageSource_Texel") == 0)
|
||||||
return false;
|
return false;
|
||||||
|
if (strcmpi(param->get_name().c_str(), "ImageTarget_Size") == 0)
|
||||||
|
return false;
|
||||||
|
if (strcmpi(param->get_name().c_str(), "ImageTarget_Texel") == 0)
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +283,6 @@ void filter::shader::shader_instance::override_param(std::shared_ptr<gs::effect>
|
||||||
auto p_source = effect->get_parameter("ImageSource");
|
auto p_source = effect->get_parameter("ImageSource");
|
||||||
auto p_source_size = effect->get_parameter("ImageSource_Size");
|
auto p_source_size = effect->get_parameter("ImageSource_Size");
|
||||||
auto p_source_texel = effect->get_parameter("ImageSource_Texel");
|
auto p_source_texel = effect->get_parameter("ImageSource_Texel");
|
||||||
|
|
||||||
if (p_source && (p_source->get_type() == gs::effect_parameter::type::Texture)) {
|
if (p_source && (p_source->get_type() == gs::effect_parameter::type::Texture)) {
|
||||||
p_source->set_texture(_rt_tex);
|
p_source->set_texture(_rt_tex);
|
||||||
}
|
}
|
||||||
|
@ -266,6 +292,15 @@ void filter::shader::shader_instance::override_param(std::shared_ptr<gs::effect>
|
||||||
if (p_source_texel && (p_source_size->get_type() == gs::effect_parameter::type::Float2)) {
|
if (p_source_texel && (p_source_size->get_type() == gs::effect_parameter::type::Float2)) {
|
||||||
p_source_texel->set_float2(1.0f / _width, 1.0f / _height);
|
p_source_texel->set_float2(1.0f / _width, 1.0f / _height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto p_target_size = effect->get_parameter("ImageTarget_Size");
|
||||||
|
auto p_target_texel = effect->get_parameter("ImageTarget_Texel");
|
||||||
|
if (p_target_size && (p_target_size->get_type() == gs::effect_parameter::type::Float2)) {
|
||||||
|
p_target_size->set_float2(_swidth, _sheight);
|
||||||
|
}
|
||||||
|
if (p_target_texel && (p_target_texel->get_type() == gs::effect_parameter::type::Float2)) {
|
||||||
|
p_target_texel->set_float2(1.0f / _swidth, 1.0f / _sheight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void filter::shader::shader_instance::enum_active_sources(obs_source_enum_proc_t r, void* p)
|
void filter::shader::shader_instance::enum_active_sources(obs_source_enum_proc_t r, void* p)
|
||||||
|
@ -280,6 +315,8 @@ void filter::shader::shader_instance::video_tick(float_t sec_since_last)
|
||||||
{ // Update width and height.
|
{ // Update width and height.
|
||||||
_width = obs_source_get_base_width(target);
|
_width = obs_source_get_base_width(target);
|
||||||
_height = obs_source_get_base_height(target);
|
_height = obs_source_get_base_height(target);
|
||||||
|
_swidth = _width * _wscale;
|
||||||
|
_sheight = _height * _hscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_fx->tick(sec_since_last)) {
|
if (_fx->tick(sec_since_last)) {
|
||||||
|
@ -326,7 +363,7 @@ void filter::shader::shader_instance::video_render(gs_effect_t* effect)
|
||||||
|
|
||||||
if (!_rt2_updated) {
|
if (!_rt2_updated) {
|
||||||
try {
|
try {
|
||||||
auto op = _rt2->render(_width, _height);
|
auto op = _rt2->render(_swidth, _sheight);
|
||||||
_fx->render();
|
_fx->render();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
obs_source_skip_video_filter(_self);
|
obs_source_skip_video_filter(_self);
|
||||||
|
@ -343,6 +380,6 @@ void filter::shader::shader_instance::video_render(gs_effect_t* effect)
|
||||||
gs_effect_set_texture(prm, _rt2_tex->get_object());
|
gs_effect_set_texture(prm, _rt2_tex->get_object());
|
||||||
|
|
||||||
while (gs_effect_loop(ef, "Draw")) {
|
while (gs_effect_loop(ef, "Draw")) {
|
||||||
gs_draw_sprite(nullptr, 0, _width, _height);
|
gs_draw_sprite(nullptr, 0, _swidth, _sheight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,10 @@ namespace filter {
|
||||||
|
|
||||||
uint32_t _width, _height;
|
uint32_t _width, _height;
|
||||||
|
|
||||||
|
bool _scale_locked;
|
||||||
|
float_t _wscale, _hscale;
|
||||||
|
uint32_t _swidth, _sheight;
|
||||||
|
|
||||||
std::shared_ptr<gs::rendertarget> _rt;
|
std::shared_ptr<gs::rendertarget> _rt;
|
||||||
bool _rt_updated;
|
bool _rt_updated;
|
||||||
std::shared_ptr<gs::texture> _rt_tex;
|
std::shared_ptr<gs::texture> _rt_tex;
|
||||||
|
|
|
@ -75,13 +75,6 @@ enum RotationOrder : int64_t {
|
||||||
ZYX,
|
ZYX,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initializer & Finalizer
|
|
||||||
P_INITIALIZER(FilterTransformInit)
|
|
||||||
{
|
|
||||||
initializer_functions.push_back([] { filter::transform::transform_factory::initialize(); });
|
|
||||||
finalizer_functions.push_back([] { filter::transform::transform_factory::finalize(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::shared_ptr<filter::transform::transform_factory> factory_instance = nullptr;
|
static std::shared_ptr<filter::transform::transform_factory> factory_instance = nullptr;
|
||||||
|
|
||||||
void filter::transform::transform_factory::initialize()
|
void filter::transform::transform_factory::initialize()
|
||||||
|
|
|
@ -1087,7 +1087,7 @@ bool gfx::effect_source::effect_source::tick(float_t time)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx::effect_source::effect_source::render()
|
void gfx::effect_source::effect_source::render(bool is_matrix_valid)
|
||||||
{
|
{
|
||||||
if (!_effect)
|
if (!_effect)
|
||||||
return;
|
return;
|
||||||
|
@ -1129,7 +1129,6 @@ void gfx::effect_source::effect_source::render()
|
||||||
}
|
}
|
||||||
|
|
||||||
gs_blend_state_push();
|
gs_blend_state_push();
|
||||||
gs_matrix_push();
|
|
||||||
|
|
||||||
gs_reset_blend_state();
|
gs_reset_blend_state();
|
||||||
gs_enable_blending(false);
|
gs_enable_blending(false);
|
||||||
|
@ -1137,7 +1136,10 @@ void gfx::effect_source::effect_source::render()
|
||||||
gs_enable_depth_test(false);
|
gs_enable_depth_test(false);
|
||||||
gs_enable_stencil_test(false);
|
gs_enable_stencil_test(false);
|
||||||
gs_enable_stencil_write(false);
|
gs_enable_stencil_write(false);
|
||||||
|
if (!is_matrix_valid) {
|
||||||
|
gs_matrix_push();
|
||||||
gs_ortho(0, 1, 0, 1, -1., 1.);
|
gs_ortho(0, 1, 0, 1, -1., 1.);
|
||||||
|
}
|
||||||
|
|
||||||
while (gs_effect_loop(_effect->get_object(), _tech.c_str())) {
|
while (gs_effect_loop(_effect->get_object(), _tech.c_str())) {
|
||||||
gs_load_vertexbuffer(_tri->update());
|
gs_load_vertexbuffer(_tri->update());
|
||||||
|
@ -1145,7 +1147,9 @@ void gfx::effect_source::effect_source::render()
|
||||||
gs_draw(gs_draw_mode::GS_TRIS, 0, _tri->size());
|
gs_draw(gs_draw_mode::GS_TRIS, 0, _tri->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_matrix_valid) {
|
||||||
gs_matrix_pop();
|
gs_matrix_pop();
|
||||||
|
}
|
||||||
gs_blend_state_pop();
|
gs_blend_state_pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,7 +314,7 @@ namespace gfx {
|
||||||
|
|
||||||
bool tick(float_t time);
|
bool tick(float_t time);
|
||||||
|
|
||||||
void render();
|
void render(bool is_matrix_valid = false);
|
||||||
|
|
||||||
obs_source_t* get_self();
|
obs_source_t* get_self();
|
||||||
|
|
||||||
|
|
|
@ -19,12 +19,41 @@
|
||||||
|
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "obs/obs-source-tracker.hpp"
|
#include "obs/obs-source-tracker.hpp"
|
||||||
|
#include "filters/filter-blur.hpp"
|
||||||
|
#include "filters/filter-color-grade.hpp"
|
||||||
|
#include "filters/filter-displacement.hpp"
|
||||||
|
#include "filters/filter-dynamic-mask.hpp"
|
||||||
|
#include "filters/filter-sdf-effects.hpp"
|
||||||
|
#include "filters/filter-shader.hpp"
|
||||||
|
#include "filters/filter-transform.hpp"
|
||||||
|
#include "sources/source-mirror.hpp"
|
||||||
|
#include "sources/source-shader.hpp"
|
||||||
|
|
||||||
std::list<std::function<void()>> initializer_functions;
|
std::list<std::function<void()>> initializer_functions;
|
||||||
std::list<std::function<void()>> finalizer_functions;
|
std::list<std::function<void()>> finalizer_functions;
|
||||||
|
|
||||||
MODULE_EXPORT bool obs_module_load(void)
|
MODULE_EXPORT bool obs_module_load(void)
|
||||||
{
|
{
|
||||||
|
// Previously through P_INITIALIZER.
|
||||||
|
initializer_functions.push_back([] { filter::blur::blur_factory::initialize(); });
|
||||||
|
finalizer_functions.push_back([] { filter::blur::blur_factory::finalize(); });
|
||||||
|
initializer_functions.push_back([] { filter::color_grade::color_grade_factory::initialize(); });
|
||||||
|
finalizer_functions.push_back([] { filter::color_grade::color_grade_factory::finalize(); });
|
||||||
|
initializer_functions.push_back([] { filter::displacement::displacement_factory::initialize(); });
|
||||||
|
finalizer_functions.push_back([] { filter::displacement::displacement_factory::finalize(); });
|
||||||
|
initializer_functions.push_back([] { filter::dynamic_mask::dynamic_mask_factory::initialize(); });
|
||||||
|
finalizer_functions.push_back([] { filter::dynamic_mask::dynamic_mask_factory::finalize(); });
|
||||||
|
initializer_functions.push_back([] { filter::sdf_effects::sdf_effects_factory::initialize(); });
|
||||||
|
finalizer_functions.push_back([] { filter::sdf_effects::sdf_effects_factory::finalize(); });
|
||||||
|
initializer_functions.push_back([] { filter::shader::shader_factory::initialize(); });
|
||||||
|
finalizer_functions.push_back([] { filter::shader::shader_factory::finalize(); });
|
||||||
|
initializer_functions.push_back([] { filter::transform::transform_factory::initialize(); });
|
||||||
|
finalizer_functions.push_back([] { filter::transform::transform_factory::finalize(); });
|
||||||
|
initializer_functions.push_back([] { source::mirror::mirror_factory::initialize(); });
|
||||||
|
finalizer_functions.push_back([] { source::mirror::mirror_factory::finalize(); });
|
||||||
|
initializer_functions.push_back([] { source::shader::shader_factory::initialize(); });
|
||||||
|
finalizer_functions.push_back([] { source::shader::shader_factory::finalize(); });
|
||||||
|
|
||||||
P_LOG_INFO("Loading Version %u.%u.%u (Build %u)", PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR,
|
P_LOG_INFO("Loading Version %u.%u.%u (Build %u)", PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR,
|
||||||
PROJECT_VERSION_PATCH, PROJECT_VERSION_TWEAK);
|
PROJECT_VERSION_PATCH, PROJECT_VERSION_TWEAK);
|
||||||
obs::source_tracker::initialize();
|
obs::source_tracker::initialize();
|
||||||
|
|
|
@ -60,13 +60,6 @@
|
||||||
#define ST_SCALING_BOUNDS_FILLHEIGHT "Source.Mirror.Scaling.Bounds.FillHeight"
|
#define ST_SCALING_BOUNDS_FILLHEIGHT "Source.Mirror.Scaling.Bounds.FillHeight"
|
||||||
#define ST_SCALING_ALIGNMENT "Source.Mirror.Scaling.Alignment"
|
#define ST_SCALING_ALIGNMENT "Source.Mirror.Scaling.Alignment"
|
||||||
|
|
||||||
// Initializer & Finalizer
|
|
||||||
P_INITIALIZER(SourceMirrorInit)
|
|
||||||
{
|
|
||||||
initializer_functions.push_back([] { source::mirror::mirror_factory::initialize(); });
|
|
||||||
finalizer_functions.push_back([] { source::mirror::mirror_factory::finalize(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::shared_ptr<source::mirror::mirror_factory> factory_instance = nullptr;
|
static std::shared_ptr<source::mirror::mirror_factory> factory_instance = nullptr;
|
||||||
|
|
||||||
void source::mirror::mirror_factory::initialize()
|
void source::mirror::mirror_factory::initialize()
|
||||||
|
|
|
@ -25,12 +25,6 @@
|
||||||
#define ST_WIDTH ST ".Width"
|
#define ST_WIDTH ST ".Width"
|
||||||
#define ST_HEIGHT ST ".Height"
|
#define ST_HEIGHT ST ".Height"
|
||||||
|
|
||||||
P_INITIALIZER(SourceShaderInit)
|
|
||||||
{
|
|
||||||
initializer_functions.push_back([] { source::shader::shader_factory::initialize(); });
|
|
||||||
finalizer_functions.push_back([] { source::shader::shader_factory::finalize(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::shared_ptr<source::shader::shader_factory> factory_instance = nullptr;
|
static std::shared_ptr<source::shader::shader_factory> factory_instance = nullptr;
|
||||||
|
|
||||||
void source::shader::shader_factory::initialize()
|
void source::shader::shader_factory::initialize()
|
||||||
|
|
|
@ -57,34 +57,6 @@ typename std::enable_if<enable_bitmask_operators<Enum>::enable, Enum>::type oper
|
||||||
#define D_STR(s) #s
|
#define D_STR(s) #s
|
||||||
#define D_VSTR(s) D_STR(s)
|
#define D_VSTR(s) D_STR(s)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define P_INITIALIZER(f) \
|
|
||||||
static void f(void); \
|
|
||||||
struct f##_t_ { \
|
|
||||||
f##_t_(void) \
|
|
||||||
{ \
|
|
||||||
f(); \
|
|
||||||
} \
|
|
||||||
}; \
|
|
||||||
static f##_t_ f##_; \
|
|
||||||
static void f(void)
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#pragma section(".CRT$XCU", read)
|
|
||||||
#define INITIALIZER2_(f, p) \
|
|
||||||
static void f(void); \
|
|
||||||
__declspec(allocate(".CRT$XCU")) void (*f##_)(void) = f; \
|
|
||||||
__pragma(comment(linker, "/include:" p #f "_")) static void f(void)
|
|
||||||
#ifdef _WIN64
|
|
||||||
#define P_INITIALIZER(f) INITIALIZER2_(f, "")
|
|
||||||
#else
|
|
||||||
#define P_INITIALIZER(f) INITIALIZER2_(f, "_")
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define P_INITIALIZER(f) \
|
|
||||||
static void f(void) __attribute__((constructor)); \
|
|
||||||
static void f(void)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
bool inline are_property_groups_broken()
|
bool inline are_property_groups_broken()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue