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

Support macroses which comes from directives for ShaderLab #1826

Merged
merged 4 commits into from
Sep 28, 2020

Conversation

krasnotsvetov
Copy link
Collaborator

We could not provide full support multi_compile/shader_target directives due to complexity problem. That PR analysis directives and extract first combination of defines, also that PR covers target directive and some built-in multi_compile directives.

}

if (pragmaType.Equals("target"))
shaderTarget = firstValue.Replace(".", "");
Copy link
Member

Choose a reason for hiding this comment

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

It's not obvious that shaderTarget is a shader version. Perhaps replace the "25", "40" and "50" magic strings with constants that explain the name? Also, is it legal to specify both target and geometry or hull? What should the target version be then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

            #pragma target 3.0
            #pragma geometry geom
 
            #if SHADER_TARGET == 40
                #error GEOMETRY
            #endif

I got "GEOMETRY" error in Unity when compiling that shader. That means that geometry is preferred by Unity thatn target directive

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Target is maximum version then, I replaced literals by constants with names

@krasnotsvetov krasnotsvetov merged commit 3163ed0 into net203 Sep 28, 2020
@citizenmatt citizenmatt deleted the net203-RIDER-49527 branch December 16, 2020 15:58
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

Successfully merging this pull request may close these issues.

None yet

2 participants