Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when building for Windows #75

Open
blair-ahlquist opened this issue Oct 25, 2023 · 2 comments
Open

Error when building for Windows #75

blair-ahlquist opened this issue Oct 25, 2023 · 2 comments

Comments

@blair-ahlquist
Copy link

Shader error in 'Hidden/UnityFx/OutlineColor.URP': invalid subscript 'uv' at line 26 (on d3d11)

I installed UnityFx from local folder (because I couldn't find the package in the Unity store). I didn't get it to work in the editor and it makes the build fail. I had good success with UnityFx in the past (non-URP).

@xzippyzachx
Copy link

Also having this issue

@yorkie
Copy link

yorkie commented Nov 23, 2023

A workaround is removing the include to "PostProcessing/Common.hlsl" and add Vert and related structs by hand:

struct Attributes
{
	float4 positionOS : POSITION;
	float2 uv         : TEXCOORD0;
	UNITY_VERTEX_INPUT_INSTANCE_ID
};

struct Varyings
{
	float4 positionCS : SV_POSITION;
	float2 uv         : TEXCOORD0;
	UNITY_VERTEX_OUTPUT_STEREO
};

Varyings Vert(Attributes input)
{
	Varyings output;
	UNITY_SETUP_INSTANCE_ID(input);
	UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);

	output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
	output.uv = input.uv;
	return output;
}

This was introduced at 9b82dde, which works with Unity 2021, but failed at Unity 2022(URP14). The reason of this failure is https://github.com/Unity-Technologies/Graphics/blob/master/Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl#L36:

struct Varyings
{
    float4 positionCS : SV_POSITION;
    float2 texcoord   : TEXCOORD0;
    UNITY_VERTEX_OUTPUT_STEREO
};

URP changed the TEXCOORD0 name from uv to texcoord, but simply change input.uv to input.texcoord doesn't work, it seems texcoord is computed in the below function and not equal to the original uv:

float2 DynamicScalingApplyScaleBias(float2 xy, float4 dynamicScalingScaleBias)
{
    return dynamicScalingScaleBias.zw + xy * dynamicScalingScaleBias.xy;
}

I am not familiar with Unity Shader programming, so we can only wait for the @Arvtesh to fix it. However, at least the workaround is temporarily working for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants