Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

127 Neutral

About mrvux

  • Rank
  1. I did not try with cubemap yet, but it should be pretty much the same (it's just a TextureArray after all)   As far as I've seen, there's no pitch for depth slice, so I'm not certain if you can copy all in one go.   Alternatively, by setting the right subresouce in TextureCopyLocation:   TextureCopyLocation destLocation = new TextureCopyLocation(textureResource, cubeSliceIndex); ?   And setting the right offset location on your buffer source footprint   You can copy each slice separately, which is pretty easy also.
  2. To load image from file, you can use any of your favourite technique (it's not D3D dependent).   So WIC, System.Drawing or any of your own parser would do.   Once you get your decompressed image data in your ram, call:   IntPtr dataPtr = uploadBuffer.Map(0, null);?   And use one of the copy memory function (memcpy,CopyMemory, SharpDX.Utilities.CopyMemory), to copy to that pointer (It's actually somehow equivalent to MapSubResource in Direct3D11)   You then unmap with:   uploadBuffer.Unmap(0, null);    
  3. In DirectX12 things are a little bit different, I'll use a simple texture (no arraysize and no mipmaps) to explain.   First you need to create a Buffer large enough to contain your image data, make sure this buffer is also using an Upload Heap   Next you create a Texture (with correct size/format) in Default heap.   Map your Buffer and copy Texture data to it.   Then you need to use CopyResourceRegion on a CommandList to perform the copy from upload heap to texture default heap, and also make sure that you have the right resource states (Texture needs to be in CopyDestination state before the copy, then you need to set it in GenericRead state again so it can be used as a shader view in your shaders pipeline) TextureCopyLocation destLocation = new TextureCopyLocation(textureResource, 0); TextureCopyLocation srcLocation = new TextureCopyLocation(uploadBuffer, new PlacedSubResourceFootprint() { Offset = 0, Footprint = new SubResourceFootprint() { Width = 1920, Depth = 1, Format = SharpDX.DXGI.Format.R8G8B8A8_UNorm, Height = 1080, RowPitch = 1920 * 4 } }); commandList.ResourceBarrierTransition(textureResource, ResourceStates.GenericRead, ResourceStates.CopyDestination); commandList.CopyTextureRegion(destLocation, 0, 0, 0, srcLocation, null); commandList.ResourceBarrierTransition(textureResource, ResourceStates.CopyDestination, ResourceStates.GenericRead);
  4. You can put variables (basically any struct as mentioned earlier) that are not a multiple of 16 bytes, but cbuffer requires to have it's total size to be a multiple of 16 bytes (so yes, if you use single variable for cbuffer then you lose data) I normally use this (considering T is a struct that you can know size of) to construct cbuffer size: size = ((Marshal.SizeOf(typeof(T)) + 15) / 16) * 16;
  5. Did a quick pixel shader that writes SV_Depth (since was a bit lazy to push some geometry). Reading back from depth buffer looked correct to me, need to test on real hardware of course, but would make sense to me as Hodgman mentioned that the transition barrier should do that work. I'll try on ATI asap.   EDIT: I tried on ATI and depth views work as expected, I'll post a sample tomorrow.   For compute shader here is a basic version that uploads data, does a simple multiply, get data back to cpu and validate. Works on warp and ati 7970, crashes on NVidia 670 when trying to set descriptor table in command list.
  6. Good point, but just doesn't make sense that it's removed in the first place (since it actually even was in 9926 build).   As a side note on progress (switched to SharpDX but can help on c++ side if someone needs) Nvidia 670 gtx here for info ? Depth buffer write and clear working Read depth buffer back as SRV working (only on warp, crash on hardware) Simple compute shader working (binding as root address, just 2 buffers and simple multiply). Same as above tho, warp only for now Buffer upload/copyresource/readback all worky too. Bundle works without any problem (and are awesome) I'll also run tests on ATI later.
  7. From my tests upgrade to 10049 did indeed break warp, so had to reinstall to 10041
  8. This is odd, I installed this as well, but no debug layer here (got a few progress on other things like, but no debug makes it quite hard to know what's done wrong). Any hint?   I'll post a compute shader sample when I get this uav binding sorted. (resource copy and readback is working already, as well as setting up pipeline and dummy dispatch)        
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!