Add texture_external to inspector

Adds texture_external to the inspector, allowing us to recognize the
type and return provide binding information. Includes a basic test.

Bug: Dawn:728
Change-Id: Ib0f39998359dc22a530ad222141229f9ba30552f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51161
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Brandon Jones
2021-05-17 17:40:17 +00:00
committed by Commit Bot service account
parent a965ad4d3a
commit 7b25769aed
7 changed files with 114 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
#include "src/ast/function.h"
#include "src/sem/depth_texture_type.h"
#include "src/sem/external_texture_type.h"
#include "src/sem/multisampled_texture_type.h"
#include "src/sem/sampled_texture_type.h"
#include "src/sem/storage_texture_type.h"
@@ -168,6 +169,24 @@ Function::VariableBindings Function::ReferencedDepthTextureVariables() const {
return ret;
}
Function::VariableBindings Function::ReferencedExternalTextureVariables()
const {
VariableBindings ret;
for (auto* var : ReferencedModuleVariables()) {
auto* unwrapped_type = var->Type()->UnwrapAccess();
auto* external_texture = unwrapped_type->As<sem::ExternalTexture>();
if (external_texture == nullptr) {
continue;
}
if (auto binding_point = var->Declaration()->binding_point()) {
ret.push_back({var, binding_point});
}
}
return ret;
}
bool Function::HasAncestorEntryPoint(Symbol symbol) const {
for (const auto& point : ancestor_entry_points_) {
if (point == symbol) {

View File

@@ -135,9 +135,14 @@ class Function : public Castable<Function, CallTarget> {
/// Retrieves any referenced depth texture variables. Note, the variables
/// must be decorated with both binding and group decorations.
/// @returns the referenced storage textures
/// @returns the referenced depth textures
VariableBindings ReferencedDepthTextureVariables() const;
/// Retrieves any referenced external texture variables. Note, the variables
/// must be decorated with both binding and group decorations.
/// @returns the referenced external textures
VariableBindings ReferencedExternalTextureVariables() const;
/// Checks if the given entry point is an ancestor
/// @param sym the entry point symbol
/// @returns true if `sym` is an ancestor entry point of this function