mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
Replace TextureType::(Is|As)Multisampled with Castable
Change-Id: I9a0e2ba4c6b0950134cef4b291cd1ba5cae1198c Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34277 Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "src/ast/decorated_variable.h"
|
||||
#include "src/ast/stage_decoration.h"
|
||||
#include "src/ast/type/multisampled_texture_type.h"
|
||||
#include "src/ast/type/texture_type.h"
|
||||
#include "src/ast/workgroup_decoration.h"
|
||||
|
||||
@@ -315,7 +316,7 @@ Function::ReferencedSampledTextureVariablesImpl(bool multisampled) const {
|
||||
}
|
||||
|
||||
if ((multisampled &&
|
||||
!unwrapped_type->As<ast::type::TextureType>()->IsMultisampled()) ||
|
||||
!unwrapped_type->Is<ast::type::MultisampledTextureType>()) ||
|
||||
(!multisampled &&
|
||||
!unwrapped_type->As<ast::type::TextureType>()->IsSampled())) {
|
||||
continue;
|
||||
|
||||
@@ -32,9 +32,6 @@ MultisampledTextureType::MultisampledTextureType(MultisampledTextureType&&) =
|
||||
|
||||
MultisampledTextureType::~MultisampledTextureType() = default;
|
||||
|
||||
bool MultisampledTextureType::IsMultisampled() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MultisampledTextureType::type_name() const {
|
||||
std::ostringstream out;
|
||||
|
||||
@@ -35,9 +35,6 @@ class MultisampledTextureType
|
||||
MultisampledTextureType(MultisampledTextureType&&);
|
||||
~MultisampledTextureType() override;
|
||||
|
||||
/// @returns true if the type is a sampled texture type
|
||||
bool IsMultisampled() const override;
|
||||
|
||||
/// @returns the subtype of the sampled texture
|
||||
Type* type() const { return type_; }
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ TEST_F(MultisampledTextureTypeTest, IsTextureType) {
|
||||
MultisampledTextureType s(TextureDimension::kCube, &f32);
|
||||
TextureType* ty = &s;
|
||||
EXPECT_FALSE(ty->Is<DepthTextureType>());
|
||||
EXPECT_TRUE(ty->IsMultisampled());
|
||||
EXPECT_TRUE(ty->Is<MultisampledTextureType>());
|
||||
EXPECT_FALSE(ty->IsSampled());
|
||||
EXPECT_FALSE(ty->IsStorage());
|
||||
}
|
||||
|
||||
@@ -60,9 +60,6 @@ TextureType::TextureType(TextureType&&) = default;
|
||||
|
||||
TextureType::~TextureType() = default;
|
||||
|
||||
bool TextureType::IsMultisampled() const {
|
||||
return false;
|
||||
}
|
||||
bool TextureType::IsStorage() const {
|
||||
return false;
|
||||
}
|
||||
@@ -70,11 +67,6 @@ bool TextureType::IsSampled() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
const MultisampledTextureType* TextureType::AsMultisampled() const {
|
||||
assert(IsMultisampled());
|
||||
return static_cast<const MultisampledTextureType*>(this);
|
||||
}
|
||||
|
||||
const SampledTextureType* TextureType::AsSampled() const {
|
||||
assert(IsSampled());
|
||||
return static_cast<const SampledTextureType*>(this);
|
||||
@@ -85,11 +77,6 @@ const StorageTextureType* TextureType::AsStorage() const {
|
||||
return static_cast<const StorageTextureType*>(this);
|
||||
}
|
||||
|
||||
MultisampledTextureType* TextureType::AsMultisampled() {
|
||||
assert(IsMultisampled());
|
||||
return static_cast<MultisampledTextureType*>(this);
|
||||
}
|
||||
|
||||
SampledTextureType* TextureType::AsSampled() {
|
||||
assert(IsSampled());
|
||||
return static_cast<SampledTextureType*>(this);
|
||||
|
||||
@@ -24,8 +24,6 @@ namespace tint {
|
||||
namespace ast {
|
||||
namespace type {
|
||||
|
||||
class DepthTextureType;
|
||||
class MultisampledTextureType;
|
||||
class SampledTextureType;
|
||||
class StorageTextureType;
|
||||
|
||||
@@ -63,22 +61,16 @@ class TextureType : public Castable<TextureType, Type> {
|
||||
/// @returns the texture dimension
|
||||
TextureDimension dim() const { return dim_; }
|
||||
|
||||
/// @returns ture if this is a multisampled texture
|
||||
virtual bool IsMultisampled() const;
|
||||
/// @returns true if this is a storage texture
|
||||
virtual bool IsStorage() const;
|
||||
/// @returns true if this is a sampled texture
|
||||
virtual bool IsSampled() const;
|
||||
|
||||
/// @returns the texture as a multisampled texture
|
||||
const MultisampledTextureType* AsMultisampled() const;
|
||||
/// @returns the texture as a sampled texture
|
||||
const SampledTextureType* AsSampled() const;
|
||||
/// @returns the texture as a storage texture
|
||||
const StorageTextureType* AsStorage() const;
|
||||
|
||||
/// @returns the texture as a multisampled texture
|
||||
MultisampledTextureType* AsMultisampled();
|
||||
/// @returns the texture as a sampled texture
|
||||
SampledTextureType* AsSampled();
|
||||
/// @returns the texture as a storage texture
|
||||
|
||||
Reference in New Issue
Block a user