|
|
|
|
|
|
// If you're not using the feature classification system, pass UINT_MAX. |
|
|
|
// Also, see comment in TileVariantToFeatureFlags. When we are the worse case (i.e last variant), we read the featureflags |
|
|
|
// from the structured buffer use to generate the indirect draw call. It allow to not go through all branch and the branch is scalar (not VGPR) |
|
|
|
uint DecodeFromGBuffer(uint2 positionSS, uint inTileFeatureFlags, out BSDFData bsdfData, out float3 bakeDiffuseLighting) |
|
|
|
uint DecodeFromGBuffer(uint2 positionSS, uint tileFeatureFlags, out BSDFData bsdfData, out float3 bakeDiffuseLighting) |
|
|
|
|
|
|
|
// Isolate material features. |
|
|
|
uint tileFeatureFlags = inTileFeatureFlags & MATERIAL_FEATURE_MASK_FLAGS; |
|
|
|
|
|
|
|
bsdfData.materialFeatures = tileFeatureFlags; // Only tile-uniform feature evaluation |
|
|
|
|
|
|
|
GBufferType0 inGBuffer0 = LOAD_TEXTURE2D(_GBufferTexture0, positionSS); |
|
|
|
GBufferType1 inGBuffer1 = LOAD_TEXTURE2D(_GBufferTexture1, positionSS); |
|
|
|
|
|
|
// If tileFeatureFlags == UINT_MAX it mean we are call from deferred.shader (or a debug mode) that have no classification |
|
|
|
// in this case for the sake of performance saving we should rely on pixelFeatureFlags |
|
|
|
// TODO: validate that this doesn't hurst performance somewhere with classification |
|
|
|
if (inTileFeatureFlags == UINT_MAX) |
|
|
|
if (tileFeatureFlags == UINT_MAX) |
|
|
|
{ |
|
|
|
tileFeatureFlags = pixelFeatureFlags; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
bsdfData.materialFeatures = tileFeatureFlags; |
|
|
|
} |
|
|
|
|
|
|
|
// Decompress feature-agnostic data from the G-Buffer. |
|
|
|
float3 baseColor = inGBuffer0.rgb; |
|
|
|