#include <limits>
#include <string>
#include <vector>
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
#include "dawn/tests/unittests/validation/ValidationTest.h"
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
#include "dawn/utils/WGPUHelpers.h"
namespace dawn {
namespace {
class CompatValidationTest : public ValidationTest { … };
TEST_F(CompatValidationTest, CanNotCreateCubeArrayTextureView) { … }
TEST_F(CompatValidationTest, CanNotSpecifyAlternateCompatibleViewFormatRGBA8Unorm) { … }
TEST_F(CompatValidationTest, CanNotSpecifyAlternateCompatibleViewFormatRGBA8UnormSrgb) { … }
TEST_F(CompatValidationTest, CanNotCreatePipelineWithDifferentPerTargetBlendStateOrWriteMask) { … }
TEST_F(CompatValidationTest, CanNotCreatePipelineWithNonZeroDepthBiasClamp) { … }
TEST_F(CompatValidationTest, CanNotUseSampleMask) { … }
TEST_F(CompatValidationTest, CanNotUseSampleIndex) { … }
TEST_F(CompatValidationTest, CanNotUseShaderWithUnsupportedInterpolateTypeOrSampling) { … }
TEST_F(CompatValidationTest, CanNotCreateRGxxxStorageTexture) { … }
constexpr const char* kRenderTwoTexturesOneBindgroupWGSL = …;
constexpr const char* kRenderTwoTexturesTwoBindgroupsWGSL = …;
void TestMultipleTextureViewValidationInRenderPass(
wgpu::Device device,
const char* wgsl,
std::function<void(wgpu::Device device,
wgpu::Texture texture,
wgpu::RenderPipeline pipeline,
std::function<void(wgpu::RenderPassEncoder pass)> drawFn)> fn) { … }
TEST_F(CompatValidationTest, CanNotDrawDifferentMipsSameTextureSameBindGroup) { … }
TEST_F(CompatValidationTest, CanNotDrawDifferentMipsSameTextureDifferentBindGroups) { … }
TEST_F(CompatValidationTest, CanBindDifferentMipsSameTextureSameBindGroupAndFixWithoutError) { … }
TEST_F(CompatValidationTest, CanBindSameViewIn2BindGroups) { … }
TEST_F(CompatValidationTest, NoErrorIfMultipleDifferentViewsOfTextureAreNotUsed) { … }
constexpr const char* kComputeTwoTexturesOneBindgroupWGSL = …;
constexpr const char* kComputeTwoTexturesTwoBindgroupsWGSL = …;
void TestMultipleTextureViewValidationInComputePass(
wgpu::Device device,
const char* wgsl,
wgpu::TextureUsage textureUsage,
std::function<void(wgpu::Device device,
wgpu::Texture texture,
wgpu::ComputePipeline pipeline,
std::function<void(wgpu::ComputePassEncoder pass)> dispatchFn)> fn) { … }
TEST_F(CompatValidationTest, CanNotComputeWithDifferentMipsSameTextureSameBindGroup) { … }
TEST_F(CompatValidationTest, CanNotComputeWithDifferentMipsSameTextureDifferentBindGroups) { … }
TEST_F(CompatValidationTest,
CanBindDifferentMipsSameTextureSameBindGroupAndFixWithoutErrorInComputePass) { … }
TEST_F(CompatValidationTest, CanBindSameViewIn2BindGroupsInComputePass) { … }
TEST_F(CompatValidationTest, NoErrorIfMultipleDifferentViewsOfTextureAreNotUsedInComputePass) { … }
constexpr const char* kComputeTwoStorageTexturesOneBindgroupWGSL = …;
constexpr const char* kComputeTwoStorageTexturesTwoBindgroupsWGSL = …;
TEST_F(CompatValidationTest, CanNotComputeWithDifferentMipsSameStorageTextureSameBindGroup) { … }
TEST_F(CompatValidationTest, CanNotComputeWithDifferentMipsSameStorageTextureDifferentBindGroups) { … }
TEST_F(CompatValidationTest,
CanBindDifferentMipsSameStorageTextureSameBindGroupAndFixWithoutErrorInComputePass) { … }
TEST_F(CompatValidationTest,
NoErrorIfMultipleDifferentViewsOfStorageTextureAreNotUsedInComputePass) { … }
TEST_F(CompatValidationTest, CanNotCreateBGRA8UnormSRGBTexture) { … }
TEST_F(CompatValidationTest, CanNotCreateBGRA8UnormTextureWithBGRA8UnormSrgbView) { … }
TEST_F(CompatValidationTest, CanNotCopyMultisampleTextureToTexture) { … }
TEST_F(CompatValidationTest, DoNotResolveDefaultTextureBindingViewDimensionOnErrorTexture) { … }
TEST_F(CompatValidationTest, InvalidTextureBindingViewDimensionDescriptorDescriptor) { … }
class CompatTextureViewDimensionValidationTests : public CompatValidationTest { … };
const wgpu::TextureViewDimension kViewDimensions[] = …;
TEST_F(CompatTextureViewDimensionValidationTests, E1D) { … }
TEST_F(CompatTextureViewDimensionValidationTests, E2D) { … }
TEST_F(CompatTextureViewDimensionValidationTests, E3D) { … }
TEST_F(CompatTextureViewDimensionValidationTests, E2DViewMoreThan1Layer) { … }
TEST_F(CompatTextureViewDimensionValidationTests, CubeViewMoreWhereLayersIsNot6) { … }
TEST_F(CompatTextureViewDimensionValidationTests, OneLayerIs2DView) { … }
TEST_F(CompatTextureViewDimensionValidationTests, TwoLayersIs2DArrayView) { … }
TEST_F(CompatTextureViewDimensionValidationTests, SixLayersIs2DArrayView) { … }
TEST_F(CompatTextureViewDimensionValidationTests, TwoDTextureViewDimensionCanNotBeViewedAs2DArray) { … }
TEST_F(CompatTextureViewDimensionValidationTests,
TwoDArrayTextureViewDimensionCanNotBeViewedAsCube) { … }
TEST_F(CompatTextureViewDimensionValidationTests, CubeTextureViewDimensionCanNotBeViewedAs2DArray) { … }
class CompatCompressedCopyT2BAndCopyT2TValidationTests : public CompatValidationTest { … };
TEST_F(CompatCompressedCopyT2BAndCopyT2TValidationTests, CanNotCopyCompressedTextureToBuffer) { … }
TEST_F(CompatCompressedCopyT2BAndCopyT2TValidationTests, CanNotCopyCompressedTextureToTexture) { … }
class CompatMaxVertexAttributesTest : public CompatValidationTest { … };
TEST_F(CompatMaxVertexAttributesTest, CanUseMaxVertexAttributes) { … }
TEST_F(CompatMaxVertexAttributesTest, VertexIndexTakesAnAttribute) { … }
TEST_F(CompatMaxVertexAttributesTest, InstanceIndexTakesAnAttribute) { … }
TEST_F(CompatMaxVertexAttributesTest, VertexAndInstanceIndexEachTakeAnAttribute) { … }
}
}