Refactor material shaders to use separate constant buffer (slot 1) for shared per-view constants

This commit is contained in:
Wojtek Figat
2022-11-27 12:06:31 +01:00
parent 189575efec
commit 835a230323
26 changed files with 92 additions and 194 deletions

View File

@@ -12,17 +12,9 @@
#include "Engine/Renderer/DrawCall.h"
PACK_STRUCT(struct DecalMaterialShaderData {
Matrix ViewProjectionMatrix;
Matrix WorldMatrix;
Matrix ViewMatrix;
Matrix InvWorld;
Matrix SVPositionToWorld;
Float3 ViewPos;
float ViewFar;
Float3 ViewDir;
float TimeParam;
Float4 ViewInfo;
Float4 ScreenSize;
});
DrawPass DecalMaterialShader::GetDrawModes() const
@@ -58,15 +50,7 @@ void DecalMaterialShader::Bind(BindParameters& params)
// Setup material constants
{
Matrix::Transpose(view.Frustum.GetMatrix(), materialData->ViewProjectionMatrix);
Matrix::Transpose(drawCall.World, materialData->WorldMatrix);
Matrix::Transpose(view.View, materialData->ViewMatrix);
materialData->ViewPos = view.Position;
materialData->ViewFar = view.Far;
materialData->ViewDir = view.Direction;
materialData->TimeParam = params.TimeParam;
materialData->ViewInfo = view.ViewInfo;
materialData->ScreenSize = view.ScreenSize;
// Matrix for transformation from world space to decal object space
Matrix invWorld;