<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLCounterSampleBufferError-swift.struct/Code",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:@E@MTLCounterSampleBufferError"
  },
  "title" : "MTLCounterSampleBufferError.Code"
}
-->

# MTLCounterSampleBufferError.Code

The underlying error code type that indicates why a GPU driver can’t create a counter sample buffer.

```
enum Code
```

## Topics

### Error codes

[`MTLCounterSampleBufferError.Code.outOfMemory`](/documentation/Metal/MTLCounterSampleBufferError-swift.struct/Code/outOfMemory)

An error code that indicates the GPU device doesn’t have sufficient memory to create a counter sample buffer.

[`MTLCounterSampleBufferError.Code.invalid`](/documentation/Metal/MTLCounterSampleBufferError-swift.struct/Code/invalid)

An error code that indicates when a counter-sample buffer descriptor has at
least one invalid property.

[`MTLCounterSampleBufferError.Code.internal`](/documentation/Metal/MTLCounterSampleBufferError-swift.struct/Code/internal)

An error code that indicates the Metal framework has an internal problem.

[`MTLCounterSampleBufferError.Code.outOfMemory`](/documentation/Metal/MTLCounterSampleBufferError-swift.struct/Code/outOfMemory)

An error code that indicates the GPU device doesn’t have sufficient memory to create a counter sample buffer.

[`MTLCounterSampleBufferError.Code.invalid`](/documentation/Metal/MTLCounterSampleBufferError-swift.struct/Code/invalid)

An error code that indicates when a counter-sample buffer descriptor has at
least one invalid property.

[`MTLCounterSampleBufferError.Code.internal`](/documentation/Metal/MTLCounterSampleBufferError-swift.struct/Code/internal)

An error code that indicates the Metal framework has an internal problem.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)