> ## 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.

# D3D12_SHADER_COMPONENT_MAPPING

> Spécifie comment la mémoire est acheminée par une vue de ressource de nuanceur (SRV).

Spécifie comment la mémoire est acheminée par une vue de ressource de nuanceur (SRV).

## Syntaxe

```cpp theme={null}
typedef enum D3D12_SHADER_COMPONENT_MAPPING
{
    D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0 = 0,
    D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1 = 1,
    D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2 = 2,
    D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3 = 3,
    D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0 = 4,
    D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1 = 5
} D3D12_SHADER_COMPONENT_MAPPING
```

## Constantes

| Constante | Description |
| - | - |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FROM\_MEMORY\_COMPONENT\_0 | Indique le composant de retour 0 (rouge). |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FROM\_MEMORY\_COMPONENT\_1 | Indique le composant de retour 1 (vert). |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FROM\_MEMORY\_COMPONENT\_2 | Indique le composant de retour 2 (bleu). |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FROM\_MEMORY\_COMPONENT\_3 | Indique le composant de retour 3 (alpha). |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FORCE\_VALUE\_0 | Indique que la valeur résultante est forcée à 0. |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FORCE\_VALUE\_1 | Indique que la valeur résultante est forcée à 1. La valeur forcée à 1 est soit 0x1, soit 1.0f, selon le type de format de ce composant dans le format source. |

## Remarques

Cette énumération permet à la SRV de sélectionner la manière dont la mémoire est acheminée vers les quatre composants de retour d'un nuanceur après une lecture mémoire. Les options pour chaque composant de nuanceur \[0..3] (correspondant à RGBA) sont : composant 0..3 du résultat de lecture de la SRV, forcer à 0 ou forcer à 1.

Le mappage 1:1 par défaut peut être indiqué en spécifiant **D3D12\_DEFAULT\_SHADER\_4\_COMPONENT\_MAPPING** ; sinon, un mappage arbitraire peut être spécifié à l'aide de la macro **D3D12\_ENCODE\_SHADER\_4\_COMPONENT\_MAPPING**.

Voir ci-dessous.

Notez les définitions suivantes.

```cpp theme={null}
#define D3D12_SHADER_COMPONENT_MAPPING_MASK 0x7
#define D3D12_SHADER_COMPONENT_MAPPING_SHIFT 3
#define D3D12_SHADER_COMPONENT_MAPPING_ALWAYS_SET_BIT_AVOIDING_ZEROMEM_MISTAKES \
(1<<(D3D12_SHADER_COMPONENT_MAPPING_SHIFT*4))
#define D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(Src0,Src1,Src2,Src3) \
((((Src0)&D3D12_SHADER_COMPONENT_MAPPING_MASK)| \
(((Src1)&D3D12_SHADER_COMPONENT_MAPPING_MASK)<<D3D12_SHADER_COMPONENT_MAPPING_SHIFT)| \
(((Src2)&D3D12_SHADER_COMPONENT_MAPPING_MASK)<<(D3D12_SHADER_COMPONENT_MAPPING_SHIFT*2))| \
(((Src3)&D3D12_SHADER_COMPONENT_MAPPING_MASK)<<(D3D12_SHADER_COMPONENT_MAPPING_SHIFT*3))| \
D3D12_SHADER_COMPONENT_MAPPING_ALWAYS_SET_BIT_AVOIDING_ZEROMEM_MISTAKES))
#define D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(ComponentToExtract,Mapping) \
((D3D12_SHADER_COMPONENT_MAPPING)(Mapping >> (D3D12_SHADER_COMPONENT_MAPPING_SHIFT*ComponentToExtract) & D3D12_SHADER_COMPONENT_MAPPING_MASK))
#define D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(0,1,2,3)
```

## Configuration requise

**En-tête :** d3d12\_xs.h ou d3d12\_x.h\
**Bibliothèque :** d3d12\_xs.lib ou d3d12\_x.lib\
**Plateformes prises en charge** : consoles XBOX Series et famille XBOX One

## Voir aussi

[Énumérations principales](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-enumerations)


## Related topics

- [D3D12_SHADER_RESOURCE_VIEW_DESC](/fr/reference/graphics/d3d12/structs/d3d12_shader_resource_view_desc_public.md)
- [D3D12_SHADER_VISIBILITY](/fr/reference/graphics/d3d12/enums/d3d12_shader_visibility_public.md)
- [D3D12_SHADER_BYTECODE](/fr/reference/graphics/d3d12/structs/d3d12_shader_bytecode_public.md)
- [D3D12_TILE_MAPPING_FLAGS](/fr/reference/graphics/d3d12/enums/d3d12_tile_mapping_flags_public.md)
- [D3D12_SHADER_CACHE_FLAGS](/fr/reference/graphics/d3d12/enums/d3d12_shader_cache_flags_public.md)
