Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D3D12: Support for SHADER_4_COMPONENT_MAPPING macros #2467

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
12 changes: 12 additions & 0 deletions vendor/directx/d3d12/d3d12_constants.odin
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,18 @@ WHQL_DRAW_VERTEX_COUNT_2_TO_EXP :: 25

SHADER_COMPONENT_MAPPING_MASK :: 0x7
SHADER_COMPONENT_MAPPING_SHIFT :: 3
SHADER_COMPONENT_MAPPING_ALWAYS_SET_BIT_AVOIDING_ZEROMEM_MISTAKES :: 1<<(SHADER_COMPONENT_MAPPING_SHIFT*4)
ENCODE_SHADER_4_COMPONENT_MAPPING :: proc(Src0, Src1, Src2, Src3: SHADER_COMPONENT_MAPPING) -> u32 {
return (u32(Src0)&SHADER_COMPONENT_MAPPING_MASK)|
((u32(Src1)&SHADER_COMPONENT_MAPPING_MASK)<<SHADER_COMPONENT_MAPPING_SHIFT)|
((u32(Src2)&SHADER_COMPONENT_MAPPING_MASK)<<(SHADER_COMPONENT_MAPPING_SHIFT*2))|
((u32(Src3)&SHADER_COMPONENT_MAPPING_MASK)<<(SHADER_COMPONENT_MAPPING_SHIFT*3))|
SHADER_COMPONENT_MAPPING_ALWAYS_SET_BIT_AVOIDING_ZEROMEM_MISTAKES
}
DECODE_SHADER_4_COMPONENT_MAPPING :: proc(ComponentToExtract, Mapping: u32) -> SHADER_COMPONENT_MAPPING {
Comment on lines +502 to +509
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend making these proc "c" or something that is the default "odin" calling convention

return SHADER_COMPONENT_MAPPING(Mapping >> (SHADER_COMPONENT_MAPPING_SHIFT*ComponentToExtract) & SHADER_COMPONENT_MAPPING_MASK)
}
DEFAULT_SHADER_4_COMPONENT_MAPPING := ENCODE_SHADER_4_COMPONENT_MAPPING(.FROM_MEMORY_COMPONENT_0, .FROM_MEMORY_COMPONENT_1, .FROM_MEMORY_COMPONENT_2, .FROM_MEMORY_COMPONENT_3)

FILTER_REDUCTION_TYPE_MASK :: 0x3
FILTER_REDUCTION_TYPE_SHIFT :: 7
Expand Down