What works in DX11 and not DX9.
- BlueSkyKnight
- Topic Author
Less
More
7 years 1 month ago - 7 years 1 month ago #1
by BlueSkyKnight
What works in DX11 and not DX9. was created by BlueSkyKnight
So I would like clarification/help.
So i noticed that when testing my shader in DX11 There is a lot more leniency when coding. The same thing happens in openGL.
Like In DX 10 I am allowed to do this. But, if I go to a dx9 application I have to change the code a bit and add a other Pass.
Are the limitation there because of DX9 or is there a better way of doing this?
I ended up doing this. Adding a 2nd Pass
I would like to ask is there a better way to shut down loops in DX9? Any help will be appreciated.
Thank you and have a nice day.
So i noticed that when testing my shader in DX11 There is a lot more leniency when coding. The same thing happens in openGL.
Like In DX 10 I am allowed to do this. But, if I go to a dx9 application I have to change the code a bit and add a other Pass.
int Con;
if (Dis_Occlusion == 0)
Con = 0;
else
Con = 8;
[loop]
for (int i = 0; i < Con; i++)
{
colOutOne += DepthMapOne(texcoord + dir * weight[i] * B)/Con;
colOutTwo += DepthMapTwo(texcoord - dir * weight[i] * B)/Con;
}
Are the limitation there because of DX9 or is there a better way of doing this?
I ended up doing this. Adding a 2nd Pass
int Con;
if (Dis_Occlusion == 0)
Con = 1;//has to be one for DX9 Games
else
Con = 8;
[unroll]
for (int i = 0; i < Con; i++)
{
colOutOne += tex2D(SamplerDML,texcoord + dir * weight[i] * B)/Con;
colOutTwo += tex2D(SamplerDMR,texcoord - dir * weight[i] * B)/Con;
}
I would like to ask is there a better way to shut down loops in DX9? Any help will be appreciated.
Thank you and have a nice day.
Last edit: 7 years 1 month ago by BlueSkyKnight.
Please Log in or Create an account to join the conversation.
- crosire
Less
More
Why do the loop at all if you don't want it?
if (Dis_Occlusion)
{
const int Con = 8;
for (int i = 0; i < Con; i++)
{
colOutOne += tex2D(SamplerDML, texcoord + dir * weight[i] * B) / Con;
colOutTwo += tex2D(SamplerDMR, texcoord - dir * weight[i] * B) / Con;
}
}
Please Log in or Create an account to join the conversation.
- BlueSkyKnight
- Topic Author
Less
More
7 years 1 month ago - 7 years 1 month ago #3
by BlueSkyKnight
Replied by BlueSkyKnight on topic What works in DX11 and not DX9.
crosire wrote: Why do the loop at all if you don't want it?
if (Dis_Occlusion) { const int Con = 8; for (int i = 0; i < Con; i++) { colOutOne += tex2D(SamplerDML, texcoord + dir * weight[i] * B) / Con; colOutTwo += tex2D(SamplerDMR, texcoord - dir * weight[i] * B) / Con; } }
Oh that loop is used in some games to help with the halo effect. But, Sometimes it's not needed in other games. The loop helps with disocclusion.
The inconsistency from game engine to game engine sometimes necessitates it. So I leave it as a option to be turned off or on.
What it does is smooth out the harsh edge of the Halo effect so basically masking it. I wish I knew a better way of doing this. But, I don't.
This is a link to the section. This is the shader that works in DX11 and not DX9
github.com/BlueSkyDefender/Depth3D/blob/...1.9.5.fx#L1742-L1830
This is what I had to change to make it work in DX 9
github.com/BlueSkyDefender/Depth3D/blob/...5_dx9.fx#L1755-L1894
I try my best. But, some times I don't know what to do. Also the other reason I ask is because, in this instance it feels like I am trying to force something that I should not do.
Last edit: 7 years 1 month ago by BlueSkyKnight.
Please Log in or Create an account to join the conversation.