Resolver: collect unique texture/samplers pairs.

GLSL does not support separate textures and samplers, so they must be
replaced with combined samplers. This is the first stage of that change,
where we collect the unique texture/sampler pairs. Within a function,
texture and sampler must be either a global variable or a function
parameter. At the entry point level, all references must resolve to global
variables, so by recursing the call graph we can determine all of the
global pairs required.

This information will be used by an upcoming transform to modify the AST
to be GLSL-compliant: modifying function signatures, call sites, removing
separate globals and adding combined globals. It will also eventually
replace the pair-gathering currently performed by
Inspector::GetSamplerTextureUses().

Bug: tint:1366
Change-Id: I89451b195649da26e45641ea2f6955683ae9fc66
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75960
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White
2022-01-10 20:46:35 +00:00
committed by Tint LUCI CQ
parent d1efb5d48c
commit 3e354fd524
5 changed files with 219 additions and 3 deletions

View File

@@ -142,6 +142,9 @@ const ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx,
if (auto* t = ty->As<sem::DepthMultisampledTexture>()) {
return ctx.dst->create<ast::DepthMultisampledTexture>(t->dim());
}
if (ty->Is<sem::ExternalTexture>()) {
return ctx.dst->create<ast::ExternalTexture>();
}
if (auto* t = ty->As<sem::MultisampledTexture>()) {
return ctx.dst->create<ast::MultisampledTexture>(
t->dim(), CreateASTTypeFor(ctx, t->type()));