Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ac45f49

Browse files
SenorBlancoSkia Commit-Bot
authored andcommitted
Dawn: work around a fragcoord.w issue on D3D12.
D3D12 supplies w in fragcoord.w, while other backends supply 1/w. This may be better handled in Dawn or SPIRV-Cross, but for now we'll work around the issue here. Bug: skia:10475 Change-Id: I8f32f71f8f6b454365fbd0728fe063de2c150b8a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300711 Commit-Queue: Stephen White <[email protected]> Reviewed-by: Greg Daniel <[email protected]>
1 parent 709ce81 commit ac45f49

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/gpu/dawn/GrDawnProgramBuilder.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ static SkSL::String sksl_to_spirv(const GrDawnGpu* gpu, const char* shaderString
2323
settings.fRTHeightOffset = rtHeightOffset;
2424
settings.fRTHeightBinding = 0;
2525
settings.fRTHeightSet = 0;
26+
#ifdef SK_BUILD_FOR_WIN
27+
// Work around the fact that D3D12 gives w in fragcoord.w, while the other APIs give 1/w.
28+
// This difference may be better handled by Dawn, at which point this workaround can be removed.
29+
// (See http://skbug.com/10475).
30+
settings.fInverseW = true;
31+
#endif
2632
std::unique_ptr<SkSL::Program> program = gpu->shaderCompiler()->convertProgram(
2733
kind,
2834
shaderString,

0 commit comments

Comments
 (0)