Implement texture_depth_multisampled_2d
Implemented for all readers and writers. Cleaned up some verbose code in sem::Function and the Inspector in the process. Fixed: tint:1032 Change-Id: Ia6f2f59e6d2e511c89160b97be990e8b7c9828d9 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59664 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: David Neto <dneto@google.com> Reviewed-by: James Price <jrprice@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Auto-Submit: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
d12379a405
commit
fd35aa8e47
|
@ -126,6 +126,7 @@ decorated with `NonWritable` or each member of the struct can be decorated with
|
|||
| texture_depth_2d_array | OpTypeImage 2D Depth=1 Arrayed=1 Sampled=1 | depth2d_array<float, access::sample> | Texture2DArray |
|
||||
| texture_depth_cube | OpTypeImage Cube Depth=1 Sampled=1 | depthcube<float, access::sample> | TextureCube |
|
||||
| texture_depth_cube_array | OpTypeImage Cube Depth=1 Arrayed=1 Sampled=1 | depthcube_array<float, access::sample> | TextureCubeArray |
|
||||
| texture_depth_multisampled_2d | OpTypeImage 2D Depth=1 MS=1 Sampled=1 | depth2d<float, access::sample>| Texture2DMSArray |
|
||||
| | | |
|
||||
| texture_storage_1d<image_storage_type> | OpTypeImage 1D Sampled=2| texture1d<type, access::read> | RWTexture1D |
|
||||
| texture_storage_2d<image_storage_type> | OpTypeImage 2D Sampled=2 | texture2d<type, access::read> | RWTexture2D |
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
"texture_depth_2d_array"
|
||||
"texture_depth_cube"
|
||||
"texture_depth_cube_array"
|
||||
"texture_depth_multisampled_2d"
|
||||
"texture_multisampled_2d"
|
||||
"texture_storage_1d"
|
||||
"texture_storage_2d_array"
|
||||
|
|
|
@ -351,6 +351,9 @@ std::string ResourceTypeToString(
|
|||
return "WriteOnlyStorageTexture";
|
||||
case tint::inspector::ResourceBinding::ResourceType::kDepthTexture:
|
||||
return "DepthTexture";
|
||||
case tint::inspector::ResourceBinding::ResourceType::
|
||||
kDepthMultisampledTexture:
|
||||
return "DepthMultisampledTexture";
|
||||
case tint::inspector::ResourceBinding::ResourceType::kExternalTexture:
|
||||
return "ExternalTexture";
|
||||
}
|
||||
|
|
|
@ -210,6 +210,8 @@ libtint_source_set("libtint_core_all_src") {
|
|||
"ast/continue_statement.h",
|
||||
"ast/decoration.cc",
|
||||
"ast/decoration.h",
|
||||
"ast/depth_multisampled_texture.cc",
|
||||
"ast/depth_multisampled_texture.h",
|
||||
"ast/depth_texture.cc",
|
||||
"ast/depth_texture.h",
|
||||
"ast/disable_validation_decoration.cc",
|
||||
|
@ -377,6 +379,7 @@ libtint_source_set("libtint_core_all_src") {
|
|||
"sem/call.h",
|
||||
"sem/call_target.h",
|
||||
"sem/constant.h",
|
||||
"sem/depth_multisampled_texture_type.h",
|
||||
"sem/depth_texture_type.h",
|
||||
"sem/expression.h",
|
||||
"sem/external_texture_type.h",
|
||||
|
@ -502,6 +505,8 @@ libtint_source_set("libtint_sem_src") {
|
|||
"sem/call_target.h",
|
||||
"sem/constant.cc",
|
||||
"sem/constant.h",
|
||||
"sem/depth_multisampled_texture_type.cc",
|
||||
"sem/depth_multisampled_texture_type.h",
|
||||
"sem/depth_texture_type.cc",
|
||||
"sem/depth_texture_type.h",
|
||||
"sem/expression.cc",
|
||||
|
|
|
@ -80,6 +80,8 @@ set(TINT_LIB_SRCS
|
|||
ast/continue_statement.h
|
||||
ast/decoration.cc
|
||||
ast/decoration.h
|
||||
ast/depth_multisampled_texture.cc
|
||||
ast/depth_multisampled_texture.h
|
||||
ast/disable_validation_decoration.cc
|
||||
ast/disable_validation_decoration.h
|
||||
ast/depth_texture.cc
|
||||
|
@ -256,6 +258,8 @@ set(TINT_LIB_SRCS
|
|||
sem/call.h
|
||||
sem/constant.cc
|
||||
sem/constant.h
|
||||
sem/depth_multisampled_texture_type.cc
|
||||
sem/depth_multisampled_texture_type.h
|
||||
sem/expression.cc
|
||||
sem/expression.h
|
||||
sem/function.cc
|
||||
|
@ -564,6 +568,7 @@ if(${TINT_BUILD_TESTS})
|
|||
ast/call_statement_test.cc
|
||||
ast/case_statement_test.cc
|
||||
ast/continue_statement_test.cc
|
||||
ast/depth_multisampled_texture_test.cc
|
||||
ast/depth_texture_test.cc
|
||||
ast/discard_statement_test.cc
|
||||
ast/else_statement_test.cc
|
||||
|
@ -669,6 +674,7 @@ if(${TINT_BUILD_TESTS})
|
|||
test_main.cc
|
||||
sem/atomic_type_test.cc
|
||||
sem/bool_type_test.cc
|
||||
sem/depth_multisampled_texture_type_test.cc
|
||||
sem/depth_texture_type_test.cc
|
||||
sem/external_texture_type_test.cc
|
||||
sem/f32_type_test.cc
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "src/ast/depth_multisampled_texture.h"
|
||||
|
||||
#include "src/program_builder.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::ast::DepthMultisampledTexture);
|
||||
|
||||
namespace tint {
|
||||
namespace ast {
|
||||
namespace {
|
||||
|
||||
bool IsValidDepthDimension(TextureDimension dim) {
|
||||
return dim == TextureDimension::k2d;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
DepthMultisampledTexture::DepthMultisampledTexture(ProgramID program_id,
|
||||
const Source& source,
|
||||
TextureDimension dim)
|
||||
: Base(program_id, source, dim) {
|
||||
TINT_ASSERT(AST, IsValidDepthDimension(dim));
|
||||
}
|
||||
|
||||
DepthMultisampledTexture::DepthMultisampledTexture(DepthMultisampledTexture&&) =
|
||||
default;
|
||||
|
||||
DepthMultisampledTexture::~DepthMultisampledTexture() = default;
|
||||
|
||||
std::string DepthMultisampledTexture::type_name() const {
|
||||
std::ostringstream out;
|
||||
out << "__depth_multisampled_texture_" << dim();
|
||||
return out.str();
|
||||
}
|
||||
|
||||
std::string DepthMultisampledTexture::FriendlyName(const SymbolTable&) const {
|
||||
std::ostringstream out;
|
||||
out << "texture_depth_multisampled_" << dim();
|
||||
return out.str();
|
||||
}
|
||||
|
||||
DepthMultisampledTexture* DepthMultisampledTexture::Clone(
|
||||
CloneContext* ctx) const {
|
||||
auto src = ctx->Clone(source());
|
||||
return ctx->dst->create<DepthMultisampledTexture>(src, dim());
|
||||
}
|
||||
|
||||
} // namespace ast
|
||||
} // namespace tint
|
|
@ -0,0 +1,57 @@
|
|||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef SRC_AST_DEPTH_MULTISAMPLED_TEXTURE_H_
|
||||
#define SRC_AST_DEPTH_MULTISAMPLED_TEXTURE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "src/ast/texture.h"
|
||||
|
||||
namespace tint {
|
||||
namespace ast {
|
||||
|
||||
/// A multisampled depth texture type.
|
||||
class DepthMultisampledTexture
|
||||
: public Castable<DepthMultisampledTexture, Texture> {
|
||||
public:
|
||||
/// Constructor
|
||||
/// @param program_id the identifier of the program that owns this node
|
||||
/// @param source the source of this node
|
||||
/// @param dim the dimensionality of the texture
|
||||
DepthMultisampledTexture(ProgramID program_id,
|
||||
const Source& source,
|
||||
TextureDimension dim);
|
||||
/// Move constructor
|
||||
DepthMultisampledTexture(DepthMultisampledTexture&&);
|
||||
~DepthMultisampledTexture() override;
|
||||
|
||||
/// @returns the name for this type
|
||||
std::string type_name() const override;
|
||||
|
||||
/// @param symbols the program's symbol table
|
||||
/// @returns the name for this type that closely resembles how it would be
|
||||
/// declared in WGSL.
|
||||
std::string FriendlyName(const SymbolTable& symbols) const override;
|
||||
|
||||
/// Clones this type and all transitive types using the `CloneContext` `ctx`.
|
||||
/// @param ctx the clone context
|
||||
/// @return the newly cloned type
|
||||
DepthMultisampledTexture* Clone(CloneContext* ctx) const override;
|
||||
};
|
||||
|
||||
} // namespace ast
|
||||
} // namespace tint
|
||||
|
||||
#endif // SRC_AST_DEPTH_MULTISAMPLED_TEXTURE_H_
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "src/ast/depth_multisampled_texture.h"
|
||||
|
||||
#include "src/ast/test_helper.h"
|
||||
|
||||
namespace tint {
|
||||
namespace ast {
|
||||
namespace {
|
||||
|
||||
using AstDepthMultisampledTextureTest = TestHelper;
|
||||
|
||||
TEST_F(AstDepthMultisampledTextureTest, Dim) {
|
||||
auto* d = create<DepthMultisampledTexture>(TextureDimension::k2d);
|
||||
EXPECT_EQ(d->dim(), TextureDimension::k2d);
|
||||
}
|
||||
|
||||
TEST_F(AstDepthMultisampledTextureTest, TypeName) {
|
||||
auto* d = create<DepthMultisampledTexture>(TextureDimension::k2d);
|
||||
EXPECT_EQ(d->type_name(), "__depth_multisampled_texture_2d");
|
||||
}
|
||||
|
||||
TEST_F(AstDepthMultisampledTextureTest, FriendlyName) {
|
||||
auto* d = create<DepthMultisampledTexture>(TextureDimension::k2d);
|
||||
EXPECT_EQ(d->FriendlyName(Symbols()), "texture_depth_multisampled_2d");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace ast
|
||||
} // namespace tint
|
|
@ -88,6 +88,9 @@ std::ostream& operator<<(std::ostream& out, const TextureKind& kind) {
|
|||
case TextureKind::kDepth:
|
||||
out << "depth";
|
||||
break;
|
||||
case TextureKind::kDepthMultisampled:
|
||||
out << "depth-multisampled";
|
||||
break;
|
||||
case TextureKind::kMultisampled:
|
||||
out << "multisampled";
|
||||
break;
|
||||
|
@ -163,6 +166,11 @@ ast::Variable* TextureOverloadCase::buildTextureVariable(
|
|||
return b->Global("texture", b->ty.depth_texture(texture_dimension),
|
||||
decos);
|
||||
|
||||
case ast::intrinsic::test::TextureKind::kDepthMultisampled:
|
||||
return b->Global("texture",
|
||||
b->ty.depth_multisampled_texture(texture_dimension),
|
||||
decos);
|
||||
|
||||
case ast::intrinsic::test::TextureKind::kMultisampled:
|
||||
return b->Global(
|
||||
"texture",
|
||||
|
@ -400,6 +408,16 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureDimensions",
|
||||
[](ProgramBuilder* b) { return b->ExprList("texture", 1); },
|
||||
},
|
||||
{
|
||||
ValidTextureOverload::kDimensionsDepthMultisampled2d,
|
||||
"textureDimensions(t : texture_depth_multisampled_2d) -> vec2<i32>",
|
||||
TextureKind::kDepthMultisampled,
|
||||
ast::SamplerKind::kSampler,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureDimensions",
|
||||
[](ProgramBuilder* b) { return b->ExprList("texture"); },
|
||||
},
|
||||
{
|
||||
ValidTextureOverload::kDimensionsStorageRO1d,
|
||||
"textureDimensions(t : texture_storage_1d<rgba32float>) -> i32",
|
||||
|
|
|
@ -26,7 +26,13 @@ namespace ast {
|
|||
namespace intrinsic {
|
||||
namespace test {
|
||||
|
||||
enum class TextureKind { kRegular, kDepth, kMultisampled, kStorage };
|
||||
enum class TextureKind {
|
||||
kRegular,
|
||||
kDepth,
|
||||
kDepthMultisampled,
|
||||
kMultisampled,
|
||||
kStorage
|
||||
};
|
||||
enum class TextureDataType { kF32, kU32, kI32 };
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const TextureKind& kind);
|
||||
|
@ -54,6 +60,7 @@ enum class ValidTextureOverload {
|
|||
kDimensionsDepthCubeLevel,
|
||||
kDimensionsDepthCubeArray,
|
||||
kDimensionsDepthCubeArrayLevel,
|
||||
kDimensionsDepthMultisampled2d,
|
||||
kDimensionsStorageRO1d,
|
||||
kDimensionsStorageRO2d,
|
||||
kDimensionsStorageRO2dArray,
|
||||
|
@ -77,6 +84,7 @@ enum class ValidTextureOverload {
|
|||
kNumLevelsDepthCube,
|
||||
kNumLevelsDepthCubeArray,
|
||||
kNumSamplesMultisampled2d,
|
||||
kNumSamplesDepthMultisampled2d,
|
||||
kSample1dF32,
|
||||
kSample2dF32,
|
||||
kSample2dOffsetF32,
|
||||
|
@ -151,6 +159,7 @@ enum class ValidTextureOverload {
|
|||
kLoadMultisampled2dI32,
|
||||
kLoadDepth2dLevelF32,
|
||||
kLoadDepth2dArrayLevelF32,
|
||||
kLoadDepthMultisampled2dF32,
|
||||
kLoadStorageRO1dRgba32float, // Not permutated for all texel formats
|
||||
kLoadStorageRO2dRgba8unorm,
|
||||
kLoadStorageRO2dRgba8snorm,
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "src/ast/uint_literal.h"
|
||||
#include "src/sem/array.h"
|
||||
#include "src/sem/call.h"
|
||||
#include "src/sem/depth_multisampled_texture_type.h"
|
||||
#include "src/sem/f32_type.h"
|
||||
#include "src/sem/function.h"
|
||||
#include "src/sem/i32_type.h"
|
||||
|
@ -319,27 +320,22 @@ std::vector<ResourceBinding> Inspector::GetResourceBindings(
|
|||
}
|
||||
|
||||
std::vector<ResourceBinding> result;
|
||||
|
||||
AppendResourceBindings(&result,
|
||||
GetUniformBufferResourceBindings(entry_point));
|
||||
AppendResourceBindings(&result,
|
||||
GetStorageBufferResourceBindings(entry_point));
|
||||
AppendResourceBindings(&result,
|
||||
GetReadOnlyStorageBufferResourceBindings(entry_point));
|
||||
AppendResourceBindings(&result, GetSamplerResourceBindings(entry_point));
|
||||
AppendResourceBindings(&result,
|
||||
GetComparisonSamplerResourceBindings(entry_point));
|
||||
AppendResourceBindings(&result,
|
||||
GetSampledTextureResourceBindings(entry_point));
|
||||
AppendResourceBindings(&result,
|
||||
GetMultisampledTextureResourceBindings(entry_point));
|
||||
AppendResourceBindings(
|
||||
&result, GetReadOnlyStorageTextureResourceBindings(entry_point));
|
||||
AppendResourceBindings(
|
||||
&result, GetWriteOnlyStorageTextureResourceBindings(entry_point));
|
||||
AppendResourceBindings(&result, GetDepthTextureResourceBindings(entry_point));
|
||||
AppendResourceBindings(&result,
|
||||
GetExternalTextureResourceBindings(entry_point));
|
||||
for (auto fn : {
|
||||
&Inspector::GetUniformBufferResourceBindings,
|
||||
&Inspector::GetStorageBufferResourceBindings,
|
||||
&Inspector::GetReadOnlyStorageBufferResourceBindings,
|
||||
&Inspector::GetSamplerResourceBindings,
|
||||
&Inspector::GetComparisonSamplerResourceBindings,
|
||||
&Inspector::GetSampledTextureResourceBindings,
|
||||
&Inspector::GetMultisampledTextureResourceBindings,
|
||||
&Inspector::GetReadOnlyStorageTextureResourceBindings,
|
||||
&Inspector::GetWriteOnlyStorageTextureResourceBindings,
|
||||
&Inspector::GetDepthTextureResourceBindings,
|
||||
&Inspector::GetDepthMultisampledTextureResourceBindings,
|
||||
&Inspector::GetExternalTextureResourceBindings,
|
||||
}) {
|
||||
AppendResourceBindings(&result, (this->*fn)(entry_point));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -465,8 +461,10 @@ Inspector::GetWriteOnlyStorageTextureResourceBindings(
|
|||
return GetStorageTextureResourceBindingsImpl(entry_point, false);
|
||||
}
|
||||
|
||||
std::vector<ResourceBinding> Inspector::GetDepthTextureResourceBindings(
|
||||
const std::string& entry_point) {
|
||||
std::vector<ResourceBinding> Inspector::GetTextureResourceBindings(
|
||||
const std::string& entry_point,
|
||||
const tint::TypeInfo& texture_type,
|
||||
ResourceBinding::ResourceType resource_type) {
|
||||
auto* func = FindEntryPointByName(entry_point);
|
||||
if (!func) {
|
||||
return {};
|
||||
|
@ -474,18 +472,18 @@ std::vector<ResourceBinding> Inspector::GetDepthTextureResourceBindings(
|
|||
|
||||
std::vector<ResourceBinding> result;
|
||||
auto* func_sem = program_->Sem().Get(func);
|
||||
for (auto& ref : func_sem->ReferencedDepthTextureVariables()) {
|
||||
for (auto& ref : func_sem->ReferencedVariablesOfType(texture_type)) {
|
||||
auto* var = ref.first;
|
||||
auto binding_info = ref.second;
|
||||
|
||||
ResourceBinding entry;
|
||||
entry.resource_type = ResourceBinding::ResourceType::kDepthTexture;
|
||||
entry.resource_type = resource_type;
|
||||
entry.bind_group = binding_info.group->value();
|
||||
entry.binding = binding_info.binding->value();
|
||||
|
||||
auto* texture_type = var->Type()->UnwrapRef()->As<sem::Texture>();
|
||||
entry.dim = TypeTextureDimensionToResourceBindingTextureDimension(
|
||||
texture_type->dim());
|
||||
auto* tex = var->Type()->UnwrapRef()->As<sem::Texture>();
|
||||
entry.dim =
|
||||
TypeTextureDimensionToResourceBindingTextureDimension(tex->dim());
|
||||
|
||||
result.push_back(entry);
|
||||
}
|
||||
|
@ -493,31 +491,26 @@ std::vector<ResourceBinding> Inspector::GetDepthTextureResourceBindings(
|
|||
return result;
|
||||
}
|
||||
|
||||
std::vector<ResourceBinding> Inspector::GetDepthTextureResourceBindings(
|
||||
const std::string& entry_point) {
|
||||
return GetTextureResourceBindings(
|
||||
entry_point, TypeInfo::Of<sem::DepthTexture>(),
|
||||
ResourceBinding::ResourceType::kDepthTexture);
|
||||
}
|
||||
|
||||
std::vector<ResourceBinding>
|
||||
Inspector::GetDepthMultisampledTextureResourceBindings(
|
||||
const std::string& entry_point) {
|
||||
return GetTextureResourceBindings(
|
||||
entry_point, TypeInfo::Of<sem::DepthMultisampledTexture>(),
|
||||
ResourceBinding::ResourceType::kDepthMultisampledTexture);
|
||||
}
|
||||
|
||||
std::vector<ResourceBinding> Inspector::GetExternalTextureResourceBindings(
|
||||
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->ReferencedExternalTextureVariables()) {
|
||||
auto* var = ref.first;
|
||||
auto binding_info = ref.second;
|
||||
|
||||
ResourceBinding entry;
|
||||
entry.resource_type = ResourceBinding::ResourceType::kExternalTexture;
|
||||
entry.bind_group = binding_info.group->value();
|
||||
entry.binding = binding_info.binding->value();
|
||||
|
||||
auto* texture_type = var->Type()->UnwrapRef()->As<sem::Texture>();
|
||||
entry.dim = TypeTextureDimensionToResourceBindingTextureDimension(
|
||||
texture_type->dim());
|
||||
|
||||
result.push_back(entry);
|
||||
}
|
||||
return result;
|
||||
return GetTextureResourceBindings(
|
||||
entry_point, TypeInfo::Of<sem::ExternalTexture>(),
|
||||
ResourceBinding::ResourceType::kExternalTexture);
|
||||
}
|
||||
|
||||
std::vector<SamplerTexturePair> Inspector::GetSamplerTextureUses(
|
||||
|
@ -734,7 +727,7 @@ std::vector<ResourceBinding> Inspector::GetStorageTextureResourceBindingsImpl(
|
|||
|
||||
auto* func_sem = program_->Sem().Get(func);
|
||||
std::vector<ResourceBinding> result;
|
||||
for (auto& ref : func_sem->ReferencedStorageTextureVariables()) {
|
||||
for (auto& ref : func_sem->ReferencedVariablesOfType<sem::StorageTexture>()) {
|
||||
auto* var = ref.first;
|
||||
auto binding_info = ref.second;
|
||||
|
||||
|
|
|
@ -121,6 +121,11 @@ class Inspector {
|
|||
std::vector<ResourceBinding> GetDepthTextureResourceBindings(
|
||||
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> GetDepthMultisampledTextureResourceBindings(
|
||||
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 external textures.
|
||||
std::vector<ResourceBinding> GetExternalTextureResourceBindings(
|
||||
|
@ -167,6 +172,18 @@ class Inspector {
|
|||
bool ContainsSampleMaskBuiltin(sem::Type* type,
|
||||
const ast::DecorationList& decorations) const;
|
||||
|
||||
/// Gathers all the texture resource bindings of the given type for the given
|
||||
/// entry point.
|
||||
/// @param entry_point name of the entry point to get information about.
|
||||
/// @param texture_type the type of the textures to gather.
|
||||
/// @param resource_type the ResourceBinding::ResourceType for the given
|
||||
/// texture type.
|
||||
/// @returns vector of all of the bindings for depth textures.
|
||||
std::vector<ResourceBinding> GetTextureResourceBindings(
|
||||
const std::string& entry_point,
|
||||
const tint::TypeInfo& texture_type,
|
||||
ResourceBinding::ResourceType resource_type);
|
||||
|
||||
/// @param entry_point name of the entry point to get information about.
|
||||
/// @param read_only if true get only read-only bindings, if false get
|
||||
/// write-only bindings.
|
||||
|
|
|
@ -116,6 +116,10 @@ class InspectorGetDepthTextureResourceBindingsTestWithParam
|
|||
: public InspectorBuilder,
|
||||
public testing::TestWithParam<GetDepthTextureTestParams> {};
|
||||
|
||||
class InspectorGetDepthMultisampledTextureResourceBindingsTest
|
||||
: public InspectorBuilder,
|
||||
public testing::Test {};
|
||||
|
||||
typedef std::tuple<ast::TextureDimension, ResourceBinding::TextureDimension>
|
||||
DimensionParams;
|
||||
typedef std::tuple<ast::ImageFormat,
|
||||
|
@ -1005,22 +1009,26 @@ TEST_F(InspectorGetResourceBindingsTest, Simple) {
|
|||
{{0, ty.i32()}});
|
||||
|
||||
auto* s_texture_type =
|
||||
MakeSampledTextureType(ast::TextureDimension::k1d, ty.f32());
|
||||
AddSampledTexture("s_texture", s_texture_type, 2, 0);
|
||||
ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
|
||||
AddResource("s_texture", s_texture_type, 2, 0);
|
||||
AddSampler("s_var", 3, 0);
|
||||
AddGlobalVariable("s_coords", ty.f32());
|
||||
MakeSamplerReferenceBodyFunction("s_func", "s_texture", "s_var", "s_coords",
|
||||
ty.f32(), {});
|
||||
|
||||
auto* cs_depth_texture_type =
|
||||
MakeDepthTextureType(ast::TextureDimension::k2d);
|
||||
AddDepthTexture("cs_texture", cs_depth_texture_type, 3, 1);
|
||||
auto* cs_depth_texture_type = ty.depth_texture(ast::TextureDimension::k2d);
|
||||
AddResource("cs_texture", cs_depth_texture_type, 3, 1);
|
||||
AddComparisonSampler("cs_var", 3, 2);
|
||||
AddGlobalVariable("cs_coords", ty.vec2<f32>());
|
||||
AddGlobalVariable("cs_depth", ty.f32());
|
||||
MakeComparisonSamplerReferenceBodyFunction(
|
||||
"cs_func", "cs_texture", "cs_var", "cs_coords", "cs_depth", ty.f32(), {});
|
||||
|
||||
auto* depth_ms_texture_type =
|
||||
ty.depth_multisampled_texture(ast::TextureDimension::k2d);
|
||||
AddResource("depth_ms_texture", depth_ms_texture_type, 3, 3);
|
||||
Func("depth_ms_func", {}, ty.void_(), {Ignore("depth_ms_texture")});
|
||||
|
||||
auto* st_type = MakeStorageTextureTypes(ast::TextureDimension::k2d,
|
||||
ast::ImageFormat::kR32Uint, false);
|
||||
AddStorageTexture("st_var", st_type, 4, 0);
|
||||
|
@ -1033,7 +1041,7 @@ TEST_F(InspectorGetResourceBindingsTest, Simple) {
|
|||
|
||||
MakeCallerBodyFunction("ep_func",
|
||||
{"ub_func", "sb_func", "rosb_func", "s_func",
|
||||
"cs_func", "st_func", "rost_func"},
|
||||
"cs_func", "depth_ms_func", "st_func", "rost_func"},
|
||||
ast::DecorationList{
|
||||
Stage(ast::PipelineStage::kFragment),
|
||||
});
|
||||
|
@ -1042,7 +1050,7 @@ TEST_F(InspectorGetResourceBindingsTest, Simple) {
|
|||
|
||||
auto result = inspector.GetResourceBindings("ep_func");
|
||||
ASSERT_FALSE(inspector.has_error()) << inspector.error();
|
||||
ASSERT_EQ(9u, result.size());
|
||||
ASSERT_EQ(10u, result.size());
|
||||
|
||||
EXPECT_EQ(ResourceBinding::ResourceType::kUniformBuffer,
|
||||
result[0].resource_type);
|
||||
|
@ -1087,6 +1095,11 @@ TEST_F(InspectorGetResourceBindingsTest, Simple) {
|
|||
result[8].resource_type);
|
||||
EXPECT_EQ(3u, result[8].bind_group);
|
||||
EXPECT_EQ(1u, result[8].binding);
|
||||
|
||||
EXPECT_EQ(ResourceBinding::ResourceType::kDepthMultisampledTexture,
|
||||
result[9].resource_type);
|
||||
EXPECT_EQ(3u, result[9].bind_group);
|
||||
EXPECT_EQ(3u, result[9].binding);
|
||||
}
|
||||
|
||||
TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingEntryPoint) {
|
||||
|
@ -1663,8 +1676,8 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, SkipNonReadOnly) {
|
|||
|
||||
TEST_F(InspectorGetSamplerResourceBindingsTest, Simple) {
|
||||
auto* sampled_texture_type =
|
||||
MakeSampledTextureType(ast::TextureDimension::k1d, ty.f32());
|
||||
AddSampledTexture("foo_texture", sampled_texture_type, 0, 0);
|
||||
ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
|
||||
AddResource("foo_texture", sampled_texture_type, 0, 0);
|
||||
AddSampler("foo_sampler", 0, 1);
|
||||
AddGlobalVariable("foo_coords", ty.f32());
|
||||
|
||||
|
@ -1700,8 +1713,8 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, NoSampler) {
|
|||
|
||||
TEST_F(InspectorGetSamplerResourceBindingsTest, InFunction) {
|
||||
auto* sampled_texture_type =
|
||||
MakeSampledTextureType(ast::TextureDimension::k1d, ty.f32());
|
||||
AddSampledTexture("foo_texture", sampled_texture_type, 0, 0);
|
||||
ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
|
||||
AddResource("foo_texture", sampled_texture_type, 0, 0);
|
||||
AddSampler("foo_sampler", 0, 1);
|
||||
AddGlobalVariable("foo_coords", ty.f32());
|
||||
|
||||
|
@ -1726,8 +1739,8 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, InFunction) {
|
|||
|
||||
TEST_F(InspectorGetSamplerResourceBindingsTest, UnknownEntryPoint) {
|
||||
auto* sampled_texture_type =
|
||||
MakeSampledTextureType(ast::TextureDimension::k1d, ty.f32());
|
||||
AddSampledTexture("foo_texture", sampled_texture_type, 0, 0);
|
||||
ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
|
||||
AddResource("foo_texture", sampled_texture_type, 0, 0);
|
||||
AddSampler("foo_sampler", 0, 1);
|
||||
AddGlobalVariable("foo_coords", ty.f32());
|
||||
|
||||
|
@ -1744,8 +1757,8 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, UnknownEntryPoint) {
|
|||
}
|
||||
|
||||
TEST_F(InspectorGetSamplerResourceBindingsTest, SkipsComparisonSamplers) {
|
||||
auto* depth_texture_type = MakeDepthTextureType(ast::TextureDimension::k2d);
|
||||
AddDepthTexture("foo_texture", depth_texture_type, 0, 0);
|
||||
auto* depth_texture_type = ty.depth_texture(ast::TextureDimension::k2d);
|
||||
AddResource("foo_texture", depth_texture_type, 0, 0);
|
||||
AddComparisonSampler("foo_sampler", 0, 1);
|
||||
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||
AddGlobalVariable("foo_depth", ty.f32());
|
||||
|
@ -1765,8 +1778,8 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, SkipsComparisonSamplers) {
|
|||
}
|
||||
|
||||
TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, Simple) {
|
||||
auto* depth_texture_type = MakeDepthTextureType(ast::TextureDimension::k2d);
|
||||
AddDepthTexture("foo_texture", depth_texture_type, 0, 0);
|
||||
auto* depth_texture_type = ty.depth_texture(ast::TextureDimension::k2d);
|
||||
AddResource("foo_texture", depth_texture_type, 0, 0);
|
||||
AddComparisonSampler("foo_sampler", 0, 1);
|
||||
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||
AddGlobalVariable("foo_depth", ty.f32());
|
||||
|
@ -1803,8 +1816,8 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, NoSampler) {
|
|||
}
|
||||
|
||||
TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, InFunction) {
|
||||
auto* depth_texture_type = MakeDepthTextureType(ast::TextureDimension::k2d);
|
||||
AddDepthTexture("foo_texture", depth_texture_type, 0, 0);
|
||||
auto* depth_texture_type = ty.depth_texture(ast::TextureDimension::k2d);
|
||||
AddResource("foo_texture", depth_texture_type, 0, 0);
|
||||
AddComparisonSampler("foo_sampler", 0, 1);
|
||||
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||
AddGlobalVariable("foo_depth", ty.f32());
|
||||
|
@ -1831,8 +1844,8 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, InFunction) {
|
|||
}
|
||||
|
||||
TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, UnknownEntryPoint) {
|
||||
auto* depth_texture_type = MakeDepthTextureType(ast::TextureDimension::k2d);
|
||||
AddDepthTexture("foo_texture", depth_texture_type, 0, 0);
|
||||
auto* depth_texture_type = ty.depth_texture(ast::TextureDimension::k2d);
|
||||
AddResource("foo_texture", depth_texture_type, 0, 0);
|
||||
AddComparisonSampler("foo_sampler", 0, 1);
|
||||
AddGlobalVariable("foo_coords", ty.vec2<f32>());
|
||||
AddGlobalVariable("foo_depth", ty.f32());
|
||||
|
@ -1851,8 +1864,8 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, UnknownEntryPoint) {
|
|||
|
||||
TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, SkipsSamplers) {
|
||||
auto* sampled_texture_type =
|
||||
MakeSampledTextureType(ast::TextureDimension::k1d, ty.f32());
|
||||
AddSampledTexture("foo_texture", sampled_texture_type, 0, 0);
|
||||
ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
|
||||
AddResource("foo_texture", sampled_texture_type, 0, 0);
|
||||
AddSampler("foo_sampler", 0, 1);
|
||||
AddGlobalVariable("foo_coords", ty.f32());
|
||||
|
||||
|
@ -1884,9 +1897,9 @@ TEST_F(InspectorGetSampledTextureResourceBindingsTest, Empty) {
|
|||
}
|
||||
|
||||
TEST_P(InspectorGetSampledTextureResourceBindingsTestWithParam, textureSample) {
|
||||
auto* sampled_texture_type = MakeSampledTextureType(
|
||||
auto* sampled_texture_type = ty.sampled_texture(
|
||||
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
||||
AddSampledTexture("foo_texture", sampled_texture_type, 0, 0);
|
||||
AddResource("foo_texture", sampled_texture_type, 0, 0);
|
||||
AddSampler("foo_sampler", 0, 1);
|
||||
auto* coord_type = GetCoordsType(GetParam().type_dim, ty.f32());
|
||||
AddGlobalVariable("foo_coords", coord_type);
|
||||
|
@ -1942,9 +1955,9 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
|
||||
TEST_P(InspectorGetSampledArrayTextureResourceBindingsTestWithParam,
|
||||
textureSample) {
|
||||
auto* sampled_texture_type = MakeSampledTextureType(
|
||||
auto* sampled_texture_type = ty.sampled_texture(
|
||||
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
||||
AddSampledTexture("foo_texture", sampled_texture_type, 0, 0);
|
||||
AddResource("foo_texture", sampled_texture_type, 0, 0);
|
||||
AddSampler("foo_sampler", 0, 1);
|
||||
auto* coord_type = GetCoordsType(GetParam().type_dim, ty.f32());
|
||||
AddGlobalVariable("foo_coords", coord_type);
|
||||
|
@ -1986,9 +1999,9 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
|
||||
TEST_P(InspectorGetMultisampledTextureResourceBindingsTestWithParam,
|
||||
textureLoad) {
|
||||
auto* multisampled_texture_type = MakeMultisampledTextureType(
|
||||
auto* multisampled_texture_type = ty.multisampled_texture(
|
||||
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
||||
AddMultisampledTexture("foo_texture", multisampled_texture_type, 0, 0);
|
||||
AddResource("foo_texture", multisampled_texture_type, 0, 0);
|
||||
auto* coord_type = GetCoordsType(GetParam().type_dim, ty.i32());
|
||||
AddGlobalVariable("foo_coords", coord_type);
|
||||
AddGlobalVariable("foo_sample_index", ty.i32());
|
||||
|
@ -2055,9 +2068,9 @@ TEST_F(InspectorGetMultisampledArrayTextureResourceBindingsTest, Empty) {
|
|||
|
||||
TEST_P(InspectorGetMultisampledArrayTextureResourceBindingsTestWithParam,
|
||||
DISABLED_textureSample) {
|
||||
auto* multisampled_texture_type = MakeMultisampledTextureType(
|
||||
auto* multisampled_texture_type = ty.multisampled_texture(
|
||||
GetParam().type_dim, GetBaseType(GetParam().sampled_kind));
|
||||
AddMultisampledTexture("foo_texture", multisampled_texture_type, 0, 0);
|
||||
AddResource("foo_texture", multisampled_texture_type, 0, 0);
|
||||
AddSampler("foo_sampler", 0, 1);
|
||||
auto* coord_type = GetCoordsType(GetParam().type_dim, ty.f32());
|
||||
AddGlobalVariable("foo_coords", coord_type);
|
||||
|
@ -2247,13 +2260,12 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
|
||||
TEST_P(InspectorGetDepthTextureResourceBindingsTestWithParam,
|
||||
textureDimensions) {
|
||||
auto* depth_texture_type = MakeDepthTextureType(GetParam().type_dim);
|
||||
AddDepthTexture("dt", depth_texture_type, 0, 0);
|
||||
AddGlobalVariable("dt_level", ty.i32());
|
||||
auto* depth_texture_type = ty.depth_texture(GetParam().type_dim);
|
||||
AddResource("dt", depth_texture_type, 0, 0);
|
||||
|
||||
Func("ep", ast::VariableList(), ty.void_(),
|
||||
ast::StatementList{
|
||||
Ignore(Call("textureDimensions", "dt", "dt_level")),
|
||||
Ignore(Call("textureDimensions", "dt")),
|
||||
},
|
||||
ast::DecorationList{
|
||||
Stage(ast::PipelineStage::kFragment),
|
||||
|
@ -2289,9 +2301,36 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
ast::TextureDimension::kCubeArray,
|
||||
inspector::ResourceBinding::TextureDimension::kCubeArray}));
|
||||
|
||||
TEST_F(InspectorGetDepthMultisampledTextureResourceBindingsTest,
|
||||
textureDimensions) {
|
||||
auto* depth_ms_texture_type =
|
||||
ty.depth_multisampled_texture(ast::TextureDimension::k2d);
|
||||
AddResource("tex", depth_ms_texture_type, 0, 0);
|
||||
|
||||
Func("ep", ast::VariableList(), ty.void_(),
|
||||
ast::StatementList{
|
||||
Ignore(Call("textureDimensions", "tex")),
|
||||
},
|
||||
ast::DecorationList{
|
||||
Stage(ast::PipelineStage::kFragment),
|
||||
});
|
||||
|
||||
Inspector& inspector = Build();
|
||||
|
||||
auto result = inspector.GetDepthMultisampledTextureResourceBindings("ep");
|
||||
ASSERT_FALSE(inspector.has_error()) << inspector.error();
|
||||
|
||||
EXPECT_EQ(ResourceBinding::ResourceType::kDepthMultisampledTexture,
|
||||
result[0].resource_type);
|
||||
ASSERT_EQ(1u, result.size());
|
||||
EXPECT_EQ(0u, result[0].bind_group);
|
||||
EXPECT_EQ(0u, result[0].binding);
|
||||
EXPECT_EQ(ResourceBinding::TextureDimension::k2d, result[0].dim);
|
||||
}
|
||||
|
||||
TEST_F(InspectorGetExternalTextureResourceBindingsTest, Simple) {
|
||||
auto* external_texture_type = MakeExternalTextureType();
|
||||
AddExternalTexture("et", external_texture_type, 0, 0);
|
||||
auto* external_texture_type = ty.external_texture();
|
||||
AddResource("et", external_texture_type, 0, 0);
|
||||
|
||||
Func("ep", ast::VariableList(), ty.void_(),
|
||||
ast::StatementList{
|
||||
|
@ -2328,8 +2367,8 @@ TEST_F(InspectorGetSamplerTextureUsesTest, None) {
|
|||
|
||||
TEST_F(InspectorGetSamplerTextureUsesTest, Simple) {
|
||||
auto* sampled_texture_type =
|
||||
MakeSampledTextureType(ast::TextureDimension::k1d, ty.f32());
|
||||
AddSampledTexture("foo_texture", sampled_texture_type, 0, 10);
|
||||
ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
|
||||
AddResource("foo_texture", sampled_texture_type, 0, 10);
|
||||
AddSampler("foo_sampler", 0, 1);
|
||||
AddGlobalVariable("foo_coords", ty.f32());
|
||||
|
||||
|
@ -2354,8 +2393,8 @@ TEST_F(InspectorGetSamplerTextureUsesTest, Simple) {
|
|||
|
||||
TEST_F(InspectorGetSamplerTextureUsesTest, MultipleCalls) {
|
||||
auto* sampled_texture_type =
|
||||
MakeSampledTextureType(ast::TextureDimension::k1d, ty.f32());
|
||||
AddSampledTexture("foo_texture", sampled_texture_type, 0, 10);
|
||||
ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
|
||||
AddResource("foo_texture", sampled_texture_type, 0, 10);
|
||||
AddSampler("foo_sampler", 0, 1);
|
||||
AddGlobalVariable("foo_coords", ty.f32());
|
||||
|
||||
|
@ -2378,8 +2417,8 @@ TEST_F(InspectorGetSamplerTextureUsesTest, MultipleCalls) {
|
|||
|
||||
TEST_F(InspectorGetSamplerTextureUsesTest, InFunction) {
|
||||
auto* sampled_texture_type =
|
||||
MakeSampledTextureType(ast::TextureDimension::k1d, ty.f32());
|
||||
AddSampledTexture("foo_texture", sampled_texture_type, 0, 0);
|
||||
ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
|
||||
AddResource("foo_texture", sampled_texture_type, 0, 0);
|
||||
AddSampler("foo_sampler", 0, 1);
|
||||
AddGlobalVariable("foo_coords", ty.f32());
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ struct ResourceBinding {
|
|||
kReadOnlyStorageTexture,
|
||||
kWriteOnlyStorageTexture,
|
||||
kDepthTexture,
|
||||
kDepthMultisampledTexture,
|
||||
kExternalTexture
|
||||
};
|
||||
|
||||
|
|
|
@ -207,39 +207,7 @@ void InspectorBuilder::AddComparisonSampler(const std::string& name,
|
|||
});
|
||||
}
|
||||
|
||||
ast::SampledTexture* InspectorBuilder::MakeSampledTextureType(
|
||||
ast::TextureDimension dim,
|
||||
ast::Type* type) {
|
||||
return ty.sampled_texture(dim, type);
|
||||
}
|
||||
|
||||
ast::DepthTexture* InspectorBuilder::MakeDepthTextureType(
|
||||
ast::TextureDimension dim) {
|
||||
return ty.depth_texture(dim);
|
||||
}
|
||||
|
||||
ast::MultisampledTexture* InspectorBuilder::MakeMultisampledTextureType(
|
||||
ast::TextureDimension dim,
|
||||
ast::Type* type) {
|
||||
return ty.multisampled_texture(dim, type);
|
||||
}
|
||||
|
||||
ast::ExternalTexture* InspectorBuilder::MakeExternalTextureType() {
|
||||
return ty.external_texture();
|
||||
}
|
||||
|
||||
void InspectorBuilder::AddSampledTexture(const std::string& name,
|
||||
ast::Type* type,
|
||||
uint32_t group,
|
||||
uint32_t binding) {
|
||||
Global(name, type,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(binding),
|
||||
create<ast::GroupDecoration>(group),
|
||||
});
|
||||
}
|
||||
|
||||
void InspectorBuilder::AddMultisampledTexture(const std::string& name,
|
||||
void InspectorBuilder::AddResource(const std::string& name,
|
||||
ast::Type* type,
|
||||
uint32_t group,
|
||||
uint32_t binding) {
|
||||
|
@ -255,28 +223,6 @@ void InspectorBuilder::AddGlobalVariable(const std::string& name,
|
|||
Global(name, type, ast::StorageClass::kPrivate);
|
||||
}
|
||||
|
||||
void InspectorBuilder::AddDepthTexture(const std::string& name,
|
||||
ast::Type* type,
|
||||
uint32_t group,
|
||||
uint32_t binding) {
|
||||
Global(name, type,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(binding),
|
||||
create<ast::GroupDecoration>(group),
|
||||
});
|
||||
}
|
||||
|
||||
void InspectorBuilder::AddExternalTexture(const std::string& name,
|
||||
ast::Type* type,
|
||||
uint32_t group,
|
||||
uint32_t binding) {
|
||||
Global(name, type,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(binding),
|
||||
create<ast::GroupDecoration>(group),
|
||||
});
|
||||
}
|
||||
|
||||
ast::Function* InspectorBuilder::MakeSamplerReferenceBodyFunction(
|
||||
const std::string& func_name,
|
||||
const std::string& texture_name,
|
||||
|
|
|
@ -256,46 +256,12 @@ class InspectorBuilder : public ProgramBuilder {
|
|||
uint32_t group,
|
||||
uint32_t binding);
|
||||
|
||||
/// Generates a SampledTexture appropriate for the params
|
||||
/// @param dim the dimensions of the texture
|
||||
/// @param type the data type of the sampled texture
|
||||
/// @returns the generated SampleTextureType
|
||||
ast::SampledTexture* MakeSampledTextureType(ast::TextureDimension dim,
|
||||
ast::Type* type);
|
||||
|
||||
/// Generates a DepthTexture appropriate for the params
|
||||
/// @param dim the dimensions of the texture
|
||||
/// @returns the generated DepthTexture
|
||||
ast::DepthTexture* MakeDepthTextureType(ast::TextureDimension dim);
|
||||
|
||||
/// Generates a MultisampledTexture appropriate for the params
|
||||
/// @param dim the dimensions of the texture
|
||||
/// @param type the data type of the sampled texture
|
||||
/// @returns the generated SampleTextureType
|
||||
ast::MultisampledTexture* MakeMultisampledTextureType(
|
||||
ast::TextureDimension dim,
|
||||
ast::Type* type);
|
||||
|
||||
/// Generates an ExternalTexture appropriate for the params
|
||||
/// @returns the generated ExternalTexture
|
||||
ast::ExternalTexture* MakeExternalTextureType();
|
||||
|
||||
/// Adds a sampled texture variable to the program
|
||||
/// Adds a sampler or texture variable to the program
|
||||
/// @param name the name of the variable
|
||||
/// @param type the type to use
|
||||
/// @param group the binding/group to use for the sampled texture
|
||||
/// @param binding the binding number to use for the sampled texture
|
||||
void AddSampledTexture(const std::string& name,
|
||||
ast::Type* type,
|
||||
uint32_t group,
|
||||
uint32_t binding);
|
||||
|
||||
/// Adds a multi-sampled texture variable to the program
|
||||
/// @param name the name of the variable
|
||||
/// @param type the type to use
|
||||
/// @param group the binding/group to use for the multi-sampled texture
|
||||
/// @param binding the binding number to use for the multi-sampled texture
|
||||
void AddMultisampledTexture(const std::string& name,
|
||||
/// @param group the binding/group to use for the resource
|
||||
/// @param binding the binding number to use for the resource
|
||||
void AddResource(const std::string& name,
|
||||
ast::Type* type,
|
||||
uint32_t group,
|
||||
uint32_t binding);
|
||||
|
@ -305,26 +271,6 @@ class InspectorBuilder : public ProgramBuilder {
|
|||
/// @param type the type to use
|
||||
void AddGlobalVariable(const std::string& name, ast::Type* type);
|
||||
|
||||
/// Adds a depth texture variable to the program
|
||||
/// @param name the name of the variable
|
||||
/// @param type the type to use
|
||||
/// @param group the binding/group to use for the depth texture
|
||||
/// @param binding the binding number to use for the depth texture
|
||||
void AddDepthTexture(const std::string& name,
|
||||
ast::Type* type,
|
||||
uint32_t group,
|
||||
uint32_t binding);
|
||||
|
||||
/// Adds an external texture variable to the program
|
||||
/// @param name the name of the variable
|
||||
/// @param type the type to use
|
||||
/// @param group the binding/group to use for the external texture
|
||||
/// @param binding the binding number to use for the external texture
|
||||
void AddExternalTexture(const std::string& name,
|
||||
ast::Type* type,
|
||||
uint32_t group,
|
||||
uint32_t binding);
|
||||
|
||||
/// Generates a function that references a specific sampler variable
|
||||
/// @param func_name name of the function created
|
||||
/// @param texture_name name of the texture to be sampled
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "src/program_builder.h"
|
||||
#include "src/sem/atomic_type.h"
|
||||
#include "src/sem/depth_multisampled_texture_type.h"
|
||||
#include "src/sem/depth_texture_type.h"
|
||||
#include "src/sem/external_texture_type.h"
|
||||
#include "src/sem/multisampled_texture_type.h"
|
||||
|
@ -592,6 +593,20 @@ DECLARE_DEPTH_TEXTURE(cube, ast::TextureDimension::kCube)
|
|||
DECLARE_DEPTH_TEXTURE(cube_array, ast::TextureDimension::kCubeArray)
|
||||
#undef DECLARE_DEPTH_TEXTURE
|
||||
|
||||
bool match_texture_depth_multisampled_2d(const sem::Type* ty) {
|
||||
if (ty->Is<Any>()) {
|
||||
return true;
|
||||
}
|
||||
return ty->Is<sem::DepthMultisampledTexture>(
|
||||
[&](auto t) { return t->dim() == ast::TextureDimension::k2d; });
|
||||
}
|
||||
|
||||
sem::DepthMultisampledTexture* build_texture_depth_multisampled_2d(
|
||||
MatchState& state) {
|
||||
return state.builder.create<sem::DepthMultisampledTexture>(
|
||||
ast::TextureDimension::k2d);
|
||||
}
|
||||
|
||||
bool match_texture_storage(const sem::Type* ty,
|
||||
ast::TextureDimension dim,
|
||||
Number& F,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "gmock/gmock.h"
|
||||
#include "src/program_builder.h"
|
||||
#include "src/sem/depth_multisampled_texture_type.h"
|
||||
#include "src/sem/depth_texture_type.h"
|
||||
#include "src/sem/external_texture_type.h"
|
||||
#include "src/sem/multisampled_texture_type.h"
|
||||
|
@ -346,6 +347,26 @@ TEST_F(IntrinsicTableTest, MatchDepthTexture) {
|
|||
EXPECT_EQ(result->Parameters()[2]->Usage(), ParameterUsage::kLevel);
|
||||
}
|
||||
|
||||
TEST_F(IntrinsicTableTest, MatchDepthMultisampledTexture) {
|
||||
auto* f32 = create<sem::F32>();
|
||||
auto* i32 = create<sem::I32>();
|
||||
auto* vec2_i32 = create<sem::Vector>(i32, 2);
|
||||
auto* tex = create<sem::DepthMultisampledTexture>(ast::TextureDimension::k2d);
|
||||
auto* result = table->Lookup(IntrinsicType::kTextureLoad,
|
||||
{tex, vec2_i32, i32}, Source{});
|
||||
ASSERT_NE(result, nullptr) << Diagnostics().str();
|
||||
ASSERT_EQ(Diagnostics().str(), "");
|
||||
EXPECT_THAT(result->Type(), IntrinsicType::kTextureLoad);
|
||||
EXPECT_THAT(result->ReturnType(), f32);
|
||||
ASSERT_EQ(result->Parameters().size(), 3u);
|
||||
EXPECT_EQ(result->Parameters()[0]->Type(), tex);
|
||||
EXPECT_EQ(result->Parameters()[0]->Usage(), ParameterUsage::kTexture);
|
||||
EXPECT_EQ(result->Parameters()[1]->Type(), vec2_i32);
|
||||
EXPECT_EQ(result->Parameters()[1]->Usage(), ParameterUsage::kCoords);
|
||||
EXPECT_EQ(result->Parameters()[2]->Type(), i32);
|
||||
EXPECT_EQ(result->Parameters()[2]->Usage(), ParameterUsage::kSampleIndex);
|
||||
}
|
||||
|
||||
TEST_F(IntrinsicTableTest, MatchExternalTexture) {
|
||||
auto* f32 = create<sem::F32>();
|
||||
auto* i32 = create<sem::I32>();
|
||||
|
@ -519,7 +540,7 @@ TEST_F(IntrinsicTableTest, OverloadOrderByNumberOfParameters) {
|
|||
ASSERT_EQ(Diagnostics().str(),
|
||||
R"(error: no matching call to textureDimensions(bool, bool)
|
||||
|
||||
26 candidate functions:
|
||||
27 candidate functions:
|
||||
textureDimensions(texture: texture_1d<T>, level: i32) -> i32 where: T is f32, i32 or u32
|
||||
textureDimensions(texture: texture_2d<T>, level: i32) -> vec2<i32> where: T is f32, i32 or u32
|
||||
textureDimensions(texture: texture_2d_array<T>, level: i32) -> vec2<i32> where: T is f32, i32 or u32
|
||||
|
@ -541,6 +562,7 @@ TEST_F(IntrinsicTableTest, OverloadOrderByNumberOfParameters) {
|
|||
textureDimensions(texture: texture_depth_2d_array) -> vec2<i32>
|
||||
textureDimensions(texture: texture_depth_cube) -> vec2<i32>
|
||||
textureDimensions(texture: texture_depth_cube_array) -> vec2<i32>
|
||||
textureDimensions(texture: texture_depth_multisampled_2d) -> vec2<i32>
|
||||
textureDimensions(texture: texture_storage_1d<F, A>) -> i32 where: A is read or write
|
||||
textureDimensions(texture: texture_storage_2d<F, A>) -> vec2<i32> where: A is read or write
|
||||
textureDimensions(texture: texture_storage_2d_array<F, A>) -> vec2<i32> where: A is read or write
|
||||
|
@ -557,7 +579,7 @@ TEST_F(IntrinsicTableTest, OverloadOrderByMatchingParameter) {
|
|||
Diagnostics().str(),
|
||||
R"(error: no matching call to textureDimensions(texture_depth_2d, bool)
|
||||
|
||||
26 candidate functions:
|
||||
27 candidate functions:
|
||||
textureDimensions(texture: texture_depth_2d, level: i32) -> vec2<i32>
|
||||
textureDimensions(texture: texture_depth_2d) -> vec2<i32>
|
||||
textureDimensions(texture: texture_1d<T>, level: i32) -> i32 where: T is f32, i32 or u32
|
||||
|
@ -579,6 +601,7 @@ TEST_F(IntrinsicTableTest, OverloadOrderByMatchingParameter) {
|
|||
textureDimensions(texture: texture_depth_2d_array) -> vec2<i32>
|
||||
textureDimensions(texture: texture_depth_cube) -> vec2<i32>
|
||||
textureDimensions(texture: texture_depth_cube_array) -> vec2<i32>
|
||||
textureDimensions(texture: texture_depth_multisampled_2d) -> vec2<i32>
|
||||
textureDimensions(texture: texture_storage_1d<F, A>) -> i32 where: A is read or write
|
||||
textureDimensions(texture: texture_storage_2d<F, A>) -> vec2<i32> where: A is read or write
|
||||
textureDimensions(texture: texture_storage_2d_array<F, A>) -> vec2<i32> where: A is read or write
|
||||
|
|
|
@ -90,6 +90,7 @@ type texture_depth_2d
|
|||
type texture_depth_2d_array
|
||||
type texture_depth_cube
|
||||
type texture_depth_cube_array
|
||||
type texture_depth_multisampled_2d
|
||||
type texture_storage_1d<F: texel_format, A: access>
|
||||
type texture_storage_2d<F: texel_format, A: access>
|
||||
type texture_storage_2d_array<F: texel_format, A: access>
|
||||
|
@ -418,6 +419,7 @@ fn textureDimensions(texture: texture_depth_cube) -> vec2<i32>
|
|||
fn textureDimensions(texture: texture_depth_cube, level: i32) -> vec2<i32>
|
||||
fn textureDimensions(texture: texture_depth_cube_array) -> vec2<i32>
|
||||
fn textureDimensions(texture: texture_depth_cube_array, level: i32) -> vec2<i32>
|
||||
fn textureDimensions(texture: texture_depth_multisampled_2d) -> vec2<i32>
|
||||
fn textureDimensions<F: texel_format, A: read_or_write>(texture: texture_storage_1d<F, A>) -> i32
|
||||
fn textureDimensions<F: texel_format, A: read_or_write>(texture: texture_storage_2d<F, A>) -> vec2<i32>
|
||||
fn textureDimensions<F: texel_format, A: read_or_write>(texture: texture_storage_2d_array<F, A>) -> vec2<i32>
|
||||
|
@ -439,6 +441,7 @@ fn textureNumLevels(texture: texture_depth_2d_array) -> i32
|
|||
fn textureNumLevels(texture: texture_depth_cube) -> i32
|
||||
fn textureNumLevels(texture: texture_depth_cube_array) -> i32
|
||||
fn textureNumSamples<T: fiu32>(texture: texture_multisampled_2d<T>) -> i32
|
||||
fn textureNumSamples(texture: texture_depth_multisampled_2d) -> i32
|
||||
[[stage("fragment")]] fn textureSample(texture: texture_1d<f32>, sampler: sampler, coords: f32) -> vec4<f32>
|
||||
[[stage("fragment")]] fn textureSample(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
|
||||
[[stage("fragment")]] fn textureSample(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, offset: vec2<i32>) -> vec4<f32>
|
||||
|
@ -516,6 +519,7 @@ fn textureLoad<T: fiu32>(texture: texture_3d<T>, coords: vec3<i32>, level: i32)
|
|||
fn textureLoad<T: fiu32>(texture: texture_multisampled_2d<T>, coords: vec2<i32>, sample_index: i32) -> vec4<T>
|
||||
fn textureLoad(texture: texture_depth_2d, coords: vec2<i32>, level: i32) -> f32
|
||||
fn textureLoad(texture: texture_depth_2d_array, coords: vec2<i32>, array_index: i32, level: i32) -> f32
|
||||
fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2<i32>, sample_index: i32) -> f32
|
||||
[[deprecated]] fn textureLoad(texture: texture_storage_1d<f32_texel_format, read>, coords: i32) -> vec4<f32>
|
||||
[[deprecated]] fn textureLoad(texture: texture_storage_2d<f32_texel_format, read>, coords: vec2<i32>) -> vec4<f32>
|
||||
[[deprecated]] fn textureLoad(texture: texture_storage_2d_array<f32_texel_format, read>, coords: vec2<i32>, array_index: i32) -> vec4<f32>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "src/ast/call_expression.h"
|
||||
#include "src/ast/call_statement.h"
|
||||
#include "src/ast/case_statement.h"
|
||||
#include "src/ast/depth_multisampled_texture.h"
|
||||
#include "src/ast/depth_texture.h"
|
||||
#include "src/ast/external_texture.h"
|
||||
#include "src/ast/f32.h"
|
||||
|
@ -801,6 +802,22 @@ class ProgramBuilder {
|
|||
return builder->create<ast::DepthTexture>(source, dims);
|
||||
}
|
||||
|
||||
/// @param dims the dimensionality of the texture
|
||||
/// @returns the multisampled depth texture
|
||||
ast::DepthMultisampledTexture* depth_multisampled_texture(
|
||||
ast::TextureDimension dims) const {
|
||||
return builder->create<ast::DepthMultisampledTexture>(dims);
|
||||
}
|
||||
|
||||
/// @param source the Source of the node
|
||||
/// @param dims the dimensionality of the texture
|
||||
/// @returns the multisampled depth texture
|
||||
ast::DepthMultisampledTexture* depth_multisampled_texture(
|
||||
const Source& source,
|
||||
ast::TextureDimension dims) const {
|
||||
return builder->create<ast::DepthMultisampledTexture>(source, dims);
|
||||
}
|
||||
|
||||
/// @param dims the dimensionality of the texture
|
||||
/// @param subtype the texture subtype.
|
||||
/// @returns the sampled texture
|
||||
|
|
|
@ -5404,7 +5404,7 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) {
|
|||
// dref gather vec4 ImageFetch vec4 TODO(dneto)
|
||||
// Construct a 4-element vector with the result from the builtin in the
|
||||
// first component.
|
||||
if (texture_type->Is<DepthTexture>()) {
|
||||
if (texture_type->IsAnyOf<DepthTexture, DepthMultisampledTexture>()) {
|
||||
if (is_non_dref_sample || (opcode == SpvOpImageFetch)) {
|
||||
value = create<ast::TypeConstructorExpression>(
|
||||
Source{},
|
||||
|
|
|
@ -2516,7 +2516,11 @@ const Pointer* ParserImpl::GetTypeForHandleVar(
|
|||
// OpImage variable with an OpImage*Dref* instruction. In WGSL we must
|
||||
// treat that as a depth texture.
|
||||
if (image_type->depth() || usage.IsDepthTexture()) {
|
||||
if (image_type->is_multisampled()) {
|
||||
ast_store_type = ty_.DepthMultisampledTexture(dim);
|
||||
} else {
|
||||
ast_store_type = ty_.DepthTexture(dim);
|
||||
}
|
||||
} else if (image_type->is_multisampled()) {
|
||||
if (dim != ast::TextureDimension::k2d) {
|
||||
Fail() << "WGSL multisampled textures must be 2d and non-arrayed: "
|
||||
|
|
|
@ -3973,6 +3973,52 @@ INSTANTIATE_TEST_SUITE_P(ImageFetch_Depth,
|
|||
}
|
||||
})"}}));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ImageFetch_DepthMultisampled,
|
||||
// In SPIR-V OpImageFetch always yields a vector of 4
|
||||
// elements, even for depth images. But in WGSL,
|
||||
// textureLoad on a depth image yields f32.
|
||||
// crbug.com/tint/439
|
||||
SpvParserHandleTest_ImageAccessTest,
|
||||
::testing::ValuesIn(std::vector<ImageAccessCase>{
|
||||
// ImageFetch on multisampled depth image.
|
||||
{"%float 2D 1 0 1 1 Unknown",
|
||||
"%99 = OpImageFetch %v4float %im %vi12 Sample %i1",
|
||||
R"(Variable{
|
||||
Decorations{
|
||||
GroupDecoration{2}
|
||||
BindingDecoration{1}
|
||||
}
|
||||
x_20
|
||||
none
|
||||
undefined
|
||||
__depth_multisampled_texture_2d
|
||||
})",
|
||||
R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_99
|
||||
none
|
||||
undefined
|
||||
__vec_4__f32
|
||||
{
|
||||
TypeConstructor[not set]{
|
||||
__vec_4__f32
|
||||
Call[not set]{
|
||||
Identifier[not set]{textureLoad}
|
||||
(
|
||||
Identifier[not set]{x_20}
|
||||
Identifier[not set]{vi12}
|
||||
Identifier[not set]{i1}
|
||||
)
|
||||
}
|
||||
ScalarConstructor[not set]{0.000000}
|
||||
ScalarConstructor[not set]{0.000000}
|
||||
ScalarConstructor[not set]{0.000000}
|
||||
}
|
||||
}
|
||||
}
|
||||
})"}}));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ImageFetch_Multisampled,
|
||||
SpvParserHandleTest_ImageAccessTest,
|
||||
|
|
|
@ -36,6 +36,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::reader::spirv::Array);
|
|||
TINT_INSTANTIATE_TYPEINFO(tint::reader::spirv::Sampler);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::reader::spirv::Texture);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::reader::spirv::DepthTexture);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::reader::spirv::DepthMultisampledTexture);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::reader::spirv::MultisampledTexture);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::reader::spirv::SampledTexture);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::reader::spirv::StorageTexture);
|
||||
|
@ -206,6 +207,15 @@ ast::Type* DepthTexture::Build(ProgramBuilder& b) const {
|
|||
return b.ty.depth_texture(dims);
|
||||
}
|
||||
|
||||
DepthMultisampledTexture::DepthMultisampledTexture(ast::TextureDimension d)
|
||||
: Base(d) {}
|
||||
DepthMultisampledTexture::DepthMultisampledTexture(
|
||||
const DepthMultisampledTexture&) = default;
|
||||
|
||||
ast::Type* DepthMultisampledTexture::Build(ProgramBuilder& b) const {
|
||||
return b.ty.depth_multisampled_texture(dims);
|
||||
}
|
||||
|
||||
MultisampledTexture::MultisampledTexture(ast::TextureDimension d, const Type* t)
|
||||
: Base(d), type(t) {}
|
||||
MultisampledTexture::MultisampledTexture(const MultisampledTexture&) = default;
|
||||
|
@ -288,6 +298,10 @@ struct TypeManager::State {
|
|||
/// Map of ast::TextureDimension to returned DepthTexture instance
|
||||
std::unordered_map<ast::TextureDimension, const spirv::DepthTexture*>
|
||||
depth_textures_;
|
||||
/// Map of ast::TextureDimension to returned DepthMultisampledTexture instance
|
||||
std::unordered_map<ast::TextureDimension,
|
||||
const spirv::DepthMultisampledTexture*>
|
||||
depth_multisampled_textures_;
|
||||
/// Map of MultisampledTexture to the returned MultisampledTexture type
|
||||
/// instance
|
||||
std::unordered_map<spirv::MultisampledTexture,
|
||||
|
@ -487,6 +501,13 @@ const spirv::DepthTexture* TypeManager::DepthTexture(
|
|||
});
|
||||
}
|
||||
|
||||
const spirv::DepthMultisampledTexture* TypeManager::DepthMultisampledTexture(
|
||||
ast::TextureDimension dims) {
|
||||
return utils::GetOrCreate(state->depth_multisampled_textures_, dims, [&] {
|
||||
return state->allocator_.Create<spirv::DepthMultisampledTexture>(dims);
|
||||
});
|
||||
}
|
||||
|
||||
const spirv::MultisampledTexture* TypeManager::MultisampledTexture(
|
||||
ast::TextureDimension dims,
|
||||
const Type* ty) {
|
||||
|
@ -586,6 +607,12 @@ std::string DepthTexture::String() const {
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
std::string DepthMultisampledTexture::String() const {
|
||||
std::stringstream ss;
|
||||
ss << "depth_multisampled_" << dims;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string MultisampledTexture::String() const {
|
||||
std::stringstream ss;
|
||||
ss << "texture_multisampled_" << dims << "<" << type << ">";
|
||||
|
|
|
@ -344,6 +344,27 @@ struct DepthTexture : public Castable<DepthTexture, Texture> {
|
|||
#endif // NDEBUG
|
||||
};
|
||||
|
||||
/// `texture_depth_multisampled_D` type
|
||||
struct DepthMultisampledTexture
|
||||
: public Castable<DepthMultisampledTexture, Texture> {
|
||||
/// Constructor
|
||||
/// @param d the texture dimensions
|
||||
explicit DepthMultisampledTexture(ast::TextureDimension d);
|
||||
|
||||
/// Copy constructor
|
||||
/// @param other the other type to copy
|
||||
DepthMultisampledTexture(const DepthMultisampledTexture& other);
|
||||
|
||||
/// @param b the ProgramBuilder used to construct the AST types
|
||||
/// @returns the constructed ast::Type node for the given type
|
||||
ast::Type* Build(ProgramBuilder& b) const override;
|
||||
|
||||
#ifndef NDEBUG
|
||||
/// @returns a string representation of the type, for debug purposes only
|
||||
std::string String() const override;
|
||||
#endif // NDEBUG
|
||||
};
|
||||
|
||||
/// `texture_multisampled_D<T>` type
|
||||
struct MultisampledTexture : public Castable<MultisampledTexture, Texture> {
|
||||
/// Constructor
|
||||
|
@ -549,6 +570,11 @@ class TypeManager {
|
|||
/// return the same pointer.
|
||||
const spirv::DepthTexture* DepthTexture(ast::TextureDimension d);
|
||||
/// @param d the texture dimensions
|
||||
/// @return a DepthMultisampledTexture type. Repeated calls with the same
|
||||
/// arguments will return the same pointer.
|
||||
const spirv::DepthMultisampledTexture* DepthMultisampledTexture(
|
||||
ast::TextureDimension d);
|
||||
/// @param d the texture dimensions
|
||||
/// @param t the multisampled texture type
|
||||
/// @return a MultisampledTexture type. Repeated calls with the same arguments
|
||||
/// will return the same pointer.
|
||||
|
|
|
@ -931,6 +931,10 @@ Token Lexer::check_keyword(const Source& source, const std::string& str) {
|
|||
return {Token::Type::kTextureDepthCubeArray, source,
|
||||
"texture_depth_cube_array"};
|
||||
}
|
||||
if (str == "texture_depth_multisampled_2d") {
|
||||
return {Token::Type::kTextureDepthMultisampled2d, source,
|
||||
"texture_depth_multisampled_2d"};
|
||||
}
|
||||
if (str == "texture_external") {
|
||||
return {Token::Type::kTextureExternal, source, "texture_external"};
|
||||
}
|
||||
|
|
|
@ -543,6 +543,8 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
TokenData{"texture_depth_cube", Token::Type::kTextureDepthCube},
|
||||
TokenData{"texture_depth_cube_array",
|
||||
Token::Type::kTextureDepthCubeArray},
|
||||
TokenData{"texture_depth_multisampled_2d",
|
||||
Token::Type::kTextureDepthMultisampled2d},
|
||||
TokenData{"texture_multisampled_2d",
|
||||
Token::Type::kTextureMultisampled2d},
|
||||
TokenData{"texture_storage_1d", Token::Type::kTextureStorage1d},
|
||||
|
|
|
@ -724,21 +724,25 @@ Maybe<ast::TextureDimension> ParserImpl::storage_texture_type() {
|
|||
// | TEXTURE_DEPTH_2D_ARRAY
|
||||
// | TEXTURE_DEPTH_CUBE
|
||||
// | TEXTURE_DEPTH_CUBE_ARRAY
|
||||
// | TEXTURE_DEPTH_MULTISAMPLED_2D
|
||||
Maybe<ast::Type*> ParserImpl::depth_texture_type() {
|
||||
Source source;
|
||||
|
||||
if (match(Token::Type::kTextureDepth2d, &source))
|
||||
if (match(Token::Type::kTextureDepth2d, &source)) {
|
||||
return builder_.ty.depth_texture(source, ast::TextureDimension::k2d);
|
||||
|
||||
if (match(Token::Type::kTextureDepth2dArray, &source))
|
||||
}
|
||||
if (match(Token::Type::kTextureDepth2dArray, &source)) {
|
||||
return builder_.ty.depth_texture(source, ast::TextureDimension::k2dArray);
|
||||
|
||||
if (match(Token::Type::kTextureDepthCube, &source))
|
||||
}
|
||||
if (match(Token::Type::kTextureDepthCube, &source)) {
|
||||
return builder_.ty.depth_texture(source, ast::TextureDimension::kCube);
|
||||
|
||||
if (match(Token::Type::kTextureDepthCubeArray, &source))
|
||||
}
|
||||
if (match(Token::Type::kTextureDepthCubeArray, &source)) {
|
||||
return builder_.ty.depth_texture(source, ast::TextureDimension::kCubeArray);
|
||||
|
||||
}
|
||||
if (match(Token::Type::kTextureDepthMultisampled2d, &source)) {
|
||||
return builder_.ty.depth_multisampled_texture(source,
|
||||
ast::TextureDimension::k2d);
|
||||
}
|
||||
return Failure::kNoMatch;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,19 @@ TEST_F(ParserImplTest, DepthTextureType_CubeArray) {
|
|||
EXPECT_EQ(t.value->source().range, (Source::Range{{1u, 1u}, {1u, 25u}}));
|
||||
}
|
||||
|
||||
TEST_F(ParserImplTest, DepthTextureType_Multisampled2d) {
|
||||
auto p = parser("texture_depth_multisampled_2d");
|
||||
auto t = p->depth_texture_type();
|
||||
EXPECT_TRUE(t.matched);
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
ASSERT_TRUE(t->Is<ast::Texture>());
|
||||
ASSERT_TRUE(t->Is<ast::DepthMultisampledTexture>());
|
||||
EXPECT_EQ(t->As<ast::Texture>()->dim(), ast::TextureDimension::k2d);
|
||||
EXPECT_FALSE(p->has_error());
|
||||
EXPECT_EQ(t.value->source().range, (Source::Range{{1u, 1u}, {1u, 30u}}));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace wgsl
|
||||
} // namespace reader
|
||||
|
|
|
@ -269,6 +269,8 @@ std::string Token::TypeToName(Type type) {
|
|||
return "texture_depth_cube";
|
||||
case Token::Type::kTextureDepthCubeArray:
|
||||
return "texture_depth_cube_array";
|
||||
case Token::Type::kTextureDepthMultisampled2d:
|
||||
return "texture_depth_multisampled_2d";
|
||||
case Token::Type::kTextureExternal:
|
||||
return "texture_external";
|
||||
case Token::Type::kTextureMultisampled2d:
|
||||
|
|
|
@ -277,6 +277,8 @@ class Token {
|
|||
kTextureDepthCube,
|
||||
/// A 'texture_depth_cube_array'
|
||||
kTextureDepthCubeArray,
|
||||
/// A 'texture_depth_multisampled_2d'
|
||||
kTextureDepthMultisampled2d,
|
||||
/// A 'texture_external'
|
||||
kTextureExternal,
|
||||
/// A 'texture_multisampled_2d'
|
||||
|
|
|
@ -1867,6 +1867,7 @@ const char* expected_texture_overload(
|
|||
case ValidTextureOverload::kDimensionsDepth2dArray:
|
||||
case ValidTextureOverload::kDimensionsDepthCube:
|
||||
case ValidTextureOverload::kDimensionsDepthCubeArray:
|
||||
case ValidTextureOverload::kDimensionsDepthMultisampled2d:
|
||||
case ValidTextureOverload::kDimensionsStorageRO1d:
|
||||
case ValidTextureOverload::kDimensionsStorageRO2d:
|
||||
case ValidTextureOverload::kDimensionsStorageRO2dArray:
|
||||
|
@ -1892,6 +1893,7 @@ const char* expected_texture_overload(
|
|||
case ValidTextureOverload::kNumLevelsDepthCube:
|
||||
case ValidTextureOverload::kNumLevelsDepthCubeArray:
|
||||
return R"(textureNumLevels(texture))";
|
||||
case ValidTextureOverload::kNumSamplesDepthMultisampled2d:
|
||||
case ValidTextureOverload::kNumSamplesMultisampled2d:
|
||||
return R"(textureNumSamples(texture))";
|
||||
case ValidTextureOverload::kDimensions2dLevel:
|
||||
|
@ -2019,41 +2021,29 @@ const char* expected_texture_overload(
|
|||
case ValidTextureOverload::kSampleCompareLevelDepthCubeArrayF32:
|
||||
return R"(textureSampleCompare(texture, sampler, coords, array_index, depth_ref))";
|
||||
case ValidTextureOverload::kLoad1dLevelF32:
|
||||
return R"(textureLoad(texture, coords, level))";
|
||||
case ValidTextureOverload::kLoad1dLevelU32:
|
||||
return R"(textureLoad(texture, coords, level))";
|
||||
case ValidTextureOverload::kLoad1dLevelI32:
|
||||
return R"(textureLoad(texture, coords, level))";
|
||||
case ValidTextureOverload::kLoad2dLevelF32:
|
||||
return R"(textureLoad(texture, coords, level))";
|
||||
case ValidTextureOverload::kLoad2dLevelU32:
|
||||
return R"(textureLoad(texture, coords, level))";
|
||||
case ValidTextureOverload::kLoad2dLevelI32:
|
||||
return R"(textureLoad(texture, coords, level))";
|
||||
case ValidTextureOverload::kLoad2dArrayLevelF32:
|
||||
return R"(textureLoad(texture, coords, array_index, level))";
|
||||
case ValidTextureOverload::kLoad2dArrayLevelU32:
|
||||
return R"(textureLoad(texture, coords, array_index, level))";
|
||||
case ValidTextureOverload::kLoad2dArrayLevelI32:
|
||||
return R"(textureLoad(texture, coords, array_index, level))";
|
||||
case ValidTextureOverload::kLoad3dLevelF32:
|
||||
return R"(textureLoad(texture, coords, level))";
|
||||
case ValidTextureOverload::kLoad3dLevelU32:
|
||||
return R"(textureLoad(texture, coords, level))";
|
||||
case ValidTextureOverload::kLoad3dLevelI32:
|
||||
return R"(textureLoad(texture, coords, level))";
|
||||
case ValidTextureOverload::kLoadMultisampled2dF32:
|
||||
return R"(textureLoad(texture, coords, sample_index))";
|
||||
case ValidTextureOverload::kLoadMultisampled2dU32:
|
||||
return R"(textureLoad(texture, coords, sample_index))";
|
||||
case ValidTextureOverload::kLoadMultisampled2dI32:
|
||||
return R"(textureLoad(texture, coords, sample_index))";
|
||||
case ValidTextureOverload::kLoadDepth2dLevelF32:
|
||||
return R"(textureLoad(texture, coords, level))";
|
||||
case ValidTextureOverload::kLoadDepthMultisampled2dF32:
|
||||
case ValidTextureOverload::kLoadMultisampled2dF32:
|
||||
case ValidTextureOverload::kLoadMultisampled2dU32:
|
||||
case ValidTextureOverload::kLoadMultisampled2dI32:
|
||||
return R"(textureLoad(texture, coords, sample_index))";
|
||||
case ValidTextureOverload::kLoadDepth2dArrayLevelF32:
|
||||
return R"(textureLoad(texture, coords, array_index, level))";
|
||||
case ValidTextureOverload::kLoadStorageRO1dRgba32float:
|
||||
return R"(textureLoad(texture, coords))";
|
||||
case ValidTextureOverload::kLoadStorageRO2dRgba8unorm:
|
||||
case ValidTextureOverload::kLoadStorageRO2dRgba8snorm:
|
||||
case ValidTextureOverload::kLoadStorageRO2dRgba8uint:
|
||||
|
@ -2076,13 +2066,11 @@ const char* expected_texture_overload(
|
|||
case ValidTextureOverload::kLoadStorageRO3dRgba32float:
|
||||
return R"(textureLoad(texture, coords))";
|
||||
case ValidTextureOverload::kStoreWO1dRgba32float:
|
||||
return R"(textureStore(texture, coords, value))";
|
||||
case ValidTextureOverload::kStoreWO2dRgba32float:
|
||||
case ValidTextureOverload::kStoreWO3dRgba32float:
|
||||
return R"(textureStore(texture, coords, value))";
|
||||
case ValidTextureOverload::kStoreWO2dArrayRgba32float:
|
||||
return R"(textureStore(texture, coords, array_index, value))";
|
||||
case ValidTextureOverload::kStoreWO3dRgba32float:
|
||||
return R"(textureStore(texture, coords, value))";
|
||||
}
|
||||
return "<unmatched texture overload>";
|
||||
}
|
||||
|
@ -2152,7 +2140,8 @@ TEST_P(ResolverIntrinsicTest_Texture, Call) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case ast::intrinsic::test::TextureKind::kDepth: {
|
||||
case ast::intrinsic::test::TextureKind::kDepth:
|
||||
case ast::intrinsic::test::TextureKind::kDepthMultisampled: {
|
||||
EXPECT_TRUE(TypeOf(call)->Is<sem::F32>());
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "src/sem/array.h"
|
||||
#include "src/sem/atomic_type.h"
|
||||
#include "src/sem/call.h"
|
||||
#include "src/sem/depth_multisampled_texture_type.h"
|
||||
#include "src/sem/depth_texture_type.h"
|
||||
#include "src/sem/for_loop_statement.h"
|
||||
#include "src/sem/function.h"
|
||||
|
@ -372,6 +373,9 @@ sem::Type* Resolver::Type(const ast::Type* ty) {
|
|||
if (auto* t = ty->As<ast::DepthTexture>()) {
|
||||
return builder_->create<sem::DepthTexture>(t->dim());
|
||||
}
|
||||
if (auto* t = ty->As<ast::DepthMultisampledTexture>()) {
|
||||
return builder_->create<sem::DepthMultisampledTexture>(t->dim());
|
||||
}
|
||||
if (auto* t = ty->As<ast::StorageTexture>()) {
|
||||
if (auto* el = Type(t->type())) {
|
||||
if (!ValidateStorageTexture(t)) {
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "src/sem/depth_multisampled_texture_type.h"
|
||||
|
||||
#include "src/program_builder.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::sem::DepthMultisampledTexture);
|
||||
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
namespace {
|
||||
|
||||
bool IsValidDepthDimension(ast::TextureDimension dim) {
|
||||
return dim == ast::TextureDimension::k2d;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
DepthMultisampledTexture::DepthMultisampledTexture(ast::TextureDimension dim)
|
||||
: Base(dim) {
|
||||
TINT_ASSERT(Semantic, IsValidDepthDimension(dim));
|
||||
}
|
||||
|
||||
DepthMultisampledTexture::DepthMultisampledTexture(DepthMultisampledTexture&&) =
|
||||
default;
|
||||
|
||||
DepthMultisampledTexture::~DepthMultisampledTexture() = default;
|
||||
|
||||
std::string DepthMultisampledTexture::type_name() const {
|
||||
std::ostringstream out;
|
||||
out << "__depth_multisampled_texture_" << dim();
|
||||
return out.str();
|
||||
}
|
||||
|
||||
std::string DepthMultisampledTexture::FriendlyName(const SymbolTable&) const {
|
||||
std::ostringstream out;
|
||||
out << "texture_depth_multisampled_" << dim();
|
||||
return out.str();
|
||||
}
|
||||
|
||||
} // namespace sem
|
||||
} // namespace tint
|
|
@ -0,0 +1,48 @@
|
|||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef SRC_SEM_DEPTH_MULTISAMPLED_TEXTURE_TYPE_H_
|
||||
#define SRC_SEM_DEPTH_MULTISAMPLED_TEXTURE_TYPE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "src/sem/texture_type.h"
|
||||
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
|
||||
/// A multisampled depth texture type.
|
||||
class DepthMultisampledTexture
|
||||
: public Castable<DepthMultisampledTexture, Texture> {
|
||||
public:
|
||||
/// Constructor
|
||||
/// @param dim the dimensionality of the texture
|
||||
explicit DepthMultisampledTexture(ast::TextureDimension dim);
|
||||
/// Move constructor
|
||||
DepthMultisampledTexture(DepthMultisampledTexture&&);
|
||||
~DepthMultisampledTexture() override;
|
||||
|
||||
/// @returns the name for this type
|
||||
std::string type_name() const override;
|
||||
|
||||
/// @param symbols the program's symbol table
|
||||
/// @returns the name for this type that closely resembles how it would be
|
||||
/// declared in WGSL.
|
||||
std::string FriendlyName(const SymbolTable& symbols) const override;
|
||||
};
|
||||
|
||||
} // namespace sem
|
||||
} // namespace tint
|
||||
|
||||
#endif // SRC_SEM_DEPTH_MULTISAMPLED_TEXTURE_TYPE_H_
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "src/sem/depth_multisampled_texture_type.h"
|
||||
|
||||
#include "src/sem/test_helper.h"
|
||||
|
||||
#include "src/sem/external_texture_type.h"
|
||||
#include "src/sem/sampled_texture_type.h"
|
||||
#include "src/sem/storage_texture_type.h"
|
||||
|
||||
namespace tint {
|
||||
namespace sem {
|
||||
namespace {
|
||||
|
||||
using DepthMultisampledTextureTest = TestHelper;
|
||||
|
||||
TEST_F(DepthMultisampledTextureTest, Dim) {
|
||||
DepthMultisampledTexture d(ast::TextureDimension::k2d);
|
||||
EXPECT_EQ(d.dim(), ast::TextureDimension::k2d);
|
||||
}
|
||||
|
||||
TEST_F(DepthMultisampledTextureTest, TypeName) {
|
||||
DepthMultisampledTexture d(ast::TextureDimension::k2d);
|
||||
EXPECT_EQ(d.type_name(), "__depth_multisampled_texture_2d");
|
||||
}
|
||||
|
||||
TEST_F(DepthMultisampledTextureTest, FriendlyName) {
|
||||
DepthMultisampledTexture d(ast::TextureDimension::k2d);
|
||||
EXPECT_EQ(d.FriendlyName(Symbols()), "texture_depth_multisampled_2d");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace sem
|
||||
} // namespace tint
|
|
@ -130,54 +130,16 @@ Function::VariableBindings Function::ReferencedMultisampledTextureVariables()
|
|||
return ReferencedSampledTextureVariablesImpl(true);
|
||||
}
|
||||
|
||||
Function::VariableBindings Function::ReferencedStorageTextureVariables() const {
|
||||
Function::VariableBindings Function::ReferencedVariablesOfType(
|
||||
const tint::TypeInfo& type_info) const {
|
||||
VariableBindings ret;
|
||||
|
||||
for (auto* var : ReferencedModuleVariables()) {
|
||||
auto* unwrapped_type = var->Type()->UnwrapRef();
|
||||
auto* storage_texture = unwrapped_type->As<sem::StorageTexture>();
|
||||
if (storage_texture == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (unwrapped_type->TypeInfo().Is(type_info)) {
|
||||
if (auto binding_point = var->Declaration()->binding_point()) {
|
||||
ret.push_back({var, binding_point});
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Function::VariableBindings Function::ReferencedDepthTextureVariables() const {
|
||||
VariableBindings ret;
|
||||
|
||||
for (auto* var : ReferencedModuleVariables()) {
|
||||
auto* unwrapped_type = var->Type()->UnwrapRef();
|
||||
auto* storage_texture = unwrapped_type->As<sem::DepthTexture>();
|
||||
if (storage_texture == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto binding_point = var->Declaration()->binding_point()) {
|
||||
ret.push_back({var, binding_point});
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Function::VariableBindings Function::ReferencedExternalTextureVariables()
|
||||
const {
|
||||
VariableBindings ret;
|
||||
|
||||
for (auto* var : ReferencedModuleVariables()) {
|
||||
auto* unwrapped_type = var->Type()->UnwrapRef();
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -144,20 +144,20 @@ class Function : public Castable<Function, CallTarget> {
|
|||
/// @returns the referenced sampled textures
|
||||
VariableBindings ReferencedMultisampledTextureVariables() const;
|
||||
|
||||
/// Retrieves any referenced storage texture variables. Note, the variables
|
||||
/// Retrieves any referenced variables of the given type. Note, the variables
|
||||
/// must be decorated with both binding and group decorations.
|
||||
/// @returns the referenced storage textures
|
||||
VariableBindings ReferencedStorageTextureVariables() const;
|
||||
/// @param type_info the type of the variables to find
|
||||
/// @returns the referenced variables
|
||||
VariableBindings ReferencedVariablesOfType(
|
||||
const tint::TypeInfo& type_info) const;
|
||||
|
||||
/// Retrieves any referenced depth texture variables. Note, the variables
|
||||
/// Retrieves any referenced variables of the given type. Note, the variables
|
||||
/// must be decorated with both binding and group decorations.
|
||||
/// @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;
|
||||
/// @returns the referenced variables
|
||||
template <typename T>
|
||||
VariableBindings ReferencedVariablesOfType() const {
|
||||
return ReferencedVariablesOfType(TypeInfo::Of<T>());
|
||||
}
|
||||
|
||||
/// Checks if the given entry point is an ancestor
|
||||
/// @param sym the entry point symbol
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "src/program_builder.h"
|
||||
#include "src/sem/atomic_type.h"
|
||||
#include "src/sem/block_statement.h"
|
||||
#include "src/sem/depth_multisampled_texture_type.h"
|
||||
#include "src/sem/for_loop_statement.h"
|
||||
#include "src/sem/reference_type.h"
|
||||
#include "src/sem/sampler_type.h"
|
||||
|
@ -146,6 +147,9 @@ ast::Type* Transform::CreateASTTypeFor(CloneContext& ctx, const sem::Type* ty) {
|
|||
if (auto* t = ty->As<sem::DepthTexture>()) {
|
||||
return ctx.dst->create<ast::DepthTexture>(t->dim());
|
||||
}
|
||||
if (auto* t = ty->As<sem::DepthMultisampledTexture>()) {
|
||||
return ctx.dst->create<ast::DepthMultisampledTexture>(t->dim());
|
||||
}
|
||||
if (auto* t = ty->As<sem::MultisampledTexture>()) {
|
||||
return ctx.dst->create<ast::MultisampledTexture>(
|
||||
t->dim(), CreateASTTypeFor(ctx, t->type()));
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "src/sem/atomic_type.h"
|
||||
#include "src/sem/block_statement.h"
|
||||
#include "src/sem/call.h"
|
||||
#include "src/sem/depth_multisampled_texture_type.h"
|
||||
#include "src/sem/depth_texture_type.h"
|
||||
#include "src/sem/function.h"
|
||||
#include "src/sem/member_accessor_expression.h"
|
||||
|
@ -1605,7 +1606,8 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
|
|||
case sem::IntrinsicType::kTextureNumLevels:
|
||||
case sem::IntrinsicType::kTextureNumSamples: {
|
||||
// All of these intrinsics use the GetDimensions() method on the texture
|
||||
bool is_ms = texture_type->Is<sem::MultisampledTexture>();
|
||||
bool is_ms = texture_type->IsAnyOf<sem::MultisampledTexture,
|
||||
sem::DepthMultisampledTexture>();
|
||||
int num_dimensions = 0;
|
||||
std::string swizzle;
|
||||
|
||||
|
@ -3002,7 +3004,8 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
|||
out << StructName(str);
|
||||
} else if (auto* tex = type->As<sem::Texture>()) {
|
||||
auto* storage = tex->As<sem::StorageTexture>();
|
||||
auto* multism = tex->As<sem::MultisampledTexture>();
|
||||
auto* ms = tex->As<sem::MultisampledTexture>();
|
||||
auto* depth_ms = tex->As<sem::DepthMultisampledTexture>();
|
||||
auto* sampled = tex->As<sem::SampledTexture>();
|
||||
|
||||
if (storage && storage->access() != ast::Access::kRead) {
|
||||
|
@ -3015,10 +3018,10 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
|||
out << "1D";
|
||||
break;
|
||||
case ast::TextureDimension::k2d:
|
||||
out << (multism ? "2DMS" : "2D");
|
||||
out << ((ms || depth_ms) ? "2DMS" : "2D");
|
||||
break;
|
||||
case ast::TextureDimension::k2dArray:
|
||||
out << (multism ? "2DMSArray" : "2DArray");
|
||||
out << ((ms || depth_ms) ? "2DMSArray" : "2DArray");
|
||||
break;
|
||||
case ast::TextureDimension::k3d:
|
||||
out << "3D";
|
||||
|
@ -3044,8 +3047,10 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
|||
return false;
|
||||
}
|
||||
out << "<" << component << ">";
|
||||
} else if (sampled || multism) {
|
||||
auto* subtype = sampled ? sampled->type() : multism->type();
|
||||
} else if (depth_ms) {
|
||||
out << "<float4>";
|
||||
} else if (sampled || ms) {
|
||||
auto* subtype = sampled ? sampled->type() : ms->type();
|
||||
out << "<";
|
||||
if (subtype->Is<sem::F32>()) {
|
||||
out << "float4";
|
||||
|
|
|
@ -56,6 +56,7 @@ ExpectedResult expected_texture_overload(
|
|||
)",
|
||||
"tint_tmp;",
|
||||
};
|
||||
case ValidTextureOverload::kDimensionsDepthMultisampled2d:
|
||||
case ValidTextureOverload::kDimensionsMultisampled2d:
|
||||
return {
|
||||
R"(int3 tint_tmp;
|
||||
|
@ -170,6 +171,7 @@ ExpectedResult expected_texture_overload(
|
|||
)",
|
||||
"tint_tmp.w;",
|
||||
};
|
||||
case ValidTextureOverload::kNumSamplesDepthMultisampled2d:
|
||||
case ValidTextureOverload::kNumSamplesMultisampled2d:
|
||||
return {
|
||||
R"(int3 tint_tmp;
|
||||
|
@ -292,33 +294,23 @@ ExpectedResult expected_texture_overload(
|
|||
case ValidTextureOverload::kSampleCompareLevelDepthCubeArrayF32:
|
||||
return R"(tint_symbol.SampleCmpLevelZero(tint_symbol_1, float4(1.0f, 2.0f, 3.0f, float(4)), 5.0f);)";
|
||||
case ValidTextureOverload::kLoad1dLevelF32:
|
||||
return R"(tint_symbol.Load(int2(1, 3));)";
|
||||
case ValidTextureOverload::kLoad1dLevelU32:
|
||||
return R"(tint_symbol.Load(int2(1, 3));)";
|
||||
case ValidTextureOverload::kLoad1dLevelI32:
|
||||
return R"(tint_symbol.Load(int2(1, 3));)";
|
||||
case ValidTextureOverload::kLoad2dLevelF32:
|
||||
return R"(tint_symbol.Load(int3(1, 2, 3));)";
|
||||
case ValidTextureOverload::kLoad2dLevelU32:
|
||||
return R"(tint_symbol.Load(int3(1, 2, 3));)";
|
||||
case ValidTextureOverload::kLoad2dLevelI32:
|
||||
return R"(tint_symbol.Load(int3(1, 2, 3));)";
|
||||
case ValidTextureOverload::kLoad2dArrayLevelF32:
|
||||
return R"(tint_symbol.Load(int4(1, 2, 3, 4));)";
|
||||
case ValidTextureOverload::kLoad2dArrayLevelU32:
|
||||
return R"(tint_symbol.Load(int4(1, 2, 3, 4));)";
|
||||
case ValidTextureOverload::kLoad2dArrayLevelI32:
|
||||
return R"(tint_symbol.Load(int4(1, 2, 3, 4));)";
|
||||
case ValidTextureOverload::kLoad3dLevelF32:
|
||||
return R"(tint_symbol.Load(int4(1, 2, 3, 4));)";
|
||||
case ValidTextureOverload::kLoad3dLevelU32:
|
||||
return R"(tint_symbol.Load(int4(1, 2, 3, 4));)";
|
||||
case ValidTextureOverload::kLoad3dLevelI32:
|
||||
return R"(tint_symbol.Load(int4(1, 2, 3, 4));)";
|
||||
case ValidTextureOverload::kLoadDepthMultisampled2dF32:
|
||||
case ValidTextureOverload::kLoadMultisampled2dF32:
|
||||
return R"(tint_symbol.Load(int2(1, 2), 3);)";
|
||||
case ValidTextureOverload::kLoadMultisampled2dU32:
|
||||
return R"(tint_symbol.Load(int2(1, 2), 3);)";
|
||||
case ValidTextureOverload::kLoadMultisampled2dI32:
|
||||
return R"(tint_symbol.Load(int2(1, 2), 3);)";
|
||||
case ValidTextureOverload::kLoadDepth2dLevelF32:
|
||||
|
@ -345,7 +337,6 @@ ExpectedResult expected_texture_overload(
|
|||
case ValidTextureOverload::kLoadStorageRO2dRgba32float:
|
||||
return R"(tint_symbol.Load(int3(1, 2, 0));)";
|
||||
case ValidTextureOverload::kLoadStorageRO2dArrayRgba32float:
|
||||
return R"(tint_symbol.Load(int4(1, 2, 3, 0));)";
|
||||
case ValidTextureOverload::kLoadStorageRO3dRgba32float:
|
||||
return R"(tint_symbol.Load(int4(1, 2, 3, 0));)";
|
||||
case ValidTextureOverload::kStoreWO1dRgba32float:
|
||||
|
|
|
@ -361,6 +361,26 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
HlslDepthTextureData{ast::TextureDimension::kCubeArray,
|
||||
"TextureCubeArray tex : register(t1, space2);"}));
|
||||
|
||||
using HlslDepthMultisampledTexturesTest = TestHelper;
|
||||
TEST_F(HlslDepthMultisampledTexturesTest, Emit) {
|
||||
auto* t = ty.depth_multisampled_texture(ast::TextureDimension::k2d);
|
||||
|
||||
Global("tex", t,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(1),
|
||||
create<ast::GroupDecoration>(2),
|
||||
});
|
||||
|
||||
Func("main", {}, ty.void_(), {Ignore(Call("textureDimensions", "tex"))},
|
||||
{Stage(ast::PipelineStage::kFragment)});
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||
EXPECT_THAT(gen.result(),
|
||||
HasSubstr("Texture2DMS<float4> tex : register(t1, space2);"));
|
||||
}
|
||||
|
||||
enum class TextureDataType { F32, U32, I32 };
|
||||
struct HlslSampledTextureData {
|
||||
ast::TextureDimension dim;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "src/sem/atomic_type.h"
|
||||
#include "src/sem/bool_type.h"
|
||||
#include "src/sem/call.h"
|
||||
#include "src/sem/depth_multisampled_texture_type.h"
|
||||
#include "src/sem/depth_texture_type.h"
|
||||
#include "src/sem/f32_type.h"
|
||||
#include "src/sem/function.h"
|
||||
|
@ -2034,7 +2035,7 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
|||
}
|
||||
|
||||
if (auto* tex = type->As<sem::Texture>()) {
|
||||
if (tex->Is<sem::DepthTexture>()) {
|
||||
if (tex->IsAnyOf<sem::DepthTexture, sem::DepthMultisampledTexture>()) {
|
||||
out << "depth";
|
||||
} else {
|
||||
out << "texture";
|
||||
|
@ -2064,12 +2065,15 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
|||
"Invalid texture dimensions");
|
||||
return false;
|
||||
}
|
||||
if (tex->Is<sem::MultisampledTexture>()) {
|
||||
if (tex->IsAnyOf<sem::MultisampledTexture,
|
||||
sem::DepthMultisampledTexture>()) {
|
||||
out << "_ms";
|
||||
}
|
||||
out << "<";
|
||||
if (tex->Is<sem::DepthTexture>()) {
|
||||
out << "float, access::sample";
|
||||
} else if (tex->Is<sem::DepthMultisampledTexture>()) {
|
||||
out << "float, access::read";
|
||||
} else if (auto* storage = tex->As<sem::StorageTexture>()) {
|
||||
if (!EmitType(out, storage->type(), "")) {
|
||||
return false;
|
||||
|
|
|
@ -38,6 +38,7 @@ std::string expected_texture_overload(
|
|||
case ValidTextureOverload::kDimensionsDepth2dArray:
|
||||
case ValidTextureOverload::kDimensionsDepthCube:
|
||||
case ValidTextureOverload::kDimensionsDepthCubeArray:
|
||||
case ValidTextureOverload::kDimensionsDepthMultisampled2d:
|
||||
case ValidTextureOverload::kDimensionsStorageRO2d:
|
||||
case ValidTextureOverload::kDimensionsStorageRO2dArray:
|
||||
case ValidTextureOverload::kDimensionsStorageWO2d:
|
||||
|
@ -74,6 +75,7 @@ std::string expected_texture_overload(
|
|||
case ValidTextureOverload::kNumLevelsDepthCube:
|
||||
case ValidTextureOverload::kNumLevelsDepthCubeArray:
|
||||
return R"(int(texture.get_num_mip_levels()))";
|
||||
case ValidTextureOverload::kNumSamplesDepthMultisampled2d:
|
||||
case ValidTextureOverload::kNumSamplesMultisampled2d:
|
||||
return R"(int(texture.get_num_samples()))";
|
||||
case ValidTextureOverload::kSample1dF32:
|
||||
|
@ -221,6 +223,7 @@ std::string expected_texture_overload(
|
|||
case ValidTextureOverload::kLoadMultisampled2dI32:
|
||||
return R"(texture.read(uint2(int2(1, 2)), 3))";
|
||||
case ValidTextureOverload::kLoadDepth2dLevelF32:
|
||||
case ValidTextureOverload::kLoadDepthMultisampled2dF32:
|
||||
return R"(texture.read(uint2(int2(1, 2)), 3))";
|
||||
case ValidTextureOverload::kLoadDepth2dArrayLevelF32:
|
||||
return R"(texture.read(uint2(int2(1, 2)), 3, 4))";
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "gmock/gmock.h"
|
||||
|
||||
#include "src/ast/struct_block_decoration.h"
|
||||
#include "src/sem/depth_multisampled_texture_type.h"
|
||||
#include "src/sem/depth_texture_type.h"
|
||||
#include "src/sem/multisampled_texture_type.h"
|
||||
#include "src/sem/sampled_texture_type.h"
|
||||
|
@ -780,6 +781,17 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
ast::TextureDimension::kCubeArray,
|
||||
"depthcube_array<float, access::sample>"}));
|
||||
|
||||
using MslDepthMultisampledTexturesTest = TestHelper;
|
||||
TEST_F(MslDepthMultisampledTexturesTest, Emit) {
|
||||
sem::DepthMultisampledTexture s(ast::TextureDimension::k2d);
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
||||
std::stringstream out;
|
||||
ASSERT_TRUE(gen.EmitType(out, &s, "")) << gen.error();
|
||||
EXPECT_EQ(out.str(), "depth2d_ms<float, access::read>");
|
||||
}
|
||||
|
||||
struct MslTextureData {
|
||||
ast::TextureDimension dim;
|
||||
std::string result;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "src/sem/array.h"
|
||||
#include "src/sem/atomic_type.h"
|
||||
#include "src/sem/call.h"
|
||||
#include "src/sem/depth_multisampled_texture_type.h"
|
||||
#include "src/sem/depth_texture_type.h"
|
||||
#include "src/sem/function.h"
|
||||
#include "src/sem/intrinsic.h"
|
||||
|
@ -2697,7 +2698,8 @@ bool Builder::GenerateTextureIntrinsic(ast::CallExpression* call,
|
|||
// If the texture is not a depth texture, then this function simply delegates
|
||||
// to calling append_result_type_and_id_to_spirv_params().
|
||||
auto append_result_type_and_id_to_spirv_params_for_read = [&]() {
|
||||
if (texture_type->Is<sem::DepthTexture>()) {
|
||||
if (texture_type
|
||||
->IsAnyOf<sem::DepthTexture, sem::DepthMultisampledTexture>()) {
|
||||
auto* f32 = builder_.create<sem::F32>();
|
||||
auto* spirv_result_type = builder_.create<sem::Vector>(f32, 4);
|
||||
auto spirv_result = result_op();
|
||||
|
@ -2821,8 +2823,9 @@ bool Builder::GenerateTextureIntrinsic(ast::CallExpression* call,
|
|||
}
|
||||
|
||||
spirv_params.emplace_back(gen_arg(Usage::kTexture));
|
||||
if (texture_type->Is<sem::MultisampledTexture>() ||
|
||||
texture_type->Is<sem::StorageTexture>()) {
|
||||
if (texture_type->IsAnyOf<sem::MultisampledTexture, //
|
||||
sem::DepthMultisampledTexture, //
|
||||
sem::StorageTexture>()) {
|
||||
op = spv::Op::OpImageQuerySize;
|
||||
} else if (auto* level = arg(Usage::kLevel)) {
|
||||
op = spv::Op::OpImageQuerySizeLod;
|
||||
|
@ -3805,7 +3808,6 @@ uint32_t Builder::GenerateTypeIfNeeded(const sem::Type* type) {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO(tommek): Cover multisampled textures here when they're included in AST
|
||||
bool Builder::GenerateTextureType(const sem::Texture* texture,
|
||||
const Operand& result) {
|
||||
uint32_t array_literal = 0u;
|
||||
|
@ -3833,18 +3835,19 @@ bool Builder::GenerateTextureType(const sem::Texture* texture,
|
|||
}
|
||||
|
||||
uint32_t ms_literal = 0u;
|
||||
if (texture->Is<sem::MultisampledTexture>()) {
|
||||
if (texture->IsAnyOf<sem::MultisampledTexture,
|
||||
sem::DepthMultisampledTexture>()) {
|
||||
ms_literal = 1u;
|
||||
}
|
||||
|
||||
uint32_t depth_literal = 0u;
|
||||
if (texture->Is<sem::DepthTexture>()) {
|
||||
if (texture->IsAnyOf<sem::DepthTexture, sem::DepthMultisampledTexture>()) {
|
||||
depth_literal = 1u;
|
||||
}
|
||||
|
||||
uint32_t sampled_literal = 2u;
|
||||
if (texture->Is<sem::MultisampledTexture>() ||
|
||||
texture->Is<sem::SampledTexture>() || texture->Is<sem::DepthTexture>()) {
|
||||
if (texture->IsAnyOf<sem::MultisampledTexture, sem::SampledTexture,
|
||||
sem::DepthTexture, sem::DepthMultisampledTexture>()) {
|
||||
sampled_literal = 1u;
|
||||
}
|
||||
|
||||
|
@ -3856,7 +3859,7 @@ bool Builder::GenerateTextureType(const sem::Texture* texture,
|
|||
}
|
||||
|
||||
uint32_t type_id = 0u;
|
||||
if (texture->Is<sem::DepthTexture>()) {
|
||||
if (texture->IsAnyOf<sem::DepthTexture, sem::DepthMultisampledTexture>()) {
|
||||
sem::F32 f32;
|
||||
type_id = GenerateTypeIfNeeded(&f32);
|
||||
} else if (auto* s = texture->As<sem::SampledTexture>()) {
|
||||
|
|
|
@ -472,6 +472,26 @@ OpCapability ImageQuery
|
|||
R"(
|
||||
OpCapability SampledCubeArray
|
||||
OpCapability ImageQuery
|
||||
)"};
|
||||
case ValidTextureOverload::kDimensionsDepthMultisampled2d:
|
||||
return {
|
||||
R"(
|
||||
%4 = OpTypeFloat 32
|
||||
%3 = OpTypeImage %4 2D 1 0 1 1 Unknown
|
||||
%2 = OpTypePointer UniformConstant %3
|
||||
%1 = OpVariable %2 UniformConstant
|
||||
%7 = OpTypeSampler
|
||||
%6 = OpTypePointer UniformConstant %7
|
||||
%5 = OpVariable %6 UniformConstant
|
||||
%10 = OpTypeInt 32 1
|
||||
%9 = OpTypeVector %10 2
|
||||
)",
|
||||
R"(
|
||||
%11 = OpLoad %3 %1
|
||||
%8 = OpImageQuerySize %9 %11
|
||||
)",
|
||||
R"(
|
||||
OpCapability ImageQuery
|
||||
)"};
|
||||
case ValidTextureOverload::kDimensionsStorageRO1d:
|
||||
return {
|
||||
|
@ -924,6 +944,24 @@ OpCapability ImageQuery
|
|||
)",
|
||||
R"(
|
||||
OpCapability ImageQuery
|
||||
)"};
|
||||
case ValidTextureOverload::kNumSamplesDepthMultisampled2d:
|
||||
return {R"(
|
||||
%4 = OpTypeFloat 32
|
||||
%3 = OpTypeImage %4 2D 1 0 1 1 Unknown
|
||||
%2 = OpTypePointer UniformConstant %3
|
||||
%1 = OpVariable %2 UniformConstant
|
||||
%7 = OpTypeSampler
|
||||
%6 = OpTypePointer UniformConstant %7
|
||||
%5 = OpVariable %6 UniformConstant
|
||||
%9 = OpTypeInt 32 1
|
||||
)",
|
||||
R"(
|
||||
%10 = OpLoad %3 %1
|
||||
%8 = OpImageQuerySamples %9 %10
|
||||
)",
|
||||
R"(
|
||||
OpCapability ImageQuery
|
||||
)"};
|
||||
case ValidTextureOverload::kSample1dF32:
|
||||
return {
|
||||
|
@ -3051,6 +3089,32 @@ OpCapability Sampled1D
|
|||
%11 = OpLoad %3 %1
|
||||
%9 = OpImageFetch %10 %11 %17 Lod %18
|
||||
%8 = OpCompositeExtract %4 %9 0
|
||||
)",
|
||||
R"(
|
||||
)"};
|
||||
case ValidTextureOverload::kLoadDepthMultisampled2dF32:
|
||||
return {
|
||||
R"(
|
||||
%4 = OpTypeFloat 32
|
||||
%3 = OpTypeImage %4 2D 1 1 0 1 Unknown
|
||||
%2 = OpTypePointer UniformConstant %3
|
||||
%1 = OpVariable %2 UniformConstant
|
||||
%7 = OpTypeSampler
|
||||
%6 = OpTypePointer UniformConstant %7
|
||||
%5 = OpVariable %6 UniformConstant
|
||||
%10 = OpTypeVector %4 4
|
||||
%13 = OpTypeInt 32 1
|
||||
%12 = OpTypeVector %13 3
|
||||
%14 = OpConstant %13 1
|
||||
%15 = OpConstant %13 2
|
||||
%16 = OpConstant %13 3
|
||||
%17 = OpConstantComposite %12 %14 %15 %16
|
||||
%18 = OpConstant %13 4
|
||||
)",
|
||||
R"(
|
||||
%11 = OpLoad %3 %1
|
||||
%9 = OpImageFetch %10 %11 %17 Sample %18
|
||||
%8 = OpCompositeExtract %4 %9 0
|
||||
)",
|
||||
R"(
|
||||
)"};
|
||||
|
|
|
@ -445,6 +445,8 @@ bool GeneratorImpl::EmitType(std::ostream& out, const ast::Type* ty) {
|
|||
out << "texture_";
|
||||
if (texture->Is<ast::DepthTexture>()) {
|
||||
out << "depth_";
|
||||
} else if (texture->Is<ast::DepthMultisampledTexture>()) {
|
||||
out << "depth_multisampled_";
|
||||
} else if (texture->Is<ast::SampledTexture>()) {
|
||||
/* nothing to emit */
|
||||
} else if (texture->Is<ast::MultisampledTexture>()) {
|
||||
|
|
|
@ -162,6 +162,7 @@ tint_unittests_source_set("tint_unittests_core_src") {
|
|||
"../src/ast/call_statement_test.cc",
|
||||
"../src/ast/case_statement_test.cc",
|
||||
"../src/ast/continue_statement_test.cc",
|
||||
"../src/ast/depth_multisampled_texture_test.cc",
|
||||
"../src/ast/depth_texture_test.cc",
|
||||
"../src/ast/discard_statement_test.cc",
|
||||
"../src/ast/else_statement_test.cc",
|
||||
|
@ -262,6 +263,7 @@ tint_unittests_source_set("tint_unittests_core_src") {
|
|||
"../src/scope_stack_test.cc",
|
||||
"../src/sem/atomic_type_test.cc",
|
||||
"../src/sem/bool_type_test.cc",
|
||||
"../src/sem/depth_multisampled_texture_type_test.cc",
|
||||
"../src/sem/depth_texture_type_test.cc",
|
||||
"../src/sem/external_texture_type_test.cc",
|
||||
"../src/sem/f32_type_test.cc",
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(0)]] var arg_0: texture_depth_multisampled_2d;
|
||||
|
||||
// fn ignore(texture_depth_multisampled_2d)
|
||||
fn ignore_2a6ac2() {
|
||||
ignore(arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
ignore_2a6ac2();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
ignore_2a6ac2();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
ignore_2a6ac2();
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
Texture2DMS<float4> arg_0 : register(t0, space1);
|
||||
|
||||
void ignore_2a6ac2() {
|
||||
arg_0;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
ignore_2a6ac2();
|
||||
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
ignore_2a6ac2();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
ignore_2a6ac2();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void ignore_2a6ac2(depth2d_ms<float, access::read> tint_symbol_2) {
|
||||
(void) tint_symbol_2;
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(depth2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
|
||||
ignore_2a6ac2(tint_symbol_3);
|
||||
tint_symbol const tint_symbol_1 = {.value=float4()};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depth2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
|
||||
ignore_2a6ac2(tint_symbol_4);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
|
||||
ignore_2a6ac2(tint_symbol_5);
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 33
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %ignore_2a6ac2 "ignore_2a6ac2"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%7 = OpTypeImage %float 2D 1 0 1 1 Unknown
|
||||
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%11 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11
|
||||
%void = OpTypeVoid
|
||||
%12 = OpTypeFunction %void
|
||||
%18 = OpTypeFunction %void %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%ignore_2a6ac2 = OpFunction %void None %12
|
||||
%15 = OpLabel
|
||||
%17 = OpLoad %7 %arg_0
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %18
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%21 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %12
|
||||
%23 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%25 = OpFunctionCall %void %ignore_2a6ac2
|
||||
%26 = OpFunctionCall %void %tint_symbol_2 %11
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %12
|
||||
%28 = OpLabel
|
||||
%29 = OpFunctionCall %void %ignore_2a6ac2
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %12
|
||||
%31 = OpLabel
|
||||
%32 = OpFunctionCall %void %ignore_2a6ac2
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,21 @@
|
|||
[[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d;
|
||||
|
||||
fn ignore_2a6ac2() {
|
||||
ignore(arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
ignore_2a6ac2();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
ignore_2a6ac2();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
ignore_2a6ac2();
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(0)]] var arg_0: texture_depth_multisampled_2d;
|
||||
|
||||
// fn textureDimensions(texture: texture_depth_multisampled_2d) -> vec2<i32>
|
||||
fn textureDimensions_f60bdb() {
|
||||
var res: vec2<i32> = textureDimensions(arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureDimensions_f60bdb();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureDimensions_f60bdb();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureDimensions_f60bdb();
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
Texture2DMS<float4> arg_0 : register(t0, space1);
|
||||
|
||||
void textureDimensions_f60bdb() {
|
||||
int3 tint_tmp;
|
||||
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
|
||||
int2 res = tint_tmp.xy;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
textureDimensions_f60bdb();
|
||||
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureDimensions_f60bdb();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureDimensions_f60bdb();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureDimensions_f60bdb(depth2d_ms<float, access::read> tint_symbol_2) {
|
||||
int2 res = int2(tint_symbol_2.get_width(), tint_symbol_2.get_height());
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(depth2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
|
||||
textureDimensions_f60bdb(tint_symbol_3);
|
||||
tint_symbol const tint_symbol_1 = {.value=float4()};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depth2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
|
||||
textureDimensions_f60bdb(tint_symbol_4);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
|
||||
textureDimensions_f60bdb(tint_symbol_5);
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 38
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability ImageQuery
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %textureDimensions_f60bdb "textureDimensions_f60bdb"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%7 = OpTypeImage %float 2D 1 0 1 1 Unknown
|
||||
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%11 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11
|
||||
%void = OpTypeVoid
|
||||
%12 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%_ptr_Function_v2int = OpTypePointer Function %v2int
|
||||
%22 = OpConstantNull %v2int
|
||||
%23 = OpTypeFunction %void %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureDimensions_f60bdb = OpFunction %void None %12
|
||||
%15 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v2int Function %22
|
||||
%19 = OpLoad %7 %arg_0
|
||||
%16 = OpImageQuerySize %v2int %19
|
||||
OpStore %res %16
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %23
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%26 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %12
|
||||
%28 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%30 = OpFunctionCall %void %textureDimensions_f60bdb
|
||||
%31 = OpFunctionCall %void %tint_symbol_2 %11
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %12
|
||||
%33 = OpLabel
|
||||
%34 = OpFunctionCall %void %textureDimensions_f60bdb
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %12
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %textureDimensions_f60bdb
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,21 @@
|
|||
[[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d;
|
||||
|
||||
fn textureDimensions_f60bdb() {
|
||||
var res : vec2<i32> = textureDimensions(arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureDimensions_f60bdb();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureDimensions_f60bdb();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureDimensions_f60bdb();
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(0)]] var arg_0: texture_depth_multisampled_2d;
|
||||
|
||||
// fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2<i32>, sample_index: i32) -> f32
|
||||
fn textureLoad_6273b1() {
|
||||
var res: f32 = textureLoad(arg_0, vec2<i32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureLoad_6273b1();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureLoad_6273b1();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureLoad_6273b1();
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
Texture2DMS<float4> arg_0 : register(t0, space1);
|
||||
|
||||
void textureLoad_6273b1() {
|
||||
float res = arg_0.Load(int3(0, 0, 0), 1).x;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
textureLoad_6273b1();
|
||||
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureLoad_6273b1();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureLoad_6273b1();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureLoad_6273b1(depth2d_ms<float, access::read> tint_symbol_2) {
|
||||
float res = tint_symbol_2.read(uint2(int2()), 1);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(depth2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
|
||||
textureLoad_6273b1(tint_symbol_3);
|
||||
tint_symbol const tint_symbol_1 = {.value=float4()};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depth2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
|
||||
textureLoad_6273b1(tint_symbol_4);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
|
||||
textureLoad_6273b1(tint_symbol_5);
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 40
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %textureLoad_6273b1 "textureLoad_6273b1"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%7 = OpTypeImage %float 2D 1 0 1 1 Unknown
|
||||
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%11 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11
|
||||
%void = OpTypeVoid
|
||||
%12 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%21 = OpConstantNull %v2int
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%25 = OpTypeFunction %void %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureLoad_6273b1 = OpFunction %void None %12
|
||||
%15 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_float Function %4
|
||||
%18 = OpLoad %7 %arg_0
|
||||
%17 = OpImageFetch %v4float %18 %21 Sample %int_1
|
||||
%16 = OpCompositeExtract %float %17 0
|
||||
OpStore %res %16
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %25
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%28 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %12
|
||||
%30 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%32 = OpFunctionCall %void %textureLoad_6273b1
|
||||
%33 = OpFunctionCall %void %tint_symbol_2 %11
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %12
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %void %textureLoad_6273b1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %12
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %void %textureLoad_6273b1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,21 @@
|
|||
[[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d;
|
||||
|
||||
fn textureLoad_6273b1() {
|
||||
var res : f32 = textureLoad(arg_0, vec2<i32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureLoad_6273b1();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureLoad_6273b1();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureLoad_6273b1();
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(0)]] var arg_0: texture_depth_multisampled_2d;
|
||||
|
||||
// fn textureNumSamples(texture: texture_depth_multisampled_2d) -> i32
|
||||
fn textureNumSamples_a3c8a0() {
|
||||
var res: i32 = textureNumSamples(arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureNumSamples_a3c8a0();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureNumSamples_a3c8a0();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureNumSamples_a3c8a0();
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
Texture2DMS<float4> arg_0 : register(t0, space1);
|
||||
|
||||
void textureNumSamples_a3c8a0() {
|
||||
int3 tint_tmp;
|
||||
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
|
||||
int res = tint_tmp.z;
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
textureNumSamples_a3c8a0();
|
||||
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureNumSamples_a3c8a0();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureNumSamples_a3c8a0();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureNumSamples_a3c8a0(depth2d_ms<float, access::read> tint_symbol_2) {
|
||||
int res = int(tint_symbol_2.get_num_samples());
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(depth2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
|
||||
textureNumSamples_a3c8a0(tint_symbol_3);
|
||||
tint_symbol const tint_symbol_1 = {.value=float4()};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depth2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
|
||||
textureNumSamples_a3c8a0(tint_symbol_4);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
|
||||
textureNumSamples_a3c8a0(tint_symbol_5);
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 37
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability ImageQuery
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %textureNumSamples_a3c8a0 "textureNumSamples_a3c8a0"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%7 = OpTypeImage %float 2D 1 0 1 1 Unknown
|
||||
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%11 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11
|
||||
%void = OpTypeVoid
|
||||
%12 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%21 = OpConstantNull %int
|
||||
%22 = OpTypeFunction %void %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureNumSamples_a3c8a0 = OpFunction %void None %12
|
||||
%15 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_int Function %21
|
||||
%18 = OpLoad %7 %arg_0
|
||||
%16 = OpImageQuerySamples %int %18
|
||||
OpStore %res %16
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %22
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%25 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %12
|
||||
%27 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%29 = OpFunctionCall %void %textureNumSamples_a3c8a0
|
||||
%30 = OpFunctionCall %void %tint_symbol_2 %11
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %12
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %textureNumSamples_a3c8a0
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %12
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %void %textureNumSamples_a3c8a0
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,21 @@
|
|||
[[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d;
|
||||
|
||||
fn textureNumSamples_a3c8a0() {
|
||||
var res : i32 = textureNumSamples(arg_0);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureNumSamples_a3c8a0();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureNumSamples_a3c8a0();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureNumSamples_a3c8a0();
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 38
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability ImageQuery
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %textureDimensions_f60bdb "textureDimensions_f60bdb"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%7 = OpTypeImage %float 2D 1 0 1 1 Unknown
|
||||
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%11 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11
|
||||
%void = OpTypeVoid
|
||||
%12 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%_ptr_Function_v2int = OpTypePointer Function %v2int
|
||||
%22 = OpConstantNull %v2int
|
||||
%23 = OpTypeFunction %void %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureDimensions_f60bdb = OpFunction %void None %12
|
||||
%15 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v2int Function %22
|
||||
%19 = OpLoad %7 %arg_0
|
||||
%16 = OpImageQuerySize %v2int %19
|
||||
OpStore %res %16
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %23
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%26 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %12
|
||||
%28 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%30 = OpFunctionCall %void %textureDimensions_f60bdb
|
||||
%31 = OpFunctionCall %void %tint_symbol_2 %11
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %12
|
||||
%33 = OpLabel
|
||||
%34 = OpFunctionCall %void %textureDimensions_f60bdb
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %12
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %textureDimensions_f60bdb
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,57 @@
|
|||
Texture2DMS<float4> arg_0 : register(t0, space1);
|
||||
static float4 tint_symbol_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void textureDimensions_f60bdb() {
|
||||
int2 res = int2(0, 0);
|
||||
int3 tint_tmp;
|
||||
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
|
||||
const int2 x_16 = int2(tint_tmp.xy);
|
||||
res = x_16;
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol_2(float4 tint_symbol) {
|
||||
tint_symbol_1 = tint_symbol;
|
||||
return;
|
||||
}
|
||||
|
||||
void vertex_main_1() {
|
||||
textureDimensions_f60bdb();
|
||||
tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
return;
|
||||
}
|
||||
|
||||
struct vertex_main_out {
|
||||
float4 tint_symbol_1_1;
|
||||
};
|
||||
struct tint_symbol_3 {
|
||||
float4 tint_symbol_1_1 : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol_3 vertex_main() {
|
||||
vertex_main_1();
|
||||
const vertex_main_out tint_symbol_4 = {tint_symbol_1};
|
||||
const tint_symbol_3 tint_symbol_5 = {tint_symbol_4.tint_symbol_1_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
void fragment_main_1() {
|
||||
textureDimensions_f60bdb();
|
||||
return;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
fragment_main_1();
|
||||
return;
|
||||
}
|
||||
|
||||
void compute_main_1() {
|
||||
textureDimensions_f60bdb();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
compute_main_1();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct vertex_main_out {
|
||||
float4 tint_symbol_1_1;
|
||||
};
|
||||
struct tint_symbol_3 {
|
||||
float4 tint_symbol_1_1 [[position]];
|
||||
};
|
||||
|
||||
void textureDimensions_f60bdb(depth2d_ms<float, access::read> tint_symbol_6) {
|
||||
int2 res = int2(0, 0);
|
||||
int2 const x_16 = int2(int2(tint_symbol_6.get_width(), tint_symbol_6.get_height()));
|
||||
res = x_16;
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol_2(float4 tint_symbol, thread float4* const tint_symbol_7) {
|
||||
*(tint_symbol_7) = tint_symbol;
|
||||
return;
|
||||
}
|
||||
|
||||
void vertex_main_1(depth2d_ms<float, access::read> tint_symbol_8, thread float4* const tint_symbol_9) {
|
||||
textureDimensions_f60bdb(tint_symbol_8);
|
||||
tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f), tint_symbol_9);
|
||||
return;
|
||||
}
|
||||
|
||||
vertex tint_symbol_3 vertex_main(depth2d_ms<float, access::read> tint_symbol_10 [[texture(0)]]) {
|
||||
thread float4 tint_symbol_11 = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
vertex_main_1(tint_symbol_10, &(tint_symbol_11));
|
||||
vertex_main_out const tint_symbol_4 = {.tint_symbol_1_1=tint_symbol_11};
|
||||
tint_symbol_3 const tint_symbol_5 = {.tint_symbol_1_1=tint_symbol_4.tint_symbol_1_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
void fragment_main_1(depth2d_ms<float, access::read> tint_symbol_12) {
|
||||
textureDimensions_f60bdb(tint_symbol_12);
|
||||
return;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depth2d_ms<float, access::read> tint_symbol_13 [[texture(0)]]) {
|
||||
fragment_main_1(tint_symbol_13);
|
||||
return;
|
||||
}
|
||||
|
||||
void compute_main_1(depth2d_ms<float, access::read> tint_symbol_14) {
|
||||
textureDimensions_f60bdb(tint_symbol_14);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_15 [[texture(0)]]) {
|
||||
compute_main_1(tint_symbol_15);
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 63
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability ImageQuery
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_4
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %tint_symbol_4 "tint_symbol_4"
|
||||
OpName %textureDimensions_f60bdb "textureDimensions_f60bdb"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main_1 "vertex_main_1"
|
||||
OpName %vertex_main_out "vertex_main_out"
|
||||
OpMemberName %vertex_main_out 0 "tint_symbol_1_1"
|
||||
OpName %tint_symbol_5 "tint_symbol_5"
|
||||
OpName %tint_symbol_3 "tint_symbol_3"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main_1 "fragment_main_1"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main_1 "compute_main_1"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %tint_symbol_4 BuiltIn Position
|
||||
OpMemberDecorate %vertex_main_out 0 Offset 0
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%7 = OpTypeImage %float 2D 1 0 1 1 Unknown
|
||||
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
|
||||
%v4float = OpTypeVector %float 4
|
||||
%float_0 = OpConstant %float 0
|
||||
%10 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Private_v4float Private %10
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%15 = OpConstantNull %v4float
|
||||
%tint_symbol_4 = OpVariable %_ptr_Output_v4float Output %15
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%int_0 = OpConstant %int 0
|
||||
%23 = OpConstantComposite %v2int %int_0 %int_0
|
||||
%_ptr_Function_v2int = OpTypePointer Function %v2int
|
||||
%26 = OpConstantNull %v2int
|
||||
%30 = OpTypeFunction %void %v4float
|
||||
%vertex_main_out = OpTypeStruct %v4float
|
||||
%38 = OpTypeFunction %void %vertex_main_out
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureDimensions_f60bdb = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v2int Function %26
|
||||
OpStore %res %23
|
||||
%29 = OpLoad %7 %arg_0
|
||||
%28 = OpImageQuerySize %v2int %29
|
||||
OpStore %res %28
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %30
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%33 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_1 = OpFunction %void None %16
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %void %textureDimensions_f60bdb
|
||||
%37 = OpFunctionCall %void %tint_symbol_2 %10
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_5 = OpFunction %void None %38
|
||||
%tint_symbol_3 = OpFunctionParameter %vertex_main_out
|
||||
%42 = OpLabel
|
||||
%43 = OpCompositeExtract %v4float %tint_symbol_3 0
|
||||
OpStore %tint_symbol_4 %43
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%45 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%47 = OpFunctionCall %void %vertex_main_1
|
||||
%49 = OpLoad %v4float %tint_symbol_1
|
||||
%50 = OpCompositeConstruct %vertex_main_out %49
|
||||
%48 = OpFunctionCall %void %tint_symbol_5 %50
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main_1 = OpFunction %void None %16
|
||||
%52 = OpLabel
|
||||
%53 = OpFunctionCall %void %textureDimensions_f60bdb
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%55 = OpLabel
|
||||
%56 = OpFunctionCall %void %fragment_main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main_1 = OpFunction %void None %16
|
||||
%58 = OpLabel
|
||||
%59 = OpFunctionCall %void %textureDimensions_f60bdb
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%61 = OpLabel
|
||||
%62 = OpFunctionCall %void %compute_main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,52 @@
|
|||
[[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d;
|
||||
|
||||
var<private> tint_symbol_1 : vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
fn textureDimensions_f60bdb() {
|
||||
var res : vec2<i32> = vec2<i32>(0, 0);
|
||||
let x_16 : vec2<i32> = vec2<i32>(textureDimensions(arg_0));
|
||||
res = x_16;
|
||||
return;
|
||||
}
|
||||
|
||||
fn tint_symbol_2(tint_symbol : vec4<f32>) {
|
||||
tint_symbol_1 = tint_symbol;
|
||||
return;
|
||||
}
|
||||
|
||||
fn vertex_main_1() {
|
||||
textureDimensions_f60bdb();
|
||||
tint_symbol_2(vec4<f32>(0.0, 0.0, 0.0, 0.0));
|
||||
return;
|
||||
}
|
||||
|
||||
struct vertex_main_out {
|
||||
[[builtin(position)]]
|
||||
tint_symbol_1_1 : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> vertex_main_out {
|
||||
vertex_main_1();
|
||||
return vertex_main_out(tint_symbol_1);
|
||||
}
|
||||
|
||||
fn fragment_main_1() {
|
||||
textureDimensions_f60bdb();
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
fragment_main_1();
|
||||
}
|
||||
|
||||
fn compute_main_1() {
|
||||
textureDimensions_f60bdb();
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1, 1, 1)]]
|
||||
fn compute_main() {
|
||||
compute_main_1();
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 40
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %textureLoad_6273b1 "textureLoad_6273b1"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%7 = OpTypeImage %float 2D 1 0 1 1 Unknown
|
||||
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%11 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11
|
||||
%void = OpTypeVoid
|
||||
%12 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%21 = OpConstantNull %v2int
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%25 = OpTypeFunction %void %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureLoad_6273b1 = OpFunction %void None %12
|
||||
%15 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_float Function %4
|
||||
%18 = OpLoad %7 %arg_0
|
||||
%17 = OpImageFetch %v4float %18 %21 Sample %int_1
|
||||
%16 = OpCompositeExtract %float %17 0
|
||||
OpStore %res %16
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %25
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%28 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %12
|
||||
%30 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%32 = OpFunctionCall %void %textureLoad_6273b1
|
||||
%33 = OpFunctionCall %void %tint_symbol_2 %11
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %12
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %void %textureLoad_6273b1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %12
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %void %textureLoad_6273b1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,55 @@
|
|||
Texture2DMS<float4> arg_0 : register(t0, space1);
|
||||
static float4 tint_symbol_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void textureLoad_6273b1() {
|
||||
float res = 0.0f;
|
||||
const float4 x_17 = float4(arg_0.Load(int3(0, 0, 0), 1).x, 0.0f, 0.0f, 0.0f);
|
||||
res = x_17.x;
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol_2(float4 tint_symbol) {
|
||||
tint_symbol_1 = tint_symbol;
|
||||
return;
|
||||
}
|
||||
|
||||
void vertex_main_1() {
|
||||
textureLoad_6273b1();
|
||||
tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
return;
|
||||
}
|
||||
|
||||
struct vertex_main_out {
|
||||
float4 tint_symbol_1_1;
|
||||
};
|
||||
struct tint_symbol_3 {
|
||||
float4 tint_symbol_1_1 : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol_3 vertex_main() {
|
||||
vertex_main_1();
|
||||
const vertex_main_out tint_symbol_4 = {tint_symbol_1};
|
||||
const tint_symbol_3 tint_symbol_5 = {tint_symbol_4.tint_symbol_1_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
void fragment_main_1() {
|
||||
textureLoad_6273b1();
|
||||
return;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
fragment_main_1();
|
||||
return;
|
||||
}
|
||||
|
||||
void compute_main_1() {
|
||||
textureLoad_6273b1();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
compute_main_1();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct vertex_main_out {
|
||||
float4 tint_symbol_1_1;
|
||||
};
|
||||
struct tint_symbol_3 {
|
||||
float4 tint_symbol_1_1 [[position]];
|
||||
};
|
||||
|
||||
void textureLoad_6273b1(depth2d_ms<float, access::read> tint_symbol_6) {
|
||||
float res = 0.0f;
|
||||
float4 const x_17 = float4(tint_symbol_6.read(uint2(int2(0, 0)), 1), 0.0f, 0.0f, 0.0f);
|
||||
res = x_17.x;
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol_2(float4 tint_symbol, thread float4* const tint_symbol_7) {
|
||||
*(tint_symbol_7) = tint_symbol;
|
||||
return;
|
||||
}
|
||||
|
||||
void vertex_main_1(depth2d_ms<float, access::read> tint_symbol_8, thread float4* const tint_symbol_9) {
|
||||
textureLoad_6273b1(tint_symbol_8);
|
||||
tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f), tint_symbol_9);
|
||||
return;
|
||||
}
|
||||
|
||||
vertex tint_symbol_3 vertex_main(depth2d_ms<float, access::read> tint_symbol_10 [[texture(0)]]) {
|
||||
thread float4 tint_symbol_11 = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
vertex_main_1(tint_symbol_10, &(tint_symbol_11));
|
||||
vertex_main_out const tint_symbol_4 = {.tint_symbol_1_1=tint_symbol_11};
|
||||
tint_symbol_3 const tint_symbol_5 = {.tint_symbol_1_1=tint_symbol_4.tint_symbol_1_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
void fragment_main_1(depth2d_ms<float, access::read> tint_symbol_12) {
|
||||
textureLoad_6273b1(tint_symbol_12);
|
||||
return;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depth2d_ms<float, access::read> tint_symbol_13 [[texture(0)]]) {
|
||||
fragment_main_1(tint_symbol_13);
|
||||
return;
|
||||
}
|
||||
|
||||
void compute_main_1(depth2d_ms<float, access::read> tint_symbol_14) {
|
||||
textureLoad_6273b1(tint_symbol_14);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_15 [[texture(0)]]) {
|
||||
compute_main_1(tint_symbol_15);
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 65
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_4
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %tint_symbol_4 "tint_symbol_4"
|
||||
OpName %textureLoad_6273b1 "textureLoad_6273b1"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main_1 "vertex_main_1"
|
||||
OpName %vertex_main_out "vertex_main_out"
|
||||
OpMemberName %vertex_main_out 0 "tint_symbol_1_1"
|
||||
OpName %tint_symbol_5 "tint_symbol_5"
|
||||
OpName %tint_symbol_3 "tint_symbol_3"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main_1 "fragment_main_1"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main_1 "compute_main_1"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %tint_symbol_4 BuiltIn Position
|
||||
OpMemberDecorate %vertex_main_out 0 Offset 0
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%7 = OpTypeImage %float 2D 1 0 1 1 Unknown
|
||||
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
|
||||
%v4float = OpTypeVector %float 4
|
||||
%float_0 = OpConstant %float 0
|
||||
%10 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Private_v4float Private %10
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%15 = OpConstantNull %v4float
|
||||
%tint_symbol_4 = OpVariable %_ptr_Output_v4float Output %15
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%int_0 = OpConstant %int 0
|
||||
%28 = OpConstantComposite %v2int %int_0 %int_0
|
||||
%int_1 = OpConstant %int 1
|
||||
%32 = OpTypeFunction %void %v4float
|
||||
%vertex_main_out = OpTypeStruct %v4float
|
||||
%40 = OpTypeFunction %void %vertex_main_out
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureLoad_6273b1 = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_float Function %4
|
||||
OpStore %res %float_0
|
||||
%24 = OpLoad %7 %arg_0
|
||||
%23 = OpImageFetch %v4float %24 %28 Sample %int_1
|
||||
%22 = OpCompositeExtract %float %23 0
|
||||
%30 = OpCompositeConstruct %v4float %22 %float_0 %float_0 %float_0
|
||||
%31 = OpCompositeExtract %float %30 0
|
||||
OpStore %res %31
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %32
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%35 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_1 = OpFunction %void None %16
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %void %textureLoad_6273b1
|
||||
%39 = OpFunctionCall %void %tint_symbol_2 %10
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_5 = OpFunction %void None %40
|
||||
%tint_symbol_3 = OpFunctionParameter %vertex_main_out
|
||||
%44 = OpLabel
|
||||
%45 = OpCompositeExtract %v4float %tint_symbol_3 0
|
||||
OpStore %tint_symbol_4 %45
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%47 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%49 = OpFunctionCall %void %vertex_main_1
|
||||
%51 = OpLoad %v4float %tint_symbol_1
|
||||
%52 = OpCompositeConstruct %vertex_main_out %51
|
||||
%50 = OpFunctionCall %void %tint_symbol_5 %52
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main_1 = OpFunction %void None %16
|
||||
%54 = OpLabel
|
||||
%55 = OpFunctionCall %void %textureLoad_6273b1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%57 = OpLabel
|
||||
%58 = OpFunctionCall %void %fragment_main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main_1 = OpFunction %void None %16
|
||||
%60 = OpLabel
|
||||
%61 = OpFunctionCall %void %textureLoad_6273b1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%63 = OpLabel
|
||||
%64 = OpFunctionCall %void %compute_main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,52 @@
|
|||
[[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d;
|
||||
|
||||
var<private> tint_symbol_1 : vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
fn textureLoad_6273b1() {
|
||||
var res : f32 = 0.0;
|
||||
let x_17 : vec4<f32> = vec4<f32>(textureLoad(arg_0, vec2<i32>(0, 0), 1), 0.0, 0.0, 0.0);
|
||||
res = x_17.x;
|
||||
return;
|
||||
}
|
||||
|
||||
fn tint_symbol_2(tint_symbol : vec4<f32>) {
|
||||
tint_symbol_1 = tint_symbol;
|
||||
return;
|
||||
}
|
||||
|
||||
fn vertex_main_1() {
|
||||
textureLoad_6273b1();
|
||||
tint_symbol_2(vec4<f32>(0.0, 0.0, 0.0, 0.0));
|
||||
return;
|
||||
}
|
||||
|
||||
struct vertex_main_out {
|
||||
[[builtin(position)]]
|
||||
tint_symbol_1_1 : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> vertex_main_out {
|
||||
vertex_main_1();
|
||||
return vertex_main_out(tint_symbol_1);
|
||||
}
|
||||
|
||||
fn fragment_main_1() {
|
||||
textureLoad_6273b1();
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
fragment_main_1();
|
||||
}
|
||||
|
||||
fn compute_main_1() {
|
||||
textureLoad_6273b1();
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1, 1, 1)]]
|
||||
fn compute_main() {
|
||||
compute_main_1();
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 37
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability ImageQuery
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_1
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %textureNumSamples_a3c8a0 "textureNumSamples_a3c8a0"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %tint_symbol_1 BuiltIn Position
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%7 = OpTypeImage %float 2D 1 0 1 1 Unknown
|
||||
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%11 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11
|
||||
%void = OpTypeVoid
|
||||
%12 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%21 = OpConstantNull %int
|
||||
%22 = OpTypeFunction %void %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureNumSamples_a3c8a0 = OpFunction %void None %12
|
||||
%15 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_int Function %21
|
||||
%18 = OpLoad %7 %arg_0
|
||||
%16 = OpImageQuerySamples %int %18
|
||||
OpStore %res %16
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %22
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%25 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %12
|
||||
%27 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%29 = OpFunctionCall %void %textureNumSamples_a3c8a0
|
||||
%30 = OpFunctionCall %void %tint_symbol_2 %11
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %12
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %textureNumSamples_a3c8a0
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %12
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %void %textureNumSamples_a3c8a0
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,57 @@
|
|||
Texture2DMS<float4> arg_0 : register(t0, space1);
|
||||
static float4 tint_symbol_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void textureNumSamples_a3c8a0() {
|
||||
int res = 0;
|
||||
int3 tint_tmp;
|
||||
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
|
||||
const int x_16 = tint_tmp.z;
|
||||
res = x_16;
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol_2(float4 tint_symbol) {
|
||||
tint_symbol_1 = tint_symbol;
|
||||
return;
|
||||
}
|
||||
|
||||
void vertex_main_1() {
|
||||
textureNumSamples_a3c8a0();
|
||||
tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
return;
|
||||
}
|
||||
|
||||
struct vertex_main_out {
|
||||
float4 tint_symbol_1_1;
|
||||
};
|
||||
struct tint_symbol_3 {
|
||||
float4 tint_symbol_1_1 : SV_Position;
|
||||
};
|
||||
|
||||
tint_symbol_3 vertex_main() {
|
||||
vertex_main_1();
|
||||
const vertex_main_out tint_symbol_4 = {tint_symbol_1};
|
||||
const tint_symbol_3 tint_symbol_5 = {tint_symbol_4.tint_symbol_1_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
void fragment_main_1() {
|
||||
textureNumSamples_a3c8a0();
|
||||
return;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
fragment_main_1();
|
||||
return;
|
||||
}
|
||||
|
||||
void compute_main_1() {
|
||||
textureNumSamples_a3c8a0();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
compute_main_1();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct vertex_main_out {
|
||||
float4 tint_symbol_1_1;
|
||||
};
|
||||
struct tint_symbol_3 {
|
||||
float4 tint_symbol_1_1 [[position]];
|
||||
};
|
||||
|
||||
void textureNumSamples_a3c8a0(depth2d_ms<float, access::read> tint_symbol_6) {
|
||||
int res = 0;
|
||||
int const x_16 = int(tint_symbol_6.get_num_samples());
|
||||
res = x_16;
|
||||
return;
|
||||
}
|
||||
|
||||
void tint_symbol_2(float4 tint_symbol, thread float4* const tint_symbol_7) {
|
||||
*(tint_symbol_7) = tint_symbol;
|
||||
return;
|
||||
}
|
||||
|
||||
void vertex_main_1(depth2d_ms<float, access::read> tint_symbol_8, thread float4* const tint_symbol_9) {
|
||||
textureNumSamples_a3c8a0(tint_symbol_8);
|
||||
tint_symbol_2(float4(0.0f, 0.0f, 0.0f, 0.0f), tint_symbol_9);
|
||||
return;
|
||||
}
|
||||
|
||||
vertex tint_symbol_3 vertex_main(depth2d_ms<float, access::read> tint_symbol_10 [[texture(0)]]) {
|
||||
thread float4 tint_symbol_11 = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
vertex_main_1(tint_symbol_10, &(tint_symbol_11));
|
||||
vertex_main_out const tint_symbol_4 = {.tint_symbol_1_1=tint_symbol_11};
|
||||
tint_symbol_3 const tint_symbol_5 = {.tint_symbol_1_1=tint_symbol_4.tint_symbol_1_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
void fragment_main_1(depth2d_ms<float, access::read> tint_symbol_12) {
|
||||
textureNumSamples_a3c8a0(tint_symbol_12);
|
||||
return;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depth2d_ms<float, access::read> tint_symbol_13 [[texture(0)]]) {
|
||||
fragment_main_1(tint_symbol_13);
|
||||
return;
|
||||
}
|
||||
|
||||
void compute_main_1(depth2d_ms<float, access::read> tint_symbol_14) {
|
||||
textureNumSamples_a3c8a0(tint_symbol_14);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_15 [[texture(0)]]) {
|
||||
compute_main_1(tint_symbol_15);
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 60
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability ImageQuery
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %tint_pointsize %tint_symbol_4
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %tint_pointsize "tint_pointsize"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %tint_symbol_4 "tint_symbol_4"
|
||||
OpName %textureNumSamples_a3c8a0 "textureNumSamples_a3c8a0"
|
||||
OpName %res "res"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %vertex_main_1 "vertex_main_1"
|
||||
OpName %vertex_main_out "vertex_main_out"
|
||||
OpMemberName %vertex_main_out 0 "tint_symbol_1_1"
|
||||
OpName %tint_symbol_5 "tint_symbol_5"
|
||||
OpName %tint_symbol_3 "tint_symbol_3"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main_1 "fragment_main_1"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main_1 "compute_main_1"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %tint_pointsize BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %tint_symbol_4 BuiltIn Position
|
||||
OpMemberDecorate %vertex_main_out 0 Offset 0
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%4 = OpConstantNull %float
|
||||
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
|
||||
%7 = OpTypeImage %float 2D 1 0 1 1 Unknown
|
||||
%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
|
||||
%v4float = OpTypeVector %float 4
|
||||
%float_0 = OpConstant %float 0
|
||||
%10 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Private_v4float Private %10
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%15 = OpConstantNull %v4float
|
||||
%tint_symbol_4 = OpVariable %_ptr_Output_v4float Output %15
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%24 = OpConstantNull %int
|
||||
%27 = OpTypeFunction %void %v4float
|
||||
%vertex_main_out = OpTypeStruct %v4float
|
||||
%35 = OpTypeFunction %void %vertex_main_out
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureNumSamples_a3c8a0 = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_int Function %24
|
||||
OpStore %res %int_0
|
||||
%26 = OpLoad %7 %arg_0
|
||||
%25 = OpImageQuerySamples %int %26
|
||||
OpStore %res %25
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %27
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%30 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_1 = OpFunction %void None %16
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %textureNumSamples_a3c8a0
|
||||
%34 = OpFunctionCall %void %tint_symbol_2 %10
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_5 = OpFunction %void None %35
|
||||
%tint_symbol_3 = OpFunctionParameter %vertex_main_out
|
||||
%39 = OpLabel
|
||||
%40 = OpCompositeExtract %v4float %tint_symbol_3 0
|
||||
OpStore %tint_symbol_4 %40
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%42 = OpLabel
|
||||
OpStore %tint_pointsize %float_1
|
||||
%44 = OpFunctionCall %void %vertex_main_1
|
||||
%46 = OpLoad %v4float %tint_symbol_1
|
||||
%47 = OpCompositeConstruct %vertex_main_out %46
|
||||
%45 = OpFunctionCall %void %tint_symbol_5 %47
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main_1 = OpFunction %void None %16
|
||||
%49 = OpLabel
|
||||
%50 = OpFunctionCall %void %textureNumSamples_a3c8a0
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%52 = OpLabel
|
||||
%53 = OpFunctionCall %void %fragment_main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main_1 = OpFunction %void None %16
|
||||
%55 = OpLabel
|
||||
%56 = OpFunctionCall %void %textureNumSamples_a3c8a0
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%58 = OpLabel
|
||||
%59 = OpFunctionCall %void %compute_main_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -0,0 +1,52 @@
|
|||
[[group(1), binding(0)]] var arg_0 : texture_depth_multisampled_2d;
|
||||
|
||||
var<private> tint_symbol_1 : vec4<f32> = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
fn textureNumSamples_a3c8a0() {
|
||||
var res : i32 = 0;
|
||||
let x_16 : i32 = textureNumSamples(arg_0);
|
||||
res = x_16;
|
||||
return;
|
||||
}
|
||||
|
||||
fn tint_symbol_2(tint_symbol : vec4<f32>) {
|
||||
tint_symbol_1 = tint_symbol;
|
||||
return;
|
||||
}
|
||||
|
||||
fn vertex_main_1() {
|
||||
textureNumSamples_a3c8a0();
|
||||
tint_symbol_2(vec4<f32>(0.0, 0.0, 0.0, 0.0));
|
||||
return;
|
||||
}
|
||||
|
||||
struct vertex_main_out {
|
||||
[[builtin(position)]]
|
||||
tint_symbol_1_1 : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> vertex_main_out {
|
||||
vertex_main_1();
|
||||
return vertex_main_out(tint_symbol_1);
|
||||
}
|
||||
|
||||
fn fragment_main_1() {
|
||||
textureNumSamples_a3c8a0();
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
fragment_main_1();
|
||||
}
|
||||
|
||||
fn compute_main_1() {
|
||||
textureNumSamples_a3c8a0();
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1, 1, 1)]]
|
||||
fn compute_main() {
|
||||
compute_main_1();
|
||||
}
|
Loading…
Reference in New Issue