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

Conversation

Hyp-X
Copy link
Contributor

@Hyp-X Hyp-X commented Apr 18, 2023

Added procedures for D3D12 macros:
ENCODE_SHADER_4_COMPONENT_MAPPING
DECODE_SHADER_4_COMPONENT_MAPPING
Added a "runtime constant" for
DEFAULT_SHADER_4_COMPONENT_MAPPING

@gingerBill
Copy link
Member

Did you even test this code before you wrote it?

@Hyp-X
Copy link
Contributor Author

Hyp-X commented Apr 22, 2023

Sorry for the late replay.

I'm actively using it in my renderer.
Altough, I'm only using DEFAULT_SHADER_4_COMPONENT_MAPPING, I've tested other variations of ENCODE_SHADER_4_COMPONENT_MAPPING and it seems to work correctly.

I've also tested DECODE_SHADER_4_COMPONENT_MAPPING and it seems to work ok.

What problem did you find?
I can fix it if you tell me.

Comment on lines +502 to +509
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 {
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

@github-actions github-actions bot added the stale label Sep 15, 2023
@github-actions github-actions bot removed the stale label Feb 2, 2024
@github-actions github-actions bot added the stale label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants