> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CreateShaderCacheSession (XBOX Series consoles)

> Creates an object that grants access to a shader cache, potentially opening an existing cache or creating a new one.

Creates an object that grants access to a shader cache, potentially opening an existing cache or creating a new one.

## Syntax

```cpp theme={null}
HRESULT CreateShaderCacheSession(
    const D3D12_SHADER_CACHE_SESSION_DESC  pDesc,
    const IID & riid,
    void  ppvSession
)
```

### Parameters

*pDesc*<br />Type: const D3D12\_SHADER\_CACHE\_SESSION\_DESC \*

A **D3D12\_SHADER\_CACHE\_SESSION\_DESC** structure describing the shader cache session to create.

*riid*<br />Type: const IID &

The globally unique identifier (GUID) for the shader cache session interface.

*ppvSession*<br />Type: void \*\*

A pointer to a memory block that receives a pointer to the [ID3D12ShaderCacheSession](/reference/graphics/d3d12/interfaces/id3d12shadercachesession/id3d12shadercachesession_public) interface for the shader cache session.

### Return value

Type: HRESULT

If the function succeeds, it returns **S\_OK**. Otherwise, it returns an [**HRESULT**](https://learn.microsoft.com/en-us/windows/desktop/com/structure-of-com-error-codes) [error code](https://learn.microsoft.com/en-us/windows/win32/com/com-error-codes-10).

| Return value                 | Description                                                                                                                                                                               |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| DXGI\_ERROR\_ALREADY\_EXISTS | You tried to create a cache with an existing identifier. See [D3D12\_SHADER\_CACHE\_SESSION\_DESC::Identifier](/reference/graphics/d3d12/structs/d3d12_shader_cache_session_desc_public). |

## Remarks

## Requirements

**Header:** d3d12\_xs.h<br />**Library:** d3d12\_xs.lib<br />**Supported Platforms**: XBOX Series consoles

## See Also

* [D3D12 shader cache APIs](https://microsoft.github.io/DirectX-Specs/d3d/ShaderCache.html)


## Related topics

- [D3D12_SHADER_CACHE_KIND_FLAGS (XBOX Series consoles)](/reference/graphics/d3d12/enums/d3d12_shader_cache_kind_flags_public.md)
- [D3D12_SHADER_CACHE_CONTROL_FLAGS (XBOX Series consoles)](/reference/graphics/d3d12/enums/d3d12_shader_cache_control_flags_public.md)
- [ShaderCacheControl (XBOX Series consoles)](/reference/graphics/d3d12/interfaces/id3d12device9/methods/id3d12device9_shadercachecontrol_public.md)
- [CreateProtectedResourceSession (XBOX Series consoles)](/reference/graphics/d3d12/interfaces/id3d12device4/methods/id3d12device4_createprotectedresourcesession_public.md)
- [D3D12_SHADER_CACHE_SESSION_DESC](/reference/graphics/d3d12/structs/d3d12_shader_cache_session_desc_public.md)
