[Fixed] Freeze when loading Spooktober MAP09

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Re: Freeze when loading Spooktober MAP09

Postby dpJudas » Sun May 05, 2019 2:33 am

That's an artifact of a decade old hack in GZD. The render to texture implementation in the OpenGL backend always used the existing frame buffer zbuffer. As this varies in size it effectively meant only smaller texture sizes actually works, but nobody officially put a limit to what that size is - i.e. on a 1920x1080 monitor the max camtex size is 1080. The line you pasted puts the formal size limit to a 1024x1024 texture.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Freeze when loading Spooktober MAP09

Postby Graf Zahl » Sun May 05, 2019 2:41 am

Really? I thought I had this changed when transitioning the camtex rendering to an external frame buffer to create a dedicated depth buffer for the texture.

Code: Select allExpand view
//===========================================================================
//
//   Creates a depth buffer for this texture
//
//===========================================================================

int FHardwareTexture::GetDepthBuffer(int width, int height)
{
   if (glDepthID == 0)
   {
      glGenRenderbuffers(1, &glDepthID);
      glBindRenderbuffer(GL_RENDERBUFFER, glDepthID);
      glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
         GetTexDimension(width), GetTexDimension(height));
      glBindRenderbuffer(GL_RENDERBUFFER, 0);
   }
   return glDepthID;
}


//===========================================================================
//
//   Binds this texture's surfaces to the current framrbuffer
//
//===========================================================================

void FHardwareTexture::BindToFrameBuffer(int width, int height)
{
   width = GetTexDimension(width);
   height = GetTexDimension(height);
   glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, glTexID, 0);
   glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, GetDepthBuffer(width, height));
   glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, GetDepthBuffer(width, height));
}
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Freeze when loading Spooktober MAP09

Postby dpJudas » Sun May 05, 2019 2:48 am

Okay, so maybe I was wrong about the OpenGL backend. :)

I can move the allocation to VkHardwareTexture like that, but using a depth buffer for each individual camtex texture seems a bit wasteful though. I guess it comes down to what the typical size of a camtexture is anyway. What decides this? The modder?
dpJudas
 
 
 
Joined: 28 May 2016

Re: Freeze when loading Spooktober MAP09

Postby Graf Zahl » Sun May 05, 2019 3:01 am

dpJudas wrote:Okay, so maybe I was wrong about the OpenGL backend. :)


Originally the camera texture was rendered into the main framebuffer, because when the feature was invented, framebuffers weren't universally available and even if they were, were slower on most hardware out there. So the restriction surely existed at some point in time.

I can move the allocation to VkHardwareTexture like that, but using a depth buffer for each individual camtex texture seems a bit wasteful though. I guess it comes down to what the typical size of a camtexture is anyway. What decides this? The modder?



Yes, the modder. But you can do some analysis on what is needed yourself by scanning through all the textures, see which one is a camera texture and collect the maximum size in both dimensions. For OpenGL this buffer separation was unfortunately necessary because of their idiotic framebuffer-completeness specs and how drivers implement it. At least back in the day it just didn't work to share this buffer.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Previous

Return to Closed Bugs

Who is online

Users browsing this forum: XxMiltenXx and 4 guests