Jump to content

Pre-Pull Request: D3D11 Initial testing


JeffR

Recommended Posts

While not a full PR yet, the D3D11 stuff looks stable enough we can being preliminary testing of how it plays for everyone.


The branch is here: https://github.com/rextimmy/Torque3D/tree/d3d11


Follow the standard 'how to test a PR' instructions to pull it down to your local repository an make sure you do a new project to ensure the new engine and template files get copied. Once you get the game fired up, ensure you can switch to the D3D11 driver in the options menu and test everything and make note of any problems.


If you can integrate it into an existing project for a more in-depth test, that's even better.

Link to comment
Share on other sites

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

If you can integrate it into an existing project for a more in-depth test, that's even better.

 

I am not sure that would be possible as I use AFX 2.0 with UAIK in my project. I mean AFX 2.0 uses DX 9 shaders as far as I know and DX 11 does not fall back to DX 9 shaders right?


Anyway I will try to see the outcome after some testings :D And report back with the results :mrgreen:

 

Actually, Timmy threw in some macros to allow dx9 and dx11 to share shaders. for some practical samples:

https://github.com/rextimmy/Torque3D/blob/development/Templates/Full/game/shaders/common/basicCloudsP.hlsl#L31 becomes

https://github.com/rextimmy/Torque3D/blob/d3d11/Templates/Full/game/shaders/common/basicCloudsP.hlsl#L32


https://github.com/rextimmy/Torque3D/blob/development/Templates/Full/game/shaders/common/basicCloudsP.hlsl#L35 becomes

https://github.com/rextimmy/Torque3D/blob/d3d11/Templates/Full/game/shaders/common/basicCloudsP.hlsl#L32


https://github.com/rextimmy/Torque3D/blob/development/Templates/Full/game/shaders/common/lighting/advanced/vectorLightP.hlsl#L41-L67 becomes

https://github.com/rextimmy/Torque3D/blob/d3d11/Templates/Full/game/shaders/common/lighting/advanced/vectorLightP.hlsl#L39-L59 (Do note best kept in groups of 4, so 3+1, 2+2, 4)


https://github.com/rextimmy/Torque3D/blob/development/Templates/Full/game/shaders/common/lighting/advanced/vectorLightP.hlsl#L70 becomes

https://github.com/rextimmy/Torque3D/blob/d3d11/Templates/Full/game/shaders/common/lighting/advanced/vectorLightP.hlsl#L62


https://github.com/rextimmy/Torque3D/blob/development/Templates/Full/game/shaders/common/lighting/advanced/vectorLightP.hlsl#L178 becomes

https://github.com/rextimmy/Torque3D/blob/d3d11/Templates/Full/game/shaders/common/lighting/advanced/vectorLightP.hlsl#L170 on the send end with

https://github.com/rextimmy/Torque3D/blob/development/Templates/Full/game/shaders/common/lighting/advanced/softShadow.hlsl#L75 becoming

https://github.com/rextimmy/Torque3D/blob/d3d11/Templates/Full/game/shaders/common/lighting/advanced/softShadow.hlsl#L76 on the recieving end,

Link to comment
Share on other sites

While not a full PR yet, the D3D11 stuff looks stable enough we can being preliminary testing of how it plays for everyone.


The branch is here: https://github.com/rextimmy/Torque3D/tree/d3d11


Follow the standard 'how to test a PR' instructions to pull it down to your local repository an make sure you do a new project to ensure the new engine and template files get copied. Once you get the game fired up, ensure you can switch to the D3D11 driver in the options menu and test everything and make note of any problems.


If you can integrate it into an existing project for a more in-depth test, that's even better.

 

Works great so far and with the switch options. :)

Link to comment
Share on other sites

  • 4 weeks later...

I'm trying to solve an issue I'm having with SkyBox/SkyLine with the PBRDX11 branch and I found something which look not correct in the new shaders. I'm really not an expert in shaders but I'm starting to understand a little more how they work.


In shaders/common/planarReflectV.hlsl there's this:

TORQUE_UNIFORM_SAMPLER2D(texMap, 0);
TORQUE_UNIFORM_SAMPLER2D(refractMap, 0);

