X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Frendertarget.cpp;h=f2f12d50c441fc70cf2439a025057dac13ff4b05;hb=328b67fa59ce6736949732ea8ff4ef7c6675e200;hp=5c4cc20ffdcbd05c477eacde748fb2a8a3170c8a;hpb=87f7273a6a7979d07d954de601cb826f97d2e447;p=libs%2Fgl.git diff --git a/source/render/rendertarget.cpp b/source/render/rendertarget.cpp index 5c4cc20f..f2f12d50 100644 --- a/source/render/rendertarget.cpp +++ b/source/render/rendertarget.cpp @@ -1,4 +1,5 @@ #include +#include #include "error.h" #include "renderbuffer.h" #include "rendertarget.h" @@ -147,15 +148,10 @@ void RenderTarget::init(unsigned w, unsigned h, unsigned s, const RenderTargetFo { tgt.texture = new Texture2D; tgt.texture->storage(pf, width, height, 1); - Sampler &sampler = tgt.texture->get_default_sampler(); - sampler.set_filter(NEAREST); - sampler.set_wrap(CLAMP_TO_EDGE); fbo.attach(att, *tgt.texture); } buffers.push_back(tgt); } - - fbo.require_complete(); } RenderTarget::~RenderTarget() @@ -169,15 +165,6 @@ RenderTarget::~RenderTarget() } } -void RenderTarget::set_texture_filter(TextureFilter filt) -{ - if(!samples) - { - for(vector::iterator i=buffers.begin(); i!=buffers.end(); ++i) - i->texture->get_default_sampler().set_filter(filt); - } -} - const Texture2D &RenderTarget::get_target_texture(unsigned i) const { if(i>=buffers.size()) @@ -197,9 +184,29 @@ const Texture2D &RenderTarget::get_target_texture(RenderOutput o) const return get_target_texture(index); } -void RenderTarget::blit_from(const RenderTarget &other) +void RenderTarget::set_debug_name(const string &name) { - fbo.blit_from(other.fbo, COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT, false); +#ifdef DEBUG + fbo.set_debug_name(name+" [FBO]"); + unsigned i = 0; + for(const unsigned char *j=format.begin(); j!=format.end(); ++i, ++j) + { + unsigned type = get_output_type(*j); + + string buf_name; + if(type>=get_output_type(RENDER_DEPTH)) + buf_name = name+"/depth"; + else + buf_name = Msp::format("%s/color%d", name, type); + + if(samples) + buffers[i].buffer->set_debug_name(buf_name+".rbuf"); + else + buffers[i].texture->set_debug_name(buf_name+".tex2d"); + } +#else + (void)name; +#endif } } // namespace GL