/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
static Maybe<uint8_t> GetBytesPerBlockSingleAspect(
dom::GPUTextureFormat aFormat) { auto format = ConvertTextureFormat(aFormat);
uint32_t bytes = ffi::wgpu_texture_format_block_size_single_aspect(format); if (bytes == 0) { // The above function returns zero if the texture has multiple aspects like // depth and stencil. return Nothing();
}
ffi::WGPUTextureFormat format = {ffi::WGPUTextureFormat_Sentinel}; if (aDesc.mFormat.WasPassed()) {
format = ConvertTextureFormat(aDesc.mFormat.Value());
desc.format = &format;
}
ffi::WGPUTextureViewDimension dimension =
ffi::WGPUTextureViewDimension_Sentinel; if (aDesc.mDimension.WasPassed()) {
dimension = ffi::WGPUTextureViewDimension(aDesc.mDimension.Value());
desc.dimension = &dimension;
}
// Ideally we'd just do something like "aDesc.mMipLevelCount.ptrOr(nullptr)" // but dom::Optional does not seem to have very many nice things.
uint32_t mipCount =
aDesc.mMipLevelCount.WasPassed() ? aDesc.mMipLevelCount.Value() : 0;
uint32_t layerCount =
aDesc.mArrayLayerCount.WasPassed() ? aDesc.mArrayLayerCount.Value() : 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.