Adding bindless material descriptors

This commit is contained in:
Dynamitos
2024-06-18 19:19:05 +02:00
parent cff14981ff
commit f6ebbc2067
23 changed files with 387 additions and 274 deletions
+32
View File
@@ -1,9 +1,41 @@
import Common;
import BRDF;
import MaterialParameter;
import Scene;
//interface IMaterial
//{
// associatedtype BRDF : IBRDF;
// BRDF prepare(MaterialParameter input);
//};
layout(set=4, binding=0)
Texture2D textureArray[];
layout(set=4, binding=1)
SamplerState samplerArray[];
layout(set=4, binding=2)
StructuredBuffer<float> floatArray;
Texture2D getMaterialTextureParameter(uint index)
{
return textureArray[pOffsets.textureOffset + index];
}
SamplerState getMaterialSamplerParameter(uint index)
{
return samplerArray[pOffsets.samplerOffset + index];
}
float getMaterialFloatParameter(uint index)
{
return floatArray[pOffsets.floatOffset + index];
}
float3 getMaterialVectorParameter(uint index)
{
return float3(
floatArray[pOffsets.floatOffset + index],
floatArray[pOffsets.floatOffset + index + 1],
floatArray[pOffsets.floatOffset + index + 2]
);
}
+3
View File
@@ -60,6 +60,9 @@ struct MeshletCullingInfo
struct DrawCallOffsets
{
uint32_t instanceOffset;
uint textureOffset;
uint samplerOffset;
uint floatOffset;
};
layout(push_constant)
ConstantBuffer<DrawCallOffsets> pOffsets;