Skip to content

[SRP] Add Conditional field for shader code generation in Generate include command #4889

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

Merged
merged 4 commits into from
Jun 13, 2021

Conversation

sebastienlagarde
Copy link
Contributor

Purpose of this PR

[SRP] Add Conditional field for shader code generation in Generate include command

Example:
[SurfaceDataAttributes("Shadow Tint", false, true, preprocessor: "defined(_ENABLE_SHADOW_MATTE) && (SHADERPASS == SHADERPASS_PATH_TRACING)")]
public Vector4 shadowTint;

Generate on HLSL side

{
float3 color;
float3 normalWS;
#if defined(_ENABLE_SHADOW_MATTE) && (SHADERPASS == SHADERPASS_PATH_TRACING)
float4 shadowTint;
#endif
};

and for debug code it generate an empty field so it doesn't perturb the debug menu

    case DEBUGVIEW_UNLIT_SURFACEDATA_NORMAL_VIEW_SPACE:
        result = surfacedata.normalWS * 0.5 + 0.5;
        break;

#if defined(_ENABLE_SHADOW_MATTE) && (SHADERPASS == SHADERPASS_PATH_TRACING)
case DEBUGVIEW_UNLIT_SURFACEDATA_SHADOW_TINT:
result = surfacedata.shadowTint.xyz;
needLinearToSRGB = true;
break;
#else
case DEBUGVIEW_UNLIT_SURFACEDATA_SHADOW_TINT:
result = 0;
break;
#endif


Testing status

Describe what manual/automated tests were performed for this PR


Comments to reviewers

Notes for the reviewers you have assigned.

@github-actions
Copy link

It appears that you made a non-draft PR!
Please convert your PR to draft (button on the right side of the page)
and cancel any jobs that started on Yamato.
See the PR template for more information.
Thank you!

@sebastienlagarde sebastienlagarde merged commit 3f32633 into master Jun 13, 2021
@sebastienlagarde sebastienlagarde deleted the HDRP/add-define-support branch June 13, 2021 21:47
sebastienlagarde added a commit that referenced this pull request Aug 6, 2021
* Improved a bit the area cookie behavior for higher smoothness values to reduce artifacts. #3578

* [SRP] Add Conditional field for shader code generation in Generate include command #4889

* Fix VT Feedback buffer #4868

* [HDRP][Path Tracing] Backport of sky+recorder fix #5001

* [HDRP] Fix distortion when resizing the graphics compositor window in builds #5062

* Add compatibility with Unity 2020.3 for compositor resize callback

* Small cleanup

Co-authored-by: anisunity <42026998+anisunity@users.noreply.github.com>
Co-authored-by: Yao Xiaoling <yao@unity3d.com>
Co-authored-by: Emmanuel Turquin <emmanuel@turquin.org>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
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.

1 participant