• Advertisement

Search the Community

Showing results for tags 'DX12'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Audio
    • Music and Sound FX
  • Business
    • Business and Law
    • Career Development
    • Production and Management
  • Game Design
    • Game Design and Theory
    • Writing for Games
    • UX for Games
  • Industry
    • Interviews
    • Event Coverage
  • Programming
    • Artificial Intelligence
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Engines and Middleware
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
  • Archive

Categories

  • News

Categories

  • Audio
  • Visual Arts
  • Programming
  • Writing

Categories

  • GameDev Unboxed

Categories

  • Game Dev Loadout

Forums

  • Audio
    • Music and Sound FX
  • Business
    • Games Career Development
    • Production and Management
    • Games Business and Law
  • Game Design
    • Game Design and Theory
    • Writing for Games
  • Programming
    • Artificial Intelligence
    • Engines and Middleware
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
    • 2D and 3D Art
    • Critique and Feedback
  • Topical
    • Virtual and Augmented Reality
    • News
  • Community
    • GameDev Challenges
    • For Beginners
    • GDNet+ Member Forum
    • GDNet Lounge
    • GDNet Comments, Suggestions, and Ideas
    • Coding Horrors
    • Your Announcements
    • Hobby Project Classifieds
    • Indie Showcase
    • Article Writing
  • Affiliates
    • NeHe Productions
    • AngelCode
  • Workshops
    • C# Workshop
    • CPP Workshop
    • Freehand Drawing Workshop
    • Hands-On Interactive Game Development
    • SICP Workshop
    • XNA 4.0 Workshop
  • Archive
    • Topical
    • Affiliates
    • Contests
    • Technical

Calendars

  • Community Calendar
  • Games Industry Events
  • Game Jams

Blogs

There are no results to display.

There are no results to display.

Marker Groups

  • Members

Developers

Developers


Group


About Me


Website


Industry Role


Twitter


Github


Twitch


Steam

