Add inspector support for DepthTexture reflection
BUG=tint:527 Change-Id: I4f017993ffa85515b5b646bd9cf15c4b6d50c441 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/43700 Auto-Submit: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
7732ca51c4
commit
04d93c88a0
|
@ -33,6 +33,7 @@
|
||||||
#include "src/semantic/variable.h"
|
#include "src/semantic/variable.h"
|
||||||
#include "src/type/access_control_type.h"
|
#include "src/type/access_control_type.h"
|
||||||
#include "src/type/array_type.h"
|
#include "src/type/array_type.h"
|
||||||
|
#include "src/type/depth_texture_type.h"
|
||||||
#include "src/type/f32_type.h"
|
#include "src/type/f32_type.h"
|
||||||
#include "src/type/i32_type.h"
|
#include "src/type/i32_type.h"
|
||||||
#include "src/type/matrix_type.h"
|
#include "src/type/matrix_type.h"
|
||||||
|
@ -343,6 +344,7 @@ std::vector<ResourceBinding> Inspector::GetResourceBindings(
|
||||||
GetSampledTextureResourceBindings(entry_point));
|
GetSampledTextureResourceBindings(entry_point));
|
||||||
AppendResourceBindings(&result,
|
AppendResourceBindings(&result,
|
||||||
GetMultisampledTextureResourceBindings(entry_point));
|
GetMultisampledTextureResourceBindings(entry_point));
|
||||||
|
AppendResourceBindings(&result, GetDepthTextureResourceBindings(entry_point));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -470,6 +472,35 @@ Inspector::GetWriteOnlyStorageTextureResourceBindings(
|
||||||
return GetStorageTextureResourceBindingsImpl(entry_point, false);
|
return GetStorageTextureResourceBindingsImpl(entry_point, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<ResourceBinding> Inspector::GetDepthTextureResourceBindings(
|
||||||
|
const std::string& entry_point) {
|
||||||
|
auto* func = FindEntryPointByName(entry_point);
|
||||||
|
if (!func) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<ResourceBinding> result;
|
||||||
|
auto* func_sem = program_->Sem().Get(func);
|
||||||
|
for (auto& ref : func_sem->ReferencedDepthTextureVariables()) {
|
||||||
|
auto* var = ref.first;
|
||||||
|
auto* decl = var->Declaration();
|
||||||
|
auto binding_info = ref.second;
|
||||||
|
|
||||||
|
ResourceBinding entry;
|
||||||
|
entry.resource_type = ResourceBinding::ResourceType::kDepthTexture;
|
||||||
|
entry.bind_group = binding_info.group->value();
|
||||||
|
entry.binding = binding_info.binding->value();
|
||||||
|
|
||||||
|
auto* texture_type = decl->type()->UnwrapIfNeeded()->As<type::Texture>();
|
||||||
|
entry.dim = TypeTextureDimensionToResourceBindingTextureDimension(
|
||||||
|
texture_type->dim());
|
||||||
|
|
||||||
|
result.push_back(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
ast::Function* Inspector::FindEntryPointByName(const std::string& name) {
|
ast::Function* Inspector::FindEntryPointByName(const std::string& name) {
|
||||||
auto* func = program_->AST().Functions().Find(program_->Symbols().Get(name));
|
auto* func = program_->AST().Functions().Find(program_->Symbols().Get(name));
|
||||||
if (!func) {
|
if (!func) {
|
||||||
|
|
|
@ -104,6 +104,7 @@ struct ResourceBinding {
|
||||||
kMulitsampledTexture,
|
kMulitsampledTexture,
|
||||||
kReadOnlyStorageTexture,
|
kReadOnlyStorageTexture,
|
||||||
kWriteOnlyStorageTexture,
|
kWriteOnlyStorageTexture,
|
||||||
|
kDepthTexture,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Type of resource that is bound.
|
/// Type of resource that is bound.
|
||||||
|
@ -198,6 +199,11 @@ class Inspector {
|
||||||
std::vector<ResourceBinding> GetWriteOnlyStorageTextureResourceBindings(
|
std::vector<ResourceBinding> GetWriteOnlyStorageTextureResourceBindings(
|
||||||
const std::string& entry_point);
|
const std::string& entry_point);
|
||||||
|
|
||||||
|
/// @param entry_point name of the entry point to get information about.
|
||||||
|
/// @returns vector of all of the bindings for depth textures.
|
||||||
|
std::vector<ResourceBinding> GetDepthTextureResourceBindings(
|
||||||
|
const std::string& entry_point);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Program* program_;
|
const Program* program_;
|
||||||
std::string error_;
|
std::string error_;
|
||||||
|
|
|
@ -463,8 +463,13 @@ class InspectorHelper : public ProgramBuilder {
|
||||||
/// Adds a depth texture variable to the program
|
/// Adds a depth texture variable to the program
|
||||||
/// @param name the name of the variable
|
/// @param name the name of the variable
|
||||||
/// @param type the type to use
|
/// @param type the type to use
|
||||||
void AddDepthTexture(const std::string& name, type::Type* type) {
|
/// @param group the binding/group to use for the depth texture
|
||||||
Global(name, type, ast::StorageClass::kUniformConstant);
|
/// @param binding the binding number to use for the depth texture
|
||||||
|
void AddDepthTexture(const std::string& name,
|
||||||
|
type::Type* type,
|
||||||
|
uint32_t group,
|
||||||
|
uint32_t binding) {
|
||||||
|
AddBinding(name, type, ast::StorageClass::kUniformConstant, group, binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates a function that references a specific sampler variable
|
/// Generates a function that references a specific sampler variable
|
||||||
|
@ -759,6 +764,13 @@ class InspectorGetMultisampledTextureResourceBindingsTestWithParam
|
||||||
public testing::TestWithParam<GetMultisampledTextureTestParams> {};
|
public testing::TestWithParam<GetMultisampledTextureTestParams> {};
|
||||||
class InspectorGetStorageTextureResourceBindingsTest : public InspectorHelper,
|
class InspectorGetStorageTextureResourceBindingsTest : public InspectorHelper,
|
||||||
public testing::Test {};
|
public testing::Test {};
|
||||||
|
struct GetDepthTextureTestParams {
|
||||||
|
type::TextureDimension type_dim;
|
||||||
|
inspector::ResourceBinding::TextureDimension inspector_dim;
|
||||||
|
};
|
||||||
|
class InspectorGetDepthTextureResourceBindingsTestWithParam
|
||||||
|
: public InspectorHelper,
|
||||||
|
public testing::TestWithParam<GetDepthTextureTestParams> {};
|
||||||
|
|
||||||
typedef std::tuple<type::TextureDimension, ResourceBinding::TextureDimension>
|
typedef std::tuple<type::TextureDimension, ResourceBinding::TextureDimension>
|
||||||
DimensionParams;
|
DimensionParams;
|
||||||
|
@ -1428,8 +1440,8 @@ TEST_F(InspectorGetResourceBindingsTest, Simple) {
|
||||||
|
|
||||||
auto* cs_depth_texture_type =
|
auto* cs_depth_texture_type =
|
||||||
MakeDepthTextureType(type::TextureDimension::k2d);
|
MakeDepthTextureType(type::TextureDimension::k2d);
|
||||||
AddDepthTexture("cs_texture", cs_depth_texture_type);
|
AddDepthTexture("cs_texture", cs_depth_texture_type, 3, 1);
|
||||||
AddComparisonSampler("cs_var", 3, 1);
|
AddComparisonSampler("cs_var", 3, 2);
|
||||||
AddGlobalVariable("cs_coords", ty.vec2<f32>());
|
AddGlobalVariable("cs_coords", ty.vec2<f32>());
|
||||||
AddGlobalVariable("cs_depth", ty.f32());
|
AddGlobalVariable("cs_depth", ty.f32());
|
||||||
MakeComparisonSamplerReferenceBodyFunction(
|
MakeComparisonSamplerReferenceBodyFunction(
|
||||||
|
@ -1445,7 +1457,7 @@ TEST_F(InspectorGetResourceBindingsTest, Simple) {
|
||||||
|
|
||||||
auto result = inspector.GetResourceBindings("ep_func");
|
auto result = inspector.GetResourceBindings("ep_func");
|
||||||
ASSERT_FALSE(inspector.has_error()) << inspector.error();
|
ASSERT_FALSE(inspector.has_error()) << inspector.error();
|
||||||
ASSERT_EQ(6u, result.size());
|
ASSERT_EQ(7u, result.size());
|
||||||
|
|
||||||
EXPECT_EQ(ResourceBinding::ResourceType::kUniformBuffer,
|
EXPECT_EQ(ResourceBinding::ResourceType::kUniformBuffer,
|
||||||
result[0].resource_type);
|
result[0].resource_type);
|
||||||
|
@ -1469,12 +1481,17 @@ TEST_F(InspectorGetResourceBindingsTest, Simple) {
|
||||||
EXPECT_EQ(ResourceBinding::ResourceType::kComparisonSampler,
|
EXPECT_EQ(ResourceBinding::ResourceType::kComparisonSampler,
|
||||||
result[4].resource_type);
|
result[4].resource_type);
|
||||||
EXPECT_EQ(3u, result[4].bind_group);
|
EXPECT_EQ(3u, result[4].bind_group);
|
||||||
EXPECT_EQ(1u, result[4].binding);
|
EXPECT_EQ(2u, result[4].binding);
|
||||||
|
|
||||||
EXPECT_EQ(ResourceBinding::ResourceType::kSampledTexture,
|
EXPECT_EQ(ResourceBinding::ResourceType::kSampledTexture,
|
||||||
result[5].resource_type);
|
result[5].resource_type);
|
||||||
EXPECT_EQ(2u, result[5].bind_group);
|
EXPECT_EQ(2u, result[5].bind_group);
|
||||||
EXPECT_EQ(0u, result[5].binding);
|
EXPECT_EQ(0u, result[5].binding);
|
||||||
|
|
||||||
|
EXPECT_EQ(ResourceBinding::ResourceType::kDepthTexture,
|
||||||
|
result[6].resource_type);
|
||||||
|
EXPECT_EQ(3u, result[6].bind_group);
|
||||||
|
EXPECT_EQ(1u, result[6].binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingEntryPoint) {
|
TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingEntryPoint) {
|
||||||
|
@ -2118,7 +2135,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, UnknownEntryPoint) {
|
||||||
|
|
||||||
TEST_F(InspectorGetSamplerResourceBindingsTest, SkipsComparisonSamplers) {
|
TEST_F(InspectorGetSamplerResourceBindingsTest, SkipsComparisonSamplers) {
|
||||||
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
||||||
AddDepthTexture("foo_texture", depth_texture_type);
|
AddDepthTexture("foo_texture", depth_texture_type, 0, 0);
|
||||||
AddComparisonSampler("foo_sampler", 0, 1);
|
AddComparisonSampler("foo_sampler", 0, 1);
|
||||||
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||||
AddGlobalVariable("foo_depth", ty.f32());
|
AddGlobalVariable("foo_depth", ty.f32());
|
||||||
|
@ -2139,7 +2156,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, SkipsComparisonSamplers) {
|
||||||
|
|
||||||
TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, Simple) {
|
TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, Simple) {
|
||||||
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
||||||
AddDepthTexture("foo_texture", depth_texture_type);
|
AddDepthTexture("foo_texture", depth_texture_type, 0, 0);
|
||||||
AddComparisonSampler("foo_sampler", 0, 1);
|
AddComparisonSampler("foo_sampler", 0, 1);
|
||||||
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||||
AddGlobalVariable("foo_depth", ty.f32());
|
AddGlobalVariable("foo_depth", ty.f32());
|
||||||
|
@ -2178,7 +2195,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, NoSampler) {
|
||||||
|
|
||||||
TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, InFunction) {
|
TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, InFunction) {
|
||||||
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
||||||
AddDepthTexture("foo_texture", depth_texture_type);
|
AddDepthTexture("foo_texture", depth_texture_type, 0, 0);
|
||||||
AddComparisonSampler("foo_sampler", 0, 1);
|
AddComparisonSampler("foo_sampler", 0, 1);
|
||||||
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||||
AddGlobalVariable("foo_depth", ty.f32());
|
AddGlobalVariable("foo_depth", ty.f32());
|
||||||
|
@ -2207,7 +2224,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, InFunction) {
|
||||||
|
|
||||||
TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, UnknownEntryPoint) {
|
TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, UnknownEntryPoint) {
|
||||||
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
auto* depth_texture_type = MakeDepthTextureType(type::TextureDimension::k2d);
|
||||||
AddDepthTexture("foo_texture", depth_texture_type);
|
AddDepthTexture("foo_texture", depth_texture_type, 0, 0);
|
||||||
AddComparisonSampler("foo_sampler", 0, 1);
|
AddComparisonSampler("foo_sampler", 0, 1);
|
||||||
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||||
AddGlobalVariable("foo_depth", ty.f32());
|
AddGlobalVariable("foo_depth", ty.f32());
|
||||||
|
@ -2685,6 +2702,51 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
ResourceBinding::ImageFormat::kRgba32Float,
|
ResourceBinding::ImageFormat::kRgba32Float,
|
||||||
ResourceBinding::SampledKind::kFloat))));
|
ResourceBinding::SampledKind::kFloat))));
|
||||||
|
|
||||||
|
TEST_P(InspectorGetDepthTextureResourceBindingsTestWithParam,
|
||||||
|
textureDimensions) {
|
||||||
|
auto* depth_texture_type = MakeDepthTextureType(GetParam().type_dim);
|
||||||
|
AddDepthTexture("dt", depth_texture_type, 0, 0);
|
||||||
|
AddGlobalVariable("dt_level", ty.i32());
|
||||||
|
|
||||||
|
Func("ep", ast::VariableList(), ty.void_(),
|
||||||
|
ast::StatementList{
|
||||||
|
create<ast::CallStatement>(
|
||||||
|
Call("textureDimensions", "dt", "dt_level")),
|
||||||
|
},
|
||||||
|
ast::FunctionDecorationList{
|
||||||
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
|
});
|
||||||
|
|
||||||
|
Inspector& inspector = Build();
|
||||||
|
|
||||||
|
auto result = inspector.GetDepthTextureResourceBindings("ep");
|
||||||
|
ASSERT_FALSE(inspector.has_error()) << inspector.error();
|
||||||
|
|
||||||
|
EXPECT_EQ(ResourceBinding::ResourceType::kDepthTexture,
|
||||||
|
result[0].resource_type);
|
||||||
|
ASSERT_EQ(1u, result.size());
|
||||||
|
EXPECT_EQ(0u, result[0].bind_group);
|
||||||
|
EXPECT_EQ(0u, result[0].binding);
|
||||||
|
EXPECT_EQ(GetParam().inspector_dim, result[0].dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
|
InspectorGetDepthTextureResourceBindingsTest,
|
||||||
|
InspectorGetDepthTextureResourceBindingsTestWithParam,
|
||||||
|
testing::Values(
|
||||||
|
GetDepthTextureTestParams{
|
||||||
|
type::TextureDimension::k2d,
|
||||||
|
inspector::ResourceBinding::TextureDimension::k2d},
|
||||||
|
GetDepthTextureTestParams{
|
||||||
|
type::TextureDimension::k2dArray,
|
||||||
|
inspector::ResourceBinding::TextureDimension::k2dArray},
|
||||||
|
GetDepthTextureTestParams{
|
||||||
|
type::TextureDimension::kCube,
|
||||||
|
inspector::ResourceBinding::TextureDimension::kCube},
|
||||||
|
GetDepthTextureTestParams{
|
||||||
|
type::TextureDimension::kCubeArray,
|
||||||
|
inspector::ResourceBinding::TextureDimension::kCubeArray}));
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace inspector
|
} // namespace inspector
|
||||||
} // namespace tint
|
} // namespace tint
|
||||||
|
|
|
@ -126,6 +126,11 @@ class Function : public Castable<Function, CallTarget> {
|
||||||
/// @returns the referenced storage textures
|
/// @returns the referenced storage textures
|
||||||
VariableBindings ReferencedStorageTextureVariables() const;
|
VariableBindings ReferencedStorageTextureVariables() const;
|
||||||
|
|
||||||
|
/// Retrieves any referenced depth texture variables. Note, the variables
|
||||||
|
/// must be decorated with both binding and group decorations.
|
||||||
|
/// @returns the referenced storage textures
|
||||||
|
VariableBindings ReferencedDepthTextureVariables() const;
|
||||||
|
|
||||||
/// Retrieves any locally referenced builtin variables
|
/// Retrieves any locally referenced builtin variables
|
||||||
/// @returns the <variable, decoration> pairs.
|
/// @returns the <variable, decoration> pairs.
|
||||||
std::vector<std::pair<const Variable*, ast::BuiltinDecoration*>>
|
std::vector<std::pair<const Variable*, ast::BuiltinDecoration*>>
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "src/ast/variable.h"
|
#include "src/ast/variable.h"
|
||||||
#include "src/ast/variable_decoration.h"
|
#include "src/ast/variable_decoration.h"
|
||||||
#include "src/semantic/variable.h"
|
#include "src/semantic/variable.h"
|
||||||
|
#include "src/type/depth_texture_type.h"
|
||||||
#include "src/type/multisampled_texture_type.h"
|
#include "src/type/multisampled_texture_type.h"
|
||||||
#include "src/type/sampled_texture_type.h"
|
#include "src/type/sampled_texture_type.h"
|
||||||
#include "src/type/storage_texture_type.h"
|
#include "src/type/storage_texture_type.h"
|
||||||
|
@ -43,6 +44,21 @@ ParameterList GetParameters(ast::Function* ast) {
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::tuple<ast::BindingDecoration*, ast::GroupDecoration*> GetBindingAndGroup(
|
||||||
|
const Variable* var) {
|
||||||
|
ast::BindingDecoration* binding = nullptr;
|
||||||
|
ast::GroupDecoration* group = nullptr;
|
||||||
|
for (auto* deco : var->Declaration()->decorations()) {
|
||||||
|
if (auto* b = deco->As<ast::BindingDecoration>()) {
|
||||||
|
binding = b;
|
||||||
|
}
|
||||||
|
if (auto* s = deco->As<ast::GroupDecoration>()) {
|
||||||
|
group = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {binding, group};
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Function::Function(ast::Function* declaration,
|
Function::Function(ast::Function* declaration,
|
||||||
|
@ -82,13 +98,7 @@ Function::VariableBindings Function::ReferencedUniformVariables() const {
|
||||||
|
|
||||||
ast::BindingDecoration* binding = nullptr;
|
ast::BindingDecoration* binding = nullptr;
|
||||||
ast::GroupDecoration* group = nullptr;
|
ast::GroupDecoration* group = nullptr;
|
||||||
for (auto* deco : var->Declaration()->decorations()) {
|
std::tie(binding, group) = GetBindingAndGroup(var);
|
||||||
if (auto* b = deco->As<ast::BindingDecoration>()) {
|
|
||||||
binding = b;
|
|
||||||
} else if (auto* g = deco->As<ast::GroupDecoration>()) {
|
|
||||||
group = g;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (binding == nullptr || group == nullptr) {
|
if (binding == nullptr || group == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -108,13 +118,7 @@ Function::VariableBindings Function::ReferencedStorageBufferVariables() const {
|
||||||
|
|
||||||
ast::BindingDecoration* binding = nullptr;
|
ast::BindingDecoration* binding = nullptr;
|
||||||
ast::GroupDecoration* group = nullptr;
|
ast::GroupDecoration* group = nullptr;
|
||||||
for (auto* deco : var->Declaration()->decorations()) {
|
std::tie(binding, group) = GetBindingAndGroup(var);
|
||||||
if (auto* b = deco->As<ast::BindingDecoration>()) {
|
|
||||||
binding = b;
|
|
||||||
} else if (auto* s = deco->As<ast::GroupDecoration>()) {
|
|
||||||
group = s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (binding == nullptr || group == nullptr) {
|
if (binding == nullptr || group == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -169,13 +173,29 @@ Function::VariableBindings Function::ReferencedStorageTextureVariables() const {
|
||||||
|
|
||||||
ast::BindingDecoration* binding = nullptr;
|
ast::BindingDecoration* binding = nullptr;
|
||||||
ast::GroupDecoration* group = nullptr;
|
ast::GroupDecoration* group = nullptr;
|
||||||
for (auto* deco : var->Declaration()->decorations()) {
|
std::tie(binding, group) = GetBindingAndGroup(var);
|
||||||
if (auto* b = deco->As<ast::BindingDecoration>()) {
|
if (binding == nullptr || group == nullptr) {
|
||||||
binding = b;
|
continue;
|
||||||
} else if (auto* s = deco->As<ast::GroupDecoration>()) {
|
|
||||||
group = s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret.push_back({var, BindingInfo{binding, group}});
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
Function::VariableBindings Function::ReferencedDepthTextureVariables() const {
|
||||||
|
VariableBindings ret;
|
||||||
|
|
||||||
|
for (auto* var : ReferencedModuleVariables()) {
|
||||||
|
auto* unwrapped_type = var->Declaration()->type()->UnwrapIfNeeded();
|
||||||
|
auto* storage_texture = unwrapped_type->As<type::DepthTexture>();
|
||||||
|
if (storage_texture == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ast::BindingDecoration* binding = nullptr;
|
||||||
|
ast::GroupDecoration* group = nullptr;
|
||||||
|
std::tie(binding, group) = GetBindingAndGroup(var);
|
||||||
if (binding == nullptr || group == nullptr) {
|
if (binding == nullptr || group == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -222,14 +242,7 @@ Function::VariableBindings Function::ReferencedSamplerVariablesImpl(
|
||||||
|
|
||||||
ast::BindingDecoration* binding = nullptr;
|
ast::BindingDecoration* binding = nullptr;
|
||||||
ast::GroupDecoration* group = nullptr;
|
ast::GroupDecoration* group = nullptr;
|
||||||
for (auto* deco : var->Declaration()->decorations()) {
|
std::tie(binding, group) = GetBindingAndGroup(var);
|
||||||
if (auto* b = deco->As<ast::BindingDecoration>()) {
|
|
||||||
binding = b;
|
|
||||||
}
|
|
||||||
if (auto* s = deco->As<ast::GroupDecoration>()) {
|
|
||||||
group = s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (binding == nullptr || group == nullptr) {
|
if (binding == nullptr || group == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -259,13 +272,7 @@ Function::VariableBindings Function::ReferencedSampledTextureVariablesImpl(
|
||||||
|
|
||||||
ast::BindingDecoration* binding = nullptr;
|
ast::BindingDecoration* binding = nullptr;
|
||||||
ast::GroupDecoration* group = nullptr;
|
ast::GroupDecoration* group = nullptr;
|
||||||
for (auto* deco : var->Declaration()->decorations()) {
|
std::tie(binding, group) = GetBindingAndGroup(var);
|
||||||
if (auto* b = deco->As<ast::BindingDecoration>()) {
|
|
||||||
binding = b;
|
|
||||||
} else if (auto* s = deco->As<ast::GroupDecoration>()) {
|
|
||||||
group = s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (binding == nullptr || group == nullptr) {
|
if (binding == nullptr || group == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue