mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 15:46:28 +00:00
Texture: Change to mArrayLayerCount to mSize.depth
This makes the tracking in TextureBase match the shape of wgpu::TextureDescriptor. GetSize() becomes a bit more surprising because the depth can sometimes be the array size, so new getters GetWidth(), GetHeight() and GetDepth() are added. Some simplifications to the backend texture creation code are included that will make it less error prone to add support for 1D / 3D textures. Bug: dawn:22 Change-Id: I33b6ca99af9d58fc88f5f626cfd5e2e62a8b45cb Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23103 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
4234d78201
commit
8a5325ca9a
@@ -108,8 +108,8 @@ namespace dawn_native { namespace opengl {
|
||||
: Texture(device, descriptor, GenTexture(device->gl), TextureState::OwnedInternal) {
|
||||
const OpenGLFunctions& gl = ToBackend(GetDevice())->gl;
|
||||
|
||||
uint32_t width = GetSize().width;
|
||||
uint32_t height = GetSize().height;
|
||||
uint32_t width = GetWidth();
|
||||
uint32_t height = GetHeight();
|
||||
uint32_t levels = GetNumMipLevels();
|
||||
uint32_t arrayLayers = GetArrayLayers();
|
||||
uint32_t sampleCount = GetSampleCount();
|
||||
@@ -292,15 +292,15 @@ namespace dawn_native { namespace opengl {
|
||||
// create temp buffer with clear color to copy to the texture image
|
||||
ASSERT(kTextureBytesPerRowAlignment % GetFormat().blockByteSize == 0);
|
||||
uint32_t bytesPerRow =
|
||||
Align((GetSize().width / GetFormat().blockWidth) * GetFormat().blockByteSize,
|
||||
Align((GetWidth() / GetFormat().blockWidth) * GetFormat().blockByteSize,
|
||||
kTextureBytesPerRowAlignment);
|
||||
|
||||
// Make sure that we are not rounding
|
||||
ASSERT(bytesPerRow % GetFormat().blockByteSize == 0);
|
||||
ASSERT(GetSize().height % GetFormat().blockHeight == 0);
|
||||
ASSERT(GetHeight() % GetFormat().blockHeight == 0);
|
||||
|
||||
dawn_native::BufferDescriptor descriptor;
|
||||
descriptor.size = bytesPerRow * (GetSize().height / GetFormat().blockHeight);
|
||||
descriptor.size = bytesPerRow * (GetHeight() / GetFormat().blockHeight);
|
||||
if (descriptor.size > std::numeric_limits<uint32_t>::max()) {
|
||||
return DAWN_OUT_OF_MEMORY_ERROR("Unable to allocate buffer.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user