Sign in to follow this  

custom build tool confusion

This topic is 2336 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[b]EDIT: 3rd and 4th replies have my current concerns,
The OP was a silly mistake which has mostly been corrected[/b]

I'm trying to pre-compile my shaders ready to use in my engine.
Naturally I'm using fxc.exe
but I've tried a large number of .bat files and tried looking for tutorials but its fairly undocumented.
I can't seem to get anything out of it bar a split second of cmd which I can't stop to read.

[code]"fxc.exe" /Od /Zi /T ps_4_0 /Fo "Colour.cps" "Colour.ps"[/code] is the .bat I'm currently trying (relative to content of course)
But I've also tried
[code]fxc /Od /Zi /T ps_4_0 /Fo Colour.cps Colour.ps[/code][code]fxc.exe /Od /Zi /T ps_4_0 /Fo Colour.cps Colour.ps[/code][code]fxc /Od /Zi /Tps_4_0 /Fo Colour.cps Colour.ps[/code] etc. etc.

I just can't get anything from it, its doing absolutely nothing.
I've also tried setting up a custom build tool but its completely ridiculous,
I've tried a large number of codes, all of which supposedly work but none have given any result just error after error after error.
Most recent of which
[code]"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" /T ps_4_0 "C:\Users\Bombshell\Documents\Visual Studio 2010\Projects\DXManager\Shaders\Colour.ps"[/code]
[code]1>------ Build started: Project: IndigoGraphics, Configuration: Debug Win32 ------
1>CUSTOMBUILD : error X3501: 'main': entrypoint not found
1>
1> Compiles Pixel Shaders
1> Microsoft (R) Direct3D Shader Compiler 9.29.952.3111
1> Copyright (C) Microsoft Corporation 2002-2009. All rights reserved.
1>
1> compilation failed; no code produced========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========[/code]

I'm rather disappointed that possible one of the most useful VC++ components (custom build tools) is so poorly documented and so awkward to use.
I won't lie, I'm not an experienced user of VC++, but a week of searching the internet for information and I have come up with nothing more than scraps.

Off of the subject of my whining like a little girl,
could someone shed some light on how I can set up a number of custom build tools (I intend 1 for pixel shader and 1 for vertex shader)
and why I can't get anything out of fxc.exe?

any help is appreciated,
Thanks in advanced,
Bombshell

Share this post


Link to post
Share on other sites
Looks like you're trying to compile a pixel shader... what is the content of color.ps?

Does it have a function called "main" ? The compiler is telling you that an entry point called "main" is missing. That's probably the default entry point. But I'm sure there's a way to provide an alternate entry point.

EDIT: looks like the way to provide an alternate entry point is:

/E <entry_point_name>


reference: [url="http://msdn.microsoft.com/en-us/library/bb509709(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/bb509709(v=vs.85).aspx[/url]

Share this post


Link to post
Share on other sites
woops!
sorry about that then, and thanks, its compiled fine now.
Still I would like to know how I could get it to work better. at the moment I have to define the entire path for each shader,
is there a way to have the custom build tools automatically get the files location and compile it with a different extension?
chances are I'll be using a large number of HLSL shaders and changing the custom build tool for each and every one of them is tedious.

Share this post


Link to post
Share on other sites
Okay, this "works" when I do not have "/Fo %(Outputs)"
[code]"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe"/Od /Zi /T ps_4_0 /Fo %(Outputs) %(FullPath)[/code]
Otherwise it gives me this
[code]1>------ Build started: Project: IndigoGraphics, Configuration: Debug Win32 ------
1> Too many files specified ('2010\Projects\DXManager\Debug\Shaders\Colour.cps' was the last one), use /? to get usage information
1> Compiles Pixel Shaders
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========[/code]

Can anyone help with this?
"Work" is in quotes because without defining the output via /Fo fxc.exe will not output anything. But when trying VC++ 2010 gives me the error above.

EDIT: It did "work" now Its giving me
[code]"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" /T ps_4_0 %(FullPath)[/code]
[code]1>------ Build started: Project: IndigoGraphics, Configuration: Debug Win32 ------
1> Too many files specified ('studio' was the last one), use /? to get usage information
1> Compiles Pixel Shaders
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========[/code]

EDITEDIT:
Same result with this
[code]"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" %(FullPath) /Od /Zi /T ps_4_0 /Fo $(TargetDir)Shaders\%(Filename).cps[/code]

Share this post


Link to post
Share on other sites
I found the issue but I'm not sure how to fix it.
The paths being passed through macros are not in quotes and so the first space in the path is being seen as a split to the next argument.
How would I put macro paths in quotes to avoid this?

Share this post


Link to post
Share on other sites
I got it working,
For anyone who has a similar issue, I have a reusable version working.
I didn't expect this to work as I tried things very similar to it. Regardless I gave it a go.
[code]"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" /Od /Zi /T ps_4_0 /Fo "%(Outputs)" "%(FullPath)"[/code]
worked perfectly
With output set as
[code]$(TargetDir)Shaders\%(Filename).cps[/code]
it took me a while to figure it out, I was in a rush at first.
I took a break and watched a film, came back to it and tadah!

Share this post


Link to post
Share on other sites

This topic is 2336 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this