From bfbfd9e4bc0c9b5b81dd978b34013cb89e44d4a2 Mon Sep 17 00:00:00 2001 From: Greggman Date: Wed, 30 Oct 2024 15:51:34 -0700 Subject: [PATCH] Refactor to not render to rgba32float (#4020) Compat will not have rgba32float as a render target support except as an optional feature so refactor to not use it. --- .../expression/call/builtin/texture_utils.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/webgpu/shader/execution/expression/call/builtin/texture_utils.ts b/src/webgpu/shader/execution/expression/call/builtin/texture_utils.ts index 350237459705..72268c5b368b 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/texture_utils.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/texture_utils.ts @@ -4470,7 +4470,7 @@ function createTextureCallsRunner( const samplerType = isCompare ? 'sampler_comparison' : 'sampler'; const renderTarget = t.createTextureTracked({ - format: resultFormat, + format: 'rgba32uint', size: [calls.length, 1], usage: GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT, }); @@ -4510,8 +4510,8 @@ function createTextureCallsRunner( getResult(instance_index, ${derivativeType}(0))); } -@fragment fn fsVertex(v: VOut) -> @location(0) ${returnType} { - return v.result; +@fragment fn fsVertex(v: VOut) -> @location(0) vec4u { + return bitcast(v.result); } ` : stage === 'fragment' @@ -4524,9 +4524,9 @@ function createTextureCallsRunner( return VOut(vec4f(positions[vertex_index], 0, 1), instance_index, ${returnType}(0)); } -@fragment fn fsFragment(v: VOut) -> @location(0) ${returnType} { +@fragment fn fsFragment(v: VOut) -> @location(0) vec4u { ${derivativeBaseWGSL} - return getResult(v.ndx, derivativeBase); + return bitcast(getResult(v.ndx, derivativeBase)); } ` : ` @@ -4696,7 +4696,7 @@ ${stageWGSL} vertex: { module }, fragment: { module, - targets: [{ format: renderTarget.format }], + targets: [{ format: 'rgba32uint' }], }, }); break;