{"record":{"id":"238f1a24a68867ed","repo":"stride3d/stride","slug":"resource-unorderedaccessview-has-missing-unordered-access","errorCode":null,"errorMessage":"Resource '{unorderedAccessView}' has missing Unordered Access View.","messagePattern":"Resource '(.+?)' has missing Unordered Access View\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Direct3D12/DescriptorSet.Direct3D12.cs","lineNumber":207,"sourceCode":"            var destDescriptorHandle = new CpuDescriptorHandle(SrvStart.Ptr + (nuint) bindingOffset);\n\n            nativeDevice.CreateConstantBufferView(in cbufferViewDesc, destDescriptorHandle);\n\n            // Constant buffers are typically on upload heaps (GenericRead) and don't need transitions\n        }\n\n        /// <summary>\n        ///   Sets a Unordered Access View (UAV) Descriptor in a specific slot.\n        /// </summary>\n        /// <param name=\"slot\">The slot.</param>\n        /// <param name=\"buffer\">The Unordered Access View to set.</param>\n        /// <exception cref=\"ArgumentException\">The Graphics Resource does not have an Unordered Access View.</exception>\n        public void SetUnorderedAccessView(int slot, GraphicsResource unorderedAccessView)\n        {\n            // TODO: Why this throws, but the SRVs just return?\n\n            if (unorderedAccessView.NativeUnorderedAccessView.Ptr == 0)\n                throw new ArgumentException($\"Resource '{unorderedAccessView}' has missing Unordered Access View.\");\n\n            var bindingOffset = BindingOffsets[slot];\n            var destDescriptorRangeStart = new CpuDescriptorHandle(SrvStart.Ptr + (nuint) bindingOffset);\n\n            nativeDevice.CopyDescriptorsSimple(NumDescriptors: 1, destDescriptorRangeStart,\n                                               unorderedAccessView.NativeUnorderedAccessView, DescriptorHeapType.CbvSrvUav);\n        }\n    }\n}\n\n#endif\n","sourceCodeStart":189,"sourceCodeEnd":219,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Direct3D12/DescriptorSet.Direct3D12.cs#L189-L219","documentation":"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.","triggerScenarios":"Calling DescriptorSet.SetUnorderedAccessView(slot, resource) where resource was created without UAV capability (e.g. BufferFlags without unordered access, texture created without UnorderedAccess usage).","commonSituations":"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.","solutions":["Recreate the resource with unordered-access support (e.g. BufferFlags.ShaderResource | BufferFlags.UnorderedAccess, or texture usage including UnorderedAccess).","Verify the resource actually built its UAV (don't rely on the compute path creating it implicitly).","Bind the resource as an SRV instead if you only meant to read it.","Check view creation on your graphics-compositor/shader pass setup so UAV-flagged resources are declared for the pass."],"exampleFix":"// before\nvar buf = Buffer.New(GraphicsDevice, 256, BufferFlags.ShaderResource);\ndescriptorSet.SetUnorderedAccessView(0, buf); // throws\n// after\nvar buf = Buffer.New(GraphicsDevice, 256, BufferFlags.ShaderResource | BufferFlags.UnorderedAccess);\ndescriptorSet.SetUnorderedAccessView(0, buf);","handlingStrategy":"validation","validationCode":"if (resource.NativeUnorderedAccessView.Ptr == 0)\n    throw new InvalidOperationException(\"Resource has no UAV; recreate with unordered-access flags\");","typeGuard":"static bool HasUav(GraphicsResource r) => r.NativeUnorderedAccessView.Ptr != 0;","tryCatchPattern":"try { descriptorSet.SetUnorderedAccessView(slot, resource); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Unordered Access View\"))\n{ log.Error(\"Resource missing UAV; check creation flags\", ex); }","preventionTips":["Create compute-writable buffers with BufferFlags.UnorderedAccess.","Request UnorderedAccess usage on textures bound as storage images.","Verify pass/compositor setup declares UAV bindings for the resources used."],"tags":["direct3d12","graphics","uav","compute"],"backgroundTag":"missing-required-argument","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}