I don't think this is ok, right?

From the torqueScript shader, it's set like this:

new ShaderData( Reflect )
{
  DXVertexShaderFile 	= "shaders/common/planarReflectV.hlsl";
  DXPixelShaderFile 	= "shaders/common/planarReflectP.hlsl";

  OGLVertexShaderFile  = "shaders/common/gl/planarReflectV.glsl";
  OGLPixelShaderFile   = "shaders/common/gl/planarReflectP.glsl";

  samplerNames[0] = "$diffuseMap";  
  samplerNames[1] = "$refractMap";

  pixVersion = 1.4;
};

I don't think it's what cause my issue but should it be diffuseMap or texMap used?


ReflectBump shader seem wrong also but maybe it's ok to send diffuseMap sampler and set is as textMap in the shader code... :oops:

samplerNames[0] = "$diffuseMap";
  samplerNames[1] = "$refractMap";
  samplerNames[2] = "$bumpMap";   

TORQUE_UNIFORM_SAMPLER2D(texMap, 0);
TORQUE_UNIFORM_SAMPLER2D(refractMap, 1);
TORQUE_UNIFORM_SAMPLER2D(bumpMap, 2);

Does this works or diffuseMap/texMap should be the same?

Link to comment
Share on other sites

TORQUE_UNIFORM_SAMPLER2D(texMap, 0);
TORQUE_UNIFORM_SAMPLER2D(refractMap, 1);

 

That refractMap should be using tex unit 1, it's a typo in the shader. Good pickup ;) The shader uniform texture unit should match the samplerNames[N] from ShaderData


*Edit:


I updated my original d3d11 branch with this fix, i'm sure once az notices he will update the pbr branch too.

Link to comment
Share on other sites

samplerNames[0] = "$diffuseMap";
  samplerNames[1] = "$refractMap";
  samplerNames[2] = "$bumpMap";   

TORQUE_UNIFORM_SAMPLER2D(texMap, 0);
TORQUE_UNIFORM_SAMPLER2D(refractMap, 1);
TORQUE_UNIFORM_SAMPLER2D(bumpMap, 2);

Does this works or diffuseMap/texMap should be the same?

 

It should actually work with D3D11 even though the names don't match(it works because the texture units match) BUT it's good practice to make sure it all matches up as a different API it may not work.

Link to comment
Share on other sites

Any ideas about what is causing the SkyBox with FogBandHeight > 0 issue? I think it's related to the new shader/D3D11 code so maybe it should be discussed here...


http://forums.torque3d.org/viewtopic.php?f=9&t=55&start=140#p4447


It also cause the SkyLine object to not render correctly.

 

I can't say i have noticed but truth be told i haven't been able to test every scenario. I'll take a look. Do keep reporting any problems you find, it all helps.

Link to comment
Share on other sites

samplerNames[0] = "$diffuseMap";
  samplerNames[1] = "$refractMap";
  samplerNames[2] = "$bumpMap";   

TORQUE_UNIFORM_SAMPLER2D(texMap, 0);
TORQUE_UNIFORM_SAMPLER2D(refractMap, 1);
TORQUE_UNIFORM_SAMPLER2D(bumpMap, 2);

Does this works or diffuseMap/texMap should be the same?

 

It should actually work with D3D11 even though the names don't match(it works because the texture units match) BUT it's good practice to make sure it all matches up as a different API it may not work.

 

OpenGL's twitchy about it, yeah. Up to and including case sensitivity.

Link to comment
Share on other sites

[mention]Mud-H[/mention]

I tried the fogband at 1 on the regular d3d11 and it's ok

Ahhhh, I will do a test on my clean T3D Installation by running only the D3D11 branch. Might be from PBR specific code then or could it be a local hardware issue?


Yesterday, I was wondering why the PBR FullTemplate demo was telling that my renderer was D3D9 in the window title so I reinstalled my GFX drivers but then I realized it in console that D3D11 was found: Direct 3D (version 11.x) device found so I tought it was something not updated. But after a sleep, I tought maybe I had to change the graphic options... and yes I had to but it change nothing (A chance because I would have been very angry about myself...)


EDIT:

