浏览代码

Revert the change to feature variants

/main
Evgenii Golubev 7 年前
当前提交
05dd6085
共有 4 个文件被更改,包括 61 次插入19 次删除
  1. 27
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/Deferred.compute
  2. 2
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs.hlsl
  4. 49
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl

27
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/Deferred.compute


#pragma kernel Deferred_Indirect_Fptl_Variant11 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant11 USE_INDIRECT VARIANT=11
#pragma kernel Deferred_Indirect_Fptl_Variant12 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant12 USE_INDIRECT VARIANT=12
#pragma kernel Deferred_Indirect_Fptl_Variant13 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant13 USE_INDIRECT VARIANT=13
#pragma kernel Deferred_Indirect_Fptl_Variant14 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant14 USE_INDIRECT VARIANT=14
#pragma kernel Deferred_Indirect_Fptl_Variant15 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant15 USE_INDIRECT VARIANT=15
#pragma kernel Deferred_Indirect_Fptl_Variant16 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant16 USE_INDIRECT VARIANT=16
#pragma kernel Deferred_Indirect_Fptl_Variant17 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant17 USE_INDIRECT VARIANT=17
#pragma kernel Deferred_Indirect_Fptl_Variant18 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant18 USE_INDIRECT VARIANT=18
#pragma kernel Deferred_Indirect_Fptl_Variant19 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant19 USE_INDIRECT VARIANT=19
#pragma kernel Deferred_Indirect_Fptl_Variant20 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant20 USE_INDIRECT VARIANT=20
#pragma kernel Deferred_Indirect_Fptl_Variant21 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant21 USE_INDIRECT VARIANT=21
#pragma kernel Deferred_Indirect_Fptl_Variant22 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant22 USE_INDIRECT VARIANT=22
#pragma kernel Deferred_Indirect_Fptl_Variant23 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant23 USE_INDIRECT VARIANT=23
#pragma kernel Deferred_Indirect_Fptl_Variant24 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant24 USE_INDIRECT VARIANT=24
#pragma kernel Deferred_Indirect_Fptl_Variant25 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant25 USE_INDIRECT VARIANT=25
#pragma kernel Deferred_Indirect_Fptl_Variant26 SHADE_OPAQUE_ENTRY=Deferred_Indirect_Fptl_Variant26 USE_INDIRECT VARIANT=26
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant0 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant0 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=0
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant1 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant1 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=1

#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant11 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant11 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=11
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant12 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant12 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=12
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant13 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant13 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=13
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant14 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant14 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=14
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant15 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant15 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=15
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant16 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant16 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=16
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant17 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant17 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=17
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant18 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant18 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=18
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant19 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant19 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=19
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant20 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant20 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=20
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant21 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant21 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=21
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant22 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant22 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=22
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant23 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant23 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=23
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant24 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant24 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=24
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant25 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant25 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=25
#pragma kernel Deferred_Indirect_ShadowMask_Fptl_Variant26 SHADE_OPAQUE_ENTRY=Deferred_Indirect_ShadowMask_Fptl_Variant26 USE_INDIRECT SHADOWS_SHADOWMASK VARIANT=26
#define LIGHTLOOP_TILE_PASS 1
// deferred opaque always use FPTL

2
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs


public static int s_TileSizeClustered = 32;
// feature variants
public static int s_NumFeatureVariants = 14;
public static int s_NumFeatureVariants = 27;
// Following define the maximum number of bits use in each feature category.
public static uint s_LightFeatureMaskFlags = 0xFFF000;

2
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs.hlsl


#define USE_LEFT_HAND_CAMERA_SPACE (1)
#define TILE_SIZE_FPTL (16)
#define TILE_SIZE_CLUSTERED (32)
#define NUM_FEATURE_VARIANTS (14)
#define NUM_FEATURE_VARIANTS (27)
#define LIGHT_FEATURE_MASK_FLAGS (16773120)
#define LIGHT_FEATURE_MASK_FLAGS_OPAQUE (16642048)
#define LIGHT_FEATURE_MASK_FLAGS_TRANSPARENT (16510976)

49
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


