-
Notifications
You must be signed in to change notification settings - Fork 36
Add mipmap support to createTextureWithData. #1332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,8 @@ | ||||||||||
| #include "API/Texture.h" | ||||||||||
| #include "API/Device.h" | ||||||||||
|
|
||||||||||
| #include <algorithm> | ||||||||||
|
|
||||||||||
| // Calculate the size in bytes of the texture data given a linear layout | ||||||||||
| // Useful for calculating the size for an upload or readback buffer. | ||||||||||
| size_t | ||||||||||
|
|
@@ -10,3 +12,24 @@ offloadtest::Texture::calculateLinearSizeInBytes(const Device &Dev) const { | |||||||||
| return (Desc.Height - 1) * Stride + | ||||||||||
| Desc.Width * getFormatSizeInBytes(Desc.Fmt); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| offloadtest::TextureUploadLayout | ||||||||||
| offloadtest::computeTightTextureUploadLayout(const TextureCreateDesc &Desc) { | ||||||||||
| const uint32_t ElementSize = getFormatSizeInBytes(Desc.Fmt); | ||||||||||
| TextureUploadLayout Layout; | ||||||||||
| Layout.Subresources.reserve(Desc.MipLevels); | ||||||||||
| uint64_t Offset = 0; | ||||||||||
| for (uint32_t I = 0; I < Desc.MipLevels; ++I) { | ||||||||||
| const uint32_t MipWidth = std::max(1u, Desc.Width >> I); | ||||||||||
| const uint32_t MipHeight = std::max(1u, Desc.Height >> I); | ||||||||||
| SubresourceFootprint Sub; | ||||||||||
| Sub.Offset = Offset; | ||||||||||
| Sub.RowSizeInBytes = MipWidth * ElementSize; | ||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This assumes uncompressed formats:
Suggested change
|
||||||||||
| Sub.RowPitchInBytes = Sub.RowSizeInBytes; | ||||||||||
| Sub.NumRows = MipHeight; | ||||||||||
| Layout.Subresources.push_back(Sub); | ||||||||||
| Offset += uint64_t(Sub.RowSizeInBytes) * Sub.NumRows; | ||||||||||
| } | ||||||||||
| Layout.TotalSizeInBytes = Offset; | ||||||||||
| return Layout; | ||||||||||
| } | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,8 +114,9 @@ Results: | |
| ... | ||
| #--- end | ||
|
|
||
| # Unimplemented: Clang + DX: https://github.com/llvm/llvm-project/issues/101558 | ||
| # XFAIL: DirectX || Metal | ||
| # Unimplemented: Metal: https://github.com/llvm/llvm-project/issues/101558 | ||
| # XFAIL: Metal | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This re-points the same issue (llvm-project#101558) from "Clang + DX" to "Metal". If it's a clang frontend issue it should hit DX and Metal equally, so DX presumably now passes for a different reason (the |
||
| # XFAIL: Clang && DirectX | ||
|
|
||
| # Bug https://github.com/llvm/llvm-project/issues/197837 | ||
| # XFAIL: Clang && Vulkan | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.