What DirectX SDK I should be using? While compiling the updated PBR branch I got some console warning I never saw before:

1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(12): warning C4005: 'DXGI_STATUS_OCCLUDED' : macro redefinition (F:\T3DProjects\T3DLab\Engine\source\gfx\D3D11\gfxD3D11EnumTranslate.cpp)
1>          C:\Program Files (x86)\Windows Kits\8.1\Include\shared\winerror.h(50092) : see previous definition of 'DXGI_STATUS_OCCLUDED'
1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\dxgitype.h(13): warning C4005: 'DXGI_STATUS_CLIPPED' : macro redefinition (F:\T3DProjects\T3DLab\Engine\source\gfx\D3D11\gfxD3D11CardProfiler.cpp)
1>          C:\Program Files (x86)\Windows Kits\8.1\Include\shared\winerror.h(50101) : see previous definition of 'DXGI_STATUS_CLIPPED'

I got 100+ of those but the compile succeeded. Do microsoft directx sdk (june 2010) is ok? I think I remember reading about that DirectX is now part of Windows SDK, right?

Link to comment
Share on other sites

Sorry for being annoying these days... Still haven't been able to load my test level in Debug after 2 hours of trying. I'm almost there but this time it failed to compile shader using DirectX11 (I never test my game with D3D11 yet, I forgot to change my render options to used it).

So here's what I get in console:

Constant Buffer Name: $Params
Variable Name $diffuseMaterialColor:, offset: 0, size: 16, constantDesc.Elements: 1
Variable Name $alphaTestValue:, offset: 16, size: 4, constantDesc.Elements: 1
Variable Name $matInfoFlags:, offset: 20, size: 4, constantDesc.Elements: 1
Variable Name $vEye:, offset: 32, size: 12, constantDesc.Elements: 1
Variable Name $oneOverFarplane:, offset: 48, size: 16, constantDesc.Elements: 1
Variable Name $visibility:, offset: 64, size: 4, constantDesc.Elements: 1
Compiling Shader: 'shadergen:/d062ebf5_V.hlsl'
failed to compile shader: F:\T3DProjects\T3DLab\My Projects\GameLab\game\shaders\procedural\d062ebf5_V.hlsl(27,33): error X3536: Duplicated input semantics can't change type, size, or layout ('TEXCOORD0').
f:\t3dprojects\t3dlab\engine\source\gfx\d3d11\gfxd3d11shader.cpp(922,0): {Fatal-ISV} - Unable to compile shader!

 

Here's the content of that procedural shader, I think there's something wrong with the TEXCOORD0 used twice in VertData struct: (I have attached the full file)

#include "shaders/common/lighting.hlsl"
#include "shaders/common/torque.hlsl"

// Features:
// Vert Position
// Base Texture
// Specular Map
// Bumpmap [Deferred]
// Deferred RT Lighting
// Pixel Specular [Deferred]
// Visibility
// HDR Output
// Hardware Instancing

struct VertData
{
  float3 position        : POSITION;
  float tangentW        : TANGENTW;
  float3 normal          : NORMAL;
  float3 T               : TANGENT;
  float2 texCoord        : TEXCOORD0;
  float4 inst_objectTrans[4] : TEXCOORD0;
  float inst_visibility : TEXCOORD4;
};

what are those procedural files exactly? I remember a while back, there was some options about how to manage the procedural shaders, do there's still something about it?


Edit: Okay, I understand already a bit more about procedural shader after examinating the shaderFeatureHLSL.cpp file but hard to read..

Here's how I think that procedural file should be to avoid the crash with my limited knowledge

struct VertData
{
  float3 position        : POSITION;
  float tangentW        : TANGENTW;
  float3 normal          : NORMAL;
  float3 T               : TANGENT;
  float2 texCoord        : TEXCOORD0;
[b]  float4 inst_objectTrans[4] : TEXCOORD4;[/b] //Was TEXCOORD0 but seem to be related to TEXCOORD4 in the shaderFeature file
 [b] float inst_visibility : TEXCOORD5;[/b] //Was TEXCOORD4 but in ConnectData it's 5 so I took a guess...
};


