mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 10:49:14 +00:00
Replace TextureType::(Is|As)Depth with Castable
Change-Id: I2f1785cec1880f728fbbf0c75762bc957e34ca0a Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34276 Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
#include "src/ast/storage_class.h"
|
||||
#include "src/ast/switch_statement.h"
|
||||
#include "src/ast/type/bool_type.h"
|
||||
#include "src/ast/type/depth_texture_type.h"
|
||||
#include "src/ast/type/f32_type.h"
|
||||
#include "src/ast/type/pointer_type.h"
|
||||
#include "src/ast/type/texture_type.h"
|
||||
@@ -3714,7 +3715,7 @@ bool FunctionEmitter::EmitSampledImageAccess(
|
||||
parser_impl_.GetTypeForHandleVar(*image)) {
|
||||
if (ast::type::TextureType* texture_type =
|
||||
type->type()->As<ast::type::TextureType>()) {
|
||||
if (texture_type->IsDepth()) {
|
||||
if (texture_type->Is<ast::type::DepthTextureType>()) {
|
||||
// Convert it to an unsigned integer type.
|
||||
lod_operand = ast_module_.create<ast::TypeConstructorExpression>(
|
||||
ast_module_.create<ast::type::U32Type>(),
|
||||
|
||||
@@ -37,7 +37,8 @@ TEST_F(ParserImplTest, DepthTextureType_2d) {
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
ASSERT_TRUE(t->Is<ast::type::TextureType>());
|
||||
ASSERT_TRUE(t->As<ast::type::TextureType>()->IsDepth());
|
||||
ASSERT_TRUE(
|
||||
t->As<ast::type::TextureType>()->Is<ast::type::DepthTextureType>());
|
||||
EXPECT_EQ(t->As<ast::type::TextureType>()->dim(),
|
||||
ast::type::TextureDimension::k2d);
|
||||
EXPECT_FALSE(p->has_error());
|
||||
@@ -50,7 +51,8 @@ TEST_F(ParserImplTest, DepthTextureType_2dArray) {
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
ASSERT_TRUE(t->Is<ast::type::TextureType>());
|
||||
ASSERT_TRUE(t->As<ast::type::TextureType>()->IsDepth());
|
||||
ASSERT_TRUE(
|
||||
t->As<ast::type::TextureType>()->Is<ast::type::DepthTextureType>());
|
||||
EXPECT_EQ(t->As<ast::type::TextureType>()->dim(),
|
||||
ast::type::TextureDimension::k2dArray);
|
||||
EXPECT_FALSE(p->has_error());
|
||||
@@ -63,7 +65,8 @@ TEST_F(ParserImplTest, DepthTextureType_Cube) {
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
ASSERT_TRUE(t->Is<ast::type::TextureType>());
|
||||
ASSERT_TRUE(t->As<ast::type::TextureType>()->IsDepth());
|
||||
ASSERT_TRUE(
|
||||
t->As<ast::type::TextureType>()->Is<ast::type::DepthTextureType>());
|
||||
EXPECT_EQ(t->As<ast::type::TextureType>()->dim(),
|
||||
ast::type::TextureDimension::kCube);
|
||||
EXPECT_FALSE(p->has_error());
|
||||
@@ -76,7 +79,8 @@ TEST_F(ParserImplTest, DepthTextureType_CubeArray) {
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
ASSERT_TRUE(t->Is<ast::type::TextureType>());
|
||||
ASSERT_TRUE(t->As<ast::type::TextureType>()->IsDepth());
|
||||
ASSERT_TRUE(
|
||||
t->As<ast::type::TextureType>()->Is<ast::type::DepthTextureType>());
|
||||
EXPECT_EQ(t->As<ast::type::TextureType>()->dim(),
|
||||
ast::type::TextureDimension::kCubeArray);
|
||||
EXPECT_FALSE(p->has_error());
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "src/ast/type/depth_texture_type.h"
|
||||
#include "src/ast/type/f32_type.h"
|
||||
#include "src/ast/type/i32_type.h"
|
||||
#include "src/ast/type/multisampled_texture_type.h"
|
||||
@@ -66,7 +67,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_DepthTexture) {
|
||||
EXPECT_FALSE(t.errored);
|
||||
ASSERT_NE(t.value, nullptr);
|
||||
ASSERT_TRUE(t->Is<ast::type::TextureType>());
|
||||
ASSERT_TRUE(t->As<ast::type::TextureType>()->IsDepth());
|
||||
ASSERT_TRUE(t->Is<ast::type::DepthTextureType>());
|
||||
EXPECT_EQ(t->As<ast::type::TextureType>()->dim(),
|
||||
ast::type::TextureDimension::k2d);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user