65 lines
1.5 KiB
HLSL
65 lines
1.5 KiB
HLSL
|
|
struct VertexData
|
|
{
|
|
float4 Normal;
|
|
float2 TexCoord0;
|
|
float2 TexCoord1;
|
|
float4 Color0;
|
|
};
|
|
|
|
struct TransformData
|
|
{
|
|
float4x4 Transform;
|
|
float4x4 NormalTransform;
|
|
};
|
|
|
|
struct MaterialData
|
|
{
|
|
float AlbedoFactor[4];
|
|
float EmissionFactor[3];
|
|
float MetalFactor;
|
|
float RoughFactor;
|
|
uint AlbedoTex;
|
|
uint NormalTex;
|
|
uint MetalRoughTex;
|
|
uint OcclusionTex;
|
|
uint EmissionTex;
|
|
};
|
|
|
|
struct PointLight
|
|
{
|
|
float Position[3];
|
|
float Range;
|
|
uint Color;
|
|
float Intensity;
|
|
};
|
|
|
|
struct DirectionalLight
|
|
{
|
|
float Direction[3];
|
|
float Validity_;
|
|
uint Color;
|
|
float Intensity;
|
|
};
|
|
|
|
// Little Endian storage. First short is least significant.
|
|
#define IndexerCount(Indexer) (Indexer & 0xFFFF)
|
|
#define IndexerOffset(Indexer) ((Indexer & 0xFFFF0000) >> 16);
|
|
|
|
#define INVALID_HANDLE 0xFFFFFFFF
|
|
|
|
static const float PI = 3.14159265f;
|
|
|
|
[[vk::binding(0, 0)]] StructuredBuffer<float4> VertexBuffer[];
|
|
[[vk::binding(0, 0)]] StructuredBuffer<VertexData> VertexDataBuffer[];
|
|
[[vk::binding(0, 0)]] StructuredBuffer<MaterialData> MaterialsBuffer[];
|
|
[[vk::binding(0, 0)]] StructuredBuffer<TransformData> NodeBuffer[];
|
|
[[vk::binding(0, 0)]] StructuredBuffer<PointLight> PointLightBuffer[];
|
|
[[vk::binding(0, 0)]] StructuredBuffer<DirectionalLight> DirectionalLightBuffer[];
|
|
|
|
[[vk::binding(1, 0)]] Texture2D<float4> Textures[];
|
|
[[vk::binding(1, 0)]] TextureCube<float4> TextureCubes[];
|
|
[[vk::binding(1, 0)]] SamplerState ImmutableSamplers[];
|
|
|
|
[[vk::binding(2, 0)]] RWTexture2D<float4> StorageTextures[];
|