error DX11 caelum shaders
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
error DX11 caelum shaders
Ogre Version: 1.12.8
Operating System: Win10
Render System: DX11
I'm playing a little with caelum use with DX9 it works fine but with DX11 i have the error Ogre::RenderingAPIException::RenderingAPIException: assembly shaders are unsupported . Searching around I found the problem is that DX11 doesn't support profile inferior to 4 . I tried to change the programs profiles to 4 but I receive and parsing error of script. Searching again I found the problem can be the instruction tex2d (or also others) which is no more valid for shaders 4, I found also that HLSL in ogre code has enable_backwards_compatibility set to true. So I suppose the best way to have the shader of caelum works is the set the profile to 4 and convert them to hlsl (they're all CG now). Correct?
But what is the best way to convert them? Is sufficient to convert cg to hlsl in the program declaration or also the extension of program definition file? Is there any document about the eventual syntax differences between CG and HLSL?
thanks
Operating System: Win10
Render System: DX11
I'm playing a little with caelum use with DX9 it works fine but with DX11 i have the error Ogre::RenderingAPIException::RenderingAPIException: assembly shaders are unsupported . Searching around I found the problem is that DX11 doesn't support profile inferior to 4 . I tried to change the programs profiles to 4 but I receive and parsing error of script. Searching again I found the problem can be the instruction tex2d (or also others) which is no more valid for shaders 4, I found also that HLSL in ogre code has enable_backwards_compatibility set to true. So I suppose the best way to have the shader of caelum works is the set the profile to 4 and convert them to hlsl (they're all CG now). Correct?
But what is the best way to convert them? Is sufficient to convert cg to hlsl in the program declaration or also the extension of program definition file? Is there any document about the eventual syntax differences between CG and HLSL?
thanks
- sercero
- Bronze Sponsor
- Posts: 450
- Joined: Sun Jan 18, 2015 4:20 pm
- Location: Buenos Aires, Argentina
- x 156
Re: error DX11 caelum shaders
If you know something abouth HLSL your best bet is to assume that CG is the same as HLSL and fix the errors that you encounter along the way.
The ideal strategy would be to use the Ogre unified shader language, but the syntax is GLSL like so that would be much more difficult.
The ideal strategy would be to use the Ogre unified shader language, but the syntax is GLSL like so that would be much more difficult.
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
Re: error DX11 caelum shaders
thanks Sercero, what is the best way to intercept the instructions in the cg program which generate the errors when these happen? thanks
-
- OGRE Team Member
- Posts: 1995
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
Re: error DX11 caelum shaders
there is also HLSL_SM4Support.hlsl which allows to convert old Cg shaders to SM4 like this:
https://github.com/OGRECave/ogre/blob/m ... GlassFP.cg
it is used internally by OgreUnifiedShader.h
https://github.com/OGRECave/ogre/blob/m ... GlassFP.cg
it is used internally by OgreUnifiedShader.h
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
Re: error DX11 caelum shaders
Thanks Paroj, i'll try this way; is sufficient to add the include in the CG program ? thanks
-
- OGRE Team Member
- Posts: 1995
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
Re: error DX11 caelum shaders
no, you also need to use the SAMPLER2D macro instead of sampler2D etc
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
Re: error DX11 caelum shaders
I see all the macros defined in the hlsl file at place of equivalent instructions currently present in the CG file
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
Re: error DX11 caelum shaders
I tried to use the include HLSL_SM4Support.hlsl ; in the various CG programs I added the #include <HLSL_SM4Support.hlsl> at the top and changed the various samplerXD with the equivalent macro, changed the program declaration from CG to HLSL deleting the version line like in your example.
Now using dx11 the error I received in the skydome program disappeared, but I receive an compile error in the program PhaseMoonVP
the declaration inside the material is
the material using it is
I don't see any particular problem with the code; should I add the target version in the declaration?
Now using dx11 the error I received in the skydome program disappeared, but I receive an compile error in the program PhaseMoonVP
Code: Select all
PhaseMoonVP
(
in float4 iPosition : POSITION,
in float2 iTexCoord : TEXCOORD0,
uniform float4x4 worldviewproj_matrix,
out float2 oTexCoord : TEXCOORD0,
out float4 oPosition : POSITION
) {
oPosition = mul(worldviewproj_matrix, iPosition);
oTexCoord = iTexCoord;
}
Code: Select all
vertex_program Caelum/PhaseMoonVP hlsl
{
source CaelumPhaseMoon.cg
entry_point PhaseMoonVP
default_params
{
param_named_auto worldviewproj_matrix worldviewproj_matrix
}
}
Code: Select all
material Caelum/PhaseMoon
{
receive_shadows off
technique Default
{
pass Main
{
lighting off
depth_check off
depth_write off
fog_override true none
ambient 0 0 0
diffuse 0 0 0
scene_blend alpha_blend
texture_unit MoonDisc
{
texture moon_disc.dds
}
vertex_program_ref Caelum/PhaseMoonVP
{
}
fragment_program_ref Caelum/PhaseMoonFP
{
}
}
}
}
- sercero
- Bronze Sponsor
- Posts: 450
- Joined: Sun Jan 18, 2015 4:20 pm
- Location: Buenos Aires, Argentina
- x 156
Re: error DX11 caelum shaders
But what is the compilation error?
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
Re: error DX11 caelum shaders
the error is :
unsupportedexception: can't load material "caelum/phasemoon": pass 0 vertex program CaelumPhaseMoonVP cannot be used compile error in Caelum at: d:\demoapp\caelum\main\src\internalutilities.cpp (line 102).
unsupportedexception: can't load material "caelum/phasemoon": pass 0 vertex program CaelumPhaseMoonVP cannot be used compile error in Caelum at: d:\demoapp\caelum\main\src\internalutilities.cpp (line 102).
-
- OGRE Team Member
- Posts: 1995
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
Re: error DX11 caelum shaders
there should be some more info further above in the log. My guess is that the return type of "PhaseMoonVP" is missing.
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
Re: error DX11 caelum shaders
I'll check, thanks you; I did also some parallel testing, changing simply the declaration of programs in the material from CG to HLSL and inserting the target instruction at place of profile; this error doesn't appear, I have other errors: one of I have corrected (there was a discrepancy between the out parameters of vertex and the in parameter of his fragment program of one of cg file, the other I'm still searching the reason.
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
Re: error DX11 caelum shaders
in the log is present only this warning:
Warning: material Caelum/PhaseMoon/0000020B81D62860 has no supportable Techniques and will be blank. Explanation:
Pass 0: vertex program Caelum/PhaseMoonVP cannot be used - compile error.
The only anomaly I found is that the VP program return position and texture
But the fragment takes only texture in input
This was the problem I had with the other cg of cloudlayers when I tried without the include in the header and specifying the target version (cloudlayer was target 3, the moon target 2), but the error message was different; here seems a syntax error: perhpas the return should be specified differently in DX11, with the return instruction?
Warning: material Caelum/PhaseMoon/0000020B81D62860 has no supportable Techniques and will be blank. Explanation:
Pass 0: vertex program Caelum/PhaseMoonVP cannot be used - compile error.
The only anomaly I found is that the VP program return position and texture
Code: Select all
oPosition = mul(worldviewproj_matrix, iPosition);
oTexCoord = iTexCoord;
This was the problem I had with the other cg of cloudlayers when I tried without the include in the header and specifying the target version (cloudlayer was target 3, the moon target 2), but the error message was different; here seems a syntax error: perhpas the return should be specified differently in DX11, with the return instruction?
-
- Goblin
- Posts: 211
- Joined: Sat Jan 23, 2016 11:26 am
- x 17
Re: error DX11 caelum shaders
I managed to have the shaders compiled under dx11 with only the HLSL addition + target, only correcting a couple of program wrong sequence of input out parameters between VP and FP sections. Unluckily it seems they don't work properly (the day to night cycle is broken). For the moment I'll continue with dx9, returning later on them as study case for learn to use HLSL; I'll already found the good tutorial in ogre wiki, but it exist also a page showing the deltas between the dx9 and dx11 versions of language? thanks.
- sercero
- Bronze Sponsor
- Posts: 450
- Joined: Sun Jan 18, 2015 4:20 pm
- Location: Buenos Aires, Argentina
- x 156
Re: error DX11 caelum shaders
You can get some comparisons here:
https://en.wikipedia.org/wiki/High-Leve ... g_Language
And here:
https://docs.microsoft.com/en-us/window ... ifferences
https://en.wikipedia.org/wiki/High-Leve ... g_Language
And here:
https://docs.microsoft.com/en-us/window ... ifferences