Found 242 results

  1. Hello, I am fairly experienced with DX11 and recently gave myself the challenge to keep myself up to date with graphic APIs so I am learning DX12 in parallel. After compiling one of my old DX11 shader that was using interface / classes as a hack to fake function pointers I got a nice message in the ouput saying that DX12 doesn't support interfaces in shaders. Am I right to assume that all this class linkage system was pure candy from the DX11 drivers and that it was using multiple root signatures behind the scene to achieve this? I want to be sure before I switch everything around and start handling all that stuff manually. This is the interfaces / classes that I am talking about : https://msdn.microsoft.com/en-us/library/windows/desktop/ff471421(v=vs.85).aspx Thanks for your time
  2. Hi programmers, I have this problem in DirectX 12. I have one thread that runs a compute shader in a loop. This compute shader generates a 2d image in a buffer (D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS). The buffer gets updated, say, a hundred times a second. In the main thread, I copy this buffer to the back buffer of the swap chain when WM_PAINT is called. WM_PAINT keeps getting called because I never do the BeginPaint/Endpaint. For this copy operation I use a graphical CommandQueue/CommandList. Here's the pseudo-code for this paint operation: ... reset CommandQueue/CommandList swapchain->GetBuffer(back_buffer) commandlist->CopyTextureRegion(back_buffer, 0, 0, 0, computed_buffer, nullptr); commandlist->ResourceBarrier( back_buffer, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PRESENT)); ... execute CommandList and wait for finish using fence ... swapchain->Present(..) I use a good old CriticalSection to make sure the compute CommandList and the graphical CommandList don't run at the same time. When I start the program this runs fine in a normal window. I see the procedurally generated buffer animated in real time. However, when I switch to full screen (and resize the swapchain), nothing gets rendered. The screen stays black. When I leave fullscreen (again resize swapchain), same problem. The screen just stays black. Other than that the application runs stable. No directX warnings in the debug output, no nothing. I checked that the WM_PAINT messages keep coming and I checked that the compute thread keeps computing. Note that I don't do anything else with the graphical commandlist. I set no pipeline, or root signature because I have no 3d rendering to do. Can this be a problem? I suppose I could retrieve the computed buffer with a readback buffer and paint it with an ordinary GDI function, but that seems silly with the data already being on the GPU. EDIT: I ran the code on another PC and on there the window stays black right from the start. So the resizing doesn't seem to be the problem. Any ideas appreciated!
  3. Hi, I'm reading https://software.intel.com/en-us/articles/sample-application-for-direct3d-12-flip-model-swap-chains to figure out the best way to setup my swapchain but I dont understand the following: 1 - In "Classic Mode" on the link above, what causes the GPU to wait for the next Vsync before starting working on the next frame? (eg: orange bar on the second column doesn't start executing right after the previous blue bar) Its clear it has to wait because the new frame will render to the render target currently on screen, but is there an explicit wait one must do in code? Or does the driver force the wait? If so, how does the driver know? Does it check which RT is bound, so if I was rendering to GBuffer no wait would happen? 2 - When Vsync is off, what does it mean that a frame is dropped and what causes it? Thanks!!
  4. Simple question. What is best practice for drawing overlay graphics in Directx 12? For now, all I want to do is to draw a semi-transparent rectangle in the upper left corner of my view. Is there a shortcut, or do I need to set up more shaders, vertex buffers, constant buffers, root signatures etc. etc.? Since we are talking about DX12 I guess it's the later Any small example project out there?
  5. I am having a problem rendering to multiple (two) windows, using SharpDX and DX12. I am setting up two swapchains etc, and it's almost working. The effect is that both windows shows sporadic flickering. It looks as though one window's transformation leaks into the other window every now and then (it goes both ways but not necessarily at the same time). The rendering is triggered by user input, not a render loop, and the flickering happens mostly when there is lots of input (like panning quickly). When I deliberately slow things down (for instance by printing debug info to Output) it looks fine. At the moment I have this level of separation: The application has: one device, bundles, all the resources like vertex, texture and constant buffers. Each view has: a swap chain, render target, viewport, fence, command list, command allocator and command queue, (I have also tried to use a single command list, allocator, queue and fence, but it doesn't make any difference regarding my flicker problem) The rendering process is quite straight forward: One of the windows requests to be re-rendered, and the other window's requests will be ignored until the first is done Update the transformation matrix, based on the window's parameters (size, center position etc). The matrix is written to the constant buffer: IntPtr pointer = constantBuffer.Map(0); Utilities.Write<Transform>(pointer, ref transform); constantBuffer.Unmap(0); Reset, populate and close the window's command list (populating here means setting its render target & viewport, executing bundles etc). Execute the window's command list on its command queue. Present the window's swapchain Wait for the window's command queue to finish rendering (using its fence) Reset the window's command allocator I really believe that since both windows use the same constant buffer to write and read the transformation, sometimes the first window's transformation is still there when the other window is rendering. But I don't understand why. The writing to the buffer really happens when the code in step 1 is executed... Right? And the reading of the buffer really happens when the command list is executed in step (3)... Right? At very least it must be read before reaching step (6). Am I right? Then how can it sometimes read the wrong transformation? Has anyone tripped over a similar problem before? What was the cause and how did you fix it?
  6. Guys, I've spent a lot of time to load skeletal animation but It is very difficult... I refer to http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html but I didn't get the results I wanted Please Help Me This is my codes void LoadAnimation::BoneTransform(float time, vector<XMFLOAT4X4>& transforms) { XMMATRIX Identity = XMMatrixIdentity(); float TicksPerSecond = (float)(m_pScene->mAnimations[0]->mTicksPerSecond != 0 ? m_pScene->mAnimations[0]->mTicksPerSecond : 25.0f); float TimeInTicks = time*TicksPerSecond; float AnimationTime = fmod(TimeInTicks, (float)m_pScene->mAnimations[0]->mDuration); ReadNodeHeirarchy(AnimationTime, m_pScene->mRootNode, Identity); transforms.resize(m_NumBones); for (int i = 0; i < m_NumBones; ++i) { XMStoreFloat4x4(&transforms[i], m_Bones[i].second.FinalTransformation); } } void LoadAnimation::ReadNodeHeirarchy(float AnimationTime, const aiNode * pNode, const XMMATRIX& ParentTransform) { string NodeName(pNode->mName.data); const aiAnimation* pAnim = m_pScene->mAnimations[0]; XMMATRIX NodeTransformation = XMMATRIX(&pNode->mTransformation.a1); const aiNodeAnim* pNodeAnim = FindNodeAnim(pAnim, NodeName); if (pNodeAnim) { aiVector3D scaling; CalcInterpolatedScaling(scaling, AnimationTime, pNodeAnim); XMMATRIX ScalingM = XMMatrixScaling(scaling.x, scaling.y, scaling.z); ScalingM = XMMatrixTranspose(ScalingM); aiQuaternion q; CalcInterpolatedRotation(q, AnimationTime, pNodeAnim); XMMATRIX RotationM = XMMatrixRotationQuaternion(XMVectorSet(q.x, q.y, q.z, q.w)); RotationM = XMMatrixTranspose(RotationM); aiVector3D t; CalcInterpolatedPosition(t, AnimationTime, pNodeAnim); XMMATRIX TranslationM = XMMatrixTranslation(t.x, t.y, t.z); TranslationM = XMMatrixTranspose(TranslationM); NodeTransformation = TranslationM * RotationM * ScalingM; } XMMATRIX GlobalTransformation = ParentTransform * NodeTransformation; int tmp = 0; for (auto& p : m_Bones) { if (p.first == NodeName) { p.second.FinalTransformation = XMMatrixTranspose( m_GlobalInverse * GlobalTransformation * p.second.BoneOffset); break; } tmp += 1; } for (UINT i = 0; i < pNode->mNumChildren; ++i) { ReadNodeHeirarchy(AnimationTime, pNode->mChildren[i], GlobalTransformation); } } CalcInterp~ function and Find~ function are like a tutorial (http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html) I think that I'm doing the multiplication wrong but I don't know where it went wrong If you want, i wall post other codes. here is my result (hands are stretched, legs are strange) and it is ideal result
  7. I include the source code from what I am playing with. It's an exercise from Frank Luna's DirectX 12 book about rendering a skull from a text file. I get a stack overflow error and the program quits. I don't know where I went wrong it's messy programming on the parts I added but maybe one of you masterminds can tell me where I went wrong. Chapter_7_Drawing_in_Direct3D_Part_II.zip
  8. I wanted to see how others are currently handling descriptor heap updates and management. I've read a few articles and there tends to be three major strategies : 1 ) You split up descriptor heaps per shader stage ( i.e one for vertex shader , pixel , hull, etc) 2) You have one descriptor heap for an entire pipeline 3) You split up descriptor heaps for update each update frequency (i.e EResourceSet_PerInstance , EResourceSet_PerPass , EResourceSet_PerMaterial, etc) The benefits of the first two approaches is that it makes it easier to port current code, and descriptor / resource descriptor management and updating tends to be easier to manage, but it seems to be not as efficient. The benefits of the third approach seems to be that it's the most efficient because you only manage and update objects when they change.
  9. Hi all, I want to copy just 1 mipmap level of a texture and I am doing like this: void CopyTextureRegion( &CD3DX12_TEXTURE_COPY_LOCATION(pDstData, mipmapIndex), 0, 0, 0, &CD3DX12_TEXTURE_COPY_LOCATION(pSrcData, pLayout), nullptr ); - pDstData : is DEFAULT_HEAP, pSrcData is UPLOAD_HEAP(buffer size was get by GetCopyableFootprints from pDstData with highest miplevel), pLayout is D3D12_PLACED_SUBRESOURCE_FOOTPRINT - I think the mipmapIndex will point the exact location data of Dest texture, but does it know where to get data location from Src texture because pLayout just contain info of this mipmap(Offset and Footprint). (???) - pLayout has a member name Offset, and I try to modify it but it(Offset) need 512 Alignment but real offset in Src texture does not. So what I need to do to match the location of mip texture in Src Texture ? @SoldierOfLight @galop1n
  10. Hello! I am wondering if there is a way to find out how many resources you could bind to the command list directly without putting them in a descriptor table. Specifically, I am referring to these guys: - SetGraphicsRoot32BitConstant - SetGraphicsRoot32BitConstants - SetGraphicsRootConstantBufferView - SetGraphicsRootShaderResourceView - SetGraphicsRootUnorderedAccessView I remember from early presentations on D3D12 that the count of allowed resources is hardware dependent and quite small. But I would like to learn some more concrete figures.
  11. I am trying to set up my sampler correctly so that textures are filtered the way I want. I want to use linear filtering for both min and mag, and I don't want to use any mipmap at all. To make sure that mipmap is turned off I set the MipLevels to 1 for my textures. For the sampler filter I have tried all kind of combinations, but somehow the mag filter works fine while the min filter doesn't seem to work at all. As I zoom out there seems to be a nearest point filter. Is there a catch in Dx12 that makes my min filter not working? Do I need to filter manually in my shader? I don't think so since the mag filter works correctly. My pixel shader is just a simple texture lookup: textureMap.Sample(g_sampler, input.uv); My sampler setup looks like this (SharpDX): sampler = new StaticSamplerDescription() { Filter = Filter.MinMagLinearMipPoint, AddressU = TextureAddressMode.Wrap, AddressV = TextureAddressMode.Wrap, AddressW = TextureAddressMode.Wrap, ComparisonFunc = Comparison.Never, BorderColor = StaticBorderColor.TransparentBlack, ShaderRegister = 0, RegisterSpace = 0, ShaderVisibility = ShaderVisibility.Pixel, };
  12. Does anyone have a working example of how to implement MSAA in DX12? I have read short descriptions and I have seen code fragments on how to do it with DirectX Tool Kit. I get the idea, but with all the pipeline states, root descriptions etc I somehow get lost on the way. Could someone help me with a link pointing to a small implementation in DirectX 12 (or SharpDX with DX12)?
  13. I have a vertex buffer on a default heap. I need a CPU pointer to that buffer in order to loop through the vertices and change one value in some vertices (the color value). In the past this was possible by creating the buffer with the flag D3DUSAGE_DYNAMIC/D3D11_USAGE_DYNAMIC and using IDirect3DVertexBuffer9::Lock or ID3D11DeviceContext::Map to get a pointer. What is the correct way to do the same in DX 12? As far as I understand, the method ID3D12Resource::Map cannot be used on a default heap because default heaps cannot be accessed directly from the CPU. The documentation says that upload heaps are intended for CPU-write-once, GPU-read-once usage, so I don't think these are equivalent to the "dynamic" buffers. Is the readback heap equivalent to what was called a dynamic buffer? Or should I create a custom heap? I am thinking to do the following: -Create a temporary readback heap. -Copy the data from the default heap to the readback heap using UpdateSubresources. -Get a CPU pointer to the readback heap using Map and edit the data. -Copy the data back to the default heap using UpdateSubresources. What do you think about this?
  14. Being new to DirectX 12 I am looking for examples on how to use threading. I have done lots of OpenGL in the past and some DirectX, but with DX12 the threading magic is gone and I understand that threading is crucial to get good performance. In my project I currently have one thread doing it all. I have one command list, one command allocator, one bundle and one bundle allocator. I also have a million triangles, so it's about time that I start doing this. How do I split things up? How many threads should I use? How many command lists and allocators? I realize this is a beginner's question , but I have to begin somewhere. I would be grateful if someone could point me in a direction where I could find a simple code sample, tutorial or something similar. Thanks!
  15. I am porting a DX11 game engine to DX12, and have some questions about root signature usage. The engine clearly defines a global bind slot range for resources, to avoid using shader reflection. This means, that both the application, both the shaders explicitly know the binding slots for everything (constant buffers, textures, etc.). This would trivially translate to a global root signature in DX12, and I have created it as a big root signature like the following: There are 12 descriptor tables, so for every shader stage there are a sampler descriptor table and a CBV_SRV_UAV table. I though about keeping a "staging" descriptor heap, to which I would place descriptors at resource load time. Then when calling PSSetShaderResources(), which is a DX11-style function, the function would fill out a GPU-visible descriptor heap which is created to match the layout of the root signature tables. The nice thing about is that each frame I would only have a single call to set the root signature and to set root signature tables. The command list would just fill it with descriptors before rendering. I've found out however, that filling out descriptor tables can only be done on the CPU timeline with ID3D12Device::CopyDescriptors(). This complicates things and I can only think of populating the GPU descriptor heap, and after each draw call, I would need to copy the whole table and CopyDescriptors() again when there is a new call to PSSetShaderResources(). Am I on the right path if I also want to keep DX11-style bindings? I also thought about each shader having a custom root signature and only ever copying the descriptors which are required by the shader, but in this case I will need to rebind the whole root signature each time a shader changes. I would also have to do a shader reflection step and modify my shader-asset pipeline (because I don't want to depend on d3dcompiler when I run the engine) which I really want to avoid. Which would be the preferred way? I read the Nvidia Do's and Don'ts but they say these which are contradicting in my case: Minimize the number of Root Signature changes Don’t bloat your root signature and descriptor tables to be able to reuse them UPDATE: The second way (unique root signature with PSO) I would also have to bind resources strictly after I have set the right PSO, because the table is now unique.
  16. I am doing a DX12 graphics wrapper, and I would like to update constant buffers. I found the ID3D12GraphicsCommandList2::WriteBufferImmediate method, which is apparently available from a Windows 10 Creators update only. I couldn't really find any info about this (and couldn't try it yet), am I correct to assume this would be useful for writing to constant buffers without much need to do synchronization? It seems to me like this method copies data to the command list itself and then that data will be copied into the DEFAULT resource address which I provided? The only synchronization needed here would be transition barriers to COPY_DEST before WriteBufferImmediate() and back to GENERIC_READ afterwards? I could be totally off though, I'm still wrapping my head around a lot of things. What other use cases would this method allow for?
  17. Hi, I apologize for creating multiple questions here for dx12 since information is sparse so far. Anyway in some Dx12 api's, there's a node mask for multiple node support, for e.g. D3D12_COMMAND_QUEUE_DESC for CreateCommandQueue & CreateCommandList itself has a node mask. However, these API's are all called on the D3D12Device itself, and when creating the D12Device (D3D12CreateDevice), there isn't an option for it to be a multi-adapter device; you just pass in a single adapter. So what is the point of the node masks in the other API calls? Is there some other use case I am not aware of yet? Thanks!
  18. Hi, Does anyone have suggestions on multi-gpu (cross adapter) debugging in vs2015 for dx12? It seems this is not supported (error codes returned when gpu debugging inside VS) in vs2015. Any idea if this is supported in vs2017? Thanks
  19. Hi, I recently started reworking my RootSigature system, I basically want to declare a RootSignature in hlsl and then reuse it across all my shaders. Until this point, I've been generating a custom RS for each PSO (with the exact number of resources that PSO will use). This means that each RS is efficiently used but it also means that each time I draw or dispatch the RS will change. This new system will use this RS: #define GFXRS "RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT)," \ "DescriptorTable" \ "("\ "CBV(b0, numDescriptors = 16)," \ "SRV(t0, numDescriptors = 16)," \ "UAV(u0, numDescriptors = 16)" \ ")," \ "DescriptorTable" \ "(" \ "Sampler(s0, numDescriptors = 16)" \ ")" \ NOTE: I want to start with only one RS for everything and then maybe have one for gfx and other for compute. However, I was wondering if there is any overhead of declaring the above RS and not using all the descriptors. As far as I can tell it shouldn't cause much trouble (I'm also aware that UnrealEngine uses something like this). I would love to hear the opinion of someone with more experience on this topic. Thanks!
  20. Hi all, Any idea what the mechanism is for timing commands in the GPU command buffer in DX12 now? In DX11 it was BeginDisjoint, End's, EndDisjoint, GetData's. But in DX12, I see I can place EndQuery with a timestamp type, and I also see GetTimestampFrequency to get the frequency, but how do I get the tick value for each of the timestamp EndQuery's? I see ResolveQueryData, but that places the data in a GPU buffer, am I supposed to call that and then copy the data over? If so what is the format of that data? Unfortunately, I have yet to see a sample for timestamp queries yet. Thanks!
  21. Hi! I wonder if I can achieve the same (not quite optimal) CPU readback of occlusion queries as with DX11. u64 result = 0; HRESULT hr = deviceCtx11->GetData(id3d11Query, result, sizeof(u64), D3D11_ASYNC_GETDATA_DONOTFLUSH); if (S_OK == hr) return "ready"; else "not ready"; This happens on the CPU. I'm able to see if it's ready or not and do other stuff it isn't. In DX12, ResolveQueryData obviously happens on the GPU. If I put a fence after ResolveQueryData, I can be sure it copied the results into my buffer. However I wonder, if there's any other way then inserting fences after each EndQuery to see if the individual queries already finished. It sounds bad and I guess the fence might do some flushing. I first want to implement what other platforms in our engine do, before changing all of them to some more sensible batched occlusion query querying model. Thanks for any remarks.
  22. I was wondering if it is possible to use individual faces of cubemap for creating 2D srvs. So the underlying ID3D12Resource will be the cubemap but we can also access it as 6 separate 2d textures in shader code. ID3D12Resource* pCubeMap = createCubeMap(); SRV cubeMapFace1 = {}; cubeMapFace1.dimension = 2D; cubeMapFace1.xxx = 0; // This will be the face index (is this the plane slice field in D3D12_TEX2D_SRV? How does it map to Vulkan since there is no plane slice in VkImageViewCreateInfo) // Plan is to create an srv for only the first face of the cubemap and use it as a normal 2D texture in shader code createSRV(pCubeMap, &cubeMapFace1); Thank you
  23. Hello guys, I have a very simple D3D12 program that renders 2 textured quads and apply some saturation based on values passed to shaders by constant buffers. The textures (SRV) and the constant buffers (CBV) share a single large descriptor heap, SRVs are stored in the first half of the heap and CBVs in the second half. This program works just fine but then I extended it by adding more constant buffers to do some other work and noticed that all constant buffers that were created "after the textures were created", were getting corrupted in the descriptor heap and were not usable. The curious thing is that if I create the extra const buffers before the textures then it works, but this it is not a definitive solution because the code is part of a library and the users should be able create resources in whatever order they want. It doesn't matter if I change textures in the descriptor heap to the second half and buffers to the first half, it always fail, hence I think is something about corruption of the heap or bad alignment. I'm aware of the alignment requirements for const buffers: Just as shown in the SDK samples, I'm creating 64K sized buffers just to be sure and aligning them using "(data_size + 255) & ~255". But I have no clue on how to align textures. Do you guys have a suggestion about this topic or how to properly align resource views in a single heap? Thank you guys for your time. PS: This is what the graphics debugger reports, just in case:
  24. I am doing a DX12 API abstraction layer for my engine. In the first step I just want a naïve straight forward implementation which wraps a DX11-like interface. The biggest roadblock right now is implementing the pipeline state objects from DX11-like sub-pipeline states like RasterizerState, BlendState, etc. I guess that in this case a call to MyDevice::SetRasterizerState(RasterizerState* myState) would not trigger an API call internally like the DX11 implementation, but instead it could make the currently bound pipeline state "dirty". If the pipeline state is dirty on the next draw call, then I could either retrieve a PSO if it already exists, or create one. The missing link for me is what data structure could I use here to track PSOs? What is a common/practical approach? Unfortunately I couldn't find a concreate example for this yet.
  25. Hello! I can see that when there's a write to UAVs in CS or PS, and I bind a null ID3D11UnorderedAccessView into a used UAV slot, the GPU won't hang and the writes are silently dropped. I hope I amn't dreaming. With DX12, I can't seem to emulate this. I reckon it's impossible. The shader just reads the descriptor of the UAV (from a register/offset based on the root signature layout) and does an "image_store" at some offset from the base address. If it's unmapped, bang, we're dead. I tried zeroing out that GPU visible UAV's range in the table, same result. Such an all-zero UAV descriptor doesn't seem very legit. That's expected. Am I right? How does DX11 do it that it survives this? Does it silently patch the shader or what? Thanks, .P
  • Advertisement