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

HLSL Shader compilation in Visual Studio #1037

Merged
merged 2 commits into from
Apr 9, 2018

Conversation

tdesveauxPKFX
Copy link
Contributor

Visual Studio can compile HLSL shaders with the FxCompile block.

As far as I know, this is available at least from vs2012. I did not test for earlier versions.

There is one thing bothering me with this implementation, I had to create shaderdefines and shaderoptions even though the resulting tag is the same as ClCompile.
This is to avoid doing something like

filter { "files:**.hlsl" }
   defines { "SOME_DEFINE" }

as it would be treated as a per-file config instead of a block one.

If you have any idea to improve this, I'm up to implement it.

Copy link
Member

@samsinsane samsinsane left a comment

Choose a reason for hiding this comment

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

This approach makes sense to me.

m.categories.FxCompile = {
name = "FxCompile",
extensions = { ".hlsl" },
priority = 3,
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be priority 3?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really.
I implemented it some time ago so I don't remember it that clearly but it might be that vs add this block just after the ClCompile block so I wanted to reproduce this.

I can update this to keep the previous priority order if you'd prefer.

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough, I see no reason to hold the PR up over this. What you have is fine.

@starkos starkos merged commit 0db3f56 into premake:master Apr 9, 2018
@tdesveauxPKFX tdesveauxPKFX deleted the vstudio-fxcompile branch April 12, 2018 17:33
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.

4 participants