Skip to content

Expose native C API support for R64Uint atomic storage textures #591

Description

@Milky2018

Summary

Rust wgpu exposes native API surface for R64Uint atomic storage textures, but the wgpu-native C API does not appear to expose equivalent native C ABI values.

This means C API consumers cannot express WGSL resources such as:

@group(0) @binding(0)
var visibility_buffer: texture_storage_2d<r64uint, atomic>;

I am not asking for this to become WebGPU-standard API. This seems more appropriate as a wgpu-native native-only extension surface in wgpu.h.

Versions checked

  • wgpu-native: v29.0.0.0 latest release, checked ffi/wgpu.h
  • Also observed in older release headers from v27.0.4.0
  • Rust wgpu API used for comparison: wgpu 29.0.3

Rust API that exists

Rust wgpu exposes the required pieces:

wgpu::TextureFormat::R64Uint
wgpu::TextureUsages::STORAGE_ATOMIC
wgpu::StorageTextureAccess::Atomic

A Rust bind group layout can express:

wgpu::BindingType::StorageTexture {
    access: wgpu::StorageTextureAccess::Atomic,
    format: wgpu::TextureFormat::R64Uint,
    view_dimension: wgpu::TextureViewDimension::D2,
}

C API surface that appears missing

In wgpu-native v29.0.0.0 ffi/wgpu.h, I can find native texture format constants such as:

WGPUNativeTextureFormat_R16Unorm
WGPUNativeTextureFormat_R16Snorm
WGPUNativeTextureFormat_Rg16Unorm
WGPUNativeTextureFormat_Rg16Snorm
WGPUNativeTextureFormat_Rgba16Unorm
WGPUNativeTextureFormat_Rgba16Snorm
WGPUNativeTextureFormat_NV12
WGPUNativeTextureFormat_P010

but no native C ABI equivalent for:

  • wgpu::TextureFormat::R64Uint
  • wgpu::TextureUsages::STORAGE_ATOMIC
  • wgpu::StorageTextureAccess::Atomic

Suggested direction

Would wgpu-native accept native-only C ABI constants for this capability in wgpu.h, for example:

WGPUNativeTextureFormat_R64Uint
WGPUNativeTextureUsage_StorageAtomic
WGPUNativeStorageTextureAccess_Atomic

The C descriptor conversion would then map these to:

  • wgpu_types::TextureFormat::R64Uint
  • wgpu_types::TextureUsages::STORAGE_ATOMIC
  • wgpu_types::StorageTextureAccess::Atomic

with the same feature/capability validation as the Rust API, notably TEXTURE_ATOMIC and TEXTURE_INT64_ATOMIC.

Question

Is a wgpu.h native extension the preferred way to make this Rust wgpu native capability available to C API users, or is there another intended C ABI path for R64Uint atomic storage textures?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions