Remove Texture::createDefaultView

https://github.com/gpuweb/gpuweb/pull/389

Bug: dawn:214
Change-Id: I86b8c46c71c3e5b9622ab3656124b312d3e85a7a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10420
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Kai Ninomiya 2019-08-27 17:56:23 +00:00 committed by Commit Bot service account
parent b9b088f57e
commit 4078ed8b62
33 changed files with 85 additions and 111 deletions

View File

@ -389,8 +389,7 @@
]
},
{
"name": "end pass",
"TODO": "This returns the top-level encoder in the WebGPU IDL"
"name": "end pass"
}
]
},
@ -1008,8 +1007,7 @@
]
},
{
"name": "end pass",
"TODO": "This returns the top-level encoder in the WebGPU IDL"
"name": "end pass"
}
]
},
@ -1129,10 +1127,6 @@
"texture": {
"category": "object",
"methods": [
{
"name": "create default view",
"returns": "texture view"
},
{
"name": "create view",
"returns": "texture view",

View File

@ -152,7 +152,7 @@ void frame() {
}
ubo.SetSubData(0, kNumTriangles * sizeof(ShaderData), shaderData.data());
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultView()});
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateView()});
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);

View File

@ -127,10 +127,7 @@ void init() {
void frame() {
DawnTexture backbuffer = dawnSwapChainGetNextTexture(swapchain);
DawnTextureView backbufferView;
{
backbufferView = dawnTextureCreateDefaultView(backbuffer);
}
DawnTextureView backbufferView = dawnTextureCreateView(backbuffer, nullptr);
DawnRenderPassDescriptor renderpassInfo;
DawnRenderPassColorAttachmentDescriptor colorAttachment;
DawnRenderPassColorAttachmentDescriptor* colorAttachments = {&colorAttachment};

View File

@ -279,8 +279,7 @@ dawn::CommandBuffer createCommandBuffer(const dawn::Texture backbuffer, size_t i
}
{
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultView()},
depthStencilView);
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateView()}, depthStencilView);
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
pass.SetPipeline(renderPipeline);
pass.SetVertexBuffers(0, 1, &bufferDst, zeroOffsets);

View File

@ -139,7 +139,7 @@ void init() {
pipeline = device.CreateRenderPipeline(&descriptor);
dawn::TextureView view = texture.CreateDefaultView();
dawn::TextureView view = texture.CreateView();
bindGroup = utils::MakeBindGroup(device, bgl, {
{0, sampler},
@ -154,8 +154,7 @@ void frame() {
if (s.b >= 1.0f) {s.b = 0.0f;}
dawn::Texture backbuffer = swapchain.GetNextTexture();
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultView()},
depthStencilView);
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateView()}, depthStencilView);
static const uint64_t vertexBufferOffsets[1] = {0};
dawn::CommandEncoder encoder = device.CreateCommandEncoder();

View File

