mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 14:01:08 +01:00
[dx12] Fix detection of Int64 features (#8667)
This commit is contained in:
1 parent
fd671d45a8
commit
40b2d3041b
2 files changed
+45
-12
No files matched your search
@@ -214,6 +214,7 @@ By @cwfitzgerald in [#8609](https://github.com/gfx-rs/wgpu/pull/8609).
|
||||
#### DX12
|
||||
|
||||
- Align copies b/w textures and buffers via a single intermediate buffer per copy when `D3D12_FEATURE_DATA_D3D12_OPTIONS13.UnrestrictedBufferTextureCopyPitchSupported` is `false`. By @ErichDonGubler in [#7721](https://github.com/gfx-rs/wgpu/pull/7721).
|
||||
- Fix detection of Int64 Buffer/Texture atomic features. By @cwfitzgerald in [#8667](https://github.com/gfx-rs/wgpu/pull/8667).
|
||||
|
||||
#### Vulkan
|
||||
|
||||
|
||||
@@ -518,13 +518,6 @@ impl super::Adapter {
|
||||
shader_model >= naga::back::hlsl::ShaderModel::V6_2 && float16_supported,
|
||||
);
|
||||
|
||||
features.set(
|
||||
wgt::Features::TEXTURE_INT64_ATOMIC,
|
||||
shader_model >= naga::back::hlsl::ShaderModel::V6_6
|
||||
&& hr.is_ok()
|
||||
&& features1.Int64ShaderOps.as_bool(),
|
||||
);
|
||||
|
||||
features.set(
|
||||
wgt::Features::SUBGROUP,
|
||||
shader_model >= naga::back::hlsl::ShaderModel::V6_0
|
||||
@@ -552,23 +545,62 @@ impl super::Adapter {
|
||||
supports_ray_tracing,
|
||||
);
|
||||
|
||||
let atomic_int64_on_typed_resource_supported = {
|
||||
// Check for Int64 atomic support on buffers. This is very convoluted, but is based on a conservative reading
|
||||
// of https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_Int64_and_Float_Atomics.html#integer-64-bit-capabilities.
|
||||
let atomic_int64_buffers;
|
||||
let atomic_int64_textures;
|
||||
{
|
||||
let mut features9 = Direct3D12::D3D12_FEATURE_DATA_D3D12_OPTIONS9::default();
|
||||
unsafe {
|
||||
let hr9 = unsafe {
|
||||
device.CheckFeatureSupport(
|
||||
Direct3D12::D3D12_FEATURE_D3D12_OPTIONS9,
|
||||
<*mut _>::cast(&mut features9),
|
||||
size_of_val(&features9) as u32,
|
||||
)
|
||||
}
|
||||
.is_ok()
|
||||
&& features9.AtomicInt64OnGroupSharedSupported.as_bool()
|
||||
.is_ok();
|
||||
|
||||
let mut features11 = Direct3D12::D3D12_FEATURE_DATA_D3D12_OPTIONS11::default();
|
||||
let hr11 = unsafe {
|
||||
device.CheckFeatureSupport(
|
||||
Direct3D12::D3D12_FEATURE_D3D12_OPTIONS11,
|
||||
<*mut _>::cast(&mut features11),
|
||||
size_of_val(&features11) as u32,
|
||||
)
|
||||
}
|
||||
.is_ok();
|
||||
|
||||
atomic_int64_buffers = hr9 && hr11 && hr.is_ok()
|
||||
// Int64 atomics show up in SM6.6.
|
||||
&& shader_model >= naga::back::hlsl::ShaderModel::V6_6
|
||||
// They require Int64 to be available in the shader at all.
|
||||
&& features1.Int64ShaderOps.as_bool()
|
||||
// As our RWByteAddressBuffers can exist on both descriptor heaps and
|
||||
// as root descriptors, we need to ensure that both cases are supported.
|
||||
// base SM6.6 only guarantees Int64 atomics on resources in root descriptors.
|
||||
&& features11.AtomicInt64OnDescriptorHeapResourceSupported.as_bool()
|
||||
// Our Int64 atomic caps currently require groupshared. This
|
||||
// prevents Intel or Qcomm from using Int64 currently.
|
||||
// https://github.com/gfx-rs/wgpu/issues/8666
|
||||
&& features9.AtomicInt64OnGroupSharedSupported.as_bool();
|
||||
|
||||
atomic_int64_textures = hr9 && hr11 && hr.is_ok()
|
||||
// Int64 atomics show up in SM6.6.
|
||||
&& shader_model >= naga::back::hlsl::ShaderModel::V6_6
|
||||
// They require Int64 to be available in the shader at all.
|
||||
&& features1.Int64ShaderOps.as_bool()
|
||||
// Textures are typed resources, so we need this flag.
|
||||
&& features9.AtomicInt64OnTypedResourceSupported.as_bool()
|
||||
// As textures can only exist in descriptor heaps, we require this.
|
||||
// However, all architectures that support atomics on typed resources
|
||||
// support this as well, so this is somewhat redundant.
|
||||
&& features11.AtomicInt64OnDescriptorHeapResourceSupported.as_bool();
|
||||
};
|
||||
features.set(
|
||||
wgt::Features::SHADER_INT64_ATOMIC_ALL_OPS | wgt::Features::SHADER_INT64_ATOMIC_MIN_MAX,
|
||||
atomic_int64_on_typed_resource_supported,
|
||||
atomic_int64_buffers,
|
||||
);
|
||||
features.set(wgt::Features::TEXTURE_INT64_ATOMIC, atomic_int64_textures);
|
||||
let mesh_shader_supported = {
|
||||
let mut features7 = Direct3D12::D3D12_FEATURE_DATA_D3D12_OPTIONS7::default();
|
||||
unsafe {
|
||||
|
||||
Reference in new issue
Block a user