Discussion:
Specifying target for shader entrypoints
(too old to reply)
Andrew McDonald
2009-06-17 13:20:54 UTC
Permalink
According to the HLSL docs for function syntax, the target may be specified
in the storage class element of the definition. However it gives an
incomplete description of how to do this, with no example code. I've never
actually seen this done in any code either.

The following fails to compile under the March 2009 DXSDK:
ps_3_0 float4 main() : COLOR { return 0; }

with "fxc.exe Blah.fx", yielding:
Blah.fx(1,15): error X3089: 'ps_3_0': functions cannot have a target

Are the docs simply wrong on this point? Is there any other way to specify a
compilation target within the file itself? We have files that are supposed
to be compiled to all manner of targets now, and I'd like to reduce the
bloat of multiple massive near-identical custom build rules.

--
Andy
Andrew McDonald
2009-07-06 08:44:17 UTC
Permalink
Post by Andrew McDonald
According to the HLSL docs for function syntax, the target may be
specified in the storage class element of the definition. However it gives
an incomplete description of how to do this, with no example code. I've
never actually seen this done in any code either.
ps_3_0 float4 main() : COLOR { return 0; }
Blah.fx(1,15): error X3089: 'ps_3_0': functions cannot have a target
I ran this past Microsoft if anyone else is interested. This is old syntax
that allowed a limited form of overloading. Functions with the same name
could be selected depending on the target type, but it didn't work on the
entrypoint so you still had to specify the target externally. The syntax was
removed from the compiler, and the docs will be updated.

--
Andy

Loading...