Skip to content

Commit

Permalink
Refactor to not render to rgba32float
Browse files Browse the repository at this point in the history
Compat will not have rgba32float as a render target support
except as an optional feature so refactor to not use it.
  • Loading branch information
greggman committed Oct 30, 2024
1 parent 30ee073 commit 54fee6a
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4470,7 +4470,7 @@ function createTextureCallsRunner<T extends Dimensionality>(
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,
});
Expand Down Expand Up @@ -4510,23 +4510,33 @@ function createTextureCallsRunner<T extends Dimensionality>(
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<vec4u>(v.result);
}
`
: stage === 'fragment'
? `
// --------------------------- fragment stage shaders --------------------------------
fn convertToVec4u(v: ${returnType}) -> vec4u {
return ${
returnType === 'rgba32uint'
? 'v'
: returnType === 'rgba32int'
? 'bitcast<vec4u>(v)'
: 'bitcast<vec4u>(v)'
};
}
@vertex fn vsFragment(
@builtin(vertex_index) vertex_index : u32,
@builtin(instance_index) instance_index : u32) -> VOut {
let positions = array(vec2f(-1, 3), vec2f(3, -1), vec2f(-1, -1));
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<vec4u>(getResult(v.ndx, derivativeBase));
}
`
: `
Expand Down Expand Up @@ -4696,7 +4706,7 @@ ${stageWGSL}
vertex: { module },
fragment: {
module,
targets: [{ format: renderTarget.format }],
targets: [{ format: 'rgba32uint' }],
},
});
break;
Expand Down

0 comments on commit 54fee6a

Please sign in to comment.