mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-10 22:05:06 +00:00
While Linux was not an original goal of the project, it should still be supported out of the box. Therefore a number of changes are contained in this changeset: - All C++ .h files were renamed to .hpp. - All C includes (<....h>) were replaced with C++ includes (<c...>) and missing includes were added. - std::memset and std::memcpy was replaced with memset and memcpy. - All anonymous structs were removed where necessary. - `extern "C"` was removed where it wasn't needed. - #pragma warning was placed behind an #ifdef _MSC_VER - The macros for `min`, `max` and `clamp` were removed as they were not used. - `-fpedantic` was added to the GCC flags for bitmask support. - `gs::rendertarget_op` is now declared before use. - std::exception(const char*) was replaced with std::runtime_error(const char*). - Added aligned_alloc and aligned_free macros for GCC and MSVC support. - Replaced use of `sprintf_s` with `snprintf`. - Placed additional guards around windows only code. Additonally some changes were made that do not affect Linux: - `NOMINMAX` and `NOINOUT` were removed. Fixes: #27 Fixes: #13
This commit is contained in:
parent
3b1551b8ef
commit
e0e2d9fe80
52 changed files with 380 additions and 296 deletions
|
@ -128,9 +128,21 @@ if(MSVC)
|
|||
endif()
|
||||
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Update if necessary
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
|
||||
# GCC: -fpermissive is required as GCC does not allow the same template to be in different namespaces.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -Wpedantic -fpermissive")
|
||||
endif()
|
||||
|
||||
# C++ Standard and Extensions
|
||||
IF (CMAKE_VERSION VERSION_LESS "3.8")
|
||||
SET(CMAKE_CXX_STANDARD 14)
|
||||
ELSEIF (CMAKE_VERSION VERSION_LESS "3.11")
|
||||
SET(CMAKE_CXX_STANDARD 17)
|
||||
ELSE() # CMake 3.11 or higher:
|
||||
SET(CMAKE_CXX_STANDARD 20)
|
||||
ENDIF()
|
||||
## Disable nonstandard extensions
|
||||
SET(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
################################################################################
|
||||
# Options
|
||||
################################################################################
|
||||
|
@ -239,57 +251,57 @@ SET(PROJECT_PRIVATE
|
|||
${PROJECT_DATA_SHADERS_FILTER}
|
||||
"${PROJECT_BINARY_DIR}/source/module.cpp"
|
||||
"${PROJECT_BINARY_DIR}/source/version.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/plugin.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/plugin.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/plugin.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-displacement.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-displacement.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-displacement.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-blur.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-blur.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-blur.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-shadow-sdf.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-shadow-sdf.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-shape.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-shape.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-shape.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-transform.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-transform.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-transform.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-custom-shader.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-custom-shader.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/filter-custom-shader.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/source-mirror.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/source-mirror.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/source-mirror.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gfx-effect-source.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gfx-effect-source.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gfx-effect-source.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gfx-source-texture.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gfx-source-texture.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gfx-source-texture.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-helper.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-helper.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-helper.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-effect.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-effect.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-effect.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-indexbuffer.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-indexbuffer.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-indexbuffer.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-limits.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-mipmapper.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-limits.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-mipmapper.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-mipmapper.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-rendertarget.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-rendertarget.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-rendertarget.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-sampler.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-sampler.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-sampler.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-texture.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-texture.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-texture.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-vertex.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-vertex.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-vertex.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-vertexbuffer.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-vertexbuffer.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/gs-vertexbuffer.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/obs-audio-capture.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/obs-audio-capture.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/obs-audio-capture.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/obs-tools.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/obs-tools.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/strings.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/utility.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/strings.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/utility.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/utility.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/util-event.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/util-event.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/util-math.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/util-math.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/util-math.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/util-memory.h"
|
||||
"${PROJECT_SOURCE_DIR}/source/util-memory.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/util-memory.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/obs-source.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/source/obs-source.cpp"
|
||||
|
|
|
@ -17,22 +17,26 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "filter-blur.h"
|
||||
#include "filter-blur.hpp"
|
||||
#include <cmath>
|
||||
#include <inttypes.h>
|
||||
#include <cinttypes>
|
||||
#include <map>
|
||||
#include "strings.h"
|
||||
#include "util-math.h"
|
||||
#include "strings.hpp"
|
||||
#include "util-math.hpp"
|
||||
#include <cfloat>
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include "callback/signal.h"
|
||||
#include "graphics/graphics.h"
|
||||
#include "graphics/matrix4.h"
|
||||
#include "util/platform.h"
|
||||
#endif
|
||||
#include <callback/signal.h>
|
||||
#include <graphics/graphics.h>
|
||||
#include <graphics/matrix4.h>
|
||||
#include <util/platform.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Translation Strings
|
||||
#define SOURCE_NAME "Filter.Blur"
|
||||
|
@ -569,7 +573,7 @@ void filter::blur::blur_instance::video_render(gs_effect_t* effect)
|
|||
if (obs_source_process_filter_begin(this->m_source, GS_RGBA, OBS_NO_DIRECT_RENDERING)) {
|
||||
obs_source_process_filter_end(this->m_source, defaultEffect, baseW, baseH);
|
||||
} else {
|
||||
throw std::exception("Failed to render source");
|
||||
throw std::runtime_error("Failed to render source");
|
||||
}
|
||||
} catch (std::exception ex) {
|
||||
if (this->can_log()) {
|
||||
|
|
|
@ -26,19 +26,22 @@
|
|||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include "gfx-source-texture.h"
|
||||
#include "gs-effect.h"
|
||||
#include "gs-helper.h"
|
||||
#include "gs-texture.h"
|
||||
#include "gs-rendertarget.h"
|
||||
#include "plugin.h"
|
||||
#include "gfx-source-texture.hpp"
|
||||
#include "gs-effect.hpp"
|
||||
#include "gs-helper.hpp"
|
||||
#include "gs-texture.hpp"
|
||||
#include "gs-rendertarget.hpp"
|
||||
#include "plugin.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include "callback/signal.h"
|
||||
#endif
|
||||
#include <callback/signal.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace filter {
|
||||
namespace blur {
|
|
@ -17,20 +17,23 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "filter-custom-shader.h"
|
||||
#include "filter-custom-shader.hpp"
|
||||
#include <fstream>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include "strings.h"
|
||||
#include "strings.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include "graphics/graphics.h"
|
||||
#include "graphics/matrix4.h"
|
||||
#include "util/platform.h"
|
||||
#endif
|
||||
#include <graphics/graphics.h>
|
||||
#include <graphics/matrix4.h>
|
||||
#include <util/platform.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define S "Filter.CustomShader"
|
||||
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
#include <cinttypes>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include "gfx-effect-source.h"
|
||||
#include "gs-effect.h"
|
||||
#include "gs-rendertarget.h"
|
||||
#include "plugin.h"
|
||||
#include "gfx-effect-source.hpp"
|
||||
#include "gs-effect.hpp"
|
||||
#include "gs-rendertarget.hpp"
|
||||
#include "plugin.hpp"
|
||||
|
||||
namespace filter {
|
||||
class CustomShader {
|
|
@ -17,8 +17,9 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "filter-displacement.h"
|
||||
#include "strings.h"
|
||||
#include "filter-displacement.hpp"
|
||||
#include <sys/stat.h>
|
||||
#include "strings.hpp"
|
||||
|
||||
// Initializer & Finalizer
|
||||
static filter::Displacement* filterDisplacementInstance;
|
||||
|
|
|
@ -18,17 +18,19 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "plugin.h"
|
||||
#include "plugin.hpp"
|
||||
#include <string>
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#endif
|
||||
#include <obs-source.h>
|
||||
#include <util/platform.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
#define S_FILTER_DISPLACEMENT "Filter.Displacement"
|
||||
#define S_FILTER_DISPLACEMENT_FILE "Filter.Displacement.File"
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
#include "filter-shadow-sdf.hpp"
|
||||
#include "strings.h"
|
||||
#include "strings.hpp"
|
||||
|
||||
// Translation Strings
|
||||
#define SOURCE_NAME "Filter.ShadowSDF"
|
||||
|
@ -221,25 +221,25 @@ void filter::shadow_sdf::shadow_sdf_instance::video_render(gs_effect_t*)
|
|||
if (obs_source_process_filter_begin(this->m_self, GS_RGBA, OBS_ALLOW_DIRECT_RENDERING)) {
|
||||
obs_source_process_filter_end(this->m_self, default_effect, baseW, baseH);
|
||||
} else {
|
||||
throw std::exception("failed to process source");
|
||||
throw std::runtime_error("failed to process source");
|
||||
}
|
||||
}
|
||||
m_input->get_texture(this->m_source_texture);
|
||||
if (!this->m_source_texture) {
|
||||
throw std::exception("failed to draw source");
|
||||
throw std::runtime_error("failed to draw source");
|
||||
}
|
||||
|
||||
// Generate SDF Buffers
|
||||
{
|
||||
this->m_sdf_read->get_texture(this->m_sdf_texture);
|
||||
if (!this->m_sdf_texture) {
|
||||
throw std::exception("SDF Backbuffer empty");
|
||||
throw std::runtime_error("SDF Backbuffer empty");
|
||||
}
|
||||
|
||||
std::shared_ptr<gs::effect> sdf_effect =
|
||||
filter::shadow_sdf::shadow_sdf_factory::get()->get_sdf_generator_effect();
|
||||
if (!sdf_effect) {
|
||||
throw std::exception("SDF Effect no loaded");
|
||||
throw std::runtime_error("SDF Effect no loaded");
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -266,7 +266,7 @@ void filter::shadow_sdf::shadow_sdf_instance::video_render(gs_effect_t*)
|
|||
this->m_sdf_write.swap(this->m_sdf_read);
|
||||
this->m_sdf_read->get_texture(this->m_sdf_texture);
|
||||
if (!this->m_sdf_texture) {
|
||||
throw std::exception("SDF Backbuffer empty");
|
||||
throw std::runtime_error("SDF Backbuffer empty");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ void filter::shadow_sdf::shadow_sdf_instance::video_render(gs_effect_t*)
|
|||
std::shared_ptr<gs::effect> shadow_effect =
|
||||
filter::shadow_sdf::shadow_sdf_factory::get()->get_sdf_shadow_effect();
|
||||
if (!shadow_effect) {
|
||||
throw std::exception("Shadow Effect no loaded");
|
||||
throw std::runtime_error("Shadow Effect no loaded");
|
||||
}
|
||||
|
||||
gs_set_cull_mode(GS_NEITHER);
|
||||
|
|
|
@ -22,16 +22,22 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "gs-effect.h"
|
||||
#include "gs-rendertarget.h"
|
||||
#include "gs-sampler.h"
|
||||
#include "gs-texture.h"
|
||||
#include "gs-vertexbuffer.h"
|
||||
#include "plugin.h"
|
||||
#include "gs-effect.hpp"
|
||||
#include "gs-rendertarget.hpp"
|
||||
#include "gs-sampler.hpp"
|
||||
#include "gs-texture.hpp"
|
||||
#include "gs-vertexbuffer.hpp"
|
||||
#include "plugin.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#endif
|
||||
#include <obs.h>
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
namespace filter {
|
||||
namespace shadow_sdf {
|
||||
|
|
|
@ -17,21 +17,24 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "filter-shape.h"
|
||||
#include "filter-shape.hpp"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "strings.h"
|
||||
#include "strings.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include "graphics/graphics.h"
|
||||
#include "graphics/matrix4.h"
|
||||
#include "util/platform.h"
|
||||
#endif
|
||||
#include <graphics/graphics.h>
|
||||
#include <graphics/matrix4.h>
|
||||
#include <util/platform.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initializer & Finalizer
|
||||
static filter::Shape* filterShapeInstance;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "gs-vertexbuffer.h"
|
||||
#include "plugin.h"
|
||||
#include "gs-vertexbuffer.hpp"
|
||||
#include "plugin.hpp"
|
||||
|
||||
#define P_SHAPE "Shape"
|
||||
#define P_SHAPE_LOOP "Shape.Loop"
|
|
@ -17,18 +17,21 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "filter-transform.h"
|
||||
#include "strings.h"
|
||||
#include "util-math.h"
|
||||
#include "filter-transform.hpp"
|
||||
#include "strings.hpp"
|
||||
#include "util-math.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include "graphics/graphics.h"
|
||||
#include "graphics/matrix4.h"
|
||||
#include "util/platform.h"
|
||||
#endif
|
||||
#include <graphics/graphics.h>
|
||||
#include <graphics/matrix4.h>
|
||||
#include <util/platform.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initializer & Finalizer
|
||||
static filter::Transform* filterTransformInstance;
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
#pragma once
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "gs-mipmapper.h"
|
||||
#include "gs-rendertarget.h"
|
||||
#include "gs-texture.h"
|
||||
#include "gs-vertexbuffer.h"
|
||||
#include "plugin.h"
|
||||
#include "gs-mipmapper.hpp"
|
||||
#include "gs-rendertarget.hpp"
|
||||
#include "gs-texture.hpp"
|
||||
#include "gs-vertexbuffer.hpp"
|
||||
#include "plugin.hpp"
|
||||
|
||||
namespace filter {
|
||||
class Transform {
|
||||
|
@ -78,12 +78,10 @@ namespace filter {
|
|||
|
||||
// 3D Information
|
||||
uint32_t rotation_order;
|
||||
struct {
|
||||
std::unique_ptr<util::vec3a> position;
|
||||
std::unique_ptr<util::vec3a> rotation;
|
||||
std::unique_ptr<util::vec3a> scale;
|
||||
std::unique_ptr<util::vec3a> shear;
|
||||
};
|
||||
std::unique_ptr<util::vec3a> position;
|
||||
std::unique_ptr<util::vec3a> rotation;
|
||||
std::unique_ptr<util::vec3a> scale;
|
||||
std::unique_ptr<util::vec3a> shear;
|
||||
|
||||
public:
|
||||
Instance(obs_data_t*, obs_source_t*);
|
|
@ -15,10 +15,23 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
#include "gfx-effect-source.h"
|
||||
#include "gfx-effect-source.hpp"
|
||||
#include <fstream>
|
||||
#include <sys/stat.h>
|
||||
#include "strings.hpp"
|
||||
#include <cfloat>
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#endif
|
||||
#include <util/platform.h>
|
||||
#include "strings.h"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
bool gfx::effect_source::property_type_modified(void*, obs_properties_t* props, obs_property_t*, obs_data_t* sett)
|
||||
{
|
||||
|
|
|
@ -21,16 +21,18 @@
|
|||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "gfx-source-texture.h"
|
||||
#include "gs-effect.h"
|
||||
#include "gs-mipmapper.h"
|
||||
#include "gs-rendertarget.h"
|
||||
#include "gs-texture.h"
|
||||
#include "gs-vertexbuffer.h"
|
||||
#include "gfx-source-texture.hpp"
|
||||
#include "gs-effect.hpp"
|
||||
#include "gs-mipmapper.hpp"
|
||||
#include "gs-rendertarget.hpp"
|
||||
#include "gs-texture.hpp"
|
||||
#include "gs-vertexbuffer.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <obs.h>
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
// Data Defines
|
||||
#define D_TYPE "CustomShader.Type"
|
|
@ -15,7 +15,7 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
#include "gfx-source-texture.h"
|
||||
#include "gfx-source-texture.hpp"
|
||||
|
||||
gfx::source_texture::~source_texture()
|
||||
{
|
||||
|
|
|
@ -18,13 +18,15 @@
|
|||
#pragma once
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "gs-rendertarget.h"
|
||||
#include "gs-texture.h"
|
||||
#include "gs-rendertarget.hpp"
|
||||
#include "gs-texture.hpp"
|
||||
#include "obs-source.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <obs.h>
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
namespace gfx {
|
||||
class source_texture {
|
|
@ -17,15 +17,18 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "gs-effect.h"
|
||||
#include "gs-effect.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#endif
|
||||
#include <obs.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#endif
|
||||
|
||||
gs::effect::effect() : m_effect(nullptr) {}
|
||||
|
||||
|
|
|
@ -18,14 +18,13 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
#include <cinttypes>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "gs-sampler.h"
|
||||
#include "gs-texture.h"
|
||||
#include "gs-sampler.hpp"
|
||||
#include "gs-texture.hpp"
|
||||
|
||||
extern "C" {
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <graphics/graphics.h>
|
||||
|
@ -34,7 +33,6 @@ extern "C" {
|
|||
#include <graphics/vec3.h>
|
||||
#include <graphics/vec4.h>
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
namespace gs {
|
||||
class effect_parameter {
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "gs-helper.h"
|
||||
#include "gs-helper.hpp"
|
||||
|
||||
gs_effect_param* gs_effect_get_param(gs_effect_t* effect, const char* name)
|
||||
{
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include "plugin.h"
|
||||
extern "C" {
|
||||
#include "plugin.hpp"
|
||||
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include "graphics/graphics.h"
|
||||
#include <graphics/graphics.h>
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
gs_effect_param* gs_effect_get_param(gs_effect_t* effect, const char* name);
|
||||
bool gs_set_param_int(gs_effect_t* effect, const char* name, int value);
|
|
@ -17,14 +17,18 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "gs-indexbuffer.h"
|
||||
#include "gs-limits.h"
|
||||
extern "C" {
|
||||
#include "gs-indexbuffer.hpp"
|
||||
#include "gs-limits.hpp"
|
||||
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#endif
|
||||
#include <obs.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#endif
|
||||
|
||||
gs::index_buffer::index_buffer(uint32_t maximumVertices)
|
||||
{
|
||||
|
|
|
@ -18,14 +18,13 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
#include <cinttypes>
|
||||
#include <vector>
|
||||
extern "C" {
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <graphics/graphics.h>
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
namespace gs {
|
||||
class index_buffer : public std::vector<uint32_t> {
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
#include <cinttypes>
|
||||
|
||||
namespace gs {
|
||||
static const uint32_t MAXIMUM_VERTICES = 0xFFFFFFu;
|
|
@ -17,20 +17,26 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "gs-mipmapper.h"
|
||||
#include "plugin.h"
|
||||
#include "gs-mipmapper.hpp"
|
||||
#include "plugin.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#endif
|
||||
#include <graphics/graphics.h>
|
||||
#include <obs-module.h>
|
||||
#include <obs.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
extern "C" {
|
||||
#include <windows.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
// Here be dragons!
|
||||
// This is to add support for mipmap generation which is by default not possible with libobs.
|
||||
|
@ -146,7 +152,9 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
|
|||
|
||||
// Render
|
||||
graphics_t* ctx = gs_get_context();
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
gs_d3d11_device* dev = reinterpret_cast<gs_d3d11_device*>(ctx->device);
|
||||
#endif
|
||||
int device_type = gs_get_device_type();
|
||||
void* sobj = gs_texture_get_obj(source->get_object());
|
||||
void* tobj = gs_texture_get_obj(target->get_object());
|
||||
|
|
|
@ -18,17 +18,16 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "gs-effect.h"
|
||||
#include "gs-rendertarget.h"
|
||||
#include "gs-texture.h"
|
||||
#include "gs-vertexbuffer.h"
|
||||
#include "gs-effect.hpp"
|
||||
#include "gs-rendertarget.hpp"
|
||||
#include "gs-texture.hpp"
|
||||
#include "gs-vertexbuffer.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <graphics/graphics.h>
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
namespace gs {
|
||||
class mipmapper {
|
|
@ -17,16 +17,19 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "gs-rendertarget.h"
|
||||
#include "gs-rendertarget.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#endif
|
||||
#include <graphics/graphics.h>
|
||||
#include <obs.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#endif
|
||||
|
||||
gs::rendertarget::~rendertarget()
|
||||
{
|
||||
|
|
|
@ -20,16 +20,17 @@
|
|||
#pragma once
|
||||
#include <cinttypes>
|
||||
#include <memory>
|
||||
#include "gs-texture.h"
|
||||
#include "gs-texture.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <graphics/graphics.h>
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
namespace gs {
|
||||
class rendertarget_op;
|
||||
|
||||
class rendertarget {
|
||||
friend class rendertarget_op;
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "gs-sampler.h"
|
||||
#include "gs-sampler.hpp"
|
||||
|
||||
gs::sampler::sampler()
|
||||
{
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
extern "C" {
|
||||
#include <cinttypes>
|
||||
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <graphics/graphics.h>
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
namespace gs {
|
||||
class sampler {
|
|
@ -17,19 +17,22 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "gs-texture.h"
|
||||
#include "gs-texture.hpp"
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <sys/stat.h>
|
||||
#include "util-math.h"
|
||||
#include "util-math.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#endif
|
||||
#include <obs.h>
|
||||
#include <util/platform.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#endif
|
||||
|
||||
gs::texture::texture(uint32_t width, uint32_t height, gs_color_format format, uint32_t mip_levels,
|
||||
const uint8_t** mip_data, gs::texture::flags texture_flags)
|
||||
|
|
|
@ -20,14 +20,13 @@
|
|||
#pragma once
|
||||
#include <cinttypes>
|
||||
#include <string>
|
||||
#include "utility.h"
|
||||
#include "utility.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <graphics/graphics.h>
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
namespace gs {
|
||||
class texture {
|
|
@ -17,8 +17,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "gs-vertex.h"
|
||||
#include "util-memory.h"
|
||||
#include "gs-vertex.hpp"
|
||||
#include "util-memory.hpp"
|
||||
|
||||
gs::vertex::vertex()
|
||||
: hasStore(true), store(nullptr), position(nullptr), normal(nullptr), tangent(nullptr), color(nullptr)
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
#pragma once
|
||||
#include <cinttypes>
|
||||
#include <xmmintrin.h>
|
||||
#include "gs-limits.h"
|
||||
extern "C" {
|
||||
#include "gs-limits.hpp"
|
||||
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <graphics/vec3.h>
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
namespace gs {
|
||||
struct vertex {
|
|
@ -17,15 +17,19 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "gs-vertexbuffer.h"
|
||||
#include "gs-vertexbuffer.hpp"
|
||||
#include <stdexcept>
|
||||
#include "util-memory.h"
|
||||
extern "C" {
|
||||
#include "util-memory.hpp"
|
||||
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#endif
|
||||
#include <obs.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
}
|
||||
#endif
|
||||
|
||||
gs::vertex_buffer::~vertex_buffer()
|
||||
{
|
||||
|
@ -56,7 +60,7 @@ gs::vertex_buffer::~vertex_buffer()
|
|||
m_layerdata = nullptr;
|
||||
}
|
||||
if (m_vertexbufferdata) {
|
||||
std::memset(m_vertexbufferdata, 0, sizeof(gs_vb_data));
|
||||
memset(m_vertexbufferdata, 0, sizeof(gs_vb_data));
|
||||
if (!m_vertexbuffer) {
|
||||
gs_vbdata_destroy(m_vertexbufferdata);
|
||||
m_vertexbufferdata = nullptr;
|
||||
|
@ -94,12 +98,12 @@ gs::vertex_buffer::vertex_buffer(uint32_t vertices, uint8_t uvlayers)
|
|||
m_vertexbufferdata->colors = m_colors = (uint32_t*)util::malloc_aligned(16, sizeof(uint32_t) * m_capacity);
|
||||
|
||||
// cppcheck-suppress memsetClassFloat
|
||||
std::memset(m_positions, 0, sizeof(vec3) * m_capacity);
|
||||
memset(m_positions, 0, sizeof(vec3) * m_capacity);
|
||||
// cppcheck-suppress memsetClassFloat
|
||||
std::memset(m_normals, 0, sizeof(vec3) * m_capacity);
|
||||
memset(m_normals, 0, sizeof(vec3) * m_capacity);
|
||||
// cppcheck-suppress memsetClassFloat
|
||||
std::memset(m_tangents, 0, sizeof(vec3) * m_capacity);
|
||||
std::memset(m_colors, 0, sizeof(uint32_t) * m_capacity);
|
||||
memset(m_tangents, 0, sizeof(vec3) * m_capacity);
|
||||
memset(m_colors, 0, sizeof(uint32_t) * m_capacity);
|
||||
|
||||
m_vertexbufferdata->num_tex = m_layers;
|
||||
if (m_layers > 0) {
|
||||
|
@ -108,7 +112,7 @@ gs::vertex_buffer::vertex_buffer(uint32_t vertices, uint8_t uvlayers)
|
|||
for (size_t n = 0; n < m_layers; n++) {
|
||||
m_layerdata[n].array = m_uvs[n] = (vec4*)util::malloc_aligned(16, sizeof(vec4) * m_capacity);
|
||||
m_layerdata[n].width = 4;
|
||||
std::memset(m_uvs[n], 0, sizeof(vec4) * m_capacity);
|
||||
memset(m_uvs[n], 0, sizeof(vec4) * m_capacity);
|
||||
}
|
||||
} else {
|
||||
m_vertexbufferdata->tvarray = nullptr;
|
||||
|
@ -117,7 +121,7 @@ gs::vertex_buffer::vertex_buffer(uint32_t vertices, uint8_t uvlayers)
|
|||
// Allocate GPU
|
||||
obs_enter_graphics();
|
||||
m_vertexbuffer = gs_vertexbuffer_create(m_vertexbufferdata, GS_DYNAMIC);
|
||||
std::memset(m_vertexbufferdata, 0, sizeof(gs_vb_data));
|
||||
memset(m_vertexbufferdata, 0, sizeof(gs_vb_data));
|
||||
m_vertexbufferdata->num = m_capacity;
|
||||
m_vertexbufferdata->num_tex = m_layers;
|
||||
obs_leave_graphics();
|
||||
|
@ -138,24 +142,24 @@ gs::vertex_buffer::vertex_buffer(gs_vertbuffer_t* vb)
|
|||
this->set_uv_layers((uint32_t)vbd->num_tex);
|
||||
|
||||
if (vbd->points != nullptr)
|
||||
std::memcpy(m_positions, vbd->points, vbd->num * sizeof(vec3));
|
||||
memcpy(m_positions, vbd->points, vbd->num * sizeof(vec3));
|
||||
if (vbd->normals != nullptr)
|
||||
std::memcpy(m_normals, vbd->normals, vbd->num * sizeof(vec3));
|
||||
memcpy(m_normals, vbd->normals, vbd->num * sizeof(vec3));
|
||||
if (vbd->tangents != nullptr)
|
||||
std::memcpy(m_tangents, vbd->tangents, vbd->num * sizeof(vec3));
|
||||
memcpy(m_tangents, vbd->tangents, vbd->num * sizeof(vec3));
|
||||
if (vbd->colors != nullptr)
|
||||
std::memcpy(m_colors, vbd->colors, vbd->num * sizeof(uint32_t));
|
||||
memcpy(m_colors, vbd->colors, vbd->num * sizeof(uint32_t));
|
||||
if (vbd->tvarray != nullptr) {
|
||||
for (size_t n = 0; n < vbd->num_tex; n++) {
|
||||
if (vbd->tvarray[n].array != nullptr && vbd->tvarray[n].width <= 4 && vbd->tvarray[n].width > 0) {
|
||||
if (vbd->tvarray[n].width == 4) {
|
||||
std::memcpy(m_uvs[n], vbd->tvarray[n].array, vbd->num * sizeof(vec4));
|
||||
memcpy(m_uvs[n], vbd->tvarray[n].array, vbd->num * sizeof(vec4));
|
||||
} else {
|
||||
for (size_t idx = 0; idx < m_capacity; idx++) {
|
||||
float* mem = reinterpret_cast<float*>(vbd->tvarray[n].array) + (idx * vbd->tvarray[n].width);
|
||||
// cppcheck-suppress memsetClassFloat
|
||||
std::memset(&m_uvs[n][idx], 0, sizeof(vec4));
|
||||
std::memcpy(&m_uvs[n][idx], mem, vbd->tvarray[n].width);
|
||||
memset(&m_uvs[n][idx], 0, sizeof(vec4));
|
||||
memcpy(&m_uvs[n][idx], mem, vbd->tvarray[n].width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,12 +172,12 @@ gs::vertex_buffer::vertex_buffer(gs_vertbuffer_t* vb)
|
|||
gs::vertex_buffer::vertex_buffer(vertex_buffer const& other) : vertex_buffer(other.m_capacity)
|
||||
{
|
||||
// Copy Constructor
|
||||
std::memcpy(m_positions, other.m_positions, m_capacity * sizeof(vec3));
|
||||
std::memcpy(m_normals, other.m_normals, m_capacity * sizeof(vec3));
|
||||
std::memcpy(m_tangents, other.m_tangents, m_capacity * sizeof(vec3));
|
||||
std::memcpy(m_colors, other.m_colors, m_capacity * sizeof(vec3));
|
||||
memcpy(m_positions, other.m_positions, m_capacity * sizeof(vec3));
|
||||
memcpy(m_normals, other.m_normals, m_capacity * sizeof(vec3));
|
||||
memcpy(m_tangents, other.m_tangents, m_capacity * sizeof(vec3));
|
||||
memcpy(m_colors, other.m_colors, m_capacity * sizeof(vec3));
|
||||
for (size_t n = 0; n < MAXIMUM_UVW_LAYERS; n++) {
|
||||
std::memcpy(m_uvs[n], other.m_uvs[n], m_capacity * sizeof(vec3));
|
||||
memcpy(m_uvs[n], other.m_uvs[n], m_capacity * sizeof(vec3));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +229,7 @@ void gs::vertex_buffer::operator=(vertex_buffer const&& other)
|
|||
m_layerdata = nullptr;
|
||||
}
|
||||
if (m_vertexbufferdata) {
|
||||
std::memset(m_vertexbufferdata, 0, sizeof(gs_vb_data));
|
||||
memset(m_vertexbufferdata, 0, sizeof(gs_vb_data));
|
||||
if (!m_vertexbuffer) {
|
||||
gs_vbdata_destroy(m_vertexbufferdata);
|
||||
m_vertexbufferdata = nullptr;
|
||||
|
@ -338,7 +342,7 @@ gs_vertbuffer_t* gs::vertex_buffer::update(bool refreshGPU)
|
|||
// Update VertexBuffer data.
|
||||
obs_enter_graphics();
|
||||
m_vertexbufferdata = gs_vertexbuffer_get_data(m_vertexbuffer);
|
||||
std::memset(m_vertexbufferdata, 0, sizeof(gs_vb_data));
|
||||
memset(m_vertexbufferdata, 0, sizeof(gs_vb_data));
|
||||
m_vertexbufferdata->num = m_capacity;
|
||||
m_vertexbufferdata->points = m_positions;
|
||||
m_vertexbufferdata->normals = m_normals;
|
||||
|
@ -356,7 +360,7 @@ gs_vertbuffer_t* gs::vertex_buffer::update(bool refreshGPU)
|
|||
obs_leave_graphics();
|
||||
|
||||
// WORKAROUND: OBS Studio 20.x and below incorrectly deletes data that it doesn't own.
|
||||
std::memset(m_vertexbufferdata, 0, sizeof(gs_vb_data));
|
||||
memset(m_vertexbufferdata, 0, sizeof(gs_vb_data));
|
||||
m_vertexbufferdata->num = m_capacity;
|
||||
m_vertexbufferdata->num_tex = m_layers;
|
||||
for (uint32_t n = 0; n < m_layers; n++) {
|
||||
|
|
|
@ -19,17 +19,16 @@
|
|||
|
||||
#pragma once
|
||||
#include <cinttypes>
|
||||
#include "gs-limits.h"
|
||||
#include "gs-vertex.h"
|
||||
#include "util-math.h"
|
||||
#include "util-memory.h"
|
||||
#include "gs-limits.hpp"
|
||||
#include "gs-vertex.hpp"
|
||||
#include "util-math.hpp"
|
||||
#include "util-memory.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <graphics/graphics.h>
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
namespace gs {
|
||||
class vertex_buffer {
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "obs-audio-capture.h"
|
||||
#include "obs-audio-capture.hpp"
|
||||
|
||||
void obs::audio_capture::audio_capture_cb(void* data, obs_source_t*, const struct audio_data* audio, bool muted)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,12 @@
|
|||
|
||||
#pragma once
|
||||
#include <functional>
|
||||
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <obs.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
namespace obs {
|
||||
typedef std::function<void(void* data, struct audio_data const* audio, bool muted)> audio_capture_callback_t;
|
|
@ -25,9 +25,11 @@
|
|||
#include <string>
|
||||
#include "util-event.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "obs.h"
|
||||
}
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <obs.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
namespace obs {
|
||||
class source {
|
||||
|
|
|
@ -24,9 +24,11 @@
|
|||
#include <cinttypes>
|
||||
#include <string>
|
||||
|
||||
extern "C" {
|
||||
#include "obs.h"
|
||||
}
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <obs.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
namespace obs {
|
||||
namespace tools {
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "plugin.h"
|
||||
#include "filter-blur.h"
|
||||
#include "filter-displacement.h"
|
||||
#include "filter-shape.h"
|
||||
#include "filter-transform.h"
|
||||
#include "plugin.hpp"
|
||||
#include "filter-blur.hpp"
|
||||
#include "filter-displacement.hpp"
|
||||
#include "filter-shape.hpp"
|
||||
#include "filter-transform.hpp"
|
||||
|
||||
filter::Displacement* filterDisplacement;
|
||||
filter::Shape* filterShape;
|
||||
|
@ -50,10 +50,10 @@ MODULE_EXPORT void obs_module_unload(void)
|
|||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#define NOINOUT
|
||||
|
||||
// Windows Only
|
||||
extern "C" {
|
||||
#include <windows.h>
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID)
|
||||
{
|
||||
|
|
|
@ -19,16 +19,14 @@
|
|||
|
||||
#pragma once
|
||||
#include <functional>
|
||||
#include <inttypes.h>
|
||||
#include <cinttypes>
|
||||
#include <list>
|
||||
|
||||
extern "C" {
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include "obs-module.h"
|
||||
#include "util/platform.h"
|
||||
#pragma warning(pop)
|
||||
}
|
||||
|
||||
// Plugin
|
||||
#define PLUGIN_NAME "Stream Effects"
|
||||
|
@ -44,16 +42,6 @@ extern "C" {
|
|||
#define vstr(s) dstr(s)
|
||||
#define dstr(s) #s
|
||||
|
||||
#define clamp(val, low, high) (val > high ? high : (val < low ? low : val))
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
#define max(val, high) (val > high ? val : high)
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#define min(val, low) (val < low ? val : low)
|
||||
|
||||
#ifndef __FUNCTION_NAME__
|
||||
#if defined(_WIN32) || defined(_WIN64) //WINDOWS
|
||||
#define __FUNCTION_NAME__ __FUNCTION__
|
|
@ -17,19 +17,25 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "source-mirror.h"
|
||||
#include "source-mirror.hpp"
|
||||
#include <bitset>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "obs-tools.hpp"
|
||||
#include "strings.h"
|
||||
#include "strings.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#endif
|
||||
#include <media-io/audio-io.h>
|
||||
#include <obs-config.h>
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#define S_SOURCE_MIRROR "Source.Mirror"
|
||||
#define P_SOURCE "Source.Mirror.Source"
|
||||
|
@ -109,7 +115,7 @@ bool Source::MirrorAddon::modified_properties(obs_properties_t* pr, obs_property
|
|||
obs_source_t* target = obs_get_source_by_name(obs_data_get_string(data, P_SOURCE));
|
||||
if (target) {
|
||||
std::vector<char> buf(256);
|
||||
sprintf_s(buf.data(), buf.size(), "%ldx%ld\0", obs_source_get_width(target), obs_source_get_height(target));
|
||||
snprintf(buf.data(), buf.size(), "%ldx%ld\0", obs_source_get_width(target), obs_source_get_height(target));
|
||||
obs_data_set_string(data, P_SOURCE_SIZE, buf.data());
|
||||
} else {
|
||||
obs_data_set_string(data, P_SOURCE_SIZE, "0x0");
|
||||
|
|
|
@ -23,16 +23,18 @@
|
|||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include "gfx-source-texture.h"
|
||||
#include "gs-rendertarget.h"
|
||||
#include "gs-sampler.h"
|
||||
#include "obs-audio-capture.h"
|
||||
#include "gfx-source-texture.hpp"
|
||||
#include "gs-rendertarget.hpp"
|
||||
#include "gs-sampler.hpp"
|
||||
#include "obs-audio-capture.hpp"
|
||||
#include "obs-source.hpp"
|
||||
#include "plugin.h"
|
||||
#include "plugin.hpp"
|
||||
|
||||
extern "C" {
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <obs-source.h>
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
namespace Source {
|
||||
class MirrorAddon {
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "plugin.h"
|
||||
#include "plugin.hpp"
|
||||
|
||||
#define P_TRANSLATE(x) obs_module_text(x)
|
||||
#define P_DESC(x) x ".Description"
|
|
@ -62,4 +62,4 @@ namespace util {
|
|||
listeners.clear();
|
||||
}
|
||||
};
|
||||
}; // namespace util
|
||||
} // namespace util
|
||||
|
|
|
@ -17,50 +17,49 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "util-math.h"
|
||||
#include "util-math.hpp"
|
||||
#include <cctype>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include "util-memory.h"
|
||||
#include <cstdlib>
|
||||
#include "util-memory.hpp"
|
||||
|
||||
void* util::vec3a::operator new(size_t count)
|
||||
{
|
||||
return _aligned_malloc(count, 16);
|
||||
return aligned_alloc(count, 16);
|
||||
}
|
||||
|
||||
void* util::vec3a::operator new[](size_t count)
|
||||
{
|
||||
return _aligned_malloc(count, 16);
|
||||
return aligned_alloc(count, 16);
|
||||
}
|
||||
|
||||
void util::vec3a::operator delete(void* p)
|
||||
{
|
||||
_aligned_free(p);
|
||||
aligned_free(p);
|
||||
}
|
||||
|
||||
void util::vec3a::operator delete[](void* p)
|
||||
{
|
||||
_aligned_free(p);
|
||||
aligned_free(p);
|
||||
}
|
||||
|
||||
void* util::vec4a::operator new(size_t count)
|
||||
{
|
||||
return _aligned_malloc(count, 16);
|
||||
return aligned_alloc(count, 16);
|
||||
}
|
||||
|
||||
void* util::vec4a::operator new[](size_t count)
|
||||
{
|
||||
return _aligned_malloc(count, 16);
|
||||
return aligned_alloc(count, 16);
|
||||
}
|
||||
|
||||
void util::vec4a::operator delete(void* p)
|
||||
{
|
||||
_aligned_free(p);
|
||||
aligned_free(p);
|
||||
}
|
||||
|
||||
void util::vec4a::operator delete[](void* p)
|
||||
{
|
||||
_aligned_free(p);
|
||||
aligned_free(p);
|
||||
}
|
||||
|
||||
std::pair<int64_t, int64_t> util::SizeFromString(std::string text, bool allowSquare)
|
||||
|
|
|
@ -18,15 +18,18 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
#include <cinttypes>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
// OBS
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
#include <graphics/vec2.h>
|
||||
#include <graphics/vec3.h>
|
||||
#include <graphics/vec4.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
// Constants
|
||||
#define PI 3.1415926535897932384626433832795
|
||||
|
@ -60,18 +63,24 @@ inline size_t GetNearestPowerOfTwoBelow(size_t v)
|
|||
}
|
||||
|
||||
namespace util {
|
||||
__declspec(align(16)) struct vec3a : public vec3 {
|
||||
static void* vec3a::operator new(size_t count);
|
||||
static void* vec3a::operator new[](size_t count);
|
||||
static void vec3a::operator delete(void* p);
|
||||
static void vec3a::operator delete[](void* p);
|
||||
#ifdef _MSC_VER
|
||||
__declspec(align(16))
|
||||
#endif
|
||||
struct vec3a : public vec3 {
|
||||
static void* operator new(size_t count);
|
||||
static void* operator new[](size_t count);
|
||||
static void operator delete(void* p);
|
||||
static void operator delete[](void* p);
|
||||
};
|
||||
|
||||
__declspec(align(16)) struct vec4a : public vec4 {
|
||||
static void* vec4a::operator new(size_t count);
|
||||
static void* vec4a::operator new[](size_t count);
|
||||
static void vec4a::operator delete(void* p);
|
||||
static void vec4a::operator delete[](void* p);
|
||||
#ifdef _MSC_VER
|
||||
__declspec(align(16))
|
||||
#endif
|
||||
struct vec4a : public vec4 {
|
||||
static void* operator new(size_t count);
|
||||
static void* operator new[](size_t count);
|
||||
static void operator delete(void* p);
|
||||
static void operator delete[](void* p);
|
||||
};
|
||||
|
||||
std::pair<int64_t, int64_t> SizeFromString(std::string text, bool allowSquare = true);
|
||||
|
@ -108,15 +117,15 @@ namespace util {
|
|||
inline bool is_power_of_two(x v) \
|
||||
{ \
|
||||
return is_power_of_two_loop(v); \
|
||||
};
|
||||
is_power_of_two_as_loop(int8_t);
|
||||
is_power_of_two_as_loop(uint8_t);
|
||||
is_power_of_two_as_loop(int16_t);
|
||||
is_power_of_two_as_loop(uint16_t);
|
||||
is_power_of_two_as_loop(int32_t);
|
||||
is_power_of_two_as_loop(uint32_t);
|
||||
is_power_of_two_as_loop(int64_t);
|
||||
is_power_of_two_as_loop(uint64_t);
|
||||
}
|
||||
is_power_of_two_as_loop(int8_t)
|
||||
is_power_of_two_as_loop(uint8_t)
|
||||
is_power_of_two_as_loop(int16_t)
|
||||
is_power_of_two_as_loop(uint16_t)
|
||||
is_power_of_two_as_loop(int32_t)
|
||||
is_power_of_two_as_loop(uint32_t)
|
||||
is_power_of_two_as_loop(int64_t)
|
||||
is_power_of_two_as_loop(uint64_t)
|
||||
#undef is_power_of_two_as_loop
|
||||
#pragma pop_macro("is_power_of_two_as_loop")
|
||||
|
|
@ -17,18 +17,15 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "util-memory.h"
|
||||
#include "util-memory.hpp"
|
||||
#include <cstdlib>
|
||||
|
||||
#define USE_STD_ALLOC_FREE
|
||||
|
||||
void* util::malloc_aligned(size_t align, size_t size)
|
||||
{
|
||||
#ifdef USE_STD_ALLOC_FREE
|
||||
#if defined(_MSC_VER)
|
||||
return _aligned_malloc(size, align);
|
||||
#else
|
||||
return aligned_malloc(align, size);
|
||||
#endif
|
||||
return aligned_alloc(align, size);
|
||||
#else
|
||||
// Ensure that we have space for the pointer and the data.
|
||||
size_t asize = aligned_offset(align, size + (sizeof(void*) * 2));
|
||||
|
@ -50,11 +47,7 @@ void* util::malloc_aligned(size_t align, size_t size)
|
|||
void util::free_aligned(void* mem)
|
||||
{
|
||||
#ifdef USE_STD_ALLOC_FREE
|
||||
#if defined(_MSC_VER)
|
||||
_aligned_free(mem);
|
||||
#else
|
||||
free(mem);
|
||||
#endif
|
||||
aligned_free(mem);
|
||||
#else
|
||||
void* ptr = reinterpret_cast<void*>(*reinterpret_cast<intptr_t*>(static_cast<char*>(mem) - sizeof(void*)));
|
||||
free(ptr);
|
||||
|
|
|
@ -18,8 +18,14 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define aligned_alloc _aligned_malloc
|
||||
#define aligned_free _aligned_free
|
||||
#else
|
||||
#define aligned_free free
|
||||
#endif
|
||||
|
||||
namespace util {
|
||||
inline size_t aligned_offset(size_t align, size_t pos)
|
|
@ -17,4 +17,4 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "utility.h"
|
||||
#include "utility.hpp"
|
||||
|
|
Loading…
Reference in a new issue