diff options
Diffstat (limited to 'drivers/gles2/rasterizer_gles2.cpp')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 3d75ed29f3..d84ee5a758 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -1408,6 +1408,40 @@ GLuint RasterizerGLES2::_texture_get_name(RID p_tex) { return texture->tex_id; }; +void RasterizerGLES2::texture_set_path(RID p_texture,const String& p_path) { + Texture * texture = texture_owner.get(p_texture); + ERR_FAIL_COND(!texture); + + texture->path=p_path; + +} + +String RasterizerGLES2::texture_get_path(RID p_texture) const{ + + Texture * texture = texture_owner.get(p_texture); + ERR_FAIL_COND_V(!texture,String()); + return texture->path; +} +void RasterizerGLES2::texture_debug_usage(List<VS::TextureInfo> *r_info){ + + List<RID> textures; + texture_owner.get_owned_list(&textures); + + for (List<RID>::Element *E=textures.front();E;E=E->next()) { + + Texture *t = texture_owner.get(E->get()); + if (!t) + continue; + VS::TextureInfo tinfo; + tinfo.path=t->path; + tinfo.format=t->format; + tinfo.size.x=t->alloc_width; + tinfo.size.y=t->alloc_height; + tinfo.bytes=t->total_data_size; + r_info->push_back(tinfo); + } + +} /* SHADER API */ @@ -9164,7 +9198,11 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(CanvasItemMaterial *mater glBindTexture(GL_TEXTURE_2D,framebuffer.sample_color); if (framebuffer.scale==1 && !canvas_texscreen_used) { #ifdef GLEW_ENABLED - glReadBuffer(GL_COLOR_ATTACHMENT0); + if (current_rt) { + glReadBuffer(GL_COLOR_ATTACHMENT0); + } else { + glReadBuffer(GL_BACK); + } #endif glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height); // if (current_clip) { @@ -9344,7 +9382,11 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const glBindTexture(GL_TEXTURE_2D,framebuffer.sample_color); #ifdef GLEW_ENABLED - glReadBuffer(GL_COLOR_ATTACHMENT0); + if (current_rt) { + glReadBuffer(GL_COLOR_ATTACHMENT0); + } else { + glReadBuffer(GL_BACK); + } #endif glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,w,h); // if (current_clip) { |