GLSL: clean up appending of depth reference.
Just a minor cleanup; no functional change. Change-Id: Iac4f97c2b5507f7665024885a81f6ccf8e5ab269 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82440 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:
parent
ecb570ff64
commit
80fa1bbd56
|
@ -1265,6 +1265,16 @@ bool GeneratorImpl::EmitBarrierCall(std::ostream& out,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ast::Expression* GeneratorImpl::CreateF32Zero(
|
||||||
|
const sem::Statement* stmt) {
|
||||||
|
auto* zero = builder_.Expr(0.0f);
|
||||||
|
auto* f32 = builder_.create<sem::F32>();
|
||||||
|
auto* sem_zero = builder_.create<sem::Expression>(
|
||||||
|
zero, f32, stmt, sem::Constant{}, /* has_side_effects */ false);
|
||||||
|
builder_.Sem().Add(zero, sem_zero);
|
||||||
|
return zero;
|
||||||
|
}
|
||||||
|
|
||||||
bool GeneratorImpl::EmitTextureCall(std::ostream& out,
|
bool GeneratorImpl::EmitTextureCall(std::ostream& out,
|
||||||
const sem::Call* call,
|
const sem::Call* call,
|
||||||
const sem::Builtin* builtin) {
|
const sem::Builtin* builtin) {
|
||||||
|
@ -1446,20 +1456,14 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_depth && append_depth_ref_to_coords) {
|
if (is_depth && append_depth_ref_to_coords) {
|
||||||
if (auto* depth_ref = arg(Usage::kDepthRef)) {
|
auto* depth_ref = arg(Usage::kDepthRef);
|
||||||
param_coords =
|
if (!depth_ref) {
|
||||||
AppendVector(&builder_, param_coords, depth_ref)->Declaration();
|
|
||||||
} else {
|
|
||||||
// Sampling a depth texture in GLSL always requires a depth reference, so
|
// Sampling a depth texture in GLSL always requires a depth reference, so
|
||||||
// append zero here.
|
// append zero here.
|
||||||
auto* f32 = builder_.create<sem::F32>();
|
depth_ref = CreateF32Zero(builder_.Sem().Get(param_coords)->Stmt());
|
||||||
auto* zero = builder_.Expr(0.0f);
|
|
||||||
auto* stmt = builder_.Sem().Get(param_coords)->Stmt();
|
|
||||||
auto* sem_zero = builder_.create<sem::Expression>(
|
|
||||||
zero, f32, stmt, sem::Constant{}, /* has_side_effects */ false);
|
|
||||||
builder_.Sem().Add(zero, sem_zero);
|
|
||||||
param_coords = AppendVector(&builder_, param_coords, zero)->Declaration();
|
|
||||||
}
|
}
|
||||||
|
param_coords =
|
||||||
|
AppendVector(&builder_, param_coords, depth_ref)->Declaration();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EmitExpression(out, param_coords)) {
|
if (!EmitExpression(out, param_coords)) {
|
||||||
|
|
|
@ -191,6 +191,11 @@ class GeneratorImpl : public TextGenerator {
|
||||||
/// @param expr the fma() expression
|
/// @param expr the fma() expression
|
||||||
/// @returns true if the expression is emitted
|
/// @returns true if the expression is emitted
|
||||||
bool EmitEmulatedFMA(std::ostream& out, const ast::CallExpression* expr);
|
bool EmitEmulatedFMA(std::ostream& out, const ast::CallExpression* expr);
|
||||||
|
/// Create a float literal zero AST node, and associated semantic nodes.
|
||||||
|
/// @param stmt the statement which will own the semantic expression node
|
||||||
|
/// @returns an AST expression representing 0.0f
|
||||||
|
const ast::Expression* CreateF32Zero(const sem::Statement* stmt);
|
||||||
|
|
||||||
/// Handles generating a call to a texture function (`textureSample`,
|
/// Handles generating a call to a texture function (`textureSample`,
|
||||||
/// `textureSampleGrad`, etc)
|
/// `textureSampleGrad`, etc)
|
||||||
/// @param out the output of the expression stream
|
/// @param out the output of the expression stream
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
SKIP: FAILED
|
SKIP: FAILED
|
||||||
|
|
||||||
../../src/tint/writer/glsl/generator_impl.cc:2582 internal compiler error: Multiplanar external texture transform was not run.
|
../../src/tint/writer/glsl/generator_impl.cc:2587 internal compiler error: Multiplanar external texture transform was not run.
|
||||||
|
|
||||||
|
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
SKIP: FAILED
|
SKIP: FAILED
|
||||||
|
|
||||||
../../src/tint/writer/glsl/generator_impl.cc:2582 internal compiler error: Multiplanar external texture transform was not run.
|
../../src/tint/writer/glsl/generator_impl.cc:2587 internal compiler error: Multiplanar external texture transform was not run.
|
||||||
|
|
||||||
|
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
SKIP: FAILED
|
SKIP: FAILED
|
||||||
|
|
||||||
../../src/tint/writer/glsl/generator_impl.cc:2582 internal compiler error: Multiplanar external texture transform was not run.
|
../../src/tint/writer/glsl/generator_impl.cc:2587 internal compiler error: Multiplanar external texture transform was not run.
|
||||||
|
|
||||||
|
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
Loading…
Reference in New Issue