mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-05 06:03:34 +00:00
spirv-writer: Add SampledCubeArray cap when needed
Fixed: tint:371 Change-Id: I13f568725370f446f154af26c326edfd4abec3c8 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34003 Auto-Submit: David Neto <dneto@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
b496611165
commit
8ad2c91c60
@ -2479,7 +2479,7 @@ uint32_t Builder::GenerateTypeIfNeeded(ast::type::Type* type) {
|
||||
bool Builder::GenerateTextureType(ast::type::TextureType* texture,
|
||||
const Operand& result) {
|
||||
uint32_t array_literal = 0u;
|
||||
auto dim = texture->dim();
|
||||
const auto dim = texture->dim();
|
||||
if (dim == ast::type::TextureDimension::k1dArray ||
|
||||
dim == ast::type::TextureDimension::k2dArray ||
|
||||
dim == ast::type::TextureDimension::kCubeArray) {
|
||||
@ -2520,6 +2520,12 @@ bool Builder::GenerateTextureType(ast::type::TextureType* texture,
|
||||
sampled_literal = 1u;
|
||||
}
|
||||
|
||||
if (dim == ast::type::TextureDimension::kCubeArray) {
|
||||
if (texture->IsSampled() || texture->IsDepth()) {
|
||||
push_capability(SpvCapabilitySampledCubeArray);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t type_id = 0u;
|
||||
if (texture->IsDepth()) {
|
||||
ast::type::F32Type f32;
|
||||
|
@ -665,6 +665,7 @@ TEST_F(BuilderTest_Type, DepthTexture_Generate_Cube) {
|
||||
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
|
||||
%1 = OpTypeImage %2 Cube 1 0 0 1 Unknown
|
||||
)");
|
||||
EXPECT_EQ(DumpInstructions(b.capabilities()), "");
|
||||
}
|
||||
|
||||
TEST_F(BuilderTest_Type, DepthTexture_Generate_CubeArray) {
|
||||
@ -677,6 +678,9 @@ TEST_F(BuilderTest_Type, DepthTexture_Generate_CubeArray) {
|
||||
|
||||
EXPECT_EQ(DumpInstructions(b.types()), R"(%2 = OpTypeFloat 32
|
||||
%1 = OpTypeImage %2 Cube 1 1 0 1 Unknown
|
||||
)");
|
||||
EXPECT_EQ(DumpInstructions(b.capabilities()),
|
||||
R"(OpCapability SampledCubeArray
|
||||
)");
|
||||
}
|
||||
|
||||
@ -825,6 +829,7 @@ TEST_F(BuilderTest_Type, SampledTexture_Generate_Cube) {
|
||||
R"(%2 = OpTypeFloat 32
|
||||
%1 = OpTypeImage %2 Cube 0 0 0 1 Unknown
|
||||
)");
|
||||
EXPECT_EQ(DumpInstructions(b.capabilities()), "");
|
||||
}
|
||||
|
||||
TEST_F(BuilderTest_Type, SampledTexture_Generate_CubeArray) {
|
||||
@ -837,6 +842,9 @@ TEST_F(BuilderTest_Type, SampledTexture_Generate_CubeArray) {
|
||||
EXPECT_EQ(DumpInstructions(b.types()),
|
||||
R"(%2 = OpTypeFloat 32
|
||||
%1 = OpTypeImage %2 Cube 0 1 0 1 Unknown
|
||||
)");
|
||||
EXPECT_EQ(DumpInstructions(b.capabilities()),
|
||||
R"(OpCapability SampledCubeArray
|
||||
)");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user