Skip to content

Commit

Permalink
WGPU: Create cube textures with one layer per face
Browse files Browse the repository at this point in the history
This helps to address
shader-slang/slang#4943
  • Loading branch information
aleino-nv committed Nov 15, 2024
1 parent 1b6b405 commit 195e517
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/wgpu/wgpu-texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,24 @@ Result DeviceImpl::createTexture(const TextureDesc& desc_, const SubresourceData
WGPUTextureDescriptor textureDesc = {};
textureDesc.size.width = desc.size.width;
textureDesc.size.height = desc.size.height;
textureDesc.size.depthOrArrayLayers = desc.size.depth;
if (desc_.type == TextureType::Texture3D)
{
textureDesc.size.depthOrArrayLayers = desc.size.depth;
}
else
{
uint32_t arrayLayers = desc_.arrayLength;
switch (desc_.type)
{
case TextureType::TextureCube:
arrayLayers *= 6U;
break;
case TextureType::Texture1D:
arrayLayers = 1U;
break;
}
textureDesc.size.depthOrArrayLayers = arrayLayers;
}
textureDesc.usage = translateTextureUsage(desc.usage);
if (initData)
{
Expand Down

0 comments on commit 195e517

Please sign in to comment.