static const uint kFeatureVariantFlags[NUM_FEATURE_VARIANTS] =
{
// Precomputed illumination (no dynamic lights) for all material types (except for the clear coat)
/* 0 */ (MATERIAL_FEATURE_MASK_FLAGS & ~MATERIALFEATUREFLAGS_LIT_CLEAR_COAT) | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV,
/* 0 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV | (MATERIAL_FEATURE_MASK_FLAGS & (~MATERIALFEATUREFLAGS_LIT_CLEAR_COAT)),
// Standard>Specular
/* 1 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | MATERIALFEATUREFLAGS_LIT_STANDARD,
/* 2 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_AREA | MATERIALFEATUREFLAGS_LIT_STANDARD,
/* 3 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_STANDARD,
/* 4 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_STANDARD,
/* 5 */ LIGHT_FEATURE_MASK_FLAGS_OPAQUE | MATERIALFEATUREFLAGS_LIT_STANDARD,
// Standard/Specular
/* 1 */ MATERIALFEATUREFLAGS_LIT_STANDARD | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_DIRECTIONAL,
/* 2 */ MATERIALFEATUREFLAGS_LIT_STANDARD | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL,
/* 3 */ MATERIALFEATUREFLAGS_LIT_STANDARD | LIGHT_FEATURE_MASK_FLAGS_OPAQUE,
// SSS
/* 6 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | MATERIALFEATUREFLAGS_LIT_SSS,
/* 7 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_AREA | MATERIALFEATUREFLAGS_LIT_SSS,
/* 8 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_SSS,
/* 9 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_SSS,
/* 10 */ LIGHT_FEATURE_MASK_FLAGS_OPAQUE | MATERIALFEATUREFLAGS_LIT_SSS,
// SSS + Standard/Specular
/* 4 */ MATERIALFEATUREFLAGS_LIT_SSS | MATERIALFEATUREFLAGS_LIT_STANDARD | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_DIRECTIONAL,
/* 5 */ MATERIALFEATUREFLAGS_LIT_SSS | MATERIALFEATUREFLAGS_LIT_STANDARD | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL,
/* 6 */ MATERIALFEATUREFLAGS_LIT_SSS | MATERIALFEATUREFLAGS_LIT_STANDARD | LIGHT_FEATURE_MASK_FLAGS_OPAQUE,
// Aniso
/* 11 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | MATERIALFEATUREFLAGS_LIT_ANISO,
/* 12 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_AREA | MATERIALFEATUREFLAGS_LIT_ANISO,
/* 13 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_ANISO,
/* 14 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_ANISO,
/* 15 */ LIGHT_FEATURE_MASK_FLAGS_OPAQUE | MATERIALFEATUREFLAGS_LIT_ANISO,
// Aniso + Standard/Specular
/* 7 */ MATERIALFEATUREFLAGS_LIT_ANISO | MATERIALFEATUREFLAGS_LIT_STANDARD | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_DIRECTIONAL,
/* 8 */ MATERIALFEATUREFLAGS_LIT_ANISO | MATERIALFEATUREFLAGS_LIT_STANDARD | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL,
/* 9 */ MATERIALFEATUREFLAGS_LIT_ANISO | MATERIALFEATUREFLAGS_LIT_STANDARD | LIGHT_FEATURE_MASK_FLAGS_OPAQUE,
// With foliage or crowd with SSS and standard can overlap a lot, better to have a dedicated combination
/* 16 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | MATERIALFEATUREFLAGS_LIT_SSS | MATERIALFEATUREFLAGS_LIT_STANDARD,
/* 17 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_AREA | MATERIALFEATUREFLAGS_LIT_SSS | MATERIALFEATUREFLAGS_LIT_STANDARD,
/* 18 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_SSS | MATERIALFEATUREFLAGS_LIT_STANDARD,
/* 19 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_SSS | MATERIALFEATUREFLAGS_LIT_STANDARD,
/* 20 */ LIGHT_FEATURE_MASK_FLAGS_OPAQUE | MATERIALFEATUREFLAGS_LIT_SSS | MATERIALFEATUREFLAGS_LIT_STANDARD,
/* 10 */ MATERIALFEATUREFLAGS_LIT_CLEAR_COAT | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_DIRECTIONAL,
/* 11 */ MATERIALFEATUREFLAGS_LIT_CLEAR_COAT | LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_ENV | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL,
/* 12 */ MATERIALFEATUREFLAGS_LIT_CLEAR_COAT | LIGHT_FEATURE_MASK_FLAGS_OPAQUE,
/* 21 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | MATERIALFEATUREFLAGS_LIT_CLEAR_COAT,
/* 22 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_AREA | MATERIALFEATUREFLAGS_LIT_CLEAR_COAT,
/* 23 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_CLEAR_COAT,
/* 24 */ LIGHTFEATUREFLAGS_SKY | LIGHTFEATUREFLAGS_DIRECTIONAL | LIGHTFEATUREFLAGS_PUNCTUAL | LIGHTFEATUREFLAGS_ENV | MATERIALFEATUREFLAGS_LIT_CLEAR_COAT,
/* 25 */ LIGHT_FEATURE_MASK_FLAGS_OPAQUE | MATERIALFEATUREFLAGS_LIT_CLEAR_COAT,
/* 13 */ LIGHT_FEATURE_MASK_FLAGS_OPAQUE | MATERIAL_FEATURE_MASK_FLAGS, // Catch all case with MATERIAL_FEATURE_MASK_FLAGS is needed in case we disable material classification
/* 26 */ LIGHT_FEATURE_MASK_FLAGS_OPAQUE | MATERIAL_FEATURE_MASK_FLAGS, // Catch all case with MATERIAL_FEATURE_MASK_FLAGS is needed in case we disable material classification
};
uint FeatureFlagsToTileVariant(uint featureFlags)

正在加载...
取消
保存