Freeze when loading Spooktober MAP09
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Re: Freeze when loading Spooktober MAP09
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Freeze when loading Spooktober MAP09
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 all
//===========================================================================
//
// 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));
}
Re: Freeze when loading Spooktober MAP09
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?
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?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Freeze when loading Spooktober MAP09
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.dpJudas wrote: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?
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.