@ -266,8 +266,7 @@ void frame() {
cameraBuffer.SetSubData(0, sizeof(CameraData), &cameraData);
dawn::Texture backbuffer = swapchain.GetNextTexture();
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateDefaultView()},
depthStencilView);
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateView()}, depthStencilView);
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{

View File

@ -175,7 +175,7 @@ dawn::TextureView CreateDefaultDepthStencilView(const dawn::Device& device) {
descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsage::OutputAttachment;
auto depthStencilTexture = device.CreateTexture(&descriptor);
return depthStencilTexture.CreateDefaultView();
return depthStencilTexture.CreateView();
}
bool InitSample(int argc, const char** argv) {

View File

@ -453,16 +453,6 @@ namespace dawn_native {
return extent;
}
TextureViewBase* TextureBase::CreateDefaultView() {
TextureViewDescriptor descriptor = {};
if (!IsError()) {
descriptor = GetTextureViewDescriptorWithDefaults(this, nullptr);
}
return GetDevice()->CreateTextureView(this, &descriptor);
}
TextureViewBase* TextureBase::CreateView(const TextureViewDescriptor* descriptor) {
return GetDevice()->CreateTextureView(this, descriptor);
}

View File

@ -80,7 +80,6 @@ namespace dawn_native {
Extent3D GetMipLevelVirtualSize(uint32_t level) const;
// Dawn API
TextureViewBase* CreateDefaultView();
TextureViewBase* CreateView(const TextureViewDescriptor* descriptor);
void Destroy();

View File

@ -246,7 +246,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
dawn::Texture texture = device.CreateTexture(&descriptor);
dawn::TextureView textureView = texture.CreateDefaultView();
dawn::TextureView textureView = texture.CreateView();
int width = kRTSize, height = kRTSize;
int widthInBytes = width * sizeof(RGBA8);

View File

@ -76,8 +76,8 @@ TEST_P(ClipSpaceTest, ClipSpace) {
dawn::Texture depthStencilTexture =
Create2DTextureForTest(dawn::TextureFormat::Depth24PlusStencil8);
utils::ComboRenderPassDescriptor renderPassDescriptor(
{colorTexture.CreateDefaultView()}, depthStencilTexture.CreateDefaultView());
utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()},
depthStencilTexture.CreateView());
renderPassDescriptor.cColorAttachmentsInfoPtr[0]->clearColor = {0.0, 1.0, 0.0, 1.0};
renderPassDescriptor.cColorAttachmentsInfoPtr[0]->loadOp = dawn::LoadOp::Clear;

View File

@ -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].CreateDefaultView();
renderTargetViews[i] = renderTargets[i].CreateView();
}
utils::ComboRenderPassDescriptor renderPass({renderTargetViews[0], renderTargetViews[1],

View File

@ -77,7 +77,7 @@ class CullingTest : public DawnTest {
bool isCWTriangleCulled) {
dawn::Texture colorTexture = Create2DTextureForTest(dawn::TextureFormat::RGBA8Unorm);
utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateDefaultView()});
utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()});
renderPassDescriptor.cColorAttachmentsInfoPtr[0]->clearColor = {0.0, 0.0, 1.0, 1.0};
renderPassDescriptor.cColorAttachmentsInfoPtr[0]->loadOp = dawn::LoadOp::Clear;

View File

