custom build tool confusion

Started by
4 comments, last by Bombshell93 12 years, 8 months ago
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
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
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.
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
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?
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!

This topic is closed to new replies.

Advertisement