mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 06:12:19 +00:00
- fixed: The viewpoint buffer was mapped write only but read from. On old hardware it wasn't even mapped.
Changed to cache the needed value in a CPU-side array so that the buffer access is not needed.
This commit is contained in:
parent
0e6af71376
commit
dd971805af
2 changed files with 5 additions and 2 deletions
|
@ -41,6 +41,7 @@ GLViewpointBuffer::GLViewpointBuffer()
|
|||
Allocate();
|
||||
Clear();
|
||||
mLastMappedIndex = UINT_MAX;
|
||||
mClipPlaneInfo.Push(0);
|
||||
}
|
||||
|
||||
GLViewpointBuffer::~GLViewpointBuffer()
|
||||
|
@ -121,10 +122,9 @@ int GLViewpointBuffer::Bind(unsigned int index)
|
|||
glBindBufferRange(GL_UNIFORM_BUFFER, VIEWPOINT_BINDINGPOINT, mBufferId, index * mBlockAlign, mBlockAlign);
|
||||
|
||||
// Update the viewpoint-related clip plane setting.
|
||||
auto *vp = (HWViewpointUniforms*)(((char*)mBufferPointer) + mUploadIndex * mBlockAlign);
|
||||
if (!(gl.flags & RFL_NO_CLIP_PLANES))
|
||||
{
|
||||
if (index > 0 && (vp->mClipHeightDirection != 0.f || vp->mClipLine.X > -10000000.0f))
|
||||
if (mClipPlaneInfo[index])
|
||||
{
|
||||
glEnable(GL_CLIP_DISTANCE0);
|
||||
}
|
||||
|
@ -162,6 +162,7 @@ int GLViewpointBuffer::SetViewpoint(HWViewpointUniforms *vp)
|
|||
memcpy(((char*)mBufferPointer) + mUploadIndex * mBlockAlign, vp, sizeof(*vp));
|
||||
Unmap();
|
||||
|
||||
mClipPlaneInfo.Push(vp->mClipHeightDirection != 0.f || vp->mClipLine.X > -10000000.0f);
|
||||
return Bind(mUploadIndex++);
|
||||
}
|
||||
|
||||
|
@ -169,5 +170,6 @@ void GLViewpointBuffer::Clear()
|
|||
{
|
||||
// Index 0 is reserved for the 2D projection.
|
||||
mUploadIndex = 1;
|
||||
mClipPlaneInfo.Resize(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ class GLViewpointBuffer
|
|||
unsigned int mLastMappedIndex;
|
||||
unsigned int mByteSize;
|
||||
void * mBufferPointer;
|
||||
TArray<bool> mClipPlaneInfo;
|
||||
|
||||
unsigned int m2DWidth = ~0u, m2DHeight = ~0u;
|
||||
|
||||
|
|
Loading…
Reference in a new issue