@ -38,7 +38,7 @@ class DepthStencilStateTest : public DawnTest {
dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
renderTarget = device.CreateTexture(&renderTargetDescriptor);
renderTargetView = renderTarget.CreateDefaultView();
renderTargetView = renderTarget.CreateView();
dawn::TextureDescriptor depthDescriptor;
depthDescriptor.dimension = dawn::TextureDimension::e2D;
@ -52,7 +52,7 @@ class DepthStencilStateTest : public DawnTest {
depthDescriptor.usage = dawn::TextureUsage::OutputAttachment;
depthTexture = device.CreateTexture(&depthDescriptor);
depthTextureView = depthTexture.CreateDefaultView();
depthTextureView = depthTexture.CreateView();
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450

View File

@ -251,7 +251,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
textureDescriptor.usage = dawn::TextureUsage::Sampled;
dawn::Texture wrappingTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
dawn::TextureView textureView = wrappingTexture.CreateDefaultView();
dawn::TextureView textureView = wrappingTexture.CreateView();
dawn::SamplerDescriptor samplerDescriptor = utils::GetDefaultSamplerDescriptor();
dawn::Sampler sampler = device.CreateSampler(&samplerDescriptor);
@ -344,7 +344,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
textureDescriptor.usage = dawn::TextureUsage::OutputAttachment;
dawn::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
dawn::TextureView ioSurfaceView = ioSurfaceTexture.CreateDefaultView();
dawn::TextureView ioSurfaceView = ioSurfaceTexture.CreateView();
utils::ComboRenderPassDescriptor renderPassDescriptor({ioSurfaceView}, {});
renderPassDescriptor.cColorAttachmentsInfoPtr[0]->clearColor = {1 / 255.0f, 2 / 255.0f,

View File

@ -28,12 +28,12 @@ class MultisampledRenderingTest : public DawnTest {
void InitTexturesForTest() {
mMultisampledColorView =
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateDefaultView();
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
mResolveTexture = CreateTextureForOutputAttachment(kColorFormat, 1);
mResolveView = mResolveTexture.CreateDefaultView();
mResolveView = mResolveTexture.CreateView();
mDepthStencilTexture = CreateTextureForOutputAttachment(kDepthStencilFormat, kSampleCount);
mDepthStencilView = mDepthStencilTexture.CreateDefaultView();
mDepthStencilView = mDepthStencilTexture.CreateView();
}
dawn::RenderPipeline CreateRenderPipelineWithOneOutputForTest(bool testDepth) {
@ -340,9 +340,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).CreateDefaultView();
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
dawn::Texture resolveTexture2 = CreateTextureForOutputAttachment(kColorFormat, 1);
dawn::TextureView resolveView2 = resolveTexture2.CreateDefaultView();
dawn::TextureView resolveView2 = resolveTexture2.CreateView();
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
dawn::RenderPipeline pipeline = CreateRenderPipelineWithTwoOutputsForTest();
@ -394,7 +394,7 @@ TEST_P(MultisampledRenderingTest, ResolveOneMultisampledTextureTwice) {
// In second render pass we do MSAA resolve into resolveTexture2.
{
dawn::TextureView resolveView2 = resolveTexture2.CreateDefaultView();
dawn::TextureView resolveView2 = resolveTexture2.CreateView();
utils::ComboRenderPassDescriptor renderPass = CreateComboRenderPassDescriptorForTest(
{mMultisampledColorView}, {resolveView2}, dawn::LoadOp::Load, dawn::LoadOp::Load,
kTestDepth);
@ -452,7 +452,7 @@ TEST_P(MultisampledRenderingTest, ResolveIntoOneMipmapLevelOf2DTexture) {
// Test using a level or a layer of a 2D array texture as resolve target works correctly.
TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
dawn::TextureView multisampledColorView2 =
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateDefaultView();
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
dawn::TextureViewDescriptor baseTextureViewDescriptor;
baseTextureViewDescriptor.dimension = dawn::TextureViewDimension::e2D;

View File

@ -71,7 +71,7 @@ class RenderPassLoadOpTests : public DawnTest {
descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
renderTarget = device.CreateTexture(&descriptor);
renderTargetView = renderTarget.CreateDefaultView();
renderTargetView = renderTarget.CreateView();
RGBA8 zero(0, 0, 0, 0);
std::fill(expectZero.begin(), expectZero.end(), zero);

View File

@ -88,7 +88,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.CreateDefaultView()});
utils::ComboRenderPassDescriptor renderPass({renderTarget1.CreateView()});
renderPass.cColorAttachmentsInfoPtr[0]->clearColor = {1.0f, 0.0f, 0.0f, 1.0f};
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
@ -100,7 +100,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.CreateDefaultView()});
utils::ComboRenderPassDescriptor renderPass({renderTarget2.CreateView()});
renderPass.cColorAttachmentsInfoPtr[0]->clearColor = {0.0f, 1.0f, 0.0f, 1.0f};
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);

View File

@ -114,7 +114,7 @@ protected:
dawn::CommandBuffer copy = encoder.Finish();
queue.Submit(1, &copy);
mTextureView = texture.CreateDefaultView();
mTextureView = texture.CreateView();
}
void TestAddressModes(AddressModeTestCase u, AddressModeTestCase v, AddressModeTestCase w) {

View File

@ -280,8 +280,8 @@ class TextureFormatTest : public DawnTest {
CreateSamplePipeline(sampleFormatInfo, renderFormatInfo, bgl);
dawn::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
dawn::Sampler sampler = device.CreateSampler(&samplerDesc);
dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, bgl, {{0, sampler}, {1, sampleTexture.CreateDefaultView()}});
dawn::BindGroup bindGroup =
utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, sampleTexture.CreateView()}});
// Encode commands for the test that fill texture, sample it to render to renderTarget then
// copy renderTarget in a buffer so we can read it easily.
@ -295,7 +295,7 @@ class TextureFormatTest : public DawnTest {
encoder.CopyBufferToTexture(&bufferView, &textureView, &extent);
}
utils::ComboRenderPassDescriptor renderPassDesc({renderTarget.CreateDefaultView()});
utils::ComboRenderPassDescriptor renderPassDesc({renderTarget.CreateView()});
dawn::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDesc);
renderPass.SetPipeline(pipeline);
renderPass.SetBindGroup(0, bindGroup, 0, nullptr);

View File

