Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About VietNN

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thank you, I did not know that GetCopyableFootprints can fill out offsets + layouts for all mips at the same time, by doing this pLayout.Offset will have value when NumSubresource > 1. I did get pLayout for each mip by GetCopyableFootprints with FirstSubresource=mip_index and NumSubresource always = 1, so the pLayout.Offset just return 0. Many thanks, @SoldierOfLight
  2. Hi @SoldierOfLight 1. I created upload buffer big enough for entire mip as below code: device->GetCopyableFootprints(&textureDesc, 0, textureDesc.MipLevels, 0, nullptr, nullptr, nullptr, &textureUploadBufferSize); hr = m_device->GetId()->CreateCommittedResource( &CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD), D3D12_HEAP_FLAG_NONE, &CD3DX12_RESOURCE_DESC::Buffer(textureUploadBufferSize), D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&m_textureBufferUploadHeap)); 2 & 3. At current, I fill data for each mip (mip by mip), step like this: - get data from 1 mip only - copy data to upload heap: offset for upload heap was got by: GetCopyableFootprints(&textureDesc, 0, mipmapIndex, 0, nullptr, nullptr, nullptr, &offset) offset is total bytes from mip 0 to mipmapIndex - 1. Then I get data pointer by UploadHeap->Map() + offset. and start copy at this pointer. - copy mip data from UploadHeap to DefaultHeap by CopyTextureRegion: Here is the question come, I dont know how to match pointer to this mip on UploadHeap for copying. At #1 I tried to modify pLayout.Offset by offset value got by previous step but not success because it was not 512 Alignment
  3. 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
  4. Thank you SoldierOfLight and galop1n for your explanation.
  5. Hi @SoldierOfLight , I have an offtopic question, about this: If i have a texture 128 x 128 with BC1 format, on mip level 2 it will be 32x32, so the RowSizeInBytes will be 64 (and numRow will be 8), but due to pitch alignment each row will be 256, will the rest be empty ? And when API use it, does it use 64 bytes to make a textures or make a texture with 256 x 8?
  6. @SoldierOfLight Yes, last call stack is D3D12.dll: CreateShaderResourceView >> d3d12SDKLayer >> D3D12.dll : crash
  7. Still stuck here, do I need to make sure m_texture is not update in any command list why it is being used to create shader resource ?view
  8. Thank you guys, below is my answer Debug layer is on, i still l see some D3D12 warning, so I sure debug layer is working. but the warning is not relative to this, just clear value of some render target is not same as when it is create. No, there is no device removed in output log, and I did not destroyed any texture Each descriptor just have about ~20 maximum NumDescriptors, it's quite small I think
  9. Hi everyone, I am new to Dx12 and working on a game project. My game just crash at CreateShaderResourceView with no infomation output in debug log, just: 0xC0000005: Access violation reading location 0x000001F22EF2AFE8. my code at current: CreateShaderResourceView(m_texture, &desc, *cpuDescriptorHandle); - m_texture address is: 0x000001ea3c68c8a0 - cpuDescriptorHandle address is 0x00000056d88fdd50 - desc.Format, desc.ViewDimension, Texture2D.MostDetailedMip, Texture2D.MipLevels is initalized. The crash happens all times at that stage but not on same m_texture. As I noticed the violation reading location is always somewhere near m_texture address. I just declare a temp variable to check how many times CreateShaderResourceView already called, at that moment it is 17879 (means that I created 17879 succesfully), and CreateDescriptorHeap for cpuDescriptorHandle was called 4190, do I reach any limit? One more infomation, if I set miplevel of all texture when create to 1 it seem like there is no crash but game quality is bad. Do not sure if it relative or not. Anyone could give me some advise ?
  10. O, thank you pcmaster.
  11. Hi Hodgman, thanks for a quick respone, So you mean in older API, some format like RGB (only 3 channel) will be fetched as RGBA(A=1) in shader ? (or I missunderstood). One more question, in Dx12 if I send a texture RGB, Do I have to force alpha to 0 or 1 (by setting others flag not using the DEFAULT_MAPPING flag)? or what will happen if I still using default mapping flag? Thank you
  12. Hi all, The D3D12_SHADER_RESOURCE_VIEW_DESC has a member Shader4ComponentMapping but I don't really know what is it used for? As several example set its value to D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING. I also read the document on MSDN but still do not understand anything about it. https://msdn.microsoft.com/en-us/library/windows/desktop/dn903814(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/dn770406(v=vs.85).aspx Anyone could help me, thank you.
  13. Thank you WFP, your comment is so helpful
  14. Hi, I have tried using descriptor tables for const buffer but it seems like fps is dropped. Not sure if I did not implement correctly or else, need time to investigate... But I want to know if we can use SetGraphicsRootConstantBufferView for vertex or pixel shader separately. Or doing things like using SetGraphicsRootConstantBufferView but not need to modify shader.
  15. Thank you GuyWithBeard, I will try using descriptor tables
  • 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!