- reworked buffer binding logic.
This shouldn't be in the hardware independent interface because the semantics on OpenGL and Vulkan are too different, so a common implementation is not possible. Most bind calls were in the GL interface anyway, so these no longer pass through hardware independent code. This also moves the bind calls in the shadowmap code into the GL interface - these never did anything useful in Vulkan and aren't needed there. Last but not least, this moves the legacy buffer binding handling into FGLRenderState and performs the initial binding for the light buffer in a more suitable place so that this doesn't have to pollute the render state.
This commit is contained in:
parent
6af77b25c0
commit
037b69c8a7
20 changed files with 65 additions and 65 deletions
|
|
@ -3,6 +3,8 @@
|
|||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
|
||||
class FRenderState;
|
||||
|
||||
// The low level code needs to know which attributes exist.
|
||||
// OpenGL needs to change the state of all of them per buffer binding.
|
||||
// VAOs are mostly useless for this because they lump buffer and binding state together which the model code does not want.
|
||||
|
|
@ -76,7 +78,6 @@ class IDataBuffer : virtual public IBuffer
|
|||
{
|
||||
// Can be either uniform or shader storage buffer, depending on its needs.
|
||||
public:
|
||||
virtual void BindRange(size_t start, size_t length) = 0;
|
||||
virtual void BindBase() = 0;
|
||||
virtual void BindRange(FRenderState *state, size_t start, size_t length) = 0;
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ int GLViewpointBuffer::Bind(FRenderState &di, unsigned int index)
|
|||
if (index != mLastMappedIndex)
|
||||
{
|
||||
mLastMappedIndex = index;
|
||||
mBuffer->BindRange(index * mBlockAlign, mBlockAlign);
|
||||
mBuffer->BindRange(&di, index * mBlockAlign, mBlockAlign);
|
||||
di.EnableClipDistance(0, mClipPlaneInfo[index]);
|
||||
}
|
||||
return index;
|
||||
|
|
|
|||
|
|
@ -126,14 +126,16 @@ public:
|
|||
mBuffer = screen->CreateDataBuffer(bindingpoint, false, false);
|
||||
}
|
||||
|
||||
void Set(bool bind = true)
|
||||
void SetData()
|
||||
{
|
||||
if (mBuffer != nullptr)
|
||||
mBuffer->SetData(sizeof(T), &Values);
|
||||
}
|
||||
|
||||
// Let's hope this can be done better when things have moved further ahead.
|
||||
// This really is not the best place to add something that depends on API behavior.
|
||||
if (bind) mBuffer->BindBase();
|
||||
IDataBuffer* GetBuffer() const
|
||||
{
|
||||
// OpenGL needs to mess around with this in ways that should not be part of the interface.
|
||||
return mBuffer;
|
||||
}
|
||||
|
||||
T *operator->() { return &Values; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue