gs-rendertarget: Allow retrieving color and zstencil format

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2018-09-27 05:23:14 +02:00
parent faeb5af45b
commit fb77cc90a6
2 changed files with 19 additions and 0 deletions

View file

@ -23,6 +23,7 @@
extern "C" { extern "C" {
#pragma warning(push) #pragma warning(push)
#pragma warning(disable : 4201) #pragma warning(disable : 4201)
#include <graphics/graphics.h>
#include <obs.h> #include <obs.h>
#pragma warning(pop) #pragma warning(pop)
} }
@ -35,6 +36,7 @@ gs::rendertarget::~rendertarget()
} }
gs::rendertarget::rendertarget(gs_color_format colorFormat, gs_zstencil_format zsFormat) gs::rendertarget::rendertarget(gs_color_format colorFormat, gs_zstencil_format zsFormat)
: color_format(colorFormat), zstencil_format(zsFormat)
{ {
is_being_rendered = false; is_being_rendered = false;
obs_enter_graphics(); obs_enter_graphics();
@ -70,6 +72,16 @@ void gs::rendertarget::get_texture(std::unique_ptr<gs::texture>& tex)
tex = std::make_unique<gs::texture>(get_object(), false); tex = std::make_unique<gs::texture>(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) gs::rendertarget_op::rendertarget_op(gs::rendertarget* rt, uint32_t width, uint32_t height) : parent(rt)
{ {
if (parent == nullptr) if (parent == nullptr)

View file

@ -37,6 +37,9 @@ namespace gs {
gs_texrender_t* render_target; gs_texrender_t* render_target;
bool is_being_rendered; bool is_being_rendered;
gs_color_format color_format;
gs_zstencil_format zstencil_format;
public: public:
~rendertarget(); ~rendertarget();
@ -50,6 +53,10 @@ namespace gs {
void get_texture(std::unique_ptr<gs::texture>& tex); void get_texture(std::unique_ptr<gs::texture>& tex);
gs_color_format get_color_format();
gs_zstencil_format get_zstencil_format();
gs::rendertarget_op render(uint32_t width, uint32_t height); gs::rendertarget_op render(uint32_t width, uint32_t height);
}; };