Code Monkey home page Code Monkey logo

Comments (5)

lygyue avatar lygyue commented on May 27, 2024

when i create a uploaded buffer for texture uploaded and the buffer size is 6619136, the texture uploaded will failed because the Device->GetCopyableFootprints(&TextureDesc, 0, 1, 0, &Layouts, nullptr, &RowSizeInBytes, &RequiredSize); return RequiredSize is 6635344, I uploaded the texture using microsoft's sample code:UpdateSubresources, it will return when :IntermediateDesc.Width < RequiredSize + pLayouts[0].Offset.

from d3d12memoryallocator.

lygyue avatar lygyue commented on May 27, 2024

I means the value which GetResourceAllocationInfo return must larger than GetCopyableFootprints returns. and in my situation 6619136 is smaller than 6635520 , it doesn't work, and i don't know why.

from d3d12memoryallocator.

lygyue avatar lygyue commented on May 27, 2024

I soloved this in this way:
D3D12_RESOURCE_ALLOCATION_INFO Info; Info = Device->GetResourceAllocationInfo(0, 1, &TextureDesc); UINT64 RequiredSize = 0; UINT64 RowSizeInBytes = 0; D3D12_PLACED_SUBRESOURCE_FOOTPRINT Layouts; Device->GetCopyableFootprints(&TextureDesc, 0, 1, 0, &Layouts, nullptr, &RowSizeInBytes, &RequiredSize); if (RequiredSize > Info.SizeInBytes) { mTextureLen = ((int)RequiredSize + (int)Info.Alignment - 1) / (int)Info.Alignment * (int)Info.Alignment; } else { mTextureLen = (int)Info.SizeInBytes; }
But i can't ensure is the right way.

from d3d12memoryallocator.

lygyue avatar lygyue commented on May 27, 2024
D3D12_RESOURCE_ALLOCATION_INFO Info;
Info = Device->GetResourceAllocationInfo(0, 1, &TextureDesc);
UINT64 RequiredSize = 0;
UINT64 RowSizeInBytes = 0;
D3D12_PLACED_SUBRESOURCE_FOOTPRINT Layouts;
Device->GetCopyableFootprints(&TextureDesc, 0, 1, 0, &Layouts, nullptr, &RowSizeInBytes, &RequiredSize);
if (RequiredSize > Info.SizeInBytes)
{
	mTextureLen = ((int)RequiredSize + (int)Info.Alignment - 1) / (int)Info.Alignment * (int)Info.Alignment;
}
else
{
	mTextureLen = (int)Info.SizeInBytes;
}

from d3d12memoryallocator.

adam-sawicki-a avatar adam-sawicki-a commented on May 27, 2024

I am sorry but this place is for reporting issues or feature request for this specific project - D3D12 Memory Allocator. For general questions about DirectX please refer to the official places provided by Microsoft e.g. https://devblogs.microsoft.com/directx/ and their Discord server. You can ask for help there.

from d3d12memoryallocator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.