struct ConnectData
{
  float4 hpos            : SV_Position;
  float2 out_texCoord    : TEXCOORD0;
  float3x3 outWorldToTangent : TEXCOORD1;
  float3 outWsPosition   : TEXCOORD4;
  float visibility      : TEXCOORD5;
};

 

EDIT2: Can't run the D3D11 renderer in Release either, I switched back to D3D9 and everything work fine.

procedural.rar

Link to comment
Share on other sites

Go into game/scripts/client/prefs.cs and change $pref::TS::maxInstancingVerts to 0. I haven't added instancing support yet and this will fix the procedural shader problem above.


As for the warnings in your other post, you can ignore those for now. It's because d3d9 is still using the now deprecated d3dx libraries.

Link to comment
Share on other sites

Go into game/scripts/client/prefs.cs and change $pref::TS::maxInstancingVerts to 0. I haven't added instancing support yet and this will fix the procedural shader problem above.

Thanks! I can now load my level with D3D11, everything is fine except 1 or 2 materials are weird. I think I played with vertex lit parameters on those. But then I launch TorqueLab to fix those materials and the rendering became very weird... It stay the same when I got back into game. Here's a screenshot, It's like if the view from when I open TorqueLab got lock into the rendering(You can see a House Ghost iin background)... Also it should not be that dark.

http://mud-h.com/miscweb/t3dforum/Misc/D3D11TLabBugA.jpg

Any ideas about what is happening? :shock:


Oh, and also my screenshot no longer works

Screenshot module not initialized by device

 

Anyway, take the time you need, I can live with D3D9 for now...


Edit: I tried to load the same level again without leaving and now 95% of materials are black.

Link to comment
Share on other sites

The easiest way is to supply a level or just reproduce the problem in one of the demo levels so i can take a look. By the way is that with pbr dx11 or just plain dx11 branch?


I will say i am super busy with my Deadly Matter duties currently but i'll try and fit in some more time with dx11 stuff soon.

Link to comment
Share on other sites

The easiest way is to supply a level or just reproduce the problem in one of the demo levels so i can take a look. By the way is that with pbr dx11 or just plain dx11 branch?


I will say i am super busy with my Deadly Matter duties currently but i'll try and fit in some more time with dx11 stuff soon.

This was with the PBR branch which have now the D3D11 in it (PBR_D3D11 is gone). Well, there's no hurry and I haven't test it further yet, I have enough to do and trying to avoid distraction. Tomorrow I will at least try with stock editor to see if it's a TorqueLab issue and if not, I will try to reproduce on the outpost demo. If TorqueLab is the cause, I will try to see what it do differently.

Link to comment
Share on other sites

I would guess it's most likely D3D11 related, i mean if you can fire up the exact same level with D3D9 or GL and it's all good than it's obvious where the problem is ;)


Yeah whenever you get time if you could reproduce the problem in the stock levels/art work that is a great help and makes it faster to track down the problem.

Link to comment
Share on other sites

Just a little update about my issue, I think it's strictly related to TorqueLab PostFX system which I noticed it's not working well anymore, I guess there was some changes in the settings and I need to update my script. When I activate the HDR, I get weird result and once I deactivate it, I get the same result as the issue posted above.

Using the standard editor went better but I still got some "Unable to compile shaders" crash when playing with materials.

Link to comment
Share on other sites

Hi, I've found some issue with rivers - there is a missing part at lowLODdistance, also it happens only when You look from the first node side (on screenshot it's duplicated river, one is rotated by 180 degrees). There is no problem when using d3d9.

http://i.imgur.com/flnOWFH.jpg

Link to comment
Share on other sites

But I just read the Pull Request guide :cry:

We like each pull request to have a reasonable revision history - not too many small commits with typo fixes, for example. Sometimes, we may ask contributors to rebase large numbers of commits into a single commit before the request is pulled.

Ah, I had missed the too many part. Okay I will try next time, preparing one for the PostFX scripts and manager :)

Link to comment
Share on other sites

Hi, I've found some issue with rivers - there is a missing part at lowLODdistance, also it happens only when You look from the first node side (on screenshot it's duplicated river, one is rotated by 180 degrees). There is no problem when using d3d9.

 

Thanks for that, issue is now fixed.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...