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

> Especifica cómo enruta la memoria una vista de recursos de sombreador (SRV).

Especifica cómo enruta la memoria una vista de recursos de sombreador (SRV).

## Sintaxis

```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                                                     | Descripción                                                                                                                                           |
| ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FROM\_MEMORY\_COMPONENT\_0 | Indica que se devuelve el componente 0 (rojo).                                                                                                        |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FROM\_MEMORY\_COMPONENT\_1 | Indica que se devuelve el componente 1 (verde).                                                                                                       |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FROM\_MEMORY\_COMPONENT\_2 | Indica que se devuelve el componente 2 (azul).                                                                                                        |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FROM\_MEMORY\_COMPONENT\_3 | Indica que se devuelve el componente 3 (alfa).                                                                                                        |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FORCE\_VALUE\_0            | Indica que se fuerza el valor resultante a 0.                                                                                                         |
| D3D12\_SHADER\_COMPONENT\_MAPPING\_FORCE\_VALUE\_1            | Indica que se fuerza el valor resultante a 1. El valor al forzar 1 es 0x1 o 1.0f, según el tipo de formato de ese componente en el formato de origen. |

## Comentarios

Esta enumeración permite que la SRV seleccione cómo se enruta la memoria a los cuatro componentes devueltos en un sombreador después de una captura de memoria. Las opciones para cada componente de sombreador \[0..3] (que corresponden a RGBA) son: componente 0..3 del resultado de captura de la SRV, o forzar 0 o forzar 1.

La asignación 1:1 predeterminada se puede indicar especificando **D3D12\_DEFAULT\_SHADER\_4\_COMPONENT\_MAPPING**; en caso contrario, se puede especificar una asignación arbitraria mediante la macro **D3D12\_ENCODE\_SHADER\_4\_COMPONENT\_MAPPING**.

Vea a continuación.

Tenga en cuenta las siguientes definiciones.

```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)
```

## Requisitos

**Encabezado:** d3d12\_xs.h o d3d12\_x.h\
**Biblioteca:** d3d12\_xs.lib o d3d12\_x.lib\
**Plataformas compatibles**: consolas XBOX Series y familia XBOX One

## Consulte también

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


## Related topics

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