mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-29 16:31:43 +00:00
- backend upate from GZDoom
* Vulkan SDK and dependencies updated. * better interface for buffers in the render backend.
This commit is contained in:
parent
509124c1dd
commit
9071949a46
65 changed files with 19806 additions and 5422 deletions
|
@ -46,6 +46,14 @@ struct FVertexBufferAttribute
|
|||
int offset;
|
||||
};
|
||||
|
||||
enum class BufferUsageType
|
||||
{
|
||||
Static, // initial data is not null, staticdata is true
|
||||
Stream, // initial data is not null, staticdata is false
|
||||
Persistent, // initial data is null, staticdata is false
|
||||
Mappable // initial data is null, staticdata is true
|
||||
};
|
||||
|
||||
class IBuffer
|
||||
{
|
||||
protected:
|
||||
|
@ -57,7 +65,7 @@ public:
|
|||
IBuffer &operator=(const IBuffer &) = delete;
|
||||
virtual ~IBuffer() = default;
|
||||
|
||||
virtual void SetData(size_t size, const void *data, bool staticdata = true) = 0;
|
||||
virtual void SetData(size_t size, const void *data, BufferUsageType type) = 0;
|
||||
virtual void SetSubData(size_t offset, size_t size, const void *data) = 0;
|
||||
virtual void *Lock(unsigned int size) = 0;
|
||||
virtual void Unlock() = 0;
|
||||
|
|
|
@ -81,7 +81,7 @@ FFlatVertexBuffer::FFlatVertexBuffer(int width, int height, int pipelineNbr):
|
|||
|
||||
mIndexBuffer = screen->CreateIndexBuffer();
|
||||
int data[4] = {};
|
||||
mIndexBuffer->SetData(4, data); // On Vulkan this may not be empty, so set some dummy defaults to avoid crashes.
|
||||
mIndexBuffer->SetData(4, data, BufferUsageType::Static); // On Vulkan this may not be empty, so set some dummy defaults to avoid crashes.
|
||||
|
||||
|
||||
for (int n = 0; n < mPipelineNbr; n++)
|
||||
|
@ -89,7 +89,7 @@ FFlatVertexBuffer::FFlatVertexBuffer(int width, int height, int pipelineNbr):
|
|||
mVertexBufferPipeline[n] = screen->CreateVertexBuffer();
|
||||
|
||||
unsigned int bytesize = BUFFER_SIZE * sizeof(FFlatVertex);
|
||||
mVertexBufferPipeline[n]->SetData(bytesize, nullptr, false);
|
||||
mVertexBufferPipeline[n]->SetData(bytesize, nullptr, BufferUsageType::Persistent);
|
||||
|
||||
static const FVertexBufferAttribute format[] = {
|
||||
{ 0, VATTR_VERTEX, VFmt_Float3, (int)myoffsetof(FFlatVertex, x) },
|
||||
|
|
|
@ -64,7 +64,7 @@ FLightBuffer::FLightBuffer(int pipelineNbr):
|
|||
for (int n = 0; n < mPipelineNbr; n++)
|
||||
{
|
||||
mBufferPipeline[n] = screen->CreateDataBuffer(LIGHTBUF_BINDINGPOINT, mBufferType, false);
|
||||
mBufferPipeline[n]->SetData(mByteSize, nullptr, false);
|
||||
mBufferPipeline[n]->SetData(mByteSize, nullptr, BufferUsageType::Persistent);
|
||||
}
|
||||
|
||||
Clear();
|
||||
|
|
|
@ -117,7 +117,7 @@ void IShadowMap::UploadLights()
|
|||
if (mLightList == nullptr)
|
||||
mLightList = screen->CreateDataBuffer(LIGHTLIST_BINDINGPOINT, true, false);
|
||||
|
||||
mLightList->SetData(sizeof(float) * mLights.Size(), &mLights[0]);
|
||||
mLightList->SetData(sizeof(float) * mLights.Size(), &mLights[0], BufferUsageType::Stream);
|
||||
}
|
||||
|
||||
|
||||
|
@ -129,11 +129,11 @@ void IShadowMap::UploadAABBTree()
|
|||
|
||||
if (!mNodesBuffer)
|
||||
mNodesBuffer = screen->CreateDataBuffer(LIGHTNODES_BINDINGPOINT, true, false);
|
||||
mNodesBuffer->SetData(mAABBTree->NodesSize(), mAABBTree->Nodes());
|
||||
mNodesBuffer->SetData(mAABBTree->NodesSize(), mAABBTree->Nodes(), BufferUsageType::Static);
|
||||
|
||||
if (!mLinesBuffer)
|
||||
mLinesBuffer = screen->CreateDataBuffer(LIGHTLINES_BINDINGPOINT, true, false);
|
||||
mLinesBuffer->SetData(mAABBTree->LinesSize(), mAABBTree->Lines());
|
||||
mLinesBuffer->SetData(mAABBTree->LinesSize(), mAABBTree->Lines(), BufferUsageType::Static);
|
||||
}
|
||||
else if (mAABBTree->Update())
|
||||
{
|
||||
|
|
|
@ -130,7 +130,7 @@ FSkyVertexBuffer::FSkyVertexBuffer()
|
|||
{ 0, VATTR_COLOR, VFmt_Byte4, (int)myoffsetof(FSkyVertex, color) }
|
||||
};
|
||||
mVertexBuffer->SetFormat(1, 3, sizeof(FSkyVertex), format);
|
||||
mVertexBuffer->SetData(mVertices.Size() * sizeof(FSkyVertex), &mVertices[0], true);
|
||||
mVertexBuffer->SetData(mVertices.Size() * sizeof(FSkyVertex), &mVertices[0], BufferUsageType::Static);
|
||||
}
|
||||
|
||||
FSkyVertexBuffer::~FSkyVertexBuffer()
|
||||
|
|
|
@ -43,7 +43,7 @@ HWViewpointBuffer::HWViewpointBuffer(int pipelineNbr):
|
|||
for (int n = 0; n < mPipelineNbr; n++)
|
||||
{
|
||||
mBufferPipeline[n] = screen->CreateDataBuffer(VIEWPOINT_BINDINGPOINT, false, true);
|
||||
mBufferPipeline[n]->SetData(mByteSize, nullptr, false);
|
||||
mBufferPipeline[n]->SetData(mByteSize, nullptr, BufferUsageType::Persistent);
|
||||
}
|
||||
|
||||
Clear();
|
||||
|
|
|
@ -129,7 +129,7 @@ public:
|
|||
void SetData()
|
||||
{
|
||||
if (mBuffer != nullptr)
|
||||
mBuffer->SetData(sizeof(T), &Values);
|
||||
mBuffer->SetData(sizeof(T), &Values, BufferUsageType::Static);
|
||||
}
|
||||
|
||||
IDataBuffer* GetBuffer() const
|
||||
|
|
|
@ -894,7 +894,7 @@ void PPShadowMap::Update(PPRenderState* renderstate)
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CVAR(Bool, gl_custompost, true, 0)
|
||||
CVAR(Bool, gl_custompost, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
|
||||
void PPCustomShaders::Run(PPRenderState *renderstate, FString target)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue