Jump to content
  • Advertisement
Sign in to follow this  
Bombshell93

custom build tool confusion

This topic is 2550 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

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


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.

"fxc.exe" /Od /Zi /T ps_4_0 /Fo "Colour.cps" "Colour.ps" is the .bat I'm currently trying (relative to content of course)
But I've also tried
fxc /Od /Zi /T ps_4_0 /Fo Colour.cps Colour.psfxc.exe /Od /Zi /T ps_4_0 /Fo Colour.cps Colour.psfxc /Od /Zi /Tps_4_0 /Fo Colour.cps Colour.ps 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
"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"
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 ==========


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
Advertisement
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: http://msdn.microsoft.com/en-us/library/bb509709(v=vs.85).aspx

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)"
"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe"/Od /Zi /T ps_4_0 /Fo %(Outputs) %(FullPath)
Otherwise it gives me this
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 ==========


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
"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" /T ps_4_0 %(FullPath)
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 ==========


EDITEDIT:
Same result with this
"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

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.
"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" /Od /Zi /T ps_4_0 /Fo "%(Outputs)" "%(FullPath)"
worked perfectly
With output set as
$(TargetDir)Shaders\%(Filename).cps
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!