Sign in to follow this  

DX11 Dealing with D3DX____ functions being depricated.

This topic is 816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to upgrade my framework to DX11 in hopes of then upgrading it to 12 (right now it's on 10) but I was a little lazy when creating it in the first place and just used the helper utilities in D3DX even though they were deprecated a long time ago. So now I've got Windows 10 and it doesn't even ship with D3DX so I'm forced into switching. It's a lot of code and pretty laborious. I've managed to switch all my math to newer DirectXMath but what about effects? I can't find any references to effects in DirectX12 documentation and have no idea what happening there. It seems like .fx files are no longer used is that true? And without the D3DX lib how do I load the effects file now? Thanks.

Share this post


Link to post
Share on other sites
My share:
- technically it's no biggy to use d3dx (including math functions) in windows 10. For this you need the right headers and libs
- d3d11 also has an effects library, although in your case you have to rebuild the lib's (debug and release) on your machine to be able to use them (the VS project can easily be found online)

What I did is step by step:
- migrated from d3dx math do directxmath in my existing d3d9 engine
- now moving from d3d9 to d3d11, but with using d3d11 effects

When I feel confident and finish that step, I'll move to creating "my own shader / effects management", by using the different "direct shader compilers and functions" in d3d11.

For model loading you can use assimp (possibly to create/ convert to a DIY format that your engine/applications uses most efficiently).

Doing it all at once was too big of a jump for me personally.

Share this post


Link to post
Share on other sites

@ryan20fun thanks, I'm aware of that page already, it's been a lifesaver.

 

@cozzie yes, I still have all the old sdks on my other partition so it complited and ran fine, but I really don't want to hang on to old, unsupported code for too much longer. I got my Windows SDK and just want to use that from now on. 

 

So we have to write our own shader system from now on? I do know that DX11 has a github support for DX functions which we can compile, but like I said my main goal right now is to switch to DX12 and DX11 is just a stepping stone. I don't want to go through all the work and then find out it's completely unsupported in DX12. I just can't find any documentation on effects in DX12. It just seems Microsoft is moving DirectX towards high end publishers, soon it's going to be all low-level bare bones code and we'll have to write our own utilities for it. 

Share this post


Link to post
Share on other sites

One thing you could do is to install the DXSDK from June 2010 and use the libraries from there, of course this is not recomended by MS I guess but it is an option.

 

If you don't want this option you could still install that version of the SDK, because there was a sample that basically implements FX for d3d11.

 

Of course if you can afford it you should stop using this (incredibly cool in my opinion) library, this should be an long term investment.

Edited by imoogiBG

Share this post


Link to post
Share on other sites

@imoogiBG I have the June '10 SDK on my other partition and right now the code works and compiles because I'm still using it, but I'd like to upgrade it. I'm downloading the github fx11 project now I think it's the same one you mentiontined but updated.

 

@MJP so if I compile the fx11 from github I would have to completely dump it once I move to DX12?

 

Also why is there so little info on DX12 programming, RasterTalk has 3 tutorials, last one created yesterday and then there's the Programming Guide from Microsoft, but has no reference code at all? DX12 is what about a year old now? I mean it was released to developers a while ago right since the games are bout to start coming out this or next month. It's weird that nobody started any series similar to what Bobby Anguelov did with DX10. There's a book by Frank Luna coming out in Decemeber but I think that guy jumps on on any release headlessly just to make a book.

Share this post


Link to post
Share on other sites

@MJP so if I compile the fx11 from github I would have to completely dump it once I move to DX12?


Yes. None of it will work with D3D12. You *might* be able to update Effects11 to work with the interfaces from D3D12's "11on12" layer, but that still might be a lot of work. Even if you could, it wouldn't really make very much sense. D3D12 is all about achieving low CPU overhead by exposing more direct access to memory and revamping the binding model. If you're not going to take advantage of those things, then you'll probably just end up spending a lot of time making an engine that runs slower than it would in D3D11.

Also why is there so little info on DX12 programming, RasterTalk has 3 tutorials, last one created yesterday and then there's the Programming Guide from Microsoft, but has no reference code at all? DX12 is what about a year old now? I mean it was released to developers a while ago right since the games are bout to start coming out this or next month. It's weird that nobody started any series similar to what Bobby Anguelov did with DX10. There's a book by Frank Luna coming out in Decemeber but I think that guy jumps on on any release headlessly just to make a book.


Windows 10 just came out a little while ago, it's still really early. There were some developers in the early access program, but even then things were incomplete for a long time and you had to work on pre-release builds of Windows. Now that the API's and documentations are publicly available, you'll see the ecosystem start to slowly build up. It was the same way with D3D9->D3D10, or D3D10->D3D11: it took a long time for people to transition.

Also I'm not sure if you're aware, but Microsoft has posted some D3D12 sample code on GitHub.

Share this post


Link to post
Share on other sites

 

@MJP so if I compile the fx11 from github I would have to completely dump it once I move to DX12?


Yes. None of it will work with D3D12. You *might* be able to update Effects11 to work with the interfaces from D3D12's "11on12" layer, but that still might be a lot of work. Even if you could, it wouldn't really make very much sense. D3D12 is all about achieving low CPU overhead by exposing more direct access to memory and revamping the binding model. If you're not going to take advantage of those things, then you'll probably just end up spending a lot of time making an engine that runs slower than it would in D3D11.

Also why is there so little info on DX12 programming, RasterTalk has 3 tutorials, last one created yesterday and then there's the Programming Guide from Microsoft, but has no reference code at all? DX12 is what about a year old now? I mean it was released to developers a while ago right since the games are bout to start coming out this or next month. It's weird that nobody started any series similar to what Bobby Anguelov did with DX10. There's a book by Frank Luna coming out in Decemeber but I think that guy jumps on on any release headlessly just to make a book.


Windows 10 just came out a little while ago, it's still really early. There were some developers in the early access program, but even then things were incomplete for a long time and you had to work on pre-release builds of Windows. Now that the API's and documentations are publicly available, you'll see the ecosystem start to slowly build up. It was the same way with D3D9->D3D10, or D3D10->D3D11: it took a long time for people to transition.

Also I'm not sure if you're aware, but Microsoft has posted some D3D12 sample code on GitHub.

 

 

Thanks, great explanation. I was totally not aware of that sample page. In view of all that I'm going to go straight to 12, I've got a feeling that industry will transition to that much faster then other builds considering the advantages. Thanks, cheers.

Share this post


Link to post
Share on other sites

Good to hear.

But keep in mind that you take things bite by bite, moving at once to:

- a different math library

- a new d3d/ api version

- loading models using another library

- having the make your own shader manager ("effects")

 

Is quite difficult to take all at once.

Share this post


Link to post
Share on other sites

Thanks, great explanation. I was totally not aware of that sample page. In view of all that I'm going to go straight to 12, I've got a feeling that industry will transition to that much faster then other builds considering the advantages. Thanks, cheers.


I would just like to ask this question; why are you doing what you are doing?

If it is for a project that you plan to finish and release then I would transition to 11 and work with that for a while. D3D11 isn't going away and while it might have performance issues for AAA guys if you are building your own stuff then it might be worth sticking with D3D11.

If your goal is to get a job in the industry then D3D12 makes more sense, and you might as well skip 11 as the APIs aren't remotely compatible.

One of the key things, going from 10 or 11 to 12 is that it will probably require a rethink and a rebuild of many things to get the best from it; trying to treat D3D12 the same as D3D10, data and work wise, isn't going to net you a great deal. Heck, I would make the argument that unless you are multi-threading your whole rendering system the whole way through stick to 11 - you get pretty well tuned drivers which will spread the workload.

D3D12 will shine when you can go wide and when you understand how the hardware works (and thus why things are as they are) - it is more hands on.

That's not to discourage you from moving across of course, just think about why you are doing it - new and shiny isn't the best for every project and you might be served well enough with D3D11 where things are tuned, stable and much better documented.

Share this post


Link to post
Share on other sites

This topic is 816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Forum Statistics

    • Total Topics
      628756
    • Total Posts
      2984529
  • Similar Content

    • By GreenGodDiary
      Having some issues with a geometry shader in a very basic DX app.
      We have an assignment where we are supposed to render a rotating textured quad, and in the geometry shader duplicate this quad and offset it by its normal. Very basic stuff essentially.
      My issue is that the duplicated quad, when rendered in front of the original quad, seems to fail the Z test and thus the original quad is rendered on top of it.
      Whats even weirder is that this only happens for one of the triangles in the duplicated quad, against one of the original quads triangles.

      Here's a video to show you what happens: Video (ignore the stretched textures)

      Here's my GS: (VS is simple passthrough shader and PS is just as basic)
      struct VS_OUT { float4 Pos : SV_POSITION; float2 UV : TEXCOORD; }; struct VS_IN { float4 Pos : POSITION; float2 UV : TEXCOORD; }; cbuffer cbPerObject : register(b0) { float4x4 WVP; }; [maxvertexcount(6)] void main( triangle VS_IN input[3], inout TriangleStream< VS_OUT > output ) { //Calculate normal float4 faceEdgeA = input[1].Pos - input[0].Pos; float4 faceEdgeB = input[2].Pos - input[0].Pos; float3 faceNormal = normalize(cross(faceEdgeA.xyz, faceEdgeB.xyz)); //Input triangle, transformed for (uint i = 0; i < 3; i++) { VS_OUT element; VS_IN vert = input[i]; element.Pos = mul(vert.Pos, WVP); element.UV = vert.UV; output.Append(element); } output.RestartStrip(); for (uint j = 0; j < 3; j++) { VS_OUT element; VS_IN vert = input[j]; element.Pos = mul(vert.Pos + float4(faceNormal, 0.0f), WVP); element.Pos.xyz; element.UV = vert.UV; output.Append(element); } }  
      I havent used geometry shaders much so im not 100% on what happens behind the scenes.
      Any tips appreciated! 
    • By mister345
      Hi, I'm building a game engine using DirectX11 in c++.
      I need a basic physics engine to handle collisions and motion, and no time to write my own.
      What is the easiest solution for this? Bullet and PhysX both seem too complicated and would still require writing my own wrapper classes, it seems. 
      I found this thing called PAL - physics abstraction layer that can support bullet, physx, etc, but it's so old and no info on how to download or install it.
      The simpler the better. Please let me know, thanks!
    • By Hexaa
      I try to draw lines with different thicknesses using the geometry shader approach from here:
      https://forum.libcinder.org/topic/smooth-thick-lines-using-geometry-shader
      It seems to work great on my development machine (some Intel HD). However, if I try it on my target (Nvidia NVS 300, yes it's old) I get different results. See the attached images. There
      seem to be gaps in my sine signal that the NVS 300 device creates, the intel does what I want and expect in the other picture.
      It's a shame, because I just can't figure out why. I expect it to be the same. I get no Error in the debug output, with enabled native debugging. I disabled culling with CullMode.None. Could it be some z-fighting? I have little clue about it but I tested to play around with the RasterizerStateDescription and DepthBias properties with no success, no change at all. Maybe I miss something there?
      I develop the application with SharpDX btw.
      Any clues or help is very welcome
       


    • By Beny Benz
      Hi,
      I'm currently trying to write a shader which shoud compute a fast fourier transform of some data, manipulating the transformed data, do an inverse FFT an then displaying the result as vertex offset and color. I use Unity3d and HLSL as shader language. One of the main problems is that the data should not be passed from CPU to GPU for every frame if possible. My original plan was to use a vertex shader and do the fft there, but I fail to find out how to store changing data betwen shader calls/passes. I found a technique called ping-ponging which seems to be based on writing and exchangeing render targets, but I couldn't find an example for HLSL as a vertex shader yet.
      I found https://social.msdn.microsoft.com/Forums/en-US/c79a3701-d028-41d9-ad74-a2b3b3958383/how-to-render-to-multiple-render-targets-in-hlsl?forum=xnaframework
      which seem to use COLOR0 and COLOR1 as such render targets.
      Is it even possible to do such calculations on the gpu only? (/in this shader stage?, because I need the result of the calculation to modify the vertex offsets there)
      I also saw the use of compute shaders in simmilar projects (ocean wave simulation), do they realy copy data between CPU / GPU for every frame?
      How does this ping-ponging / rendertarget switching technique work in HLSL?
      Have you seen an example of usage?
      Any answer would be helpfull.
      Thank you
      appswert
    • By ADDMX
      Hi
      Just a simple question about compute shaders (CS5, DX11).
      Do the atomic operations (InterlockedAdd in my case) should work without any issues on RWByteAddressBuffer and be globaly coherent ?
      I'v come back from CUDA world and commited fairly simple kernel that does some job, the pseudo-code is as follows:
      (both kernels use that same RWByteAddressBuffer)
      first kernel does some job and sets Result[0] = 0;
      (using Result.Store(0, 0))
      I'v checked with debugger, and indeed the value stored at dword 0 is 0
      now my second kernel
      RWByteAddressBuffer Result;  [numthreads(8, 8, 8)] void main() {     for (int i = 0; i < 5; i++)     {         uint4 v0 = DoSomeCalculations1();         uint4 v1 = DoSomeCalculations2();         uint4 v2 = DoSomeCalculations3();                  if (v0.w == 0 && v1.w == 0 && v2.w)             continue;         //    increment counter by 3, and get it previous value         // this should basically allocate space for 3 uint4 values in buffer         uint prev;         Result.InterlockedAdd(0, 3, prev);                  // this fills the buffer with 3 uint4 values (+1 is here as the first 16 bytes is occupied by DrawInstancedIndirect data)         Result.Store4((prev+0+1)*16, v0);         Result.Store4((prev+1+1)*16, v1);         Result.Store4((prev+2+1)*16, v2);     } } Now I invoke it with Dispatch(4,4,4)
      Now I use DrawInstancedIndirect to draw the buffer, but ocassionaly there is missed triangle here and there for a frame, as if the atomic counter does not work as expected
      do I need any additional synchronization there ?
      I'v tried 'AllMemoryBarrierWithGroupSync' at the end of kernel, but without effect.
      If I do not use atomic counter, and istead just output empty vertices (that will transform into degenerated triangles) the all is OK - as if I'm missing some form of synchronization, but I do not see such a thing in DX11.
      I'v tested on both old and new nvidia hardware (680M and 1080, the behaviour is that same).
       
  • Popular Now