compiles again
This commit is contained in:
@@ -1,7 +1,31 @@
|
||||
import Common;
|
||||
import LightEnv;
|
||||
import Material;
|
||||
import MaterialParameter;
|
||||
|
||||
struct LightCullingData
|
||||
{
|
||||
RWStructuredBuffer<uint> oLightIndexList;
|
||||
RWStructuredBuffer<uint> tLightIndexList;
|
||||
|
||||
RWTexture2D<uint2> oLightGrid;
|
||||
RWTexture2D<uint2> tLightGrid;
|
||||
};
|
||||
ParameterBuffer<LightCullingData> gLightCullingData;
|
||||
|
||||
[shader("pixel")]
|
||||
void pixelMain(in VertexAttributes attribs, out float4 baseColor)
|
||||
{
|
||||
BRDF brdf = gMaterial.prepare();
|
||||
MaterialParameter params = MaterialParameter.create(attribs);
|
||||
BRDF brdf = gMaterial.prepare(params);
|
||||
float3 result = float3(0, 0, 0);
|
||||
for(int i = 0; i < gLightEnv.numDirectionalLights; ++i)
|
||||
{
|
||||
result += gLightEnv.directionalLights[i].illuminate(params, brdf);
|
||||
}
|
||||
for(int i = 0; i < gLightEnv.numPointLights; ++i)
|
||||
{
|
||||
result += gLightEnv.pointLights[i].illuminate(params, brdf);
|
||||
}
|
||||
return float4(result, 1.0f);
|
||||
}
|
||||
|
||||
@@ -8,16 +8,15 @@ struct ComputeShaderInput
|
||||
uint groupIndex : SV_GroupIndex;
|
||||
};
|
||||
|
||||
layout(set = 0, binding = 1, std430)
|
||||
cbuffer DispatchParams
|
||||
struct DispatchParams
|
||||
{
|
||||
uint3 numThreadGroups;
|
||||
uint pad0;
|
||||
uint3 numThreads;
|
||||
uint pad1;
|
||||
RWShaderBuffer<Frustum> frustums;
|
||||
}
|
||||
layout(set = 0, binding = 2, std430)
|
||||
RWShaderBuffer<Frustum> out_Frustums;
|
||||
ParameterBuffer<DispatchParams> dispatchParams;
|
||||
|
||||
|
||||
[numthreads(BLOCK_SIZE, BLOCK_SIZE, 1)]
|
||||
@@ -49,9 +48,9 @@ void computeFrustums(ComputeShaderInput in)
|
||||
frustum.planes[2] = computePlane(eyePos, viewSpace[0], viewSpace[1]);
|
||||
frustum.planes[3] = computePlane(eyePos, viewSpace[3], viewSpace[2]);
|
||||
|
||||
if(in.dispatchThreadID.x < numThreads.x && in.dispatchThreadID.y < numThreads.y)
|
||||
if(in.dispatchThreadID.x < dispatchParams.numThreads.x && in.dispatchThreadID.y < dispatchParams.numThreads.y)
|
||||
{
|
||||
uint index = in.dispatchThreadID.x + (in.dispatchThreadID.y * numThreads.x);
|
||||
out_Frustums[index] = frustum;
|
||||
dispatchParams.frustums[index] = frustum;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import LightEnv;
|
||||
import Common;
|
||||
import LightEnv;
|
||||
|
||||
struct ComputeShaderInput
|
||||
{
|
||||
@@ -27,13 +27,10 @@ struct CullingParams
|
||||
RWTexture2D<uint2> tLightGrid;
|
||||
|
||||
StructuredBuffer<Frustum> frustums;
|
||||
|
||||
};
|
||||
ParameterBlock<CullingParams> gCullingParams;
|
||||
// Debug
|
||||
//layout(set = INDEX_VIEW_PARAMS, binding = 10)
|
||||
//Texture2D lightCountHeatMap;
|
||||
//layout(set = INDEX_VIEW_PARAMS, binding = 11)
|
||||
//RWTexture2D<float4> debugTexture;
|
||||
|
||||
groupshared uint uMinDepth;
|
||||
|
||||
@@ -2,7 +2,7 @@ import Common;
|
||||
import BRDF;
|
||||
import Meshlet;
|
||||
import Scene;
|
||||
import StaticMeshVertexData;
|
||||
import VertexData;
|
||||
|
||||
struct MeshPayload
|
||||
{
|
||||
@@ -61,7 +61,7 @@ void taskMain(
|
||||
DispatchMesh(head, 1, 1, p);
|
||||
}
|
||||
|
||||
groupshared StaticMeshVertexAttributes gs_vertices[MAX_VERTICES];
|
||||
groupshared VertexAttributes gs_vertices[MAX_VERTICES];
|
||||
groupshared uint3 gs_indices[MAX_PRIMITIVES];
|
||||
groupshared uint gs_numVertices;
|
||||
groupshared uint gs_numPrimitives;
|
||||
@@ -78,7 +78,7 @@ void meshMain(
|
||||
in uint threadID: SV_GroupIndex,
|
||||
in uint groupID: SV_GroupID,
|
||||
in payload MeshPayload meshPayload,
|
||||
out Vertices<StaticMeshVertexAttributes, MAX_VERTICES> vertices,
|
||||
out Vertices<VertexAttributes, MAX_VERTICES> vertices,
|
||||
out Indices<uint3, MAX_PRIMITIVES> indices
|
||||
){
|
||||
InstanceData inst = scene.instances[meshPayload.instanceId[groupID]];
|
||||
|
||||
+17
-17
@@ -10,9 +10,12 @@ struct VertexShaderOutput
|
||||
float4 clipPos : SV_Position;
|
||||
float3 texCoords;
|
||||
};
|
||||
|
||||
[[vk::push_constant]]
|
||||
ConstantBuffer<float4x4> transformMatrix;
|
||||
struct SkyboxData
|
||||
{
|
||||
float4x4 transformMatrix;
|
||||
float4 fogBlend;
|
||||
};
|
||||
ParameterBuffer<SkyboxData> gSkyboxData;
|
||||
|
||||
[shader("vertex")]
|
||||
VertexShaderOutput vertexMain(
|
||||
@@ -27,16 +30,13 @@ VertexShaderOutput vertexMain(
|
||||
return output;
|
||||
}
|
||||
|
||||
[[vk::push_constant]]
|
||||
ConstantBuffer<float4> fogBlend;
|
||||
|
||||
layout(set = 0, binding = 1)
|
||||
TextureCube cubeMap;
|
||||
layout(set = 0, binding = 2)
|
||||
TextureCube cubeMap2;
|
||||
layout(set = 0, binding = 3)
|
||||
SamplerState sampler;
|
||||
|
||||
struct TextureData
|
||||
{
|
||||
TextureCube cubeMap;
|
||||
TextureCube cubeMap2;
|
||||
SamplerState sampler;
|
||||
};
|
||||
ParameterBuffer<TextureData> textures;
|
||||
static const float lowerLimit = 0.0;
|
||||
static const float upperLimit = 0.1;
|
||||
|
||||
@@ -44,11 +44,11 @@ static const float upperLimit = 0.1;
|
||||
float4 fragmentMain(
|
||||
VertexShaderOutput output) : SV_Target
|
||||
{
|
||||
float4 texture1 = cubeMap.Sample(sampler, output.texCoords);
|
||||
float4 texture2 = cubeMap2.Sample(sampler, output.texCoords);
|
||||
float4 finalColor = lerp(texture1, texture2, fogBlend.w);
|
||||
float4 texture1 = textures.cubeMap.Sample(textures.sampler, output.texCoords);
|
||||
float4 texture2 = textures.cubeMap2.Sample(textures.sampler, output.texCoords);
|
||||
float4 finalColor = lerp(texture1, texture2, gSkyboxData.fogBlend.w);
|
||||
|
||||
float factor = (output.texCoords.y - lowerLimit) / (upperLimit - lowerLimit);
|
||||
factor = clamp(factor, 0.0, 1.0);
|
||||
return lerp(float4(fogBlend.xyz, 1), finalColor, factor);
|
||||
return lerp(float4(gSkyboxData.fogBlend.xyz, 1), finalColor, factor);
|
||||
}
|
||||
@@ -1,26 +1,19 @@
|
||||
import Common;
|
||||
|
||||
struct GlyphData
|
||||
{
|
||||
float4 bearingSize;
|
||||
};
|
||||
struct ViewData
|
||||
{
|
||||
float4x4 projectionMatrix;
|
||||
}
|
||||
struct TextData
|
||||
{
|
||||
float4 textColor;
|
||||
float scale;
|
||||
}
|
||||
layout(set = 0, binding = 0)
|
||||
ConstantBuffer<ViewData> viewData;
|
||||
layout(set = 0, binding = 1)
|
||||
SamplerState glyphSampler;
|
||||
ParameterBuffer<SamplerState> glyphSampler;
|
||||
//layout(set = 1)
|
||||
//ShaderBuffer<GlyphData> glyphData;
|
||||
layout(set = 1)
|
||||
Texture2D<uint> glyphTextures[];
|
||||
layout(push_constant)
|
||||
ParameterBuffer<Texture2D<uint>[]> glyphTextures;
|
||||
[[vk::push_constant]]
|
||||
ConstantBuffer<TextData> textData;
|
||||
|
||||
struct VertexStageInput
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import Common;
|
||||
|
||||
struct RenderElementStyle
|
||||
{
|
||||
float3 position;
|
||||
@@ -15,22 +17,14 @@ struct RenderElementStyle
|
||||
float2 dimensions;
|
||||
};
|
||||
|
||||
struct ViewData
|
||||
struct UIParameter
|
||||
{
|
||||
float4x4 projectionMatrix;
|
||||
};
|
||||
SamplerState backgroundSampler;
|
||||
uint numBackgroundTextures;
|
||||
Texture2D<float4> backgroundTextures[];
|
||||
}
|
||||
|
||||
layout(set = 0, binding = 0)
|
||||
ConstantBuffer<ViewData> viewData;
|
||||
|
||||
layout(set = 0, binding = 1)
|
||||
SamplerState backgroundSampler;
|
||||
|
||||
layout(set = 0, binding = 2)
|
||||
ConstantBuffer<uint> numBackgroundTextures;
|
||||
|
||||
layout(set = 0, binding = 3)
|
||||
Texture2D<float4> backgroundTextures[];
|
||||
ParameterBuffer<UIParameter> params;
|
||||
|
||||
struct VertexStageOutput
|
||||
{
|
||||
|
||||
@@ -70,12 +70,3 @@ struct LightEnv
|
||||
};
|
||||
|
||||
ParameterBlock<LightEnv> gLightEnv;
|
||||
|
||||
//layout(set = INDEX_LIGHT_ENV, binding = 0, std430)
|
||||
//ShaderBuffer<DirectionalLight> directionalLights;
|
||||
//layout(set = INDEX_LIGHT_ENV, binding = 1, std430)
|
||||
//ConstantBuffer<uint> numDirectionalLights;
|
||||
//layout(set = INDEX_LIGHT_ENV, binding = 2, std430)
|
||||
//ShaderBuffer<PointLight> pointLights;
|
||||
//layout(set = INDEX_LIGHT_ENV, binding = 3, std430)
|
||||
//ConstantBuffer<uint> numPointLights;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import Common;
|
||||
import BRDF;
|
||||
import MaterialParameter;
|
||||
|
||||
interface IMaterial
|
||||
{
|
||||
associatedtype BRDF : IBRDF;
|
||||
BRDF prepare(MaterialFragmentParameter input);
|
||||
|
||||
BRDF prepare(MaterialParameter input);
|
||||
};
|
||||
|
||||
layout(set = INDEX_MATERIAL)
|
||||
ParameterBlock<IMaterial> gMaterial;
|
||||
|
||||
@@ -37,6 +37,5 @@ struct Scene
|
||||
StructuredBuffer<uint32_t> vertexIndices;
|
||||
};
|
||||
|
||||
layout(set = INDEX_SCENE_DATA)
|
||||
ParameterBlock<Scene> scene;
|
||||
|
||||
|
||||
@@ -63,5 +63,3 @@ struct SkinnedMeshVertexData : VertexData
|
||||
StructuredBuffer<float4> boneWeights;
|
||||
StructuredBuffer<float4x4> bones;
|
||||
}
|
||||
layout(set = INDEX_VERTEX_DATA)
|
||||
ParameterBlock<SkinnedMeshVertexData> vertexData;
|
||||
@@ -54,6 +54,4 @@ struct StaticMeshVertexData : VertexData
|
||||
StructuredBuffer<float3> normals;
|
||||
StructuredBuffer<float3> tangents;
|
||||
StructuredBuffer<float3> biTangents;
|
||||
}
|
||||
layout(set = INDEX_VERTEX_DATA)
|
||||
ParameterBlock<StaticMeshVertexData> vertexData;
|
||||
}
|
||||
@@ -12,4 +12,5 @@ interface VertexAttributes
|
||||
interface VertexData
|
||||
{
|
||||
VertexAttributes getAttributes(uint index, float4x4 transform);
|
||||
};
|
||||
};
|
||||
ParameterBlock<VertexData> vertexData;
|
||||
Reference in New Issue
Block a user