Share via


D3D12_SHADER_COMPONENT_MAPPING enumeração (d3d12.h)

Especifica como a memória é roteada por uma SRV (exibição de recurso de sombreador).

Syntax

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
} ;

Constantes

 
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0
Valor: 0
Indica o componente de retorno 0 (vermelho).
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_1
Valor: 1
Indica o componente de retorno 1 (verde).
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2
Valor: 2
Indica o componente de retorno 2 (azul).
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3
Valor: 3
Indica o componente de retorno 3 (alfa).
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_0
Valor: 4
Indica forçar o valor resultante a 0.
D3D12_SHADER_COMPONENT_MAPPING_FORCE_VALUE_1
Valor: 5
Indica forçar o valor resultante 1. O valor de forçar 1 é 0x1 ou 1,0f, dependendo do tipo de formato para esse componente no formato de origem.

Comentários

Essa enumeração permite que o SRV selecione como a memória é roteada para os quatro componentes de retorno em um sombreador após uma busca de memória. As opções para cada componente de sombreador [0..3] (correspondente ao RGBA) são: componente 0..3 do resultado de busca SRV ou força 0 ou força 1.

O mapeamento padrão 1:1 pode ser indicado especificando D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING, caso contrário, um mapeamento arbitrário pode ser especificado usando a macro D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING.

Veja abaixo.

Observe as definições a seguir.

#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

Requisito Valor
Cabeçalho d3d12.h

Confira também

Enumerações de núcleo