Reland "Rename texture.createTextureView to createView to match WebGPU"
This is a reland of 6f0b021dbf
.
It also renames CreateDefaultTextureView to CreateDefaultView in a test
that landed after the tryjobs for the reverted patch passed.
Original change's description:
> Rename texture.createTextureView to createView to match WebGPU
>
> Bug: chromium:877147
> Change-Id: I186fc26054cc6729c859a4161c755a1133dc0bca
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6360
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Bug: chromium:877147
Change-Id: I8e1a1adc07ad2c78081ae3cb0fa2bdb648b39c50
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6361
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
2d4c66d2b8
commit
b4b3ea05eb
|
@ -934,11 +934,11 @@
|
|||
"category": "object",
|
||||
"methods": [
|
||||
{
|
||||
"name": "create default texture view",
|
||||
"name": "create default view",
|
||||
"returns": "texture view"
|
||||
},
|
||||
{
|
||||
"name": "create texture view",
|
||||
"name": "create view",
|
||||
"returns": "texture view",
|
||||
"args": [
|
||||
{"name": "descriptor", "type": "texture view descriptor", "annotation": "const*"}
|
||||
|
|
|
@ -138,7 +138,7 @@ void frame() {
|
|||
|
||||
size_t i = 0;
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultTextureView()},
|
||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultView()},
|
||||
depthStencilView);
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
|
|
|
@ -117,7 +117,7 @@ void frame() {
|
|||
DawnTexture backbuffer = dawnSwapChainGetNextTexture(swapchain);
|
||||
DawnTextureView backbufferView;
|
||||
{
|
||||
backbufferView = dawnTextureCreateDefaultTextureView(backbuffer);
|
||||
backbufferView = dawnTextureCreateDefaultView(backbuffer);
|
||||
}
|
||||
DawnRenderPassDescriptor renderpassInfo;
|
||||
DawnRenderPassColorAttachmentDescriptor colorAttachment;
|
||||
|
|
|
@ -273,7 +273,7 @@ dawn::CommandBuffer createCommandBuffer(const dawn::Texture backbuffer, size_t i
|
|||
}
|
||||
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultTextureView()},
|
||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultView()},
|
||||
depthStencilView);
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
pass.SetPipeline(renderPipeline);
|
||||
|
|
|
@ -135,7 +135,7 @@ void init() {
|
|||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
dawn::TextureView view = texture.CreateDefaultTextureView();
|
||||
dawn::TextureView view = texture.CreateDefaultView();
|
||||
|
||||
bindGroup = utils::MakeBindGroup(device, bgl, {
|
||||
{0, sampler},
|
||||
|
@ -150,7 +150,7 @@ void frame() {
|
|||
if (s.b >= 1.0f) {s.b = 0.0f;}
|
||||
|
||||
dawn::Texture backbuffer = swapchain.GetNextTexture();
|
||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultTextureView()},
|
||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultView()},
|
||||
depthStencilView);
|
||||
|
||||
static const uint64_t vertexBufferOffsets[1] = {0};
|
||||
|
|
|
@ -260,7 +260,7 @@ void frame() {
|
|||
cameraBuffer.SetSubData(0, sizeof(CameraData), reinterpret_cast<uint8_t*>(&cameraData));
|
||||
|
||||
dawn::Texture backbuffer = swapchain.GetNextTexture();
|
||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultTextureView()},
|
||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultView()},
|
||||
depthStencilView);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
|
|
@ -167,7 +167,7 @@ dawn::TextureView CreateDefaultDepthStencilView(const dawn::Device& device) {
|
|||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
auto depthStencilTexture = device.CreateTexture(&descriptor);
|
||||
return depthStencilTexture.CreateDefaultTextureView();
|
||||
return depthStencilTexture.CreateDefaultView();
|
||||
}
|
||||
|
||||
bool InitSample(int argc, const char** argv) {
|
||||
|
|
|
@ -466,7 +466,7 @@ namespace {
|
|||
dawn::CommandBuffer cmdbuf = encoder.Finish();
|
||||
queue.Submit(1, &cmdbuf);
|
||||
|
||||
textures[iTextureID] = oTexture.CreateDefaultTextureView();
|
||||
textures[iTextureID] = oTexture.CreateDefaultView();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ namespace {
|
|||
const auto& defaultSceneNodes = scene.scenes.at(scene.defaultScene);
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultTextureView()},
|
||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultView()},
|
||||
depthStencilView);
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
for (const auto& n : defaultSceneNodes) {
|
||||
|
|
|
@ -381,7 +381,7 @@ namespace dawn_native {
|
|||
return mSampleCount > 1;
|
||||
}
|
||||
|
||||
TextureViewBase* TextureBase::CreateDefaultTextureView() {
|
||||
TextureViewBase* TextureBase::CreateDefaultView() {
|
||||
TextureViewDescriptor descriptor = {};
|
||||
|
||||
if (!IsError()) {
|
||||
|
@ -391,7 +391,7 @@ namespace dawn_native {
|
|||
return GetDevice()->CreateTextureView(this, &descriptor);
|
||||
}
|
||||
|
||||
TextureViewBase* TextureBase::CreateTextureView(const TextureViewDescriptor* descriptor) {
|
||||
TextureViewBase* TextureBase::CreateView(const TextureViewDescriptor* descriptor) {
|
||||
return GetDevice()->CreateTextureView(this, descriptor);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ namespace dawn_native {
|
|||
bool IsMultisampledTexture() const;
|
||||
|
||||
// Dawn API
|
||||
TextureViewBase* CreateDefaultTextureView();
|
||||
TextureViewBase* CreateTextureView(const TextureViewDescriptor* descriptor);
|
||||
TextureViewBase* CreateDefaultView();
|
||||
TextureViewBase* CreateView(const TextureViewDescriptor* descriptor);
|
||||
void Destroy();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -251,7 +251,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
dawn::TextureView textureView = texture.CreateDefaultTextureView();
|
||||
dawn::TextureView textureView = texture.CreateDefaultView();
|
||||
|
||||
int width = kRTSize, height = kRTSize;
|
||||
int widthInBytes = width * sizeof(RGBA8);
|
||||
|
|
|
@ -76,7 +76,7 @@ TEST_P(ClipSpaceTest, ClipSpace) {
|
|||
dawn::Texture depthStencilTexture = Create2DTextureForTest(dawn::TextureFormat::D32FloatS8Uint);
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||
{colorTexture.CreateDefaultTextureView()}, depthStencilTexture.CreateDefaultTextureView());
|
||||
{colorTexture.CreateDefaultView()}, depthStencilTexture.CreateDefaultView());
|
||||
renderPassDescriptor.cColorAttachmentsInfoPtr[0]->clearColor = {0.0, 1.0, 0.0, 1.0};
|
||||
renderPassDescriptor.cColorAttachmentsInfoPtr[0]->loadOp = dawn::LoadOp::Clear;
|
||||
|
||||
|
|
|
@ -766,7 +766,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
|||
|
||||
for (uint32_t i = 0; i < 4; ++i) {
|
||||
renderTargets[i] = device.CreateTexture(&descriptor);
|
||||
renderTargetViews[i] = renderTargets[i].CreateDefaultTextureView();
|
||||
renderTargetViews[i] = renderTargets[i].CreateDefaultView();
|
||||
}
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTargetViews[0], renderTargetViews[1],
|
||||
|
|
|
@ -37,7 +37,7 @@ class DepthStencilStateTest : public DawnTest {
|
|||
renderTargetDescriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||
renderTarget = device.CreateTexture(&renderTargetDescriptor);
|
||||
|
||||
renderTargetView = renderTarget.CreateDefaultTextureView();
|
||||
renderTargetView = renderTarget.CreateDefaultView();
|
||||
|
||||
dawn::TextureDescriptor depthDescriptor;
|
||||
depthDescriptor.dimension = dawn::TextureDimension::e2D;
|
||||
|
@ -51,7 +51,7 @@ class DepthStencilStateTest : public DawnTest {
|
|||
depthDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
depthTexture = device.CreateTexture(&depthDescriptor);
|
||||
|
||||
depthTextureView = depthTexture.CreateDefaultTextureView();
|
||||
depthTextureView = depthTexture.CreateDefaultView();
|
||||
|
||||
vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"(
|
||||
#version 450
|
||||
|
|
|
@ -239,7 +239,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
|||
textureDescriptor.usage = dawn::TextureUsageBit::Sampled;
|
||||
dawn::Texture wrappingTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
|
||||
|
||||
dawn::TextureView textureView = wrappingTexture.CreateDefaultTextureView();
|
||||
dawn::TextureView textureView = wrappingTexture.CreateDefaultView();
|
||||
|
||||
dawn::SamplerDescriptor samplerDescriptor = utils::GetDefaultSamplerDescriptor();
|
||||
dawn::Sampler sampler = device.CreateSampler(&samplerDescriptor);
|
||||
|
@ -331,7 +331,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
|||
textureDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
dawn::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
|
||||
|
||||
dawn::TextureView ioSurfaceView = ioSurfaceTexture.CreateDefaultTextureView();
|
||||
dawn::TextureView ioSurfaceView = ioSurfaceTexture.CreateDefaultView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({ioSurfaceView}, {});
|
||||
renderPassDescriptor.cColorAttachmentsInfoPtr[0]->clearColor = {1 / 255.0f, 2 / 255.0f,
|
||||
|
|
|
@ -28,9 +28,9 @@ class MultisampledRenderingTest : public DawnTest {
|
|||
|
||||
void InitTexturesForTest() {
|
||||
mMultisampledColorView =
|
||||
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateDefaultTextureView();
|
||||
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateDefaultView();
|
||||
mResolveTexture = CreateTextureForOutputAttachment(kColorFormat, 1);
|
||||
mResolveView = mResolveTexture.CreateDefaultTextureView();
|
||||
mResolveView = mResolveTexture.CreateDefaultView();
|
||||
}
|
||||
|
||||
dawn::RenderPipeline CreateRenderPipelineWithOneOutputForTest(bool testDepth) {
|
||||
|
@ -143,7 +143,7 @@ class MultisampledRenderingTest : public DawnTest {
|
|||
dawn::Texture depthStencilTexture =
|
||||
CreateTextureForOutputAttachment(kDepthStencilFormat, kSampleCount);
|
||||
renderPass.cDepthStencilAttachmentInfo.attachment =
|
||||
depthStencilTexture.CreateDefaultTextureView();
|
||||
depthStencilTexture.CreateDefaultView();
|
||||
renderPass.depthStencilAttachment = &renderPass.cDepthStencilAttachmentInfo;
|
||||
}
|
||||
|
||||
|
@ -338,9 +338,9 @@ TEST_P(MultisampledRenderingTest, ResolveInAnotherRenderPass) {
|
|||
// Test doing MSAA resolve into multiple resolve targets works correctly.
|
||||
TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargets) {
|
||||
dawn::TextureView multisampledColorView2 =
|
||||
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateDefaultTextureView();
|
||||
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateDefaultView();
|
||||
dawn::Texture resolveTexture2 = CreateTextureForOutputAttachment(kColorFormat, 1);
|
||||
dawn::TextureView resolveView2 = resolveTexture2.CreateDefaultTextureView();
|
||||
dawn::TextureView resolveView2 = resolveTexture2.CreateDefaultView();
|
||||
|
||||
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
dawn::RenderPipeline pipeline = CreateRenderPipelineWithTwoOutputsForTest();
|
||||
|
@ -392,7 +392,7 @@ TEST_P(MultisampledRenderingTest, ResolveOneMultisampledTextureTwice) {
|
|||
|
||||
// In second render pass we do MSAA resolve into resolveTexture2.
|
||||
{
|
||||
dawn::TextureView resolveView2 = resolveTexture2.CreateDefaultTextureView();
|
||||
dawn::TextureView resolveView2 = resolveTexture2.CreateDefaultView();
|
||||
utils::ComboRenderPassDescriptor renderPass = CreateComboRenderPassDescriptorForTest(
|
||||
{mMultisampledColorView}, {resolveView2}, dawn::LoadOp::Load, dawn::LoadOp::Load,
|
||||
kTestDepth);
|
||||
|
@ -425,7 +425,7 @@ TEST_P(MultisampledRenderingTest, ResolveIntoOneMipmapLevelOf2DTexture) {
|
|||
|
||||
dawn::Texture resolveTexture =
|
||||
CreateTextureForOutputAttachment(kColorFormat, 1, kBaseMipLevel + 1, 1);
|
||||
dawn::TextureView resolveView = resolveTexture.CreateTextureView(&textureViewDescriptor);
|
||||
dawn::TextureView resolveView = resolveTexture.CreateView(&textureViewDescriptor);
|
||||
|
||||
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
constexpr dawn::Color kGreen = {0.0f, 0.8f, 0.0f, 0.8f};
|
||||
|
@ -454,7 +454,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
|
|||
// TODO(jiawei.shao@intel.com): investigate why this case fails on Intel and Nvidia.
|
||||
DAWN_SKIP_TEST_IF(IsMetal() && (IsIntel() || IsNvidia()));
|
||||
dawn::TextureView multisampledColorView2 =
|
||||
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateDefaultTextureView();
|
||||
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateDefaultView();
|
||||
|
||||
dawn::TextureViewDescriptor baseTextureViewDescriptor;
|
||||
baseTextureViewDescriptor.dimension = dawn::TextureViewDimension::e2D;
|
||||
|
@ -470,7 +470,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
|
|||
dawn::TextureViewDescriptor resolveViewDescriptor1 = baseTextureViewDescriptor;
|
||||
resolveViewDescriptor1.baseArrayLayer = kBaseArrayLayer1;
|
||||
resolveViewDescriptor1.baseMipLevel = kBaseMipLevel1;
|
||||
dawn::TextureView resolveView1 = resolveTexture1.CreateTextureView(&resolveViewDescriptor1);
|
||||
dawn::TextureView resolveView1 = resolveTexture1.CreateView(&resolveViewDescriptor1);
|
||||
|
||||
// Create resolveTexture2 with (kBaseMipLevel2 + 1) mipmap levels and resolve into its last
|
||||
// mipmap level.
|
||||
|
@ -481,7 +481,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
|
|||
dawn::TextureViewDescriptor resolveViewDescriptor2 = baseTextureViewDescriptor;
|
||||
resolveViewDescriptor2.baseArrayLayer = kBaseArrayLayer2;
|
||||
resolveViewDescriptor2.baseMipLevel = kBaseMipLevel2;
|
||||
dawn::TextureView resolveView2 = resolveTexture2.CreateTextureView(&resolveViewDescriptor2);
|
||||
dawn::TextureView resolveView2 = resolveTexture2.CreateView(&resolveViewDescriptor2);
|
||||
|
||||
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
dawn::RenderPipeline pipeline = CreateRenderPipelineWithTwoOutputsForTest();
|
||||
|
|
|
@ -69,7 +69,7 @@ class RenderPassLoadOpTests : public DawnTest {
|
|||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||
renderTarget = device.CreateTexture(&descriptor);
|
||||
|
||||
renderTargetView = renderTarget.CreateDefaultTextureView();
|
||||
renderTargetView = renderTarget.CreateDefaultView();
|
||||
|
||||
RGBA8 zero(0, 0, 0, 0);
|
||||
std::fill(expectZero.begin(), expectZero.end(), zero);
|
||||
|
|
|
@ -84,7 +84,7 @@ TEST_P(RenderPassTest, TwoRenderPassesInOneCommandBuffer) {
|
|||
{
|
||||
// In the first render pass we clear renderTarget1 to red and draw a blue triangle in the
|
||||
// bottom left of renderTarget1.
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTarget1.CreateDefaultTextureView()});
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTarget1.CreateDefaultView()});
|
||||
renderPass.cColorAttachmentsInfoPtr[0]->clearColor = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
|
@ -96,7 +96,7 @@ TEST_P(RenderPassTest, TwoRenderPassesInOneCommandBuffer) {
|
|||
{
|
||||
// In the second render pass we clear renderTarget2 to green and draw a blue triangle in the
|
||||
// bottom left of renderTarget2.
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTarget2.CreateDefaultTextureView()});
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTarget2.CreateDefaultView()});
|
||||
renderPass.cColorAttachmentsInfoPtr[0]->clearColor = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
|
|
|
@ -113,7 +113,7 @@ protected:
|
|||
dawn::CommandBuffer copy = encoder.Finish();
|
||||
queue.Submit(1, ©);
|
||||
|
||||
mTextureView = texture.CreateDefaultTextureView();
|
||||
mTextureView = texture.CreateDefaultView();
|
||||
}
|
||||
|
||||
void TestAddressModes(AddressModeTestCase u, AddressModeTestCase v, AddressModeTestCase w) {
|
||||
|
|
|
@ -209,7 +209,7 @@ protected:
|
|||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.baseMipLevel = textureViewBaseMipLevel;
|
||||
descriptor.mipLevelCount = 1;
|
||||
dawn::TextureView textureView = mTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView textureView = mTexture.CreateView(&descriptor);
|
||||
|
||||
const char* fragmentShader = R"(
|
||||
#version 450
|
||||
|
@ -248,7 +248,7 @@ protected:
|
|||
descriptor.arrayLayerCount = kTextureViewLayerCount;
|
||||
descriptor.baseMipLevel = textureViewBaseMipLevel;
|
||||
descriptor.mipLevelCount = 1;
|
||||
dawn::TextureView textureView = mTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView textureView = mTexture.CreateView(&descriptor);
|
||||
|
||||
const char* fragmentShader = R"(
|
||||
#version 450
|
||||
|
@ -328,7 +328,7 @@ protected:
|
|||
descriptor.baseArrayLayer = textureViewBaseLayer;
|
||||
descriptor.arrayLayerCount = textureViewLayerCount;
|
||||
|
||||
dawn::TextureView cubeMapTextureView = mTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView cubeMapTextureView = mTexture.CreateView(&descriptor);
|
||||
|
||||
// Check the data in the every face of the cube map (array) texture view.
|
||||
for (uint32_t layer = 0; layer < textureViewLayerCount; ++layer) {
|
||||
|
@ -358,7 +358,7 @@ TEST_P(TextureViewSamplingTest, Default2DArrayTexture) {
|
|||
constexpr uint32_t kMipLevels = 1;
|
||||
initTexture(kLayers, kMipLevels);
|
||||
|
||||
dawn::TextureView textureView = mTexture.CreateDefaultTextureView();
|
||||
dawn::TextureView textureView = mTexture.CreateDefaultView();
|
||||
|
||||
const char* fragmentShader = R"(
|
||||
#version 450
|
||||
|
@ -486,7 +486,7 @@ class TextureViewRenderingTest : public DawnTest {
|
|||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.baseMipLevel = textureViewBaseLevel;
|
||||
descriptor.mipLevelCount = 1;
|
||||
dawn::TextureView textureView = texture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView textureView = texture.CreateView(&descriptor);
|
||||
|
||||
dawn::ShaderModule vsModule = CreateDefaultVertexShaderModule(device);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class BindGroupValidationTest : public ValidationTest {
|
|||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::Sampled;
|
||||
mSampledTexture = device.CreateTexture(&descriptor);
|
||||
mSampledTextureView = mSampledTexture.CreateDefaultTextureView();
|
||||
mSampledTextureView = mSampledTexture.CreateDefaultView();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
|
|||
viewDesc.arrayLayerCount = 0;
|
||||
|
||||
dawn::TextureView errorView;
|
||||
ASSERT_DEVICE_ERROR(errorView = mSampledTexture.CreateTextureView(&viewDesc));
|
||||
ASSERT_DEVICE_ERROR(errorView = mSampledTexture.CreateView(&viewDesc));
|
||||
|
||||
binding.textureView = errorView;
|
||||
ASSERT_DEVICE_ERROR(device.CreateBindGroup(&descriptor));
|
||||
|
@ -301,7 +301,7 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
|
|||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
dawn::Texture outputTexture = device.CreateTexture(&descriptor);
|
||||
dawn::TextureView outputTextureView = outputTexture.CreateDefaultTextureView();
|
||||
dawn::TextureView outputTextureView = outputTexture.CreateDefaultView();
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, outputTextureView}}));
|
||||
}
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ TEST_F(CommandBufferValidationTest, TextureWithReadAndWriteUsage) {
|
|||
textureDescriptor.sampleCount = 1;
|
||||
textureDescriptor.mipLevelCount = 1;
|
||||
dawn::Texture texture = device.CreateTexture(&textureDescriptor);
|
||||
dawn::TextureView view = texture.CreateDefaultTextureView();
|
||||
dawn::TextureView view = texture.CreateDefaultView();
|
||||
|
||||
// Create the bind group to use the texture as sampled
|
||||
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(device, {{
|
||||
|
|
|
@ -69,7 +69,7 @@ dawn::TextureView Create2DAttachment(dawn::Device& device,
|
|||
dawn::TextureFormat format) {
|
||||
dawn::Texture texture = CreateTexture(
|
||||
device, dawn::TextureDimension::e2D, format, width, height, 1, 1);
|
||||
return texture.CreateDefaultTextureView();
|
||||
return texture.CreateDefaultView();
|
||||
}
|
||||
|
||||
// Using BeginRenderPass with no attachments isn't valid
|
||||
|
@ -222,7 +222,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
|||
descriptor.format = kColorFormat;
|
||||
descriptor.arrayLayerCount = 5;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({colorTextureView});
|
||||
AssertBeginRenderPassError(&renderPass);
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
|||
descriptor.format = kDepthStencilFormat;
|
||||
descriptor.arrayLayerCount = 5;
|
||||
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({}, depthStencilView);
|
||||
AssertBeginRenderPassError(&renderPass);
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
|||
descriptor.baseArrayLayer = 0;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({colorTextureView});
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
|||
descriptor.baseArrayLayer = 0;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({}, depthStencilView);
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
|||
descriptor.baseArrayLayer = kArrayLayers - 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({colorTextureView});
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
|||
descriptor.baseArrayLayer = kArrayLayers - 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({}, depthStencilView);
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
|||
descriptor.format = kColorFormat;
|
||||
descriptor.mipLevelCount = 2;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({colorTextureView});
|
||||
AssertBeginRenderPassError(&renderPass);
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
|||
descriptor.format = kDepthStencilFormat;
|
||||
descriptor.mipLevelCount = 2;
|
||||
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({}, depthStencilView);
|
||||
AssertBeginRenderPassError(&renderPass);
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
|||
descriptor.baseMipLevel = 0;
|
||||
descriptor.mipLevelCount = 1;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({colorTextureView});
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
|||
descriptor.baseMipLevel = 0;
|
||||
descriptor.mipLevelCount = 1;
|
||||
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({}, depthStencilView);
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
|||
descriptor.baseMipLevel = kLevelCount - 1;
|
||||
descriptor.mipLevelCount = 1;
|
||||
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({colorTextureView});
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepth
|
|||
descriptor.baseMipLevel = kLevelCount - 1;
|
||||
descriptor.mipLevelCount = 1;
|
||||
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateTextureView(&descriptor);
|
||||
dawn::TextureView depthStencilView = depthStencilTexture.CreateView(&descriptor);
|
||||
utils::ComboRenderPassDescriptor renderPass({}, depthStencilView);
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
@ -394,8 +394,8 @@ TEST_F(RenderPassDescriptorValidationTest, NonMultisampledColorWithResolveTarget
|
|||
dawn::Texture resolveTargetTexture = CreateTexture(
|
||||
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers,
|
||||
kLevelCount, kSampleCount);
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateDefaultTextureView();
|
||||
dawn::TextureView resolveTargetTextureView = resolveTargetTexture.CreateDefaultTextureView();
|
||||
dawn::TextureView colorTextureView = colorTexture.CreateDefaultView();
|
||||
dawn::TextureView resolveTargetTextureView = resolveTargetTexture.CreateDefaultView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass({colorTextureView});
|
||||
renderPass.cColorAttachmentsInfoPtr[0]->resolveTarget = resolveTargetTextureView;
|
||||
|
@ -428,7 +428,7 @@ class MultisampledRenderPassDescriptorValidationTest : public RenderPassDescript
|
|||
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers,
|
||||
kLevelCount, sampleCount);
|
||||
|
||||
return colorTexture.CreateDefaultTextureView();
|
||||
return colorTexture.CreateDefaultView();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -467,7 +467,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetArrayLayerMo
|
|||
dawn::Texture resolveTexture = CreateTexture(
|
||||
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers2,
|
||||
kLevelCount);
|
||||
dawn::TextureView resolveTextureView = resolveTexture.CreateDefaultTextureView();
|
||||
dawn::TextureView resolveTextureView = resolveTexture.CreateDefaultView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass = CreateMultisampledRenderPass();
|
||||
renderPass.cColorAttachmentsInfoPtr[0]->resolveTarget = resolveTextureView;
|
||||
|
@ -480,7 +480,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetMipmapLevelM
|
|||
dawn::Texture resolveTexture = CreateTexture(
|
||||
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers,
|
||||
kLevelCount2);
|
||||
dawn::TextureView resolveTextureView = resolveTexture.CreateDefaultTextureView();
|
||||
dawn::TextureView resolveTextureView = resolveTexture.CreateDefaultView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass = CreateMultisampledRenderPass();
|
||||
renderPass.cColorAttachmentsInfoPtr[0]->resolveTarget = resolveTextureView;
|
||||
|
@ -496,7 +496,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetUsageNoOutpu
|
|||
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers,
|
||||
kLevelCount, 1, kUsage);
|
||||
dawn::TextureView nonColorUsageResolveTextureView =
|
||||
nonColorUsageResolveTexture.CreateDefaultTextureView();
|
||||
nonColorUsageResolveTexture.CreateDefaultView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass = CreateMultisampledRenderPass();
|
||||
renderPass.cColorAttachmentsInfoPtr[0]->resolveTarget = nonColorUsageResolveTextureView;
|
||||
|
@ -514,7 +514,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetInErrorState
|
|||
errorTextureView.baseArrayLayer = kArrayLayers + 1;
|
||||
ASSERT_DEVICE_ERROR(
|
||||
dawn::TextureView errorResolveTarget =
|
||||
resolveTexture.CreateTextureView(&errorTextureView));
|
||||
resolveTexture.CreateView(&errorTextureView));
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass = CreateMultisampledRenderPass();
|
||||
renderPass.cColorAttachmentsInfoPtr[0]->resolveTarget = errorResolveTarget;
|
||||
|
@ -536,7 +536,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetDifferentFor
|
|||
dawn::Texture resolveTexture = CreateTexture(
|
||||
device, dawn::TextureDimension::e2D, kColorFormat2, kSize, kSize, kArrayLayers,
|
||||
kLevelCount);
|
||||
dawn::TextureView resolveTextureView = resolveTexture.CreateDefaultTextureView();
|
||||
dawn::TextureView resolveTextureView = resolveTexture.CreateDefaultView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass = CreateMultisampledRenderPass();
|
||||
renderPass.cColorAttachmentsInfoPtr[0]->resolveTarget = resolveTextureView;
|
||||
|
@ -563,7 +563,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ColorAttachmentResolveTar
|
|||
firstMipLevelDescriptor.baseMipLevel = 0;
|
||||
|
||||
dawn::TextureView resolveTextureView =
|
||||
resolveTexture.CreateTextureView(&firstMipLevelDescriptor);
|
||||
resolveTexture.CreateView(&firstMipLevelDescriptor);
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass = CreateMultisampledRenderPass();
|
||||
renderPass.cColorAttachmentsInfoPtr[0]->resolveTarget = resolveTextureView;
|
||||
|
@ -575,7 +575,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ColorAttachmentResolveTar
|
|||
secondMipLevelDescriptor.baseMipLevel = 1;
|
||||
|
||||
dawn::TextureView resolveTextureView =
|
||||
resolveTexture.CreateTextureView(&secondMipLevelDescriptor);
|
||||
resolveTexture.CreateView(&secondMipLevelDescriptor);
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass = CreateMultisampledRenderPass();
|
||||
renderPass.cColorAttachmentsInfoPtr[0]->resolveTarget = resolveTextureView;
|
||||
|
@ -590,7 +590,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, DepthStencilAttachmentSam
|
|||
device, dawn::TextureDimension::e2D, kDepthStencilFormat, kSize, kSize, kArrayLayers,
|
||||
kLevelCount, kSampleCount);
|
||||
dawn::TextureView multisampledDepthStencilTextureView =
|
||||
multisampledDepthStencilTexture.CreateDefaultTextureView();
|
||||
multisampledDepthStencilTexture.CreateDefaultView();
|
||||
|
||||
// It is not allowed to use a depth stencil attachment whose sample count is different from the
|
||||
// one of the color attachment.
|
||||
|
@ -598,7 +598,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, DepthStencilAttachmentSam
|
|||
dawn::Texture depthStencilTexture = CreateTexture(
|
||||
device, dawn::TextureDimension::e2D, kDepthStencilFormat, kSize, kSize, kArrayLayers,
|
||||
kLevelCount);
|
||||
dawn::TextureView depthStencilTextureView = depthStencilTexture.CreateDefaultTextureView();
|
||||
dawn::TextureView depthStencilTextureView = depthStencilTexture.CreateDefaultView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass(
|
||||
{CreateMultisampledColorTextureView()}, depthStencilTextureView);
|
||||
|
|
|
@ -143,7 +143,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
|||
textureDescriptor.sampleCount = kMultisampledCount;
|
||||
dawn::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||
{multisampledColorTexture.CreateDefaultTextureView()});
|
||||
{multisampledColorTexture.CreateDefaultView()});
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
dawn::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||
|
@ -160,7 +160,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
|||
dawn::Texture multisampledDepthStencilTexture =
|
||||
device.CreateTexture(&textureDescriptor);
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||
{}, multisampledDepthStencilTexture.CreateDefaultTextureView());
|
||||
{}, multisampledDepthStencilTexture.CreateDefaultView());
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
dawn::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||
|
@ -179,7 +179,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
|||
textureDescriptor.sampleCount = kMultisampledCount;
|
||||
dawn::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||
{multisampledColorTexture.CreateDefaultTextureView()});
|
||||
{multisampledColorTexture.CreateDefaultView()});
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
dawn::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||
|
@ -196,7 +196,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
|||
dawn::Texture multisampledDepthStencilTexture =
|
||||
device.CreateTexture(&textureDescriptor);
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||
{}, multisampledDepthStencilTexture.CreateDefaultTextureView());
|
||||
{}, multisampledDepthStencilTexture.CreateDefaultView());
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
dawn::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||
|
@ -215,7 +215,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
|||
textureDescriptor.sampleCount = 1;
|
||||
dawn::Texture nonMultisampledColorTexture = device.CreateTexture(&textureDescriptor);
|
||||
utils::ComboRenderPassDescriptor nonMultisampledRenderPassDescriptor(
|
||||
{ nonMultisampledColorTexture.CreateDefaultTextureView() });
|
||||
{ nonMultisampledColorTexture.CreateDefaultView() });
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
dawn::RenderPassEncoder renderPass =
|
||||
|
@ -233,7 +233,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
|||
dawn::Texture multisampledDepthStencilTexture =
|
||||
device.CreateTexture(&textureDescriptor);
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||
{}, multisampledDepthStencilTexture.CreateDefaultTextureView());
|
||||
{}, multisampledDepthStencilTexture.CreateDefaultView());
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
dawn::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||
|
|
|
@ -115,7 +115,7 @@ TEST_F(TextureValidationTest, DestroyDestroyedTexture) {
|
|||
TEST_F(TextureValidationTest, DestroyEncodeSubmit) {
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
dawn::TextureView textureView = texture.CreateDefaultTextureView();
|
||||
dawn::TextureView textureView = texture.CreateDefaultView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass({textureView});
|
||||
|
||||
|
@ -138,7 +138,7 @@ TEST_F(TextureValidationTest, DestroyEncodeSubmit) {
|
|||
TEST_F(TextureValidationTest, EncodeDestroySubmit) {
|
||||
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
dawn::TextureView textureView = texture.CreateDefaultTextureView();
|
||||
dawn::TextureView textureView = texture.CreateDefaultView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass({textureView});
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ dawn::Texture Create2DArrayTexture(dawn::Device& device,
|
|||
return device.CreateTexture(&descriptor);
|
||||
}
|
||||
|
||||
dawn::TextureViewDescriptor CreateDefaultTextureViewDescriptor(dawn::TextureViewDimension dimension) {
|
||||
dawn::TextureViewDescriptor CreateDefaultViewDescriptor(dawn::TextureViewDimension dimension) {
|
||||
dawn::TextureViewDescriptor descriptor;
|
||||
descriptor.format = kDefaultTextureFormat;
|
||||
descriptor.dimension = dimension;
|
||||
|
@ -60,13 +60,13 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
|
|||
dawn::Texture texture = Create2DArrayTexture(device, 1);
|
||||
|
||||
dawn::TextureViewDescriptor base2DTextureViewDescriptor =
|
||||
CreateDefaultTextureViewDescriptor(dawn::TextureViewDimension::e2D);
|
||||
CreateDefaultViewDescriptor(dawn::TextureViewDimension::e2D);
|
||||
|
||||
// It is OK to create a 2D texture view on a 2D texture.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
texture.CreateView(&descriptor);
|
||||
}
|
||||
|
||||
// It is an error to specify the layer count of the texture view > 1 when texture view dimension
|
||||
|
@ -74,7 +74,7 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
|
|||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.arrayLayerCount = 2;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is OK to create a 1-layer 2D array texture view on a 2D texture.
|
||||
|
@ -82,14 +82,14 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
|
|||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::e2DArray;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
texture.CreateView(&descriptor);
|
||||
}
|
||||
|
||||
// It is an error to specify mipLevelCount == 0.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.mipLevelCount = 0;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is an error to make the mip level out of range.
|
||||
|
@ -97,7 +97,7 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2D) {
|
|||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.baseMipLevel = kDefaultMipLevels - 1;
|
||||
descriptor.mipLevelCount = 2;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,35 +108,35 @@ TEST_F(TextureViewValidationTest, CreateTextureViewOnTexture2DArray) {
|
|||
dawn::Texture texture = Create2DArrayTexture(device, kDefaultArrayLayers);
|
||||
|
||||
dawn::TextureViewDescriptor base2DArrayTextureViewDescriptor =
|
||||
CreateDefaultTextureViewDescriptor(dawn::TextureViewDimension::e2DArray);
|
||||
CreateDefaultViewDescriptor(dawn::TextureViewDimension::e2DArray);
|
||||
|
||||
// It is OK to create a 2D texture view on a 2D array texture.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::e2D;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
texture.CreateView(&descriptor);
|
||||
}
|
||||
|
||||
// It is OK to create a 2D array texture view on a 2D array texture.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.arrayLayerCount = kDefaultArrayLayers;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
texture.CreateView(&descriptor);
|
||||
}
|
||||
|
||||
// It is an error to specify arrayLayerCount == 0.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.arrayLayerCount = 0;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is an error to make the array layer out of range.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.arrayLayerCount = kDefaultArrayLayers + 1;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,14 +147,14 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
|
|||
dawn::Texture texture = Create2DArrayTexture(device, kDefaultArrayLayers);
|
||||
|
||||
dawn::TextureViewDescriptor base2DArrayTextureViewDescriptor =
|
||||
CreateDefaultTextureViewDescriptor(dawn::TextureViewDimension::e2DArray);
|
||||
CreateDefaultViewDescriptor(dawn::TextureViewDimension::e2DArray);
|
||||
|
||||
// It is OK to create a cube map texture view with arrayLayerCount == 6.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::Cube;
|
||||
descriptor.arrayLayerCount = 6;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
texture.CreateView(&descriptor);
|
||||
}
|
||||
|
||||
// It is an error to create a cube map texture view with arrayLayerCount != 6.
|
||||
|
@ -162,7 +162,7 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
|
|||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::Cube;
|
||||
descriptor.arrayLayerCount = 3;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is OK to create a cube map array texture view with arrayLayerCount % 6 == 0.
|
||||
|
@ -170,7 +170,7 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
|
|||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::CubeArray;
|
||||
descriptor.arrayLayerCount = 12;
|
||||
texture.CreateTextureView(&descriptor);
|
||||
texture.CreateView(&descriptor);
|
||||
}
|
||||
|
||||
// It is an error to create a cube map array texture view with arrayLayerCount % 6 != 0.
|
||||
|
@ -178,7 +178,7 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
|
|||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::CubeArray;
|
||||
descriptor.arrayLayerCount = 11;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is an error to create a cube map texture view with width != height.
|
||||
|
@ -188,7 +188,7 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
|
|||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::Cube;
|
||||
descriptor.arrayLayerCount = 6;
|
||||
ASSERT_DEVICE_ERROR(nonSquareTexture.CreateTextureView(&descriptor));
|
||||
ASSERT_DEVICE_ERROR(nonSquareTexture.CreateView(&descriptor));
|
||||
}
|
||||
|
||||
// It is an error to create a cube map array texture view with width != height.
|
||||
|
@ -198,7 +198,7 @@ TEST_F(TextureViewValidationTest, CreateCubeMapTextureView) {
|
|||
dawn::TextureViewDescriptor descriptor = base2DArrayTextureViewDescriptor;
|
||||
descriptor.dimension = dawn::TextureViewDimension::CubeArray;
|
||||
descriptor.arrayLayerCount = 12;
|
||||
ASSERT_DEVICE_ERROR(nonSquareTexture.CreateTextureView(&descriptor));
|
||||
ASSERT_DEVICE_ERROR(nonSquareTexture.CreateView(&descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,13 +208,13 @@ TEST_F(TextureViewValidationTest, TextureViewFormatCompatibility) {
|
|||
dawn::Texture texture = Create2DArrayTexture(device, 1);
|
||||
|
||||
dawn::TextureViewDescriptor base2DTextureViewDescriptor =
|
||||
CreateDefaultTextureViewDescriptor(dawn::TextureViewDimension::e2D);
|
||||
CreateDefaultViewDescriptor(dawn::TextureViewDimension::e2D);
|
||||
|
||||
// It is an error to create a texture view in depth-stencil format on a RGBA texture.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.format = dawn::TextureFormat::D32FloatS8Uint;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,8 +222,8 @@ TEST_F(TextureViewValidationTest, TextureViewFormatCompatibility) {
|
|||
TEST_F(TextureViewValidationTest, DestroyCreateTextureView) {
|
||||
dawn::Texture texture = Create2DArrayTexture(device, 1);
|
||||
dawn::TextureViewDescriptor descriptor =
|
||||
CreateDefaultTextureViewDescriptor(dawn::TextureViewDimension::e2D);
|
||||
CreateDefaultViewDescriptor(dawn::TextureViewDimension::e2D);
|
||||
texture.Destroy();
|
||||
ASSERT_DEVICE_ERROR(texture.CreateTextureView(&descriptor));
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
}
|
|
@ -93,7 +93,7 @@ ValidationTest::DummyRenderPass::DummyRenderPass(const dawn::Device& device)
|
|||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
attachment = device.CreateTexture(&descriptor);
|
||||
|
||||
dawn::TextureView view = attachment.CreateDefaultTextureView();
|
||||
dawn::TextureView view = attachment.CreateDefaultView();
|
||||
mColorAttachment.attachment = view;
|
||||
mColorAttachment.resolveTarget = nullptr;
|
||||
mColorAttachment.clearColor = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
|
|
@ -36,9 +36,9 @@ TEST_F(WireInjectTextureTests, CallAfterReserveInject) {
|
|||
EXPECT_CALL(api, TextureReference(apiTexture));
|
||||
ASSERT_TRUE(GetWireServer()->InjectTexture(apiTexture, reservation.id, reservation.generation));
|
||||
|
||||
dawnTextureCreateDefaultTextureView(reservation.texture);
|
||||
dawnTextureCreateDefaultView(reservation.texture);
|
||||
DawnTextureView apiDummyView = api.GetNewTextureView();
|
||||
EXPECT_CALL(api, TextureCreateDefaultTextureView(apiTexture)).WillOnce(Return(apiDummyView));
|
||||
EXPECT_CALL(api, TextureCreateDefaultView(apiTexture)).WillOnce(Return(apiDummyView));
|
||||
FlushClient();
|
||||
}
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ namespace utils {
|
|||
height(texHeight),
|
||||
color(colorAttachment),
|
||||
colorFormat(textureFormat),
|
||||
renderPassInfo({colorAttachment.CreateDefaultTextureView()}) {
|
||||
renderPassInfo({colorAttachment.CreateDefaultView()}) {
|
||||
}
|
||||
|
||||
BasicRenderPass CreateBasicRenderPass(const dawn::Device& device,
|
||||
|
|
Loading…
Reference in New Issue