@ -357,7 +357,7 @@ TEST_P(TextureViewSamplingTest, Default2DArrayTexture) {
constexpr uint32_t kMipLevels = 1;
initTexture(kLayers, kMipLevels);
dawn::TextureView textureView = mTexture.CreateDefaultView();
dawn::TextureView textureView = mTexture.CreateView();
const char* fragmentShader = R"(
#version 450

View File

@ -312,8 +312,8 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepth) {
kDepthStencilFormat);
dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
utils::ComboRenderPassDescriptor renderPassDescriptor({srcTexture.CreateDefaultView()},
depthStencilTexture.CreateDefaultView());
utils::ComboRenderPassDescriptor renderPassDescriptor({srcTexture.CreateView()},
depthStencilTexture.CreateView());
renderPassDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = dawn::LoadOp::Load;
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = dawn::LoadOp::Clear;
renderPassDescriptor.cDepthStencilAttachmentInfo.clearStencil = 0;
@ -347,8 +347,8 @@ TEST_P(TextureZeroInitTest, RenderingLoadingStencil) {
kDepthStencilFormat);
dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
utils::ComboRenderPassDescriptor renderPassDescriptor({srcTexture.CreateDefaultView()},
depthStencilTexture.CreateDefaultView());
utils::ComboRenderPassDescriptor renderPassDescriptor({srcTexture.CreateView()},
depthStencilTexture.CreateView());
renderPassDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = dawn::LoadOp::Clear;
renderPassDescriptor.cDepthStencilAttachmentInfo.clearDepth = 0.0f;
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = dawn::LoadOp::Load;
@ -382,8 +382,8 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencil) {
kDepthStencilFormat);
dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
utils::ComboRenderPassDescriptor renderPassDescriptor({srcTexture.CreateDefaultView()},
depthStencilTexture.CreateDefaultView());
utils::ComboRenderPassDescriptor renderPassDescriptor({srcTexture.CreateView()},
depthStencilTexture.CreateView());
renderPassDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = dawn::LoadOp::Load;
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = dawn::LoadOp::Load;
@ -467,12 +467,12 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
dawn::RenderPipeline renderPipeline = device.CreateRenderPipeline(&renderPipelineDescriptor);
// Create bindgroup
dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout, {{0, sampler}, {1, texture.CreateDefaultView()}});
dawn::BindGroup bindGroup =
utils::MakeBindGroup(device, bindGroupLayout, {{0, sampler}, {1, texture.CreateView()}});
// Encode pass and submit
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
utils::ComboRenderPassDescriptor renderPassDesc({renderTexture.CreateDefaultView()});
utils::ComboRenderPassDescriptor renderPassDesc({renderTexture.CreateView()});
renderPassDesc.cColorAttachmentsInfoPtr[0]->clearColor = {1.0, 1.0, 1.0, 1.0};
renderPassDesc.cColorAttachmentsInfoPtr[0]->loadOp = dawn::LoadOp::Clear;
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);
@ -540,7 +540,7 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
// Create bindgroup
dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout,
{{0, texture.CreateDefaultView()}, {1, bufferTex, 0, bufferSize}, {2, sampler}});
{{0, texture.CreateView()}, {1, bufferTex, 0, bufferSize}, {2, sampler}});
// Encode the pass and submit
dawn::CommandEncoder encoder = device.CreateCommandEncoder();

View File

@ -112,7 +112,7 @@ class ViewportTest : public DawnTest {
// Note that we may explicitly call SetViewport() in this pass
{
utils::ComboRenderPassDescriptor renderPassDescriptor1(
{colorTexture1.CreateDefaultView()}, depthStencilTexture1.CreateDefaultView());
{colorTexture1.CreateView()}, depthStencilTexture1.CreateView());
renderPassDescriptor1.cColorAttachmentsInfoPtr[0]->clearColor = {0.0, 0.0, 1.0, 1.0};
renderPassDescriptor1.cColorAttachmentsInfoPtr[0]->loadOp = dawn::LoadOp::Clear;
@ -137,7 +137,7 @@ class ViewportTest : public DawnTest {
// (0, 0, rendertarget's width, rendertarget's height, 0.0, 1.0) by default.
{
utils::ComboRenderPassDescriptor renderPassDescriptor2(
{colorTexture2.CreateDefaultView()}, depthStencilTexture2.CreateDefaultView());
{colorTexture2.CreateView()}, depthStencilTexture2.CreateView());
renderPassDescriptor2.cColorAttachmentsInfoPtr[0]->clearColor = {0.0, 0.0, 1.0, 1.0};
renderPassDescriptor2.cColorAttachmentsInfoPtr[0]->loadOp = dawn::LoadOp::Clear;

View File

@ -48,7 +48,7 @@ class BindGroupValidationTest : public ValidationTest {
descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsage::Sampled;
mSampledTexture = device.CreateTexture(&descriptor);
mSampledTextureView = mSampledTexture.CreateDefaultView();
mSampledTextureView = mSampledTexture.CreateView();
}
}
@ -295,7 +295,7 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsage::OutputAttachment;
dawn::Texture outputTexture = device.CreateTexture(&descriptor);
dawn::TextureView outputTextureView = outputTexture.CreateDefaultView();
dawn::TextureView outputTextureView = outputTexture.CreateView();
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, outputTextureView}}));
}
@ -318,7 +318,7 @@ TEST_F(BindGroupValidationTest, TextureComponentType) {
descriptor.mipLevelCount = 1;
descriptor.usage = dawn::TextureUsage::Sampled;
dawn::Texture uintTexture = device.CreateTexture(&descriptor);
dawn::TextureView uintTextureView = uintTexture.CreateDefaultView();
dawn::TextureView uintTextureView = uintTexture.CreateView();
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, uintTextureView}}));
}

View File

@ -236,7 +236,7 @@ TEST_F(CommandBufferValidationTest, TextureWithReadAndWriteUsage) {
textureDescriptor.sampleCount = 1;
textureDescriptor.mipLevelCount = 1;
dawn::Texture texture = device.CreateTexture(&textureDescriptor);
dawn::TextureView view = texture.CreateDefaultView();
dawn::TextureView view = texture.CreateView();
// Create the bind group to use the texture as sampled
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(

View File

@ -857,9 +857,9 @@ TEST_F(RenderBundleValidationTest, RenderPassColorFormatMismatch) {
// Test the success case
{
utils::ComboRenderPassDescriptor renderPass({
tex0.CreateDefaultView(),
tex1.CreateDefaultView(),
tex2.CreateDefaultView(),
tex0.CreateView(),
tex1.CreateView(),
tex2.CreateView(),
});
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
@ -872,9 +872,9 @@ TEST_F(RenderBundleValidationTest, RenderPassColorFormatMismatch) {
// Test the failure case for mismatched format
{
utils::ComboRenderPassDescriptor renderPass({
tex0.CreateDefaultView(),
tex1.CreateDefaultView(),
tex0.CreateDefaultView(),
tex0.CreateView(),
tex1.CreateView(),
tex0.CreateView(),
});
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
@ -887,8 +887,8 @@ TEST_F(RenderBundleValidationTest, RenderPassColorFormatMismatch) {
// Test the failure case for missing format
{
utils::ComboRenderPassDescriptor renderPass({
tex0.CreateDefaultView(),
tex1.CreateDefaultView(),
tex0.CreateView(),
tex1.CreateView(),
});
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
@ -927,8 +927,7 @@ TEST_F(RenderBundleValidationTest, RenderPassDepthStencilFormatMismatch) {
// Test the success case
{
utils::ComboRenderPassDescriptor renderPass({tex0.CreateDefaultView()},
tex1.CreateDefaultView());
utils::ComboRenderPassDescriptor renderPass({tex0.CreateView()}, tex1.CreateView());
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPass);
@ -939,8 +938,7 @@ TEST_F(RenderBundleValidationTest, RenderPassDepthStencilFormatMismatch) {
// Test the failure case for mismatched format
{
utils::ComboRenderPassDescriptor renderPass({tex0.CreateDefaultView()},
tex2.CreateDefaultView());
utils::ComboRenderPassDescriptor renderPass({tex0.CreateView()}, tex2.CreateView());
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPass);
@ -951,7 +949,7 @@ TEST_F(RenderBundleValidationTest, RenderPassDepthStencilFormatMismatch) {
// Test the failure case for missing format
{
utils::ComboRenderPassDescriptor renderPass({tex0.CreateDefaultView()});
utils::ComboRenderPassDescriptor renderPass({tex0.CreateView()});
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPass);
@ -983,7 +981,7 @@ TEST_F(RenderBundleValidationTest, RenderPassSampleCountMismatch) {
// Test the success case
{
utils::ComboRenderPassDescriptor renderPass({tex0.CreateDefaultView()});
utils::ComboRenderPassDescriptor renderPass({tex0.CreateView()});
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPass);
@ -994,7 +992,7 @@ TEST_F(RenderBundleValidationTest, RenderPassSampleCountMismatch) {
// Test the failure case
{
utils::ComboRenderPassDescriptor renderPass({tex1.CreateDefaultView()});
utils::ComboRenderPassDescriptor renderPass({tex1.CreateView()});
dawn::CommandEncoder commandEncoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&renderPass);

View File

@ -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.CreateDefaultView();
return texture.CreateView();
}
// Using BeginRenderPass with no attachments isn't valid
@ -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.CreateDefaultView();
dawn::TextureView resolveTargetTextureView = resolveTargetTexture.CreateDefaultView();
dawn::TextureView colorTextureView = colorTexture.CreateView();
dawn::TextureView resolveTargetTextureView = resolveTargetTexture.CreateView();
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.CreateDefaultView();
return colorTexture.CreateView();
}
};
@ -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.CreateDefaultView();
dawn::TextureView resolveTextureView = resolveTexture.CreateView();
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.CreateDefaultView();
dawn::TextureView resolveTextureView = resolveTexture.CreateView();
utils::ComboRenderPassDescriptor renderPass = CreateMultisampledRenderPass();
renderPass.cColorAttachmentsInfoPtr[0]->resolveTarget = resolveTextureView;
@ -494,8 +494,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetUsageNoOutpu
dawn::Texture nonColorUsageResolveTexture = CreateTexture(
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers,
kLevelCount, 1, kUsage);
dawn::TextureView nonColorUsageResolveTextureView =
nonColorUsageResolveTexture.CreateDefaultView();
dawn::TextureView nonColorUsageResolveTextureView = nonColorUsageResolveTexture.CreateView();
utils::ComboRenderPassDescriptor renderPass = CreateMultisampledRenderPass();
renderPass.cColorAttachmentsInfoPtr[0]->resolveTarget = nonColorUsageResolveTextureView;
@ -535,7 +534,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetDifferentFor
dawn::Texture resolveTexture = CreateTexture(
device, dawn::TextureDimension::e2D, kColorFormat2, kSize, kSize, kArrayLayers,
kLevelCount);
dawn::TextureView resolveTextureView = resolveTexture.CreateDefaultView();
dawn::TextureView resolveTextureView = resolveTexture.CreateView();
utils::ComboRenderPassDescriptor renderPass = CreateMultisampledRenderPass();
renderPass.cColorAttachmentsInfoPtr[0]->resolveTarget = resolveTextureView;
@ -589,7 +588,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, DepthStencilAttachmentSam
device, dawn::TextureDimension::e2D, kDepthStencilFormat, kSize, kSize, kArrayLayers,
kLevelCount, kSampleCount);
dawn::TextureView multisampledDepthStencilTextureView =
multisampledDepthStencilTexture.CreateDefaultView();
multisampledDepthStencilTexture.CreateView();
// It is not allowed to use a depth stencil attachment whose sample count is different from the
// one of the color attachment.
@ -597,7 +596,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, DepthStencilAttachmentSam
dawn::Texture depthStencilTexture = CreateTexture(
device, dawn::TextureDimension::e2D, kDepthStencilFormat, kSize, kSize, kArrayLayers,
kLevelCount);
dawn::TextureView depthStencilTextureView = depthStencilTexture.CreateDefaultView();
dawn::TextureView depthStencilTextureView = depthStencilTexture.CreateView();
utils::ComboRenderPassDescriptor renderPass(
{CreateMultisampledColorTextureView()}, depthStencilTextureView);

View File

@ -166,7 +166,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
textureDescriptor.sampleCount = kMultisampledCount;
dawn::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
utils::ComboRenderPassDescriptor renderPassDescriptor(
{multisampledColorTexture.CreateDefaultView()});
{multisampledColorTexture.CreateView()});
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
@ -183,7 +183,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
dawn::Texture multisampledDepthStencilTexture =
device.CreateTexture(&textureDescriptor);
utils::ComboRenderPassDescriptor renderPassDescriptor(
{}, multisampledDepthStencilTexture.CreateDefaultView());
{}, multisampledDepthStencilTexture.CreateView());
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
@ -202,7 +202,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
textureDescriptor.sampleCount = kMultisampledCount;
dawn::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
utils::ComboRenderPassDescriptor renderPassDescriptor(
{multisampledColorTexture.CreateDefaultView()});
{multisampledColorTexture.CreateView()});
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
@ -219,7 +219,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
dawn::Texture multisampledDepthStencilTexture =
device.CreateTexture(&textureDescriptor);
utils::ComboRenderPassDescriptor renderPassDescriptor(
{}, multisampledDepthStencilTexture.CreateDefaultView());
{}, multisampledDepthStencilTexture.CreateView());
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
@ -238,7 +238,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
textureDescriptor.sampleCount = 1;
dawn::Texture nonMultisampledColorTexture = device.CreateTexture(&textureDescriptor);
utils::ComboRenderPassDescriptor nonMultisampledRenderPassDescriptor(
{ nonMultisampledColorTexture.CreateDefaultView() });
{nonMultisampledColorTexture.CreateView()});
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder renderPass =
@ -256,7 +256,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
dawn::Texture multisampledDepthStencilTexture =
device.CreateTexture(&textureDescriptor);
utils::ComboRenderPassDescriptor renderPassDescriptor(
{}, multisampledDepthStencilTexture.CreateDefaultView());
{}, multisampledDepthStencilTexture.CreateView());
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);

View File

@ -194,7 +194,7 @@ TEST_F(TextureValidationTest, DestroyDestroyedTexture) {
TEST_F(TextureValidationTest, DestroyEncodeSubmit) {
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
dawn::Texture texture = device.CreateTexture(&descriptor);
dawn::TextureView textureView = texture.CreateDefaultView();
dawn::TextureView textureView = texture.CreateView();
utils::ComboRenderPassDescriptor renderPass({textureView});
@ -217,7 +217,7 @@ TEST_F(TextureValidationTest, DestroyEncodeSubmit) {
TEST_F(TextureValidationTest, EncodeDestroySubmit) {
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
dawn::Texture texture = device.CreateTexture(&descriptor);
dawn::TextureView textureView = texture.CreateDefaultView();
dawn::TextureView textureView = texture.CreateView();
utils::ComboRenderPassDescriptor renderPass({textureView});

View File

@ -107,7 +107,7 @@ ValidationTest::DummyRenderPass::DummyRenderPass(const dawn::Device& device)
descriptor.usage = dawn::TextureUsage::OutputAttachment;
attachment = device.CreateTexture(&descriptor);
dawn::TextureView view = attachment.CreateDefaultView();
dawn::TextureView view = attachment.CreateView();
mColorAttachment.attachment = view;
mColorAttachment.resolveTarget = nullptr;
mColorAttachment.clearColor = { 0.0f, 0.0f, 0.0f, 0.0f };

View File

@ -36,9 +36,9 @@ TEST_F(WireInjectTextureTests, CallAfterReserveInject) {
EXPECT_CALL(api, TextureReference(apiTexture));
ASSERT_TRUE(GetWireServer()->InjectTexture(apiTexture, reservation.id, reservation.generation));
dawnTextureCreateDefaultView(reservation.texture);
dawnTextureCreateView(reservation.texture, nullptr);
DawnTextureView apiDummyView = api.GetNewTextureView();
EXPECT_CALL(api, TextureCreateDefaultView(apiTexture)).WillOnce(Return(apiDummyView));
EXPECT_CALL(api, TextureCreateView(apiTexture, nullptr)).WillOnce(Return(apiDummyView));
FlushClient();
}

View File

@ -404,7 +404,7 @@ class VulkanImageWrappingUsageTests : public VulkanImageWrappingTestBase {
// Clear a texture on a given device
void ClearImage(dawn::Device device, dawn::Texture wrappedTexture, dawn::Color clearColor) {
dawn::TextureView wrappedView = wrappedTexture.CreateDefaultView();
dawn::TextureView wrappedView = wrappedTexture.CreateView();
// Submit a clear operation
utils::ComboRenderPassDescriptor renderPassDescriptor({wrappedView}, {});

View File

@ -207,7 +207,7 @@ namespace utils {
height(texHeight),
color(colorAttachment),
colorFormat(textureFormat),
renderPassInfo({colorAttachment.CreateDefaultView()}) {
renderPassInfo({colorAttachment.CreateView()}) {
}
BasicRenderPass CreateBasicRenderPass(const dawn::Device& device,