Fixes for Render2D

This commit is contained in:
Wojtek Figat
2021-02-03 21:52:49 +01:00
parent ba0f07b57e
commit 6ffa497c0a

View File

@@ -182,6 +182,8 @@ struct ClipMask
Render2D::RenderingFeatures Render2D::Features = RenderingFeatures::VertexSnapping;
namespace
{
// Private Stuff
GPUContext* Context = nullptr;
GPUTextureView* Output = nullptr;
@@ -217,6 +219,7 @@ DynamicVertexBuffer VB(RENDER2D_INITIAL_VB_CAPACITY, (uint32)sizeof(Render2DVert
DynamicIndexBuffer IB(RENDER2D_INITIAL_IB_CAPACITY, sizeof(uint32), TEXT("Render2D.IB"));
uint32 VBIndex = 0;
uint32 IBIndex = 0;
}
#define RENDER2D_WRITE_IB_QUAD(indices) \
indices[0] = VBIndex + 0; \
@@ -957,8 +960,8 @@ void DrawBatch(int32 startIndex, int32 count)
data.Bounds.Y = bounds.Y;
data.Bounds.Z = bounds.Z - bounds.X;
data.Bounds.W = bounds.W - bounds.Y;
data.InvBufferSize.X = 1.0f / renderTargetWidth;
data.InvBufferSize.Y = 1.0f / renderTargetHeight;
data.InvBufferSize.X = 1.0f / (float)renderTargetWidth;
data.InvBufferSize.Y = 1.0f / (float)renderTargetHeight;
data.SampleCount = ComputeBlurWeights(kernelSize, blurStrength, data.WeightAndOffsets);
const auto cb = GUIShader->GetShader()->GetCB(1);
Context->UpdateCB(cb, &data);
@@ -1003,11 +1006,8 @@ void DrawBatch(int32 startIndex, int32 count)
break;
}
case DrawCallType::ClipScissors:
{
Rectangle* scissorsRect = (Rectangle*)&d.AsClipScissors.X;
Context->SetScissor(*scissorsRect);
Context->SetScissor(*(Rectangle*)&d.AsClipScissors.X);
return;
}
case DrawCallType::LineAA:
Context->SetState(CurrentPso->PS_LineAA);
break;