From fb77cc90a60f3de0c19b816e69b07189d9e52050 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Thu, 27 Sep 2018 05:23:14 +0200 Subject: [PATCH] gs-rendertarget: Allow retrieving color and zstencil format --- source/gs-rendertarget.cpp | 12 ++++++++++++ source/gs-rendertarget.h | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/source/gs-rendertarget.cpp b/source/gs-rendertarget.cpp index f346147c..aa37a5f5 100644 --- a/source/gs-rendertarget.cpp +++ b/source/gs-rendertarget.cpp @@ -23,6 +23,7 @@ extern "C" { #pragma warning(push) #pragma warning(disable : 4201) +#include #include #pragma warning(pop) } @@ -35,6 +36,7 @@ gs::rendertarget::~rendertarget() } gs::rendertarget::rendertarget(gs_color_format colorFormat, gs_zstencil_format zsFormat) + : color_format(colorFormat), zstencil_format(zsFormat) { is_being_rendered = false; obs_enter_graphics(); @@ -70,6 +72,16 @@ void gs::rendertarget::get_texture(std::unique_ptr& tex) tex = std::make_unique(get_object(), false); } +gs_color_format gs::rendertarget::get_color_format() +{ + return color_format; +} + +gs_zstencil_format gs::rendertarget::get_zstencil_format() +{ + return zstencil_format; +} + gs::rendertarget_op::rendertarget_op(gs::rendertarget* rt, uint32_t width, uint32_t height) : parent(rt) { if (parent == nullptr) diff --git a/source/gs-rendertarget.h b/source/gs-rendertarget.h index 79447184..d00d61fc 100644 --- a/source/gs-rendertarget.h +++ b/source/gs-rendertarget.h @@ -37,6 +37,9 @@ namespace gs { gs_texrender_t* render_target; bool is_being_rendered; + gs_color_format color_format; + gs_zstencil_format zstencil_format; + public: ~rendertarget(); @@ -50,6 +53,10 @@ namespace gs { void get_texture(std::unique_ptr& tex); + gs_color_format get_color_format(); + + gs_zstencil_format get_zstencil_format(); + gs::rendertarget_op render(uint32_t width, uint32_t height); };