Allow plugins to query if a texture is ready to render

This commit is contained in:
Brad Davis 2016-08-05 17:14:57 -07:00
parent a4c5c7bc16
commit f8690867d3
2 changed files with 8 additions and 0 deletions
libraries/gpu-gl/src/gpu/gl

View file

@ -163,6 +163,7 @@ public:
virtual GLuint getFramebufferID(const FramebufferPointer& framebuffer) const = 0;
virtual GLuint getTextureID(const TexturePointer& texture, bool needTransfer = true) const = 0;
virtual bool isTextureReady(const TexturePointer& texture) const;
virtual void releaseBuffer(GLuint id, Size size) const;
virtual void releaseTexture(GLuint id, Size size) const;

View file

@ -14,6 +14,13 @@
using namespace gpu;
using namespace gpu::gl;
bool GLBackend::isTextureReady(const TexturePointer& texture) const {
// DO not transfer the texture, this call is expected for rendering texture
GLTexture* object = syncGPUObject(texture, true);
return object && object->isReady();
}
void GLBackend::do_generateTextureMips(Batch& batch, size_t paramOffset) {
TexturePointer resourceTexture = batch._textures.get(batch._params[paramOffset + 0]._uint);
if (!resourceTexture) {