Refactor engine to support double-precision vectors

This commit is contained in:
Wojtek Figat
2022-06-13 00:40:32 +02:00
parent f82e370392
commit a881c90b2e
744 changed files with 19062 additions and 12467 deletions

View File

@@ -21,15 +21,15 @@ PACK_STRUCT(struct Data {
GBufferData GBuffer;
Matrix CurrentVP;
Matrix PreviousVP;
Vector4 TemporalAAJitter;
Float4 TemporalAAJitter;
float VelocityScale;
float Dummy0;
int32 MaxBlurSamples;
uint32 VariableTileLoopCount;
Vector2 Input0SizeInv;
Vector2 Input2SizeInv;
Float2 Input0SizeInv;
Float2 Input2SizeInv;
});
MotionBlurPass::MotionBlurPass()
@@ -297,7 +297,7 @@ void MotionBlurPass::Render(RenderContext& renderContext, GPUTexture*& input, GP
data.VelocityScale = settings.Scale * 0.5f * timeScale; // 2x samples in loop
data.MaxBlurSamples = Math::Clamp(settings.SampleCount / 2, 1, 64); // 2x samples in loop
data.VariableTileLoopCount = tileSize / 8;
data.Input0SizeInv = Vector2(1.0f / (float)motionVectorsWidth, 1.0f / (float)motionVectorsWidth);
data.Input0SizeInv = Float2(1.0f / (float)motionVectorsWidth, 1.0f / (float)motionVectorsWidth);
const auto cb = _shader->GetShader()->GetCB(0);
context->UpdateCB(cb, &data);
context->BindCB(0, cb);
@@ -319,7 +319,7 @@ void MotionBlurPass::Render(RenderContext& renderContext, GPUTexture*& input, GP
context->SetRenderTarget(vMaxBuffer4->View());
context->SetViewportAndScissors((float)rtDesc.Width, (float)rtDesc.Height);
context->BindSR(0, vMaxBuffer2->View());
data.Input0SizeInv = Vector2(1.0f / (float)vMaxBuffer2->Width(), 1.0f / (float)vMaxBuffer2->Height());
data.Input0SizeInv = Float2(1.0f / (float)vMaxBuffer2->Width(), 1.0f / (float)vMaxBuffer2->Height());
context->UpdateCB(cb, &data);
context->SetState(_psTileMax);
context->DrawFullscreenTriangle();
@@ -333,7 +333,7 @@ void MotionBlurPass::Render(RenderContext& renderContext, GPUTexture*& input, GP
context->SetRenderTarget(vMaxBuffer8->View());
context->SetViewportAndScissors((float)rtDesc.Width, (float)rtDesc.Height);
context->BindSR(0, vMaxBuffer4->View());
data.Input0SizeInv = Vector2(1.0f / (float)vMaxBuffer4->Width(), 1.0f / (float)vMaxBuffer4->Height());
data.Input0SizeInv = Float2(1.0f / (float)vMaxBuffer4->Width(), 1.0f / (float)vMaxBuffer4->Height());
context->UpdateCB(cb, &data);
context->SetState(_psTileMax);
context->DrawFullscreenTriangle();
@@ -347,7 +347,7 @@ void MotionBlurPass::Render(RenderContext& renderContext, GPUTexture*& input, GP
context->SetRenderTarget(vMaxBuffer->View());
context->SetViewportAndScissors((float)rtDesc.Width, (float)rtDesc.Height);
context->BindSR(0, vMaxBuffer8->View());
data.Input0SizeInv = Vector2(1.0f / (float)vMaxBuffer8->Width(), 1.0f / (float)vMaxBuffer8->Height());
data.Input0SizeInv = Float2(1.0f / (float)vMaxBuffer8->Width(), 1.0f / (float)vMaxBuffer8->Height());
context->UpdateCB(cb, &data);
context->SetState(_psTileMaxVariable);
context->DrawFullscreenTriangle();
@@ -370,8 +370,8 @@ void MotionBlurPass::Render(RenderContext& renderContext, GPUTexture*& input, GP
context->BindSR(1, motionVectors->View());
context->BindSR(2, vMaxNeighborBuffer->View());
context->BindSR(3, renderContext.Buffers->DepthBuffer->View());
data.Input0SizeInv = Vector2(1.0f / (float)input->Width(), 1.0f / (float)input->Height());
data.Input2SizeInv = Vector2(1.0f / (float)renderContext.Buffers->DepthBuffer->Width(), 1.0f / (float)renderContext.Buffers->DepthBuffer->Height());
data.Input0SizeInv = Float2(1.0f / (float)input->Width(), 1.0f / (float)input->Height());
data.Input2SizeInv = Float2(1.0f / (float)renderContext.Buffers->DepthBuffer->Width(), 1.0f / (float)renderContext.Buffers->DepthBuffer->Height());
context->UpdateCB(cb, &data);
context->SetState(_psMotionBlur);
context->DrawFullscreenTriangle();