mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +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();
|
Allocate();
|
||||||
Clear();
|
Clear();
|
||||||
mLastMappedIndex = UINT_MAX;
|
mLastMappedIndex = UINT_MAX;
|
||||||
|
mClipPlaneInfo.Push(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLViewpointBuffer::~GLViewpointBuffer()
|
GLViewpointBuffer::~GLViewpointBuffer()
|
||||||
|
@ -121,10 +122,9 @@ int GLViewpointBuffer::Bind(unsigned int index)
|
||||||
glBindBufferRange(GL_UNIFORM_BUFFER, VIEWPOINT_BINDINGPOINT, mBufferId, index * mBlockAlign, mBlockAlign);
|
glBindBufferRange(GL_UNIFORM_BUFFER, VIEWPOINT_BINDINGPOINT, mBufferId, index * mBlockAlign, mBlockAlign);
|
||||||
|
|
||||||
// Update the viewpoint-related clip plane setting.
|
// Update the viewpoint-related clip plane setting.
|
||||||
auto *vp = (HWViewpointUniforms*)(((char*)mBufferPointer) + mUploadIndex * mBlockAlign);
|
|
||||||
if (!(gl.flags & RFL_NO_CLIP_PLANES))
|
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);
|
glEnable(GL_CLIP_DISTANCE0);
|
||||||
}
|
}
|
||||||
|
@ -162,6 +162,7 @@ int GLViewpointBuffer::SetViewpoint(HWViewpointUniforms *vp)
|
||||||
memcpy(((char*)mBufferPointer) + mUploadIndex * mBlockAlign, vp, sizeof(*vp));
|
memcpy(((char*)mBufferPointer) + mUploadIndex * mBlockAlign, vp, sizeof(*vp));
|
||||||
Unmap();
|
Unmap();
|
||||||
|
|
||||||
|
mClipPlaneInfo.Push(vp->mClipHeightDirection != 0.f || vp->mClipLine.X > -10000000.0f);
|
||||||
return Bind(mUploadIndex++);
|
return Bind(mUploadIndex++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,5 +170,6 @@ void GLViewpointBuffer::Clear()
|
||||||
{
|
{
|
||||||
// Index 0 is reserved for the 2D projection.
|
// Index 0 is reserved for the 2D projection.
|
||||||
mUploadIndex = 1;
|
mUploadIndex = 1;
|
||||||
|
mClipPlaneInfo.Resize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ class GLViewpointBuffer
|
||||||
unsigned int mLastMappedIndex;
|
unsigned int mLastMappedIndex;
|
||||||
unsigned int mByteSize;
|
unsigned int mByteSize;
|
||||||
void * mBufferPointer;
|
void * mBufferPointer;
|
||||||
|
TArray<bool> mClipPlaneInfo;
|
||||||
|
|
||||||
unsigned int m2DWidth = ~0u, m2DHeight = ~0u;
|
unsigned int m2DWidth = ~0u, m2DHeight = ~0u;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue