stride3d/stride · error · ArgumentException

Resource ' ' has missing Unordered Access View.

Error message

Resource '{unorderedAccessView}' has missing Unordered Access View.

What it means

SetUnorderedAccessView copies a UAV descriptor into the descriptor set. If the resource's NativeUnorderedAccessView pointer is zero — the resource was never given an Unordered Access View (e.g. not created with unordered-access flags) — it throws ArgumentException. Unlike SRVs, which silently return, a missing UAV is treated as a hard error here.

Solutions

  1. Recreate the resource with unordered-access support (e.g. BufferFlags.ShaderResource | BufferFlags.UnorderedAccess, or texture usage including UnorderedAccess).
  2. Verify the resource actually built its UAV (don't rely on the compute path creating it implicitly).
  3. Bind the resource as an SRV instead if you only meant to read it.
  4. Check view creation on your graphics-compositor/shader pass setup so UAV-flagged resources are declared for the pass.

Example fix

// before
var buf = Buffer.New(GraphicsDevice, 256, BufferFlags.ShaderResource);
descriptorSet.SetUnorderedAccessView(0, buf); // throws
// after
var buf = Buffer.New(GraphicsDevice, 256, BufferFlags.ShaderResource | BufferFlags.UnorderedAccess);
descriptorSet.SetUnorderedAccessView(0, buf);
Defensive patterns

Strategy: validation

Validate before calling

if (resource.NativeUnorderedAccessView.Ptr == 0)
    throw new InvalidOperationException("Resource has no UAV; recreate with unordered-access flags");

Type guard

static bool HasUav(GraphicsResource r) => r.NativeUnorderedAccessView.Ptr != 0;

Try / catch

try { descriptorSet.SetUnorderedAccessView(slot, resource); }
catch (ArgumentException ex) when (ex.Message.Contains("Unordered Access View"))
{ log.Error("Resource missing UAV; check creation flags", ex); }

Prevention

When it happens

Trigger: Calling DescriptorSet.SetUnorderedAccessView(slot, resource) where resource was created without UAV capability (e.g. BufferFlags without unordered access, texture created without UnorderedAccess usage).

Common situations: Binding a storage image/buffer whose creation flags omitted the UAV flag; binding resources in compute shaders that were only set up for SRV; forgetting to request GPU write access at resource creation.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/238f1a24a68867ed. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Graphics/Direct3D12/DescriptorSet.Direct3D12.cs:207

            var destDescriptorHandle = new CpuDescriptorHandle(SrvStart.Ptr + (nuint) bindingOffset);

            nativeDevice.CreateConstantBufferView(in cbufferViewDesc, destDescriptorHandle);

            // Constant buffers are typically on upload heaps (GenericRead) and don't need transitions
        }

        /// <summary>
        ///   Sets a Unordered Access View (UAV) Descriptor in a specific slot.
        /// </summary>
        /// <param name="slot">The slot.</param>
        /// <param name="buffer">The Unordered Access View to set.</param>
        /// <exception cref="ArgumentException">The Graphics Resource does not have an Unordered Access View.</exception>
        public void SetUnorderedAccessView(int slot, GraphicsResource unorderedAccessView)
        {
            // TODO: Why this throws, but the SRVs just return?

            if (unorderedAccessView.NativeUnorderedAccessView.Ptr == 0)
                throw new ArgumentException($"Resource '{unorderedAccessView}' has missing Unordered Access View.");

            var bindingOffset = BindingOffsets[slot];
            var destDescriptorRangeStart = new CpuDescriptorHandle(SrvStart.Ptr + (nuint) bindingOffset);

            nativeDevice.CopyDescriptorsSimple(NumDescriptors: 1, destDescriptorRangeStart,
                                               unorderedAccessView.NativeUnorderedAccessView, DescriptorHeapType.CbvSrvUav);
        }
    }
}

#endif

View on GitHub (pinned to 96fad776d2)