gl-render-manager: Need to actually bind newly created textures.

This commit is contained in:
Henrik Rydgård 2017-12-14 16:08:55 +01:00
parent 8a1e7347b9
commit 9094410fd1
3 changed files with 40 additions and 18 deletions

View File

@ -690,6 +690,8 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry, bool replaceImag
}
// This will rebind it, but that's okay.
// Need to actually bind it now - it might only have gotten bound in the init phase.
render_->BindTexture(0, entry->textureName);
UpdateSamplingParams(*entry, true);
}

View File

@ -337,25 +337,31 @@ void GLQueueRunner::LogSteps(const std::vector<GLRStep *> &steps) {
void GLQueueRunner::PerformBlit(const GLRStep &step) {
/*
// Without FBO_ARB / GLES3, this will collide with bind_for_read, but there's nothing
// in ES 2.0 that actually separate them anyway of course, so doesn't matter.
fbo_bind_fb_target(false, dst->handle);
fbo_bind_fb_target(true, src->handle);
if (gl_extensions.GLES3 || gl_extensions.ARB_framebuffer_object) {
glBlitFramebuffer(srcX1, srcY1, srcX2, srcY2, dstX1, dstY1, dstX2, dstY2, aspect, linearFilter == FB_BLIT_LINEAR ? GL_LINEAR : GL_NEAREST);
CHECK_GL_ERROR_IF_DEBUG();
#if defined(USING_GLES2) && defined(__ANDROID__) // We only support this extension on Android, it's not even available on PC.
return true;
} else if (gl_extensions.NV_framebuffer_blit) {
glBlitFramebufferNV(srcX1, srcY1, srcX2, srcY2, dstX1, dstY1, dstX2, dstY2, aspect, linearFilter == FB_BLIT_LINEAR ? GL_LINEAR : GL_NEAREST);
CHECK_GL_ERROR_IF_DEBUG();
#endif // defined(USING_GLES2) && defined(__ANDROID__)
return true;
} else {
return false;
}*/
fbo_bind_fb_target(false, step.blit.dst->handle);
fbo_bind_fb_target(true, step.blit.src->handle);
int srcX1 = step.blit.srcRect.x;
int srcY1 = step.blit.srcRect.y;
int srcX2 = step.blit.srcRect.x + step.blit.srcRect.w;
int srcY2 = step.blit.srcRect.y + step.blit.srcRect.h;
int dstX1 = step.blit.dstRect.x;
int dstY1 = step.blit.dstRect.y;
int dstX2 = step.blit.dstRect.x + step.blit.dstRect.w;
int dstY2 = step.blit.dstRect.y + step.blit.dstRect.h;
if (gl_extensions.GLES3 || gl_extensions.ARB_framebuffer_object) {
glBlitFramebuffer(srcX1, srcY1, srcX2, srcY2, dstX1, dstY1, dstX2, dstY2, step.blit.aspectMask, step.blit.filter ? GL_LINEAR : GL_NEAREST);
CHECK_GL_ERROR_IF_DEBUG();
#if defined(USING_GLES2) && defined(__ANDROID__) // We only support this extension on Android, it's not even available on PC.
} else if (gl_extensions.NV_framebuffer_blit) {
glBlitFramebufferNV(srcX1, srcY1, srcX2, srcY2, dstX1, dstY1, dstX2, dstY2, step.blit.aspectMask, step.blit.filter ? GL_LINEAR : GL_NEAREST);
CHECK_GL_ERROR_IF_DEBUG();
#endif // defined(USING_GLES2) && defined(__ANDROID__)
} else {
ERROR_LOG(G3D, "GLQueueRunner: Tried to blit without the capability");
}
}
void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
@ -367,6 +373,11 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
PerformBindFramebufferAsRenderTarget(step);
glDisable(GL_SCISSOR_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_STENCIL_TEST);
glDisable(GL_BLEND);
glDisable(GL_CULL_FACE);
glEnable(GL_SCISSOR_TEST);
/*
@ -681,7 +692,9 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
glBindVertexArray(0);
glDisable(GL_SCISSOR_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_STENCIL_TEST);
glDisable(GL_BLEND);
glDisable(GL_CULL_FACE);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}

View File

@ -200,13 +200,19 @@ void GLRenderManager::CopyFramebuffer(GLRFramebuffer *src, GLRect2D srcRect, GLR
step->copy.dstPos = dstPos;
step->copy.src = src;
step->copy.dst = dst;
step->copy.dstPos = dstPos;
step->copy.aspectMask = aspectMask;
steps_.push_back(step);
}
void GLRenderManager::BlitFramebuffer(GLRFramebuffer *src, GLRect2D srcRect, GLRFramebuffer *dst, GLRect2D dstRect, int aspectMask, bool filter) {
Crash();
GLRStep * step = new GLRStep{ GLRStepType::BLIT };
step->blit.srcRect = srcRect;
step->blit.dstRect = dstRect;
step->blit.src = src;
step->blit.dst = dst;
step->blit.aspectMask = aspectMask;
step->blit.filter = filter;
steps_.push_back(step);
}
void GLRenderManager::BeginFrame() {
@ -229,6 +235,7 @@ void GLRenderManager::BeginFrame() {
// vkWaitForFences(device, 1, &frameData.fence, true, UINT64_MAX);
// vkResetFences(device, 1, &frameData.fence);
// glFenceSync(...)
// Must be after the fence - this performs deletes.
VLOG("PUSH: BeginFrame %d", curFrame);