Skip to content

Conversation

thomas-zeng
Copy link
Contributor

@thomas-zeng thomas-zeng commented Jun 4, 2021


Purpose of this PR


Testing status

  • QA
  • ABV

Comments to reviewers

  • Added special handling for fields within UNITY_STEREO_INSTANCING_ENABLED define so that they could be placed at the end of PackedVaryings struct. This is required for SV_RenderTargetArrayIndex to avoid error: Non system-generated input signature parameter () cannot appear after a system generated value
  • To QA: I have tested the repro project on Quest device and was able to see objects with shader graph materials render as expected.

//
if (subscript.HasPreprocessor() && (subscript.preprocessor.Contains("SHADER_STAGE_FRAGMENT")))
postUnpackedSubscripts.Add(subscript);
// special case, "UNITY_STEREO_INSTANCING_ENABLED" fields must be packed at the end of the struct because they are system generated semantics
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not conflict with the previous one (SHADER_STAGE_FRAGMENT) which also needs to be at the end ?

Copy link
Contributor Author

@thomas-zeng thomas-zeng Jun 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHADER_STAGE_FRAGMENT field is also a system generated semantic(FRONT_FACE_SEMANTIC) so it won't conflict in our XR use case. However the comment mentioned semantic ordering in fragment shader I am not sure about that use case. Will dig in more.

public static FieldDescriptor cullFace = new FieldDescriptor(Varyings.name, "cullFace", "VARYINGS_NEED_CULLFACE", "FRONT_FACE_TYPE",

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SHADER_STAGE_FRAGMENT case is there for situations where frag only SVs coming in wouldn't've been part of the vertex output but still needs to be in the interpolator structure. Since the custom interpolator feature allows arbitrarily adding more interpolators, we had to make sure frag only fields were pushed to the bottom.

A similar issue shows up with instancing, but the instance ids are optionally established in the vertex stage. So-- I think what we want here is for the UNITY_STEREO_INSTANCING_ENABLED case to come before the SHADER_STAGE_FRAGMENT case. They both need to be pushed to the end, but fragment should come after instancing.

I think it's safe (and preferred) to generalize this for any type of instancing, not just stereo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @esmelusina , thanks for the feedback!
I have moved the UNITY_STEREO_INSTANCING_ENABLED case before the SHADER_STAGE_FRAGMENT case in 3774019. I also checked the usage of SV_InstanceID in shader graph. It is only used as vertex shader input and not being used in Varyings. So I think we don't need to handle it in the PackedVaryings logic here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be optionally pulled in if the "Instance ID" node is used in the fragment stage. I'd prefer if you went ahead and generalized it.

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @esmelusina ,
I have made another commit that generalize the instance case here: 2a2afbe

@thomas-zeng thomas-zeng requested a review from esmelusina June 4, 2021 21:38
Copy link
Contributor

@esmelusina esmelusina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested in the comment thread there (and mentioned on slack).

Let me know if that's unclear.

@DennisDeRykeUnity
Copy link
Contributor

DennisDeRykeUnity commented Jun 9, 2021

@thomas-zeng thomas-zeng requested a review from esmelusina June 10, 2021 17:05
   - Generalized the case for all preprocessor cases that contains INSTANCING as keyword.
Copy link
Contributor

@esmelusina esmelusina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes. I'm approving for shadergraph, I'm going to @tian-unity to see if they want to check that this interacts correctly with speed tree.

@thomas-zeng thomas-zeng marked this pull request as ready for review June 15, 2021 20:54
@thomas-zeng thomas-zeng requested a review from a team as a code owner June 15, 2021 20:54
Copy link
Contributor

@DennisDeRykeUnity DennisDeRykeUnity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR’s dev branch last inherited from master around 7/4/2021 so I am comparing Nightly from back then on master against today’s Nightly on the dev branch

The dev branch is green wherever master was green except for several jobs. These became green upon re-run except for these two:

  • URP_Performance_BoatAttack on Win_DX12_performance_build_editmode_mono_Linear

  • URP_Performance_BoatAttack on Win_Vulkan_performance_build_editmode_mono_Linear

Both of these jobs had the following error and crashed. I do not believe this is due to this PR because I see the same error and crash in recent jobs on Graphics master for these two pipelines.

Error retrieving packages from source 'https://artifactory-slo.bf.unity3d.com/artifactory/api/nuget/slough-nuget':
Could not connect to the feed specified at 'https://artifactory-slo.bf.unity3d.com/artifactory/api/nuget/slough-nuget'. Please verify that
[12:17:30.831 Information] the package source (located in the Package Manager Settings) is valid and ensure your network connectivity.

@thomas-zeng thomas-zeng removed the request for review from sandy-carter-unity June 24, 2021 16:33
@esmelusina esmelusina self-requested a review July 6, 2021 17:38
Copy link
Contributor

@esmelusina esmelusina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-Approving to clear lock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants