Build fixes
Two incompatible changes landed simultaniously. Also fix a warning about variable shadowing. Change-Id: I84c9ba48fb87a348a5b0e622ca2fdb191f95a6b2 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49964 Commit-Queue: Ben Clayton <bclayton@google.com> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
parent
8e1d177590
commit
58f93c9e26
|
@ -397,6 +397,9 @@ const sem::Type* Resolver::Type(const ast::Type* ty) {
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
if (auto* t = ty->As<ast::ExternalTexture>()) {
|
||||||
|
return builder_->create<sem::ExternalTexture>();
|
||||||
|
}
|
||||||
if (auto* t = ty->As<ast::TypeName>()) {
|
if (auto* t = ty->As<ast::TypeName>()) {
|
||||||
auto it = named_types_.find(t->name());
|
auto it = named_types_.find(t->name());
|
||||||
if (it == named_types_.end()) {
|
if (it == named_types_.end()) {
|
||||||
|
|
|
@ -28,23 +28,18 @@ Output ExternalTextureTransform::Run(const Program* in, const DataMap&) {
|
||||||
// Scan the AST nodes for external texture declarations.
|
// Scan the AST nodes for external texture declarations.
|
||||||
for (auto* node : ctx.src->ASTNodes().Objects()) {
|
for (auto* node : ctx.src->ASTNodes().Objects()) {
|
||||||
if (auto* var = node->As<ast::Variable>()) {
|
if (auto* var = node->As<ast::Variable>()) {
|
||||||
if (var->type().ast->Is<ast::ExternalTexture>()) {
|
if (var->type()->Is<ast::ExternalTexture>()) {
|
||||||
// Replace a single-plane external texture with a 2D, f32 sampled
|
// Replace a single-plane external texture with a 2D, f32 sampled
|
||||||
// texture.
|
// texture.
|
||||||
auto* newAstType = ctx.dst->create<ast::SampledTexture>(
|
auto newType = ctx.dst->ty.sampled_texture(ast::TextureDimension::k2d,
|
||||||
ast::TextureDimension::k2d, ctx.dst->create<ast::F32>());
|
ctx.dst->ty.f32());
|
||||||
auto* newSemType = ctx.dst->create<sem::SampledTexture>(
|
|
||||||
ast::TextureDimension::k2d, ctx.dst->ty.f32());
|
|
||||||
|
|
||||||
auto clonedSrc = ctx.Clone(var->source());
|
auto clonedSrc = ctx.Clone(var->source());
|
||||||
auto clonedSym = ctx.Clone(var->symbol());
|
auto clonedSym = ctx.Clone(var->symbol());
|
||||||
auto* clonedConstructor = ctx.Clone(var->constructor());
|
auto* clonedConstructor = ctx.Clone(var->constructor());
|
||||||
auto clonedDecorations = ctx.Clone(var->decorations());
|
auto clonedDecorations = ctx.Clone(var->decorations());
|
||||||
|
|
||||||
auto* newVar = ctx.dst->create<ast::Variable>(
|
auto* newVar = ctx.dst->create<ast::Variable>(
|
||||||
clonedSrc, clonedSym, var->declared_storage_class(),
|
clonedSrc, clonedSym, var->declared_storage_class(), newType,
|
||||||
typ::Type(newAstType, newSemType), var->is_const(),
|
var->is_const(), clonedConstructor, clonedDecorations);
|
||||||
clonedConstructor, clonedDecorations);
|
|
||||||
|
|
||||||
ctx.Replace(var, newVar);
|
ctx.Replace(var, newVar);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,33 +24,24 @@ using ExternalTextureTransformTest = TransformTest;
|
||||||
|
|
||||||
TEST_F(ExternalTextureTransformTest, SinglePlane) {
|
TEST_F(ExternalTextureTransformTest, SinglePlane) {
|
||||||
auto* src = R"(
|
auto* src = R"(
|
||||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
|
||||||
|
|
||||||
[[group(0), binding(0)]] var s : sampler;
|
[[group(0), binding(0)]] var s : sampler;
|
||||||
|
|
||||||
[[group(0), binding(1)]] var t : texture_external;
|
[[group(0), binding(1)]] var t : texture_external;
|
||||||
|
|
||||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
fn main() {
|
fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
||||||
FragColor = textureSample(t, s, (FragCoord.xy / vec2<f32>(4.0, 4.0)));
|
return textureSample(t, s, (coord.xy / vec2<f32>(4.0, 4.0)));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
auto* expect = R"(
|
auto* expect = R"(
|
||||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
|
||||||
|
|
||||||
[[group(0), binding(0)]] var s : sampler;
|
[[group(0), binding(0)]] var s : sampler;
|
||||||
|
|
||||||
[[group(0), binding(1)]] var t : texture_2d<f32>;
|
[[group(0), binding(1)]] var t : texture_2d<f32>;
|
||||||
|
|
||||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
|
||||||
|
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
fn main() {
|
fn main([[builtin(position)]] coord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
||||||
FragColor = textureSample(t, s, (FragCoord.xy / vec2<f32>(4.0, 4.0)));
|
return textureSample(t, s, (coord.xy / vec2<f32>(4.0, 4.0)));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
|
|
|
@ -377,8 +377,7 @@ void Spirv::HoistToOutputVariables(CloneContext& ctx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spirv::Config::Config(bool emit_vertex_point_size)
|
Spirv::Config::Config(bool emit_vps) : emit_vertex_point_size(emit_vps) {}
|
||||||
: emit_vertex_point_size(emit_vertex_point_size) {}
|
|
||||||
|
|
||||||
Spirv::Config::Config(const Config&) = default;
|
Spirv::Config::Config(const Config&) = default;
|
||||||
Spirv::Config::~Config() = default;
|
Spirv::Config::~Config() = default;
|
||||||
|
|
Loading…
Reference in New Issue