Skip to content

Commit

Permalink
Fix broken example
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Feb 21, 2025
1 parent ca8475d commit 50bbee7
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions Docs/src/manual/Rendering/RootLayouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ Would work using the following RootLayout:
"samplers" : [1,2],
"uav_buffers" : [1,2],
"uav_textures" : [0,1]
},
"1" :
{
"baked" : true,
"uav_buffers" : [1,2],
"uav_textures" : [0,1]
}
}
```
Expand Down Expand Up @@ -233,16 +239,16 @@ void HlmsUnlit::setupRootLayout( RootLayout &rootLayout )
{
DescBindingRange *descBindingRanges = rootLayout.mDescBindingRanges[0];

// We have up to 3 const buffers at slots 0, 1 and 2
// We have up to 3 const buffers at slots 0, 1 and 2
descBindingRanges[DescBindingTypes::ConstBuffer].end = 3u;

// When there's texture matrix animations, we must consume one extra buffer slot
// When there's texture matrix animations, we must consume one extra buffer slot
if( getProperty( UnlitProperty::TextureMatrix ) == 0 )
descBindingRanges[DescBindingTypes::ReadOnlyBuffer].end = 1u;
else
descBindingRanges[DescBindingTypes::ReadOnlyBuffer].end = 2u;

// Baked sets are the ones that use DescriptorSetTexture/Sampler/Texture2/Uav
// Baked sets are the ones that use DescriptorSetTexture/Sampler/Texture2/Uav
rootLayout.mBaked[1] = true;
DescBindingRange *bakedRanges = rootLayout.mDescBindingRanges[1];
bakedRanges[DescBindingTypes::Sampler].start = (uint16)mSamplerUnitSlotStart;
Expand All @@ -261,9 +267,11 @@ void HlmsUnlit::setupRootLayout( RootLayout &rootLayout )
Non-baked sets are meant to behave very similarly to table models in D3D11 and OpenGL.
Baked sets on the other hand are meant exclusively for binding `DescriptorSetTexture`, `DescriptorSetSampler`, `DescriptorSetTexture2` and `DescriptorSetUav`
Baked sets on the other hand are meant exclusively for binding `DescriptorSetTexture`, `DescriptorSetSampler`, `DescriptorSetTexture2` and `DescriptorSetUav`.
The size of the DescriptorSet\* must match *exactly* the amount of bindings slots in the RootLayout
The size of the DescriptorSet\* must match *exactly* the amount of bindings slots in the RootLayout.
Since UAVs can only be bound via `DescriptorSetUav`, UAVs must be placed in baked sets.
# Prefab Root Layouts for low level materials {#RootLayoutPrefabs}
Expand Down Expand Up @@ -318,7 +326,7 @@ rootLayout.addArrayBinding( DescBindingTypes::Sampler, ArrayDesc( 0, 3 ) );
"arrays" :
{
"textures" : [[0, 5], [0, 4]],
"samplers" : [[0, 3]],
"samplers" : [[0, 3]],
}
}
```
Expand Down Expand Up @@ -420,4 +428,4 @@ layout( ogre_P0 ) uniform Params {
uniform uint3 numProbes;
uniform float3 aspectRatioFixer;
};
```
```

0 comments on commit 50bbee7

Please sign in to comment.