Skip to content

Commit

Permalink
Fix shader warnings; comment out d3d11 debug symbols pragmas as they …
Browse files Browse the repository at this point in the history
…caused incorrect paths for shader warnings [closes #82]
  • Loading branch information
Delt06 committed May 22, 2023
1 parent 955a064 commit de0a22c
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Packages/com.deltation.toon-rp/ShaderLibrary/Ramp.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ float ComputeRampAntiAliased(const float nDotL, const float2 ramp)
float ComputeRampTextured(const float ramp, const float2 uv, TEXTURE2D_PARAM(tex, texSampler))
{
const float v = uv.x + uv.y;
return SAMPLE_TEXTURE2D(tex, texSampler, float2(ramp, v));
return SAMPLE_TEXTURE2D(tex, texSampler, float2(ramp, v)).r;
}

float ComputeGlobalRamp(const float nDotL, const float2 ramp)
Expand Down
2 changes: 1 addition & 1 deletion Packages/com.deltation.toon-rp/ShaderLibrary/SSAO.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ float SampleAmbientOcclusionRaw(float2 screenUv)
float GetAmbientOcclusionPattern(const float3 positionWs)
{
const float2 uv = EncodePositionToUv(positionWs, _ToonRP_SSAO_PatternScale);
return SAMPLE_TEXTURE2D(_ToonRP_SSAO_Pattern, sampler_ToonRP_SSAO_Pattern, uv);
return SAMPLE_TEXTURE2D(_ToonRP_SSAO_Pattern, sampler_ToonRP_SSAO_Pattern, uv).r;
}

float SampleAmbientOcclusion(const float2 screenUv, const float3 positionWs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
HLSLINCLUDE

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma vertex VS
#pragma fragment PS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

HLSLINCLUDE

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#include "../../ShaderLibrary/Common.hlsl"

Expand Down Expand Up @@ -51,7 +51,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#include "../../ShaderLibrary/DepthNormals.hlsl"

Expand Down Expand Up @@ -164,7 +164,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#include "../../ShaderLibrary/Textures.hlsl"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_fog
#pragma multi_compile_instancing
Expand All @@ -75,7 +75,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_instancing

Expand All @@ -97,7 +97,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_instancing

Expand All @@ -119,7 +119,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_instancing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
HLSLINCLUDE

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma vertex VS
#pragma fragment PS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static const float EdgeStepSizes[EDGE_SEARCH_STEPS] = {EDGE_SEARCH_STEP_SIZES};
float GetSceneLuminance(float2 uv, float uOffset = 0.0, float vOffset = 0.0)
{
uv += float2(uOffset, vOffset) * _MainTex_TexelSize.xy;
return sqrt(Luminance(SampleSource(uv).rgb));
return sqrt(Luminance(SampleSource(uv)));
}

struct LuminanceNeighborhood
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ float3 ApplyFilmGrain(const float2 uv, const float3 previousColor)
const float2 pixelCoords = _MainTex_TexelSize.zw * uv;
const float2 grainPixelCoords = pixelCoords / _FilmGrain_Texture_TexelSize.zw;
const float2 grainUv = grainPixelCoords % 1;
const float3 grain = SAMPLE_TEXTURE2D_LOD(_FilmGrain_Texture, sampler_FilmGrain_Texture, grainUv, 0);
const float3 grain = SAMPLE_TEXTURE2D_LOD(_FilmGrain_Texture, sampler_FilmGrain_Texture, grainUv, 0).rgb;
const float3 grainedColor = saturate(previousColor - grain * _FilmGrain_Intensity);
const float lumaT = smoothstep(_FilmGrain_LuminanceThreshold0, _FilmGrain_LuminanceThreshold1,
Luminance(previousColor));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
HLSLINCLUDE

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma vertex VS
#pragma fragment PS
Expand Down Expand Up @@ -53,7 +53,7 @@

float3 SampleSource(const float2 uv)
{
return SAMPLE_TEXTURE2D_LOD(_MainTex, sampler_MainTex, uv, 0);
return SAMPLE_TEXTURE2D_LOD(_MainTex, sampler_MainTex, uv, 0).rgb;
}

ENDHLSL
Expand Down Expand Up @@ -115,7 +115,7 @@

float3 SampleScattering(const float2 uv)
{
return SAMPLE_TEXTURE2D(_ToonRP_ScatteringTexture, sampler_ToonRP_ScatteringTexture, uv);
return SAMPLE_TEXTURE2D(_ToonRP_ScatteringTexture, sampler_ToonRP_ScatteringTexture, uv).rgb;
}

float3 SampleScatteringBlur(const float2 uv)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_local_fragment _ _FXAA_LOW _FXAA_HIGH
#pragma multi_compile_local_fragment _ _TONE_MAPPING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ DECLARE_TEXEL_SIZE(_LookupTable_Texture);

float3 SampleSource(const float2 uv)
{
return SAMPLE_TEXTURE2D_LOD(_MainTex, LINEAR_SAMPLER, uv, 0);
return SAMPLE_TEXTURE2D_LOD(_MainTex, LINEAR_SAMPLER, uv, 0).rgb;
}

float3 SampleSource(const float2 uv, const float2 pixelOffset)
{
const float2 offsetUv = uv + pixelOffset * _MainTex_TexelSize.xy;
return SAMPLE_TEXTURE2D_LOD(_MainTex, LINEAR_SAMPLER, offsetUv, 0);
return SAMPLE_TEXTURE2D_LOD(_MainTex, LINEAR_SAMPLER, offsetUv, 0).rgb;
}

#endif // TOON_RP_POST_PROCESSING_STACK_COMMON
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "../../ShaderLibrary/Ramp.hlsl"
#include "../../ShaderLibrary/Textures.hlsl"

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_fog

Expand Down Expand Up @@ -87,7 +87,7 @@

float3 SampleSceneColor(const float2 uv)
{
return SAMPLE_TEXTURE2D_LOD(_MainTex, POINT_SAMPLER, uv, 0);
return SAMPLE_TEXTURE2D_LOD(_MainTex, POINT_SAMPLER, uv, 0).rgb;
}

float SampleLinearDepth(const float2 uv)
Expand Down Expand Up @@ -159,7 +159,7 @@
sceneColor = colorKernel.values[4];
sobelStrength = max(sobelStrength, ComputeSobelStrength3(colorKernel, _ColorRamp));
#else // !_COLOR
sceneColor = float4(SampleSceneColor(uv), 1);
sceneColor = SampleSceneColor(uv);
#endif // _COLOR
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma vertex VS
#pragma fragment PS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

HLSLINCLUDE

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma vertex VS
#pragma fragment PS
Expand Down
8 changes: 4 additions & 4 deletions Packages/com.deltation.toon-rp/Shaders/ToonRPDefault.shader
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_fog
#pragma multi_compile_instancing
Expand Down Expand Up @@ -130,7 +130,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_instancing

Expand All @@ -155,7 +155,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_instancing

Expand All @@ -177,7 +177,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_instancing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct v2f
float2 uv : TEXCOORD0;
#if !defined(UNLIT)
half3 normalWs : NORMAL_WS;
float4 positionWs : POSITION_WS;
float3 positionWs : POSITION_WS;
#endif // !UNLIT

#ifdef REQUIRE_TANGENT_INTERPOLANT
Expand All @@ -61,7 +61,7 @@ v2f VS(const appdata IN)

const half3 normalWs = TransformObjectToWorldNormal(IN.normal);
OUT.normalWs = normalWs;
OUT.positionWs = float4(positionWs, 1.0f);
OUT.positionWs = positionWs;

#endif // !UNLIT

Expand Down
8 changes: 4 additions & 4 deletions Packages/com.deltation.toon-rp/Shaders/ToonRPUnlit.shader
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_fog
#pragma multi_compile_instancing
Expand All @@ -89,7 +89,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_instancing

Expand All @@ -114,7 +114,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_instancing

Expand All @@ -136,7 +136,7 @@

HLSLPROGRAM

#pragma enable_d3d11_debug_symbols
//#pragma enable_d3d11_debug_symbols

#pragma multi_compile_instancing

Expand Down

0 comments on commit de0a22c

Please sign in to comment.