浏览代码

[fptl] converted shaders to use autogenerated .hlsl includes

/main
vlad-andreev 8 年前
当前提交
19c489a6
共有 8 个文件被更改,包括 237 次插入26 次删除
  1. 5
      Assets/ScriptableRenderLoop/common/ShaderBase.h
  2. 4
      Assets/ScriptableRenderLoop/fptl/Internal-DeferredReflections.shader
  3. 2
      Assets/ScriptableRenderLoop/fptl/Internal-DeferredShading.shader
  4. 23
      Assets/ScriptableRenderLoop/fptl/LightDefinitions.cs
  5. 2
      Assets/ScriptableRenderLoop/fptl/lightlistbuild-clustered.compute
  6. 2
      Assets/ScriptableRenderLoop/fptl/lightlistbuild.compute
  7. 2
      Assets/ScriptableRenderLoop/fptl/scrbound.compute
  8. 223
      Assets/ScriptableRenderLoop/fptl/LightDefinitions.cs.hlsl

5
Assets/ScriptableRenderLoop/common/ShaderBase.h


#define _QALIGN(x) : packoffset(c0);
float FetchDepth(Texture2D depthTexture, uint2 pixCoord)
{
return 1 - depthTexture.Load(uint3(pixCoord.xy, 0)).x;
}
#endif

4
Assets/ScriptableRenderLoop/fptl/Internal-DeferredReflections.shader


#include "..\common\ShaderBase.h"
#include "LightDefinitions.cs"
#include "LightDefinitions.cs.hlsl"

{
#if UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2 && (SHADER_TARGET >= 30)
// TODO: remove pow, store cubemap mips differently
half perceptualRoughness = pow(glossIn.perceptualRoughness, 3.0/4.0);
half perceptualRoughness = pow(glossIn.roughness, 3.0/4.0);
#else
half perceptualRoughness = glossIn.roughness; // MM: switched to this
#endif

2
Assets/ScriptableRenderLoop/fptl/Internal-DeferredShading.shader


#include "UnityPBSLighting.cginc"
#include "..\common\ShaderBase.h"
#include "LightDefinitions.cs"
#include "LightDefinitions.cs.hlsl"

23
Assets/ScriptableRenderLoop/fptl/LightDefinitions.cs


//#define LEFT_HAND_COORDINATES
[UnityEngine.ScriptableRenderLoop.GenerateHLSL]
public struct SFiniteLightData
{
// setup constant buffer

public Vec3 vLocalCubeCapturePoint;
public float fProbeBlendDistance;
[UnityEngine.ScriptableRenderLoop.GenerateHLSL]
public struct SFiniteLightBound
{
public Vec3 vBoxAxisX;

public float fRadius;
};
[UnityEngine.ScriptableRenderLoop.GenerateHLSL]
public struct DirectionalLight
{
public Vec3 vCol;

public float fPad1;
};
#if !__HLSL
[UnityEngine.ScriptableRenderLoop.GenerateHLSL]
#endif
public static int MAX_NR_LIGHTS_PER_CAMERA = 1024;
public static float VIEWPORT_SCALE_Z = 1.0f;

public static int NR_LIGHT_MODELS = 2;
public static int DIRECT_LIGHT = 0;
public static int REFLECTION_LIGHT = 1;
#if !__HLSL
#endif
#if __HLSL
float FetchDepth(Texture2D depthTexture, uint2 pixCoord)
{
return 1-depthTexture.Load( uint3(pixCoord.xy, 0) ).x;
}
#endif

2
Assets/ScriptableRenderLoop/fptl/lightlistbuild-clustered.compute


#pragma kernel TileLightListGen
#include "..\common\ShaderBase.h"
#include "LightDefinitions.cs"
#include "LightDefinitions.cs.hlsl"
//#define EXACT_EDGE_TESTS
#define PERFORM_SPHERICAL_INTERSECTION_TESTS

2
Assets/ScriptableRenderLoop/fptl/lightlistbuild.compute


#pragma kernel TileLightListGen
#include "..\common\ShaderBase.h"
#include "LightDefinitions.cs"
#include "LightDefinitions.cs.hlsl"
#define FINE_PRUNING_ENABLED

2
Assets/ScriptableRenderLoop/fptl/scrbound.compute


#pragma kernel ScreenBoundsAABB
#include "..\common\ShaderBase.h"
#include "LightDefinitions.cs"
#include "LightDefinitions.cs.hlsl"
uniform int g_iNrVisibLights;
uniform float4x4 g_mInvProjection;

223
Assets/ScriptableRenderLoop/fptl/LightDefinitions.cs.hlsl


//
// This file was automatically generated from Assets/ScriptableRenderLoop/fptl/LightDefinitions.cs. Please don't edit by hand.
//
//
// LightDefinitions: static fields
//
#define MAX_NR_LIGHTS_PER_CAMERA (1024)
#define VIEWPORT_SCALE_Z (1)
#define IS_CIRCULAR_SPOT_SHAPE (1)
#define HAS_COOKIE_TEXTURE (2)
#define IS_BOX_PROJECTED (4)
#define HAS_SHADOW (8)
#define MAX_TYPES (3)
#define SPOT_LIGHT (0)
#define SPHERE_LIGHT (1)
#define BOX_LIGHT (2)
#define DIRECTIONAL_LIGHT (3)
#define NR_LIGHT_MODELS (2)
#define DIRECT_LIGHT (0)
#define REFLECTION_LIGHT (1)
// Generated from SFiniteLightData
// PackingRules = Exact
struct SFiniteLightData
{
float fPenumbra;
int flags;
uint uLightType;
uint uLightModel;
float3 vLpos; // x: x y: y z: z
float fLightIntensity;
float3 vLaxisX; // x: x y: y z: z
float fRecipRange;
float3 vLaxisY; // x: x y: y z: z
float fSphRadiusSq;
float3 vLaxisZ; // x: x y: y z: z
float cotan;
float3 vCol; // x: x y: y z: z
int iSliceIndex;
float3 vBoxInnerDist; // x: x y: y z: z
float fDecodeExp;
float3 vBoxInvRange; // x: x y: y z: z
uint uShadowLightIndex;
float3 vLocalCubeCapturePoint; // x: x y: y z: z
float fProbeBlendDistance;
};
// Generated from SFiniteLightBound
// PackingRules = Exact
struct SFiniteLightBound
{
float3 vBoxAxisX; // x: x y: y z: z
float3 vBoxAxisY; // x: x y: y z: z
float3 vBoxAxisZ; // x: x y: y z: z
float3 vCen; // x: x y: y z: z
float2 vScaleXY; // x: x y: y
float fRadius;
};
// Generated from DirectionalLight
// PackingRules = Exact
struct DirectionalLight
{
float3 vCol; // x: x y: y z: z
float fLightIntensity;
float3 vLaxisX; // x: x y: y z: z
uint uShadowLightIndex;
float3 vLaxisY; // x: x y: y z: z
float fPad0;
float3 vLaxisZ; // x: x y: y z: z
float fPad1;
};
//
// Accessors for SFiniteLightData
//
float GetFPenumbra(SFiniteLightData value)
{
return value.fPenumbra;
}
int GetFlags(SFiniteLightData value)
{
return value.flags;
}
uint GetULightType(SFiniteLightData value)
{
return value.uLightType;
}
uint GetULightModel(SFiniteLightData value)
{
return value.uLightModel;
}
float3 GetVLpos(SFiniteLightData value)
{
return value.vLpos;
}
float GetFLightIntensity(SFiniteLightData value)
{
return value.fLightIntensity;
}
float3 GetVLaxisX(SFiniteLightData value)
{
return value.vLaxisX;
}
float GetFRecipRange(SFiniteLightData value)
{
return value.fRecipRange;
}
float3 GetVLaxisY(SFiniteLightData value)
{
return value.vLaxisY;
}
float GetFSphRadiusSq(SFiniteLightData value)
{
return value.fSphRadiusSq;
}
float3 GetVLaxisZ(SFiniteLightData value)
{
return value.vLaxisZ;
}
float GetCotan(SFiniteLightData value)
{
return value.cotan;
}
float3 GetVCol(SFiniteLightData value)
{
return value.vCol;
}
int GetISliceIndex(SFiniteLightData value)
{
return value.iSliceIndex;
}
float3 GetVBoxInnerDist(SFiniteLightData value)
{
return value.vBoxInnerDist;
}
float GetFDecodeExp(SFiniteLightData value)
{
return value.fDecodeExp;
}
float3 GetVBoxInvRange(SFiniteLightData value)
{
return value.vBoxInvRange;
}
uint GetUShadowLightIndex(SFiniteLightData value)
{
return value.uShadowLightIndex;
}
float3 GetVLocalCubeCapturePoint(SFiniteLightData value)
{
return value.vLocalCubeCapturePoint;
}
float GetFProbeBlendDistance(SFiniteLightData value)
{
return value.fProbeBlendDistance;
}
//
// Accessors for SFiniteLightBound
//
float3 GetVBoxAxisX(SFiniteLightBound value)
{
return value.vBoxAxisX;
}
float3 GetVBoxAxisY(SFiniteLightBound value)
{
return value.vBoxAxisY;
}
float3 GetVBoxAxisZ(SFiniteLightBound value)
{
return value.vBoxAxisZ;
}
float3 GetVCen(SFiniteLightBound value)
{
return value.vCen;
}
float2 GetVScaleXY(SFiniteLightBound value)
{
return value.vScaleXY;
}
float GetFRadius(SFiniteLightBound value)
{
return value.fRadius;
}
//
// Accessors for DirectionalLight
//
float3 GetVCol(DirectionalLight value)
{
return value.vCol;
}
float GetFLightIntensity(DirectionalLight value)
{
return value.fLightIntensity;
}
float3 GetVLaxisX(DirectionalLight value)
{
return value.vLaxisX;
}
uint GetUShadowLightIndex(DirectionalLight value)
{
return value.uShadowLightIndex;
}
float3 GetVLaxisY(DirectionalLight value)
{
return value.vLaxisY;
}
float GetFPad0(DirectionalLight value)
{
return value.fPad0;
}
float3 GetVLaxisZ(DirectionalLight value)
{
return value.vLaxisZ;
}
float GetFPad1(DirectionalLight value)
{
return value.fPad1;
}
正在加载...
取消
保存