mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
- use a TArray in PPUniforms.
This makes the vast majority of code in that class just go away
This commit is contained in:
parent
056b2c3a80
commit
d937c50726
2 changed files with 9 additions and 37 deletions
|
@ -966,11 +966,11 @@ void FGLRenderBuffers::RenderEffect(const FString &name)
|
|||
auto &shader = GLShaders[step.ShaderName];
|
||||
|
||||
// Set uniforms
|
||||
if (step.Uniforms.Size > 0)
|
||||
if (step.Uniforms.Data.Size() > 0)
|
||||
{
|
||||
if (!shader->Uniforms)
|
||||
shader->Uniforms.reset(screen->CreateDataBuffer(POSTPROCESS_BINDINGPOINT, false));
|
||||
shader->Uniforms->SetData(step.Uniforms.Size, step.Uniforms.Data);
|
||||
shader->Uniforms->SetData(step.Uniforms.Data.Size(), step.Uniforms.Data.Data());
|
||||
shader->Uniforms->BindBase();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,12 +38,7 @@ public:
|
|||
|
||||
PPUniforms(const PPUniforms &src)
|
||||
{
|
||||
if (src.Size > 0)
|
||||
{
|
||||
Data = new uint8_t[src.Size];
|
||||
Size = src.Size;
|
||||
memcpy(Data, src.Data, Size);
|
||||
}
|
||||
Data = src.Data;
|
||||
}
|
||||
|
||||
~PPUniforms()
|
||||
|
@ -53,49 +48,26 @@ public:
|
|||
|
||||
PPUniforms &operator=(const PPUniforms &src)
|
||||
{
|
||||
if (this != &src)
|
||||
{
|
||||
if (src.Size > 0)
|
||||
{
|
||||
Data = new uint8_t[src.Size];
|
||||
Size = src.Size;
|
||||
memcpy(Data, src.Data, Size);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete[] Data;
|
||||
Data = nullptr;
|
||||
Size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Data = src.Data;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
delete[] Data;
|
||||
Data = nullptr;
|
||||
Size = 0;
|
||||
Data.Clear();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Set(const T &v)
|
||||
{
|
||||
if (Size != (int)sizeof(T))
|
||||
if (Data.Size() != (int)sizeof(T))
|
||||
{
|
||||
delete[] Data;
|
||||
Data = nullptr;
|
||||
Size = 0;
|
||||
|
||||
Data = new uint8_t[sizeof(T)];
|
||||
Size = sizeof(T);
|
||||
memcpy(Data, &v, Size);
|
||||
Data.Resize(sizeof(T));
|
||||
memcpy(Data.Data(), &v, Data.Size());
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t *Data = nullptr;
|
||||
int Size = 0;
|
||||
TArray<uint8_t> Data;
|
||||
};
|
||||
|
||||
class PPStep
|
||||
|
|
Loading…
Reference in a new issue