guycalledfrank / bakery-issues

Bug tracker for Bakery
4 stars 0 forks source link

don't use ARGS in bakerydecodelightmap.hlsl #69

Open laurentopia opened 3 years ago

laurentopia commented 3 years ago

I was running into an odd bug that broke first build. Unity QA came back to me with this.

First of all, some shader code uses the macro TEXTURE2D_ARGS() within another macro, which will not work. TEXTURE2D_ARGS() is designed to be used when passing parameters to user functions, not inside other macros.

Also, the error reporting on Switch is not working correctly for the included files, so the error location is not reported. Here are some changes that should be made so the error location would be correctly printed in the console log.

In Assets\Bakery\shader\ShaderGraph\URP\BakeryDecodeLightmap.hlsl line 101-102:
    float4 lmColor = SAMPLE_TEXTURE2D(unity_Lightmap, samplerunity_Lightmap, lightmapUV);
    float3 lmDir = SAMPLE_TEXTURE2D(unity_LightmapInd, samplerunity_Lightmap, lightmapUV) * 2 - 1;

and in Assets\art\shaders\BakeryASE.cginc line 127-128:
    float4 lmColor = SAMPLE_TEXTURE2D(unity_Lightmap, samplerunity_Lightmap, lightmapUV);
    float3 lmDir = SAMPLE_TEXTURE2D(unity_LightmapInd, samplerunity_Lightmap, lightmapUV).rgb * 2 - 1;