• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0

Porting to DX12

1 post in this topic

Posted (edited)

Hey guys,

I started working on a port from dx11 to dx12. The first thing, was to setup everything to work with Dx11On12. Right now I've got that done. Basically, the render frame goes as follows:


D3D12Prepare(); 		// setups the command list and command allocators (as well as basic clear and set render targets)
GetWrappedResources(); 	// Dx11on12 step to adquire resources

Render();				// Basically all the Dx11 rendering code etc

D3D12End();				// On D3D12Prepare we left the command list opened so we can add aditional	
						// commands, now close and execute it


Flush();				// Flush all the dx11 code

Dx12Sync();				// Wait for fence


That setup is working and I changed some commands inside Render() from dx11 to dx12. (Basic stuff like setviewport)

I want to start porting more stuff inside the Render(), for example, we have a simple method to draw a quad (without vertex or index buffers, we use the vertex_id inside the shader).

Basically, it should translate to this:


mCmdList->DrawInstanced(4, 1, 0, 0);

But even that simple piece of code is just not working. I would like to get some advice from someone that has done a similar process (using dx11on12), what are the limitations, things that wont work etc

My main concern right now, is that if I want to start setting up commands that touch the IA, I would have to also create the PSO, root signatures etc etc.






Edited by piluve

Share this post

Link to post
Share on other sites

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  
Followers 0

  • Similar Content

    • By cpyburn78
      The D3D12 project template for creating a c++ directx 12 project aka File>New>Project>Visual C++> DirectX 12 App(Universal Windows) creates a project with a spinning cube.   This cube is rendered using 3 RTV, writing to the backbuffer, and presenting based on the current frame.  This works great as long as you are running 60 frames a second.  If I change the steptimer to 1/30, or 30 frames a second as a lot of production games run because of shadow drawing, lighting, reflections, the cube starts to jitter. I believe this jitter comes from the Update not copying the constant buffer data fast enough for render to read it so render is actually calling some previous constant buffer data.  You can fix it easily by updating all the constant buffers every update instead of by frame.
      for ( i = ; i < DX::c_frameCount; i++) { UINT8* destination = m_mappedConstantBuffer + (i * c_alignedConstantBufferSize); memcpy(destination, &m_constantBufferData, sizeof(m_constantBufferData)); }  
      My question is, is this the best way to handle this?  what is the best way?
    • By DiharaW
      So these days i'm writing a D3D12/Vulkan abstraction for a project and i've hit a wall tackling resource binding. In an older renderer i wrote, i put all of my per-object uniforms into one big Uniform Buffer/Constant Buffer, copied all the data in one go and bound ranges of it using glBindBufferRange (GL) and XSSetConstantBuffers1 (D3D11) for each object in the scene. It seemed to be a more efficient approach than copying between draws.
      The same thing can be done in Vulkan by creating a dynamic uniform buffer and providing Dynamic Offsets to vkCmdBindDescriptorSets.
      But when it comes to Direct3D 12, i haven't seen an equivalent approach yet. The only thing that i came up with so far is to create multiple ConstantBufferViews for a Constant Buffer into a Descriptor Table and bind it by adding the appropriate offset to the Descriptor Table's address.
      // Get the descriptor increment size const UINT cbvSrvDescriptorSize = pDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); // Handle for the first object's constant buffer view CD3DX12_GPU_DESCRIPTOR_HANDLE cbvSrvGpuHandle1(pCbvSrvHeap->GetGPUDescriptorHandleForHeapStart(), 0); pCommandList->SetGraphicsRootDescriptorTable(0, cbvSrvGpuHandle1); // Draw first object... // Add offset to get the handle for the second object's constant buffer view CD3DX12_GPU_DESCRIPTOR_HANDLE cbvSrvGpuHandle2(pCbvSrvHeap->GetGPUDescriptorHandleForHeapStart(), cbvSrvDescriptorSize); pCommandList->SetGraphicsRootDescriptorTable(0, cbvSrvGpuHandle2); // Draw second object... While this approach works fine, it doesn't necessarily match Vulkan's dynamic offset approach, so i can't make a clean abstraction over the two.

      So how would you guys go about handling this? And i'd love to know your approaches to abstracting the Vulkan/D3D12 binding model in general.
    • By Corillian
      I'm having an odd problem with D3D12 compute shaders. I have a very simple compute shader that does nothing but write the global ID of the current thread out to a buffer:
      RWStructuredBuffer<uint> g_pathVisibility : register(u0, space1); cbuffer cbPushConstants : register(b0) { uint g_count; }; [numthreads(32, 1, 1)] void main(uint3 DTid : SV_DispatchThreadID) { if(DTid.x < g_count) { g_pathVisibility[DTid.x] = DTid.x + 1; } } I'm allocating 2 buffers with space or 128 integers. One buffer is the output buffer for the shader above and the other is a copy destination buffer for CPU readback. If I set numthreads() to any power of two, for example it's set to 32 above, I get a device reset error on NVIDIA hardware only. If I set numthreads() to any non-power of 2 value the shader works as expected. The exceptionally odd thing is that all of the compute shaders in the D3D12 samples work fine with numthreads() containing powers of 2. It doesn't matter if I execute the compute shader on a graphics queue or a compute queue - it's the same result either way. I've tested this on a GTX 1080 and a GTX 1070 with identical results. AMD cards seem to work as expected. Anyone have any idea what the hell could be going on? I tried asking NVIDIA on their boards but per-usual they never responded. I'm using their latest drivers. I've attached my sample application if anyone is interested, it's a UWP app since Visual Studio provides a nice D3D12 app template that I use to play around with simple ideas. The shader in question in the project is TestCompute.hlsl and the function where the magic happens is Sample3DSceneRenderer::TestCompute() line 1006 in Sample3DSceneRenderer.cpp.
    • By hiya83
      Hi, I tried searching for this but either I failed or couldn't find anything. I know there's D11/D12 interop and there are extensions for GL/D11 (though not very efficient). I was wondering if there's any Vulkan/D11 or Vulkan/D12 interop?
    • By VietNN
      Hi everyone,
      I am new to DX12, I download sample project from MSDN and it can run and draw triangles successfully.
      But when I create new project and copy code from MSDN sample (Hello Triangles Project). I do not know why it could not render anything to screen except clearing the screen with blue color.
      Could you have a look at my code to see what problem is... I got stuck here for 2 days.
  • Popular Now