- Added `generatedCodePath` to `FullPassDescriptor` for better shader code organization. - Removed redundant `IID_PPV_ARGS` method and unused `Misaki.HighPerformance.Unsafe` reference. - Refactored `Material` and `MaterialAccessor` to use `CBuffer` and updated buffer size handling. - Renamed command buffer variables in `RenderingContext` for consistency. - Updated `D3D12PipelineLibrary` to cache compiled shader results and added `ShaderPassKey`. - Refactored `D3D12GraphicsEngine` to integrate `_copyCommandBuffer` lifecycle. - Enhanced `D3D12ResourceAllocator` with shader pass creation using constant buffer info. - Simplified `D3D12ShaderCompiler` with `GENERATED_CODE_PATH` support and improved reflection handling. - Introduced `CBufferPropertyInfo` and `CBufferInfo` structs for better encapsulation. - Updated HLSL shaders to use `g_PerMaterialData` and dynamic includes. - Improved error handling in `SDLCompiler` with try-catch blocks and better messages. - Refactored `test.gshader` to use dynamically generated includes. - Fixed typos, improved code readability, and removed unused code.
50 lines
1.3 KiB
HLSL
50 lines
1.3 KiB
HLSL
#ifndef PROPERTIES_HLSL
|
|
#define PROPERTIES_HLSL
|
|
|
|
#include "F:/csharp/GhostEngine/Ghost.Shader/BuiltIn/Common.hlsl"
|
|
|
|
struct PerViewData
|
|
{
|
|
float4x4 cameraMatrix;
|
|
float4 screenSize; // xy = size, zw = 1/size
|
|
};
|
|
|
|
struct PerObjectData
|
|
{
|
|
float4x4 localToWorld;
|
|
float3 worldBoundsMin;
|
|
BYTE_ADDRESS_BUFFER_BINDLESS vertexBuffer;
|
|
float3 worldBoundsMax;
|
|
BYTE_ADDRESS_BUFFER_BINDLESS indexBuffer;
|
|
};
|
|
|
|
cbuffer GlobalConstants : register(b0)
|
|
{
|
|
GlobalData g_GlobalData;
|
|
};
|
|
|
|
cbuffer PerViewConstants : register(b1)
|
|
{
|
|
PerViewData g_PerViewData;
|
|
};
|
|
|
|
cbuffer PerObjectConstants : register(b2)
|
|
{
|
|
PerObjectData g_PerObjectData;
|
|
};
|
|
|
|
cbuffer PerMaterialConstants : register(b3)
|
|
{
|
|
PerMaterialData g_PerMaterialData;
|
|
};
|
|
|
|
#if defined(USE_TRADITIONAL_BINDLESS)
|
|
Texture2D GlobalTexture2DHeap[GLOBAL_TEXTURE2D_HEAP_SIZE] : register(t0);
|
|
Texture3D GlobalTexture3DHeap[GLOBAL_TEXTURE3D_HEAP_SIZE] : register(t0);
|
|
TextureCube GlobalTextureCubeHeap[GLOBAL_TEXTURECUBE_HEAP_SIZE] : register(t0);
|
|
Texture2DArray GlobalTexture2DArrayHeap[GLOBAL_TEXTURE2D_ARRAY_HEAP_SIZE] : register(t0);
|
|
TextureCubeArray GlobalTextureCubeArrayHeap[GLOBAL_TEXTURECUBE_ARRAY_HEAP_SIZE] : register(t0);
|
|
SamplerState GlobalSamplerHeap[GLOBAL_SAMPLER_HEAP_SIZE] : register(s0);
|
|
#endif
|
|
|
|
#endif |