-
Notifications
You must be signed in to change notification settings - Fork 7
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
Use specialization constants for WR features #211
Comments
I started to take a look at this, but still have some things to figure out:
|
@zakorgy dx12 specialization constant support may be less complete still. cc @msiglreith For global scopes, I think it's solvable in each individual case: For For Overall, given the concerns raised and the state of specialization constants in DX12 at this point, I think we should postpone this feature to the next year. |
@kvark specialization constant implementation is almost identical for all backends, so should be working fine. |
I have revisited this and tried to figure out what happens on the DX12 side: we have 33 failing tests, but there should be only 7 on windows. case COLOR_MODE_SUBPX_CONST_COLOR:
case COLOR_MODE_SUBPX_BG_PASS0:
case COLOR_MODE_COLOR_BITMAP:
vMaskSwizzle = vec2(1.0, 0.0);
vColor = vec4(image_data.color.a);
break; to case COLOR_MODE_SUBPX_BG_PASS2:
vMaskSwizzle = vec2(1.0, 0.0);
vColor = image_data.color;
break;
case COLOR_MODE_SUBPX_DUAL_SOURCE:
vMaskSwizzle = vec2(1.0, 0.0);
vColor = image_data.color;
break;
case COLOR_MODE_IMAGE:
vMaskSwizzle = vec2(1.0, 0.0);
vColor = image_data.color;
break;
Unfortunatelly I haven't found any related driver/d3d12 issue for this. It is strange that we only have this issue with push constants and only with DX12. |
@zakorgy it would be good to confirm if the generated SPIR-V is wrong, or just spirv_cross messing with us. Also, I think at this point it's worth it creating an entry in WR driver bug wiki, and providing a PR upstream to fix this switch statement. |
Meanwhile I have checked the test (blend\large.yaml) with a debug build, and it passes 😕 (My previous attempt was with release). It looks like the issue is not that simple as I described, and maybe the above mentioned solution just fixes the symptom not the real problem. I will take a look at the generated SPIR-V, hope that shows us something. |
The way data is transmuted here looks really scary: zakorgy@4458fd4#diff-4d269bbd98df6af055b56ab19362567fR1149 Rather transmute it like: &unsafe { mem::transmute::<_, [u8; 4]>(color_target as u32) } |
@msiglreith thanks, that made the test results consistent with debug and release builds. |
Vulkan specialization constants appear to be the best-fit mechanism for supporting multiple shader configurations driven by features. Metal supports those natively, and there is hope that Vulkan drivers can generate a more efficient code (or save time on shader parsing) when using specialization.
The text was updated successfully, but these errors were encountered: