• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Jason Smith
      While working on a project using D3D12 I was getting an exception being thrown while trying to get a D3D12_CPU_DESCRIPTOR_HANDLE. The project is using plain C so it uses the COBJMACROS. The following application replicates the problem happening in the project.
      #define COBJMACROS #pragma warning(push, 3) #include <Windows.h> #include <d3d12.h> #include <dxgi1_4.h> #pragma warning(pop) IDXGIFactory4 *factory; ID3D12Device *device; ID3D12DescriptorHeap *rtv_heap; int WINAPI wWinMain(HINSTANCE hinst, HINSTANCE pinst, PWSTR cline, int cshow) { (hinst), (pinst), (cline), (cshow); HRESULT hr = CreateDXGIFactory1(&IID_IDXGIFactory4, (void **)&factory); hr = D3D12CreateDevice(0, D3D_FEATURE_LEVEL_11_0, &IID_ID3D12Device, &device); D3D12_DESCRIPTOR_HEAP_DESC desc; desc.NumDescriptors = 1; desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; desc.NodeMask = 0; hr = ID3D12Device_CreateDescriptorHeap(device, &desc, &IID_ID3D12DescriptorHeap, (void **)&rtv_heap); D3D12_CPU_DESCRIPTOR_HANDLE rtv = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rtv_heap); (rtv); } The call to ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart throws an exception. Stepping into the disassembly for ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart show that the error occurs on the instruction
      mov  qword ptr [rdx],rax
      which seems odd since rdx doesn't appear to be used. Any help would be greatly appreciated. Thank you.
       
    • By lubbe75
      As far as I understand there is no real random or noise function in HLSL. 
      I have a big water polygon, and I'd like to fake water wave normals in my pixel shader. I know it's not efficient and the standard way is really to use a pre-calculated noise texture, but anyway...
      Does anyone have any quick and dirty HLSL shader code that fakes water normals, and that doesn't look too repetitious? 
    • By turanszkij
      Hi,
      I finally managed to get the DX11 emulating Vulkan device working but everything is flipped vertically now because Vulkan has a different clipping space. What are the best practices out there to keep these implementation consistent? I tried using a vertically flipped viewport, and while it works on Nvidia 1050, the Vulkan debug layer is throwing error messages that this is not supported in the spec so it might not work on others. There is also the possibility to flip the clip scpace position Y coordinate before writing out with vertex shader, but that requires changing and recompiling every shader. I could also bake it into the camera projection matrices, though I want to avoid that because then I need to track down for the whole engine where I upload matrices... Any chance of an easy extension or something? If not, I will probably go with changing the vertex shaders.
    • By NikiTo
      Some people say "discard" has not a positive effect on optimization. Other people say it will at least spare the fetches of textures.
       
      if (color.A < 0.1f) { //discard; clip(-1); } // tons of reads of textures following here // and loops too
      Some people say that "discard" will only mask out the output of the pixel shader, while still evaluates all the statements after the "discard" instruction.

      MSN>
      discard: Do not output the result of the current pixel.
      clip: Discards the current pixel..
      <MSN

      As usual it is unclear, but it suggests that "clip" could discard the whole pixel(maybe stopping execution too)

      I think, that at least, because of termal and energy consuming reasons, GPU should not evaluate the statements after "discard", but some people on internet say that GPU computes the statements anyways. What I am more worried about, are the texture fetches after discard/clip.

      (what if after discard, I have an expensive branch decision that makes the approved cheap branch neighbor pixels stall for nothing? this is crazy)
    • By NikiTo
      I have a problem. My shaders are huge, in the meaning that they have lot of code inside. Many of my pixels should be completely discarded. I could use in the very beginning of the shader a comparison and discard, But as far as I understand, discard statement does not save workload at all, as it has to stale until the long huge neighbor shaders complete.
      Initially I wanted to use stencil to discard pixels before the execution flow enters the shader. Even before the GPU distributes/allocates resources for this shader, avoiding stale of pixel shaders execution flow, because initially I assumed that Depth/Stencil discards pixels before the pixel shader, but I see now that it happens inside the very last Output Merger state. It seems extremely inefficient to render that way a little mirror in a scene with big viewport. Why they've put the stencil test in the output merger anyway? Handling of Stencil is so limited compared to other resources. Does people use Stencil functionality at all for games, or they prefer discard/clip?

      Will GPU stale the pixel if I issue a discard in the very beginning of the pixel shader, or GPU will already start using the freed up resources to render another pixel?!?!



       
  • Advertisement
  • Advertisement
Sign in to follow this  

DX12 C++ and the Universal Windows Platform

This topic is 380 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

Hello everyone.
I have some background with C++, and I would like to code apps and games with it using the UWP (Universal Windows Platform).
Is there any book explaining how to do so?

I tried with Amazon but with no luck.

I know I could code with C#, but I can't make games unless I glue it to C++ and DirectX 12, so let's cut the edge and learn just C++.

 

Thanks in advance for either.

 

Bye, Ivano..

Edited by BerserkIvix

Share this post


Link to post
Share on other sites
Advertisement

Is the information on MSDN insufficient for you in some fashion? How so?

I can't make games unless I glue it to C++ and DirectX 12

You don't need to use D3D12 to make games, and in fact it's probably not a great idea unless you already know what you're doing and are already well-versed in graphics programming fundamentals.

You can also use wrappers like SharpDx to access D3D from C#.

Share this post


Link to post
Share on other sites

I'm not sure I can develop 3D games for the UWP in C#.

If it's possible, then this discussion should never being started.

 

Thanks anyhow, please let me know ASAP.

Share this post


Link to post
Share on other sites

You can use "pure" C++ (without MS C++/CX extension) with C++/WinRT library: https://github.com/Microsoft/cppwinrt

Microsoft also published a start-template for DirectX 12 and C++/WinRT too: https://blogs.msdn.microsoft.com/chuckw/2017/02/11/directx-tool-kit-and-cwinrt/

Edited by Alessio1989

Share this post


Link to post
Share on other sites
We're going slightly ot here.
I'm looking for a book about windows 10 universal windows platform for c++.
Discard the directx knowledge required, but still keep in mind I also want to create 3d games on (in example) windows phone.
Or at least I want to know if it's possible even with c#.

Share this post


Link to post
Share on other sites

For the direct answer, I'm not aware of such a book.

 

However, I'm replying because from what I understand it isn't an issue in practice. Use the API calls you would normally use to build the game. The compiler and linker will give errors for using any of the short list of 'forbidden' functions, but otherwise you would develop your application the same as you normally would.

You'll want to start verifying your app as soon as possible with the App Certification Kit, but as long as you maintain a clean build it should work without any issues. 

When you encounter an error, either a traditional runtime function that isn't available in the Universal library or some other violation, you could look up that specific error and you'll likely find multiple solutions or workarounds.

Share this post


Link to post
Share on other sites

C# is kind of the more common thing for UWP. You can certainly code it in C++ as well but you'll have to rely on the MSDN and online tutorials as there are currently no books on it that I know of. Here is a tutorial specifically for UWP with DirectX and C++.

If your goal is to write games that run on Windows as well as Windows Phone, have you considered Unity? You'd have to use C# but you can definitely make 3D games with it and get them to run on those (and a gazillion other) platforms. I think they even added DX12 support recently. If you want to write and sell games then that may be a good way forward, as with DX12 you'll have to basically write at least three separate rendering engines from scratch (one for AMD, one for NVidia, and one for whatever the GPU used in Windows Phones is).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement