mirror of https://github.com/Xaymar/obs-StreamFX
project: Fix all remaining portability issues
Clang on Windows and Clang on Linux behave differently, and of course GCC on Windows (MinGW) and GCC on Linux do too. This is the point where using either compiler on either platform should successfully compile the project without any issues. Clang and GCC have a ton of warnings however, which definitely need to be fixed in the near future. Some of them are great warnings, like old C style casts, others are non-sense like suggest brackets. Fixes #47 Fixes #60
This commit is contained in:
parent
aac52f736d
commit
be4d42312d
|
@ -947,7 +947,7 @@ void filter::blur::blur_instance::video_render(gs_effect_t* effect)
|
|||
std::string technique = "";
|
||||
switch (this->m_mask.type) {
|
||||
case Region:
|
||||
if (this->m_mask.region.feather > FLT_EPSILON) {
|
||||
if (this->m_mask.region.feather > std::numeric_limits<float_t>::epsilon()) {
|
||||
if (this->m_mask.region.invert) {
|
||||
technique = "RegionFeatherInverted";
|
||||
} else {
|
||||
|
|
|
@ -52,8 +52,6 @@ namespace filter {
|
|||
};
|
||||
|
||||
class blur_factory {
|
||||
friend class std::_Ptr_base<filter::blur::blur_factory>;
|
||||
|
||||
obs_source_info source_info;
|
||||
std::list<blur_instance*> sources;
|
||||
std::shared_ptr<gs::effect> color_converter_effect;
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
namespace filter {
|
||||
namespace displacement {
|
||||
class displacement_factory {
|
||||
friend class std::_Ptr_base<filter::displacement::displacement_factory>;
|
||||
|
||||
obs_source_info sourceInfo;
|
||||
|
||||
public: // Singleton
|
||||
|
|
|
@ -482,7 +482,7 @@ void filter::sdf_effects::sdf_effects_instance::update(obs_data_t* data)
|
|||
{
|
||||
{
|
||||
this->m_outer_shadow =
|
||||
obs_data_get_bool(data, P_SHADOW_OUTER) && (obs_data_get_double(data, P_SHADOW_OUTER_ALPHA) >= DBL_EPSILON);
|
||||
obs_data_get_bool(data, P_SHADOW_OUTER) && (obs_data_get_double(data, P_SHADOW_OUTER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
||||
{
|
||||
union {
|
||||
uint32_t color;
|
||||
|
@ -505,7 +505,7 @@ void filter::sdf_effects::sdf_effects_instance::update(obs_data_t* data)
|
|||
|
||||
{
|
||||
this->m_inner_shadow =
|
||||
obs_data_get_bool(data, P_SHADOW_INNER) && (obs_data_get_double(data, P_SHADOW_INNER_ALPHA) >= DBL_EPSILON);
|
||||
obs_data_get_bool(data, P_SHADOW_INNER) && (obs_data_get_double(data, P_SHADOW_INNER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
||||
{
|
||||
union {
|
||||
uint32_t color;
|
||||
|
@ -528,7 +528,7 @@ void filter::sdf_effects::sdf_effects_instance::update(obs_data_t* data)
|
|||
|
||||
{
|
||||
this->m_outer_glow =
|
||||
obs_data_get_bool(data, P_GLOW_OUTER) && (obs_data_get_double(data, P_GLOW_OUTER_ALPHA) >= DBL_EPSILON);
|
||||
obs_data_get_bool(data, P_GLOW_OUTER) && (obs_data_get_double(data, P_GLOW_OUTER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
||||
{
|
||||
union {
|
||||
uint32_t color;
|
||||
|
@ -546,14 +546,14 @@ void filter::sdf_effects::sdf_effects_instance::update(obs_data_t* data)
|
|||
this->m_outer_glow_width = float_t(obs_data_get_double(data, P_GLOW_OUTER_WIDTH));
|
||||
this->m_outer_glow_sharpness = float_t(obs_data_get_double(data, P_GLOW_OUTER_SHARPNESS) / 100.0);
|
||||
this->m_outer_glow_sharpness_inv = float_t(1.0f / (1.0f - this->m_outer_glow_sharpness));
|
||||
if (this->m_outer_glow_sharpness >= (1.0f - FLT_EPSILON)) {
|
||||
this->m_outer_glow_sharpness = 1.0f - FLT_EPSILON;
|
||||
if (this->m_outer_glow_sharpness >= (1.0f - std::numeric_limits<float_t>::epsilon())) {
|
||||
this->m_outer_glow_sharpness = 1.0f - std::numeric_limits<float_t>::epsilon();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
this->m_inner_glow =
|
||||
obs_data_get_bool(data, P_GLOW_INNER) && (obs_data_get_double(data, P_GLOW_INNER_ALPHA) >= DBL_EPSILON);
|
||||
obs_data_get_bool(data, P_GLOW_INNER) && (obs_data_get_double(data, P_GLOW_INNER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
||||
{
|
||||
union {
|
||||
uint32_t color;
|
||||
|
@ -571,14 +571,14 @@ void filter::sdf_effects::sdf_effects_instance::update(obs_data_t* data)
|
|||
this->m_inner_glow_width = float_t(obs_data_get_double(data, P_GLOW_INNER_WIDTH));
|
||||
this->m_inner_glow_sharpness = float_t(obs_data_get_double(data, P_GLOW_INNER_SHARPNESS) / 100.0);
|
||||
this->m_inner_glow_sharpness_inv = float_t(1.0f / (1.0f - this->m_inner_glow_sharpness));
|
||||
if (this->m_inner_glow_sharpness >= (1.0f - FLT_EPSILON)) {
|
||||
this->m_inner_glow_sharpness = 1.0f - FLT_EPSILON;
|
||||
if (this->m_inner_glow_sharpness >= (1.0f - std::numeric_limits<float_t>::epsilon())) {
|
||||
this->m_inner_glow_sharpness = 1.0f - std::numeric_limits<float_t>::epsilon();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
this->m_outline =
|
||||
obs_data_get_bool(data, P_OUTLINE) && (obs_data_get_double(data, P_OUTLINE_ALPHA) >= DBL_EPSILON);
|
||||
obs_data_get_bool(data, P_OUTLINE) && (obs_data_get_double(data, P_OUTLINE_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
||||
{
|
||||
union {
|
||||
uint32_t color;
|
||||
|
@ -597,8 +597,8 @@ void filter::sdf_effects::sdf_effects_instance::update(obs_data_t* data)
|
|||
this->m_outline_offset = float_t(obs_data_get_double(data, P_OUTLINE_OFFSET));
|
||||
this->m_outline_sharpness = float_t(obs_data_get_double(data, P_OUTLINE_SHARPNESS) / 100.0);
|
||||
this->m_outline_sharpness_inv = float_t(1.0f / (1.0f - this->m_outline_sharpness));
|
||||
if (this->m_outline_sharpness >= (1.0f - FLT_EPSILON)) {
|
||||
this->m_outline_sharpness = 1.0f - FLT_EPSILON;
|
||||
if (this->m_outline_sharpness >= (1.0f - std::numeric_limits<float_t>::epsilon())) {
|
||||
this->m_outline_sharpness = 1.0f - std::numeric_limits<float_t>::epsilon();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@ namespace filter {
|
|||
class sdf_effects_instance;
|
||||
|
||||
class sdf_effects_factory {
|
||||
friend class std::_Ptr_base<filter::sdf_effects::sdf_effects_factory>;
|
||||
|
||||
obs_source_info source_info;
|
||||
|
||||
std::list<sdf_effects_instance*> sources;
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
namespace filter {
|
||||
namespace transform {
|
||||
class transform_factory {
|
||||
friend class std::_Ptr_base<filter::transform::transform_factory>;
|
||||
|
||||
obs_source_info sourceInfo;
|
||||
|
||||
public: // Singleton
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <cinttypes>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "obs/gs/gs-texture.hpp"
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian_linear::render()
|
|||
std::shared_ptr<::gs::effect> effect = m_data->get_effect();
|
||||
auto kernel = m_data->get_kernel(size_t(m_size));
|
||||
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < DBL_EPSILON)) {
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < std::numeric_limits<double_t>::epsilon())) {
|
||||
return m_input_texture;
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian_linear::render()
|
|||
effect->get_parameter("pKernel").set_float_array(kernel.data(), MAX_KERNEL_SIZE);
|
||||
|
||||
// First Pass
|
||||
if (m_step_scale.first > DBL_EPSILON) {
|
||||
if (m_step_scale.first > std::numeric_limits<double_t>::epsilon()) {
|
||||
effect->get_parameter("pImageTexel").set_float2(float_t(1.f / width), 0.f);
|
||||
|
||||
{
|
||||
|
@ -338,7 +338,7 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian_linear::render()
|
|||
}
|
||||
|
||||
// Second Pass
|
||||
if (m_step_scale.second > DBL_EPSILON) {
|
||||
if (m_step_scale.second > std::numeric_limits<double_t>::epsilon()) {
|
||||
effect->get_parameter("pImageTexel").set_float2(0.f, float_t(1.f / height));
|
||||
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian_linear_directional::render()
|
|||
std::shared_ptr<::gs::effect> effect = m_data->get_effect();
|
||||
auto kernel = m_data->get_kernel(size_t(m_size));
|
||||
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < DBL_EPSILON)) {
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < std::numeric_limits<double_t>::epsilon())) {
|
||||
return m_input_texture;
|
||||
}
|
||||
|
||||
|
|
|
@ -302,7 +302,7 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian::render()
|
|||
std::shared_ptr<::gs::effect> effect = m_data->get_effect();
|
||||
auto kernel = m_data->get_kernel(size_t(m_size));
|
||||
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < DBL_EPSILON)) {
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < std::numeric_limits<double_t>::epsilon())) {
|
||||
return m_input_texture;
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian::render()
|
|||
effect->get_parameter("pKernel").set_float_array(kernel.data(), MAX_KERNEL_SIZE);
|
||||
|
||||
// First Pass
|
||||
if (m_step_scale.first > DBL_EPSILON) {
|
||||
if (m_step_scale.first > std::numeric_limits<double_t>::epsilon()) {
|
||||
effect->get_parameter("pImageTexel").set_float2(float_t(1.f / width), 0.f);
|
||||
|
||||
{
|
||||
|
@ -345,7 +345,7 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian::render()
|
|||
}
|
||||
|
||||
// Second Pass
|
||||
if (m_step_scale.second > DBL_EPSILON) {
|
||||
if (m_step_scale.second > std::numeric_limits<double_t>::epsilon()) {
|
||||
effect->get_parameter("pImageTexel").set_float2(0.f, float_t(1.f / height));
|
||||
|
||||
{
|
||||
|
@ -395,7 +395,7 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian_directional::render()
|
|||
std::shared_ptr<::gs::effect> effect = m_data->get_effect();
|
||||
auto kernel = m_data->get_kernel(size_t(m_size));
|
||||
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < DBL_EPSILON)) {
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < std::numeric_limits<double_t>::epsilon())) {
|
||||
return m_input_texture;
|
||||
}
|
||||
|
||||
|
@ -450,7 +450,7 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian_rotational::render()
|
|||
std::shared_ptr<::gs::effect> effect = m_data->get_effect();
|
||||
auto kernel = m_data->get_kernel(size_t(m_size));
|
||||
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < DBL_EPSILON)) {
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < std::numeric_limits<double_t>::epsilon())) {
|
||||
return m_input_texture;
|
||||
}
|
||||
|
||||
|
@ -527,7 +527,7 @@ std::shared_ptr<::gs::texture> gfx::blur::gaussian_zoom::render()
|
|||
std::shared_ptr<::gs::effect> effect = m_data->get_effect();
|
||||
auto kernel = m_data->get_kernel(size_t(m_size));
|
||||
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < DBL_EPSILON)) {
|
||||
if (!effect || ((m_step_scale.first + m_step_scale.second) < std::numeric_limits<double_t>::epsilon())) {
|
||||
return m_input_texture;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
|
||||
namespace obs {
|
||||
class source_tracker {
|
||||
friend class std::_Ref_count_obj<obs::source_tracker>;
|
||||
|
||||
std::map<std::string, obs_weak_source_t*> source_map;
|
||||
|
||||
static void source_create_handler(void* ptr, calldata_t* data);
|
||||
|
@ -46,7 +44,7 @@ namespace obs {
|
|||
static void finalize();
|
||||
static std::shared_ptr<obs::source_tracker> get();
|
||||
|
||||
private:
|
||||
public:
|
||||
source_tracker();
|
||||
~source_tracker();
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
namespace source {
|
||||
namespace mirror {
|
||||
class mirror_factory {
|
||||
friend class std::_Ptr_base<source::mirror::mirror_factory>;
|
||||
|
||||
obs_source_info osi;
|
||||
|
||||
public: // Singleton
|
||||
|
|
|
@ -40,7 +40,11 @@ namespace util {
|
|||
public:
|
||||
typedef T value_type;
|
||||
typedef size_t size_type;
|
||||
#ifdef __clang__
|
||||
typedef ptrdiff_t difference_type;
|
||||
#else
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
#endif
|
||||
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
|
|
Loading…
Reference in New Issue