Add constant buffers alignment for data structures (16-byte boundaries)

This commit is contained in:
Wojtek Figat
2024-05-23 13:58:46 +02:00
parent 91aa5a0fb9
commit 206ff89587
38 changed files with 54 additions and 49 deletions

View File

@@ -125,7 +125,7 @@ PACK_STRUCT(struct Vertex {
Color32 Color; Color32 Color;
}); });
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
Matrix ViewProjection; Matrix ViewProjection;
Float2 Padding; Float2 Padding;
float ClipPosZBias; float ClipPosZBias;

View File

@@ -28,6 +28,9 @@
// Maximum amount of thread groups per dimension for compute dispatch // Maximum amount of thread groups per dimension for compute dispatch
#define GPU_MAX_CS_DISPATCH_THREAD_GROUPS 65535 #define GPU_MAX_CS_DISPATCH_THREAD_GROUPS 65535
// Alignment of the shader data structures (16-byte boundaries) to improve memory copies efficiency.
#define GPU_SHADER_DATA_ALIGNMENT 16
// Enable/disable assertion for graphics layers // Enable/disable assertion for graphics layers
#define GPU_ENABLE_ASSERTION 1 #define GPU_ENABLE_ASSERTION 1

View File

@@ -2,6 +2,7 @@
#pragma once #pragma once
#include "Config.h"
#include "PixelFormat.h" #include "PixelFormat.h"
#include "RenderView.h" #include "RenderView.h"
#include "Engine/Scripting/ScriptingType.h" #include "Engine/Scripting/ScriptingType.h"
@@ -11,7 +12,7 @@ class SkinnedModel;
struct RenderContext; struct RenderContext;
struct FloatR10G10B10A2; struct FloatR10G10B10A2;
PACK_STRUCT(struct QuadShaderData PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) QuadShaderData
{ {
Float4 Color; Float4 Color;
}); });

View File

@@ -179,7 +179,7 @@ void ExponentialHeightFog::GetExponentialHeightFogData(const RenderView& view, S
result.VolumetricFogMaxDistance = VolumetricFogDistance; result.VolumetricFogMaxDistance = VolumetricFogDistance;
} }
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
ShaderGBufferData GBuffer; ShaderGBufferData GBuffer;
ShaderExponentialHeightFogData ExponentialHeightFog; ShaderExponentialHeightFogData ExponentialHeightFog;
}); });

View File

@@ -17,7 +17,7 @@
#include "Engine/Serialization/Serialization.h" #include "Engine/Serialization/Serialization.h"
#include "Engine/Level/Scene/SceneRendering.h" #include "Engine/Level/Scene/SceneRendering.h"
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
Matrix WVP; Matrix WVP;
Float3 ViewOffset; Float3 ViewOffset;
float Padding; float Padding;

View File

@@ -13,7 +13,7 @@
#include "Engine/Graphics/Shaders/GPUShader.h" #include "Engine/Graphics/Shaders/GPUShader.h"
#include "Engine/Graphics/Shaders/GPUConstantBuffer.h" #include "Engine/Graphics/Shaders/GPUConstantBuffer.h"
PACK_STRUCT(struct GPUParticlesData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) GPUParticlesData {
Matrix ViewProjectionMatrix; Matrix ViewProjectionMatrix;
Matrix InvViewProjectionMatrix; Matrix InvViewProjectionMatrix;
Matrix InvViewMatrix; Matrix InvViewMatrix;

View File

@@ -569,7 +569,7 @@ void DrawEmitterCPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
#if COMPILE_WITH_GPU_PARTICLES #if COMPILE_WITH_GPU_PARTICLES
PACK_STRUCT(struct GPUParticlesSortingData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) GPUParticlesSortingData {
Float3 ViewPosition; Float3 ViewPosition;
uint32 ParticleCounterOffset; uint32 ParticleCounterOffset;
uint32 ParticleStride; uint32 ParticleStride;

View File

@@ -52,11 +52,11 @@
// True if enable downscaling when rendering blur // True if enable downscaling when rendering blur
const bool DownsampleForBlur = false; const bool DownsampleForBlur = false;
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
Matrix ViewProjection; Matrix ViewProjection;
}); });
PACK_STRUCT(struct BlurData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) BlurData {
Float2 InvBufferSize; Float2 InvBufferSize;
uint32 SampleCount; uint32 SampleCount;
float Dummy0; float Dummy0;

View File

@@ -19,7 +19,7 @@ class AmbientOcclusionPass : public RendererPass<AmbientOcclusionPass>
private: private:
// Packed shader constant buffer structure (this MUST match shader code) // Packed shader constant buffer structure (this MUST match shader code)
PACK_STRUCT(struct ASSAOConstants { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ASSAOConstants {
ShaderGBufferData GBuffer; ShaderGBufferData GBuffer;
Float2 ViewportPixelSize; Float2 ViewportPixelSize;

View File

@@ -7,7 +7,7 @@
#include "Engine/Graphics/Graphics.h" #include "Engine/Graphics/Graphics.h"
#include "Engine/Graphics/RenderTask.h" #include "Engine/Graphics/RenderTask.h"
PACK_STRUCT(struct Data PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data
{ {
Float4 ScreenSize; Float4 ScreenSize;
}); });

View File

@@ -15,7 +15,7 @@ class SMAA : public RendererPass<SMAA>
{ {
private: private:
PACK_STRUCT(struct Data PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data
{ {
Float4 RtSize; Float4 RtSize;
}); });

View File

@@ -11,7 +11,7 @@
#include "Engine/Renderer/GBufferPass.h" #include "Engine/Renderer/GBufferPass.h"
#include "Engine/Engine/Engine.h" #include "Engine/Engine/Engine.h"
PACK_STRUCT(struct Data PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data
{ {
Float2 ScreenSizeInv; Float2 ScreenSizeInv;
Float2 JitterInv; Float2 JitterInv;

View File

@@ -61,7 +61,7 @@ protected:
bool Run() override; bool Run() override;
}; };
PACK_STRUCT(struct Data PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data
{ {
float First; float First;
float AtmosphereR; float AtmosphereR;

View File

@@ -8,7 +8,7 @@
#include "Engine/Graphics/RenderTargetPool.h" #include "Engine/Graphics/RenderTargetPool.h"
#include "Engine/Graphics/RenderTask.h" #include "Engine/Graphics/RenderTask.h"
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
Float4 ColorSaturationShadows; Float4 ColorSaturationShadows;
Float4 ColorContrastShadows; Float4 ColorContrastShadows;
Float4 ColorGammaShadows; Float4 ColorGammaShadows;

View File

@@ -6,11 +6,12 @@
#include "Engine/Core/Math/Vector2.h" #include "Engine/Core/Math/Vector2.h"
#include "Engine/Core/Math/Vector3.h" #include "Engine/Core/Math/Vector3.h"
#include "Engine/Core/Math/Vector4.h" #include "Engine/Core/Math/Vector4.h"
#include "Engine/Graphics/Config.h"
/// <summary> /// <summary>
/// Structure that contains information about GBuffer for shaders. /// Structure that contains information about GBuffer for shaders.
/// </summary> /// </summary>
PACK_STRUCT(struct ShaderGBufferData PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ShaderGBufferData
{ {
Float4 ViewInfo; Float4 ViewInfo;
Float4 ScreenSize; Float4 ScreenSize;
@@ -23,7 +24,7 @@ PACK_STRUCT(struct ShaderGBufferData
/// <summary> /// <summary>
/// Structure that contains information about exponential height fog for shaders. /// Structure that contains information about exponential height fog for shaders.
/// </summary> /// </summary>
PACK_STRUCT(struct ShaderExponentialHeightFogData PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ShaderExponentialHeightFogData
{ {
Float3 FogInscatteringColor; Float3 FogInscatteringColor;
float FogMinOpacity; float FogMinOpacity;
@@ -48,7 +49,7 @@ PACK_STRUCT(struct ShaderExponentialHeightFogData
/// <summary> /// <summary>
/// Structure that contains information about atmosphere fog for shaders. /// Structure that contains information about atmosphere fog for shaders.
/// </summary> /// </summary>
PACK_STRUCT(struct ShaderAtmosphericFogData PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ShaderAtmosphericFogData
{ {
float AtmosphericFogDensityScale; float AtmosphericFogDensityScale;
float AtmosphericFogSunDiscScale; float AtmosphericFogSunDiscScale;
@@ -70,7 +71,7 @@ PACK_STRUCT(struct ShaderAtmosphericFogData
/// <summary> /// <summary>
/// Structure that contains information about light for shaders. /// Structure that contains information about light for shaders.
/// </summary> /// </summary>
PACK_STRUCT(struct ShaderLightData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ShaderLightData {
Float2 SpotAngles; Float2 SpotAngles;
float SourceRadius; float SourceRadius;
float SourceLength; float SourceLength;
@@ -89,7 +90,7 @@ PACK_STRUCT(struct ShaderLightData {
/// <summary> /// <summary>
/// Packed env probe data /// Packed env probe data
/// </summary> /// </summary>
PACK_STRUCT(struct ShaderEnvProbeData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ShaderEnvProbeData {
Float4 Data0; // x - Position.x, y - Position.y, z - Position.z, w - unused Float4 Data0; // x - Position.x, y - Position.y, z - Position.z, w - unused
Float4 Data1; // x - Radius , y - 1 / Radius, z - Brightness, w - unused Float4 Data1; // x - Radius , y - 1 / Radius, z - Brightness, w - unused
}); });

View File

@@ -18,7 +18,7 @@
#define DOF_GRID_SIZE 450 #define DOF_GRID_SIZE 450
#define DOF_DEPTH_BLUR_FORMAT PixelFormat::R16G16_Float #define DOF_DEPTH_BLUR_FORMAT PixelFormat::R16G16_Float
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
Float2 ProjectionAB; Float2 ProjectionAB;
float BokehDepthCullThreshold; float BokehDepthCullThreshold;
float BokehDepthCutoff; float BokehDepthCutoff;

View File

@@ -19,7 +19,7 @@
#include "Engine/Level/Scene/Scene.h" #include "Engine/Level/Scene/Scene.h"
#include "Engine/Level/Actors/StaticModel.h" #include "Engine/Level/Actors/StaticModel.h"
PACK_STRUCT(struct LightmapUVsDensityMaterialShaderData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) LightmapUVsDensityMaterialShaderData {
Matrix ViewProjectionMatrix; Matrix ViewProjectionMatrix;
Matrix WorldMatrix; Matrix WorldMatrix;
Rectangle LightmapArea; Rectangle LightmapArea;

View File

@@ -12,7 +12,7 @@
#include "Engine/Graphics/RenderTask.h" #include "Engine/Graphics/RenderTask.h"
#include "Engine/Renderer/DrawCall.h" #include "Engine/Renderer/DrawCall.h"
PACK_STRUCT(struct VertexColorsMaterialShaderData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) VertexColorsMaterialShaderData {
Matrix ViewProjectionMatrix; Matrix ViewProjectionMatrix;
Matrix WorldMatrix; Matrix WorldMatrix;
}); });

View File

@@ -16,7 +16,7 @@
#include "Engine/Engine/Engine.h" #include "Engine/Engine/Engine.h"
#include "Engine/Engine/Time.h" #include "Engine/Engine/Time.h"
PACK_STRUCT(struct EyeAdaptationData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) EyeAdaptationData {
float MinBrightness; float MinBrightness;
float MaxBrightness; float MaxBrightness;
float SpeedUp; float SpeedUp;

View File

@@ -21,7 +21,7 @@
#include "Engine/Level/Actors/Decal.h" #include "Engine/Level/Actors/Decal.h"
#include "Engine/Engine/Engine.h" #include "Engine/Engine/Engine.h"
PACK_STRUCT(struct GBufferPassData{ PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) GBufferPassData{
ShaderGBufferData GBuffer; ShaderGBufferData GBuffer;
Float3 Dummy0; Float3 Dummy0;
int32 ViewMode; int32 ViewMode;

View File

@@ -41,7 +41,7 @@
#define DDGI_PROBE_UPDATE_BORDERS_GROUP_SIZE 8 #define DDGI_PROBE_UPDATE_BORDERS_GROUP_SIZE 8
#define DDGI_PROBE_CLASSIFY_GROUP_SIZE 32 #define DDGI_PROBE_CLASSIFY_GROUP_SIZE 32
PACK_STRUCT(struct Data0 PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data0
{ {
DynamicDiffuseGlobalIlluminationPass::ConstantsData DDGI; DynamicDiffuseGlobalIlluminationPass::ConstantsData DDGI;
GlobalSignDistanceFieldPass::ConstantsData GlobalSDF; GlobalSignDistanceFieldPass::ConstantsData GlobalSDF;
@@ -54,7 +54,7 @@ PACK_STRUCT(struct Data0
Int4 ProbeScrollClears[4]; Int4 ProbeScrollClears[4];
}); });
PACK_STRUCT(struct Data1 PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data1
{ {
// TODO: use push constants on Vulkan or root signature data on DX12 to reduce overhead of changing single DWORD // TODO: use push constants on Vulkan or root signature data on DX12 to reduce overhead of changing single DWORD
Float2 Padding1; Float2 Padding1;

View File

@@ -13,7 +13,7 @@ class FLAXENGINE_API DynamicDiffuseGlobalIlluminationPass : public RendererPass<
{ {
public: public:
// Constant buffer data for DDGI access on a GPU. // Constant buffer data for DDGI access on a GPU.
PACK_STRUCT(struct ConstantsData PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ConstantsData
{ {
Float4 ProbesOriginAndSpacing[4]; Float4 ProbesOriginAndSpacing[4];
Int4 ProbesScrollOffsets[4]; Int4 ProbesScrollOffsets[4];

View File

@@ -42,7 +42,7 @@
#include "Engine/Debug/DebugDraw.h" #include "Engine/Debug/DebugDraw.h"
#endif #endif
PACK_STRUCT(struct Data0 PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data0
{ {
Float3 ViewWorldPos; Float3 ViewWorldPos;
float ViewNearPlane; float ViewNearPlane;

View File

@@ -11,7 +11,7 @@ class FLAXENGINE_API GlobalSurfaceAtlasPass : public RendererPass<GlobalSurfaceA
{ {
public: public:
// Constant buffer data for Global Surface Atlas access on a GPU. // Constant buffer data for Global Surface Atlas access on a GPU.
PACK_STRUCT(struct ConstantsData PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ConstantsData
{ {
Float3 ViewPos; Float3 ViewPos;
float Padding0; float Padding0;

View File

@@ -38,7 +38,7 @@ static_assert(GLOBAL_SDF_RASTERIZE_MODEL_MAX_COUNT % 4 == 0, "Must be multiple o
#include "Engine/Debug/DebugDraw.h" #include "Engine/Debug/DebugDraw.h"
#endif #endif
PACK_STRUCT(struct ObjectRasterizeData PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ObjectRasterizeData
{ {
Matrix3x4 WorldToVolume; Matrix3x4 WorldToVolume;
Matrix3x4 VolumeToWorld; Matrix3x4 VolumeToWorld;
@@ -50,7 +50,7 @@ PACK_STRUCT(struct ObjectRasterizeData
float DecodeAdd; float DecodeAdd;
}); });
PACK_STRUCT(struct Data PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data
{ {
Float3 ViewWorldPos; Float3 ViewWorldPos;
float ViewNearPlane; float ViewNearPlane;
@@ -60,7 +60,7 @@ PACK_STRUCT(struct Data
GlobalSignDistanceFieldPass::ConstantsData GlobalSDF; GlobalSignDistanceFieldPass::ConstantsData GlobalSDF;
}); });
PACK_STRUCT(struct ModelsRasterizeData PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ModelsRasterizeData
{ {
Int3 ChunkCoord; Int3 ChunkCoord;
float MaxDistance; float MaxDistance;

View File

@@ -12,7 +12,7 @@ class FLAXENGINE_API GlobalSignDistanceFieldPass : public RendererPass<GlobalSig
{ {
public: public:
// Constant buffer data for Global SDF access on a GPU. // Constant buffer data for Global SDF access on a GPU.
PACK_STRUCT(struct ConstantsData PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ConstantsData
{ {
Float4 CascadePosDistance[4]; Float4 CascadePosDistance[4];
Float4 CascadeVoxelSize; Float4 CascadeVoxelSize;

View File

@@ -16,7 +16,7 @@
#define THREADGROUP_SIZE_Y 16 #define THREADGROUP_SIZE_Y 16
#define HISTOGRAM_SIZE 64 #define HISTOGRAM_SIZE 64
PACK_STRUCT(struct HistogramData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) HistogramData {
uint32 InputSizeX; uint32 InputSizeX;
uint32 InputSizeY; uint32 InputSizeY;
float HistogramMul; float HistogramMul;

View File

@@ -13,12 +13,12 @@
#include "Engine/Content/Assets/CubeTexture.h" #include "Engine/Content/Assets/CubeTexture.h"
#include "Engine/Content/Content.h" #include "Engine/Content/Content.h"
PACK_STRUCT(struct PerLight{ PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) PerLight{
ShaderLightData Light; ShaderLightData Light;
Matrix WVP; Matrix WVP;
}); });
PACK_STRUCT(struct PerFrame{ PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) PerFrame{
ShaderGBufferData GBuffer; ShaderGBufferData GBuffer;
}); });

View File

@@ -17,7 +17,7 @@
#include "Engine/Graphics/Shaders/GPUShader.h" #include "Engine/Graphics/Shaders/GPUShader.h"
#include "Engine/Engine/Time.h" #include "Engine/Engine/Time.h"
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
ShaderGBufferData GBuffer; ShaderGBufferData GBuffer;
Matrix CurrentVP; Matrix CurrentVP;
Matrix PreviousVP; Matrix PreviousVP;

View File

@@ -15,7 +15,7 @@ class PostProcessingPass : public RendererPass<PostProcessingPass>
{ {
private: private:
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
float BloomLimit; float BloomLimit;
float BloomThreshold; float BloomThreshold;
float BloomMagnitude; float BloomMagnitude;
@@ -56,7 +56,7 @@ private:
Matrix LensFlareStarMat; Matrix LensFlareStarMat;
}); });
PACK_STRUCT(struct GaussianBlurData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) GaussianBlurData {
Float2 Size; Float2 Size;
float Dummy3; float Dummy3;
float Dummy4; float Dummy4;

View File

@@ -69,7 +69,7 @@ public:
} }
}; };
PACK_STRUCT(struct Data PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data
{ {
Float2 Dummy0; Float2 Dummy0;
int32 CubeFace; int32 CubeFace;

View File

@@ -13,7 +13,7 @@
#include "Engine/Graphics/RenderTargetPool.h" #include "Engine/Graphics/RenderTargetPool.h"
#include "Engine/Level/Actors/EnvironmentProbe.h" #include "Engine/Level/Actors/EnvironmentProbe.h"
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
ShaderEnvProbeData PData; ShaderEnvProbeData PData;
Matrix WVP; Matrix WVP;
ShaderGBufferData GBuffer; ShaderGBufferData GBuffer;

View File

@@ -24,7 +24,7 @@
#define TEXTURE1 5 #define TEXTURE1 5
#define TEXTURE2 6 #define TEXTURE2 6
PACK_STRUCT(struct Data PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data
{ {
ShaderGBufferData GBuffer; ShaderGBufferData GBuffer;

View File

@@ -28,7 +28,7 @@
#define NormalOffsetScaleTweak METERS_TO_UNITS(1) #define NormalOffsetScaleTweak METERS_TO_UNITS(1)
#define LocalLightNearPlane METERS_TO_UNITS(0.1f) #define LocalLightNearPlane METERS_TO_UNITS(0.1f)
PACK_STRUCT(struct Data{ PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data{
ShaderGBufferData GBuffer; ShaderGBufferData GBuffer;
ShaderLightData Light; ShaderLightData Light;
Matrix WVP; Matrix WVP;

View File

@@ -15,7 +15,7 @@ struct Item
uint32 Value; uint32 Value;
}; };
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
Item NullItem; Item NullItem;
uint32 CounterOffset; uint32 CounterOffset;
uint32 MaxIterations; uint32 MaxIterations;

View File

@@ -5,7 +5,7 @@
#include "Engine/Content/Content.h" #include "Engine/Content/Content.h"
#include "Engine/Graphics/GPUContext.h" #include "Engine/Graphics/GPUContext.h"
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
Float2 TexelSize; Float2 TexelSize;
Float2 Padding; Float2 Padding;
}); });

View File

@@ -28,14 +28,14 @@ public:
private: private:
PACK_STRUCT(struct SkyLightData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) SkyLightData {
Float3 MultiplyColor; Float3 MultiplyColor;
float VolumetricScatteringIntensity; float VolumetricScatteringIntensity;
Float3 AdditiveColor; Float3 AdditiveColor;
float Dummy0; float Dummy0;
}); });
PACK_STRUCT(struct Data { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) Data {
ShaderGBufferData GBuffer; ShaderGBufferData GBuffer;
Float3 GlobalAlbedo; Float3 GlobalAlbedo;
@@ -67,7 +67,7 @@ private:
DynamicDiffuseGlobalIlluminationPass::ConstantsData DDGI; DynamicDiffuseGlobalIlluminationPass::ConstantsData DDGI;
}); });
PACK_STRUCT(struct PerLight { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) PerLight {
Float2 SliceToDepth; Float2 SliceToDepth;
int32 MinZ; int32 MinZ;
float LocalLightScatteringIntensity; float LocalLightScatteringIntensity;

View File

@@ -23,7 +23,7 @@
namespace ShadowsOfMordor namespace ShadowsOfMordor
{ {
PACK_STRUCT(struct ShaderData { PACK_STRUCT(struct alignas(GPU_SHADER_DATA_ALIGNMENT) ShaderData {
Rectangle LightmapArea; Rectangle LightmapArea;
Matrix WorldMatrix; Matrix WorldMatrix;
Matrix ToTangentSpace; Matrix ToTangentSpace;