Remove Bit from TextureUsageBit and BufferUsageBit
This is to match the naming convention of WebGPU's WebIDL and webgpu.h BUG=dawn:22 Change-Id: Ia91c5a018403e6a72eb0311b5f1a072d102282a2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10461 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
e25a3aede0
commit
9e9e29f7a6
10
dawn.json
10
dawn.json
|
@ -180,7 +180,7 @@
|
|||
"category": "structure",
|
||||
"extensible": true,
|
||||
"members": [
|
||||
{"name": "usage", "type": "buffer usage bit"},
|
||||
{"name": "usage", "type": "buffer usage"},
|
||||
{"name": "size", "type": "uint64_t"}
|
||||
]
|
||||
},
|
||||
|
@ -199,7 +199,7 @@
|
|||
{"value": 3, "name": "context lost"}
|
||||
]
|
||||
},
|
||||
"buffer usage bit": {
|
||||
"buffer usage": {
|
||||
"category": "bitmask",
|
||||
"values": [
|
||||
{"value": 0, "name": "none"},
|
||||
|
@ -1102,7 +1102,7 @@
|
|||
"name": "configure",
|
||||
"args": [
|
||||
{"name": "format", "type": "texture format"},
|
||||
{"name": "allowed usage", "type": "texture usage bit"},
|
||||
{"name": "allowed usage", "type": "texture usage"},
|
||||
{"name": "width", "type": "uint32_t"},
|
||||
{"name": "height", "type": "uint32_t"}
|
||||
]
|
||||
|
@ -1175,7 +1175,7 @@
|
|||
"category": "structure",
|
||||
"extensible": true,
|
||||
"members": [
|
||||
{"name": "usage", "type": "texture usage bit"},
|
||||
{"name": "usage", "type": "texture usage"},
|
||||
{"name": "dimension", "type": "texture dimension", "default": "2D"},
|
||||
{"name": "size", "type": "extent 3D"},
|
||||
{"name": "array layer count", "type": "uint32_t", "default": "1"},
|
||||
|
@ -1256,7 +1256,7 @@
|
|||
{"value": 4294967295, "name": "none", "valid": false}
|
||||
]
|
||||
},
|
||||
"texture usage bit": {
|
||||
"texture usage": {
|
||||
"category": "bitmask",
|
||||
"values": [
|
||||
{"value": 0, "name": "none"},
|
||||
|
|
|
@ -52,8 +52,8 @@ void init() {
|
|||
|
||||
queue = device.CreateQueue();
|
||||
swapchain = GetSwapChain(device);
|
||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(),
|
||||
dawn::TextureUsageBit::OutputAttachment, 640, 480);
|
||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment,
|
||||
640, 480);
|
||||
|
||||
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
|
||||
#version 450
|
||||
|
@ -134,7 +134,7 @@ void init() {
|
|||
|
||||
dawn::BufferDescriptor bufferDesc;
|
||||
bufferDesc.size = kNumTriangles * sizeof(ShaderData);
|
||||
bufferDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Uniform;
|
||||
bufferDesc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::Uniform;
|
||||
ubo = device.CreateBuffer(&bufferDesc);
|
||||
|
||||
bindGroup =
|
||||
|
|
|
@ -35,7 +35,7 @@ void init() {
|
|||
swapchain = dawnDeviceCreateSwapChain(device, &descriptor);
|
||||
}
|
||||
swapChainFormat = static_cast<DawnTextureFormat>(GetPreferredSwapChainTextureFormat());
|
||||
dawnSwapChainConfigure(swapchain, swapChainFormat, DAWN_TEXTURE_USAGE_BIT_OUTPUT_ATTACHMENT, 640,
|
||||
dawnSwapChainConfigure(swapchain, swapChainFormat, DAWN_TEXTURE_USAGE_OUTPUT_ATTACHMENT, 640,
|
||||
480);
|
||||
|
||||
const char* vs =
|
||||
|
|
|
@ -64,10 +64,12 @@ void initBuffers() {
|
|||
{0.01, -0.02},
|
||||
{0.00, 0.02},
|
||||
};
|
||||
modelBuffer = utils::CreateBufferFromData(device, model, sizeof(model), dawn::BufferUsageBit::Vertex);
|
||||
modelBuffer =
|
||||
utils::CreateBufferFromData(device, model, sizeof(model), dawn::BufferUsage::Vertex);
|
||||
|
||||
SimParams params = { 0.04f, 0.1f, 0.025f, 0.025f, 0.02f, 0.05f, 0.005f, kNumParticles };
|
||||
updateParams = utils::CreateBufferFromData(device, ¶ms, sizeof(params), dawn::BufferUsageBit::Uniform);
|
||||
updateParams =
|
||||
utils::CreateBufferFromData(device, ¶ms, sizeof(params), dawn::BufferUsage::Uniform);
|
||||
|
||||
std::vector<Particle> initialParticles(kNumParticles);
|
||||
{
|
||||
|
@ -83,8 +85,8 @@ void initBuffers() {
|
|||
for (size_t i = 0; i < 2; i++) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = sizeof(Particle) * kNumParticles;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Vertex |
|
||||
dawn::BufferUsageBit::Storage;
|
||||
descriptor.usage =
|
||||
dawn::BufferUsage::CopyDst | dawn::BufferUsage::Vertex | dawn::BufferUsage::Storage;
|
||||
particleBuffers[i] = device.CreateBuffer(&descriptor);
|
||||
|
||||
particleBuffers[i].SetSubData(0,
|
||||
|
@ -293,8 +295,8 @@ void init() {
|
|||
|
||||
queue = device.CreateQueue();
|
||||
swapchain = GetSwapChain(device);
|
||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(),
|
||||
dawn::TextureUsageBit::OutputAttachment, 640, 480);
|
||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment,
|
||||
640, 480);
|
||||
|
||||
initBuffers();
|
||||
initRender();
|
||||
|
|
|
@ -38,14 +38,16 @@ void initBuffers() {
|
|||
static const uint32_t indexData[3] = {
|
||||
0, 1, 2,
|
||||
};
|
||||
indexBuffer = utils::CreateBufferFromData(device, indexData, sizeof(indexData), dawn::BufferUsageBit::Index);
|
||||
indexBuffer =
|
||||
utils::CreateBufferFromData(device, indexData, sizeof(indexData), dawn::BufferUsage::Index);
|
||||
|
||||
static const float vertexData[12] = {
|
||||
0.0f, 0.5f, 0.0f, 1.0f,
|
||||
-0.5f, -0.5f, 0.0f, 1.0f,
|
||||
0.5f, -0.5f, 0.0f, 1.0f,
|
||||
};
|
||||
vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData), dawn::BufferUsageBit::Vertex);
|
||||
vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData),
|
||||
dawn::BufferUsage::Vertex);
|
||||
}
|
||||
|
||||
void initTextures() {
|
||||
|
@ -58,7 +60,7 @@ void initTextures() {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled;
|
||||
descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
|
||||
texture = device.CreateTexture(&descriptor);
|
||||
|
||||
dawn::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
|
@ -71,7 +73,7 @@ void initTextures() {
|
|||
}
|
||||
|
||||
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::CopySrc);
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::CopySrc);
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
|
||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
|
||||
dawn::Extent3D copySize = {1024, 1024, 1};
|
||||
|
@ -88,8 +90,8 @@ void init() {
|
|||
|
||||
queue = device.CreateQueue();
|
||||
swapchain = GetSwapChain(device);
|
||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(),
|
||||
dawn::TextureUsageBit::OutputAttachment, 640, 480);
|
||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment,
|
||||
640, 480);
|
||||
|
||||
initBuffers();
|
||||
initTextures();
|
||||
|
|
|
@ -62,7 +62,8 @@ void initBuffers() {
|
|||
20, 21, 22,
|
||||
20, 22, 23
|
||||
};
|
||||
indexBuffer = utils::CreateBufferFromData(device, indexData, sizeof(indexData), dawn::BufferUsageBit::Index);
|
||||
indexBuffer =
|
||||
utils::CreateBufferFromData(device, indexData, sizeof(indexData), dawn::BufferUsage::Index);
|
||||
|
||||
static const float vertexData[6 * 4 * 6] = {
|
||||
-1.0, -1.0, 1.0, 1.0, 0.0, 0.0,
|
||||
|
@ -95,7 +96,8 @@ void initBuffers() {
|
|||
-1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
|
||||
-1.0, 1.0, -1.0, 1.0, 1.0, 1.0
|
||||
};
|
||||
vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData), dawn::BufferUsageBit::Vertex);
|
||||
vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData),
|
||||
dawn::BufferUsage::Vertex);
|
||||
|
||||
static const float planeData[6 * 4] = {
|
||||
-2.0, -1.0, -2.0, 0.5, 0.5, 0.5,
|
||||
|
@ -103,7 +105,8 @@ void initBuffers() {
|
|||
2.0, -1.0, 2.0, 0.5, 0.5, 0.5,
|
||||
-2.0, -1.0, 2.0, 0.5, 0.5, 0.5,
|
||||
};
|
||||
planeBuffer = utils::CreateBufferFromData(device, planeData, sizeof(planeData), dawn::BufferUsageBit::Vertex);
|
||||
planeBuffer = utils::CreateBufferFromData(device, planeData, sizeof(planeData),
|
||||
dawn::BufferUsage::Vertex);
|
||||
}
|
||||
|
||||
struct CameraData {
|
||||
|
@ -116,8 +119,8 @@ void init() {
|
|||
|
||||
queue = device.CreateQueue();
|
||||
swapchain = GetSwapChain(device);
|
||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(),
|
||||
dawn::TextureUsageBit::OutputAttachment, 640, 480);
|
||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment,
|
||||
640, 480);
|
||||
|
||||
initBuffers();
|
||||
|
||||
|
@ -176,14 +179,16 @@ void init() {
|
|||
|
||||
dawn::BufferDescriptor cameraBufDesc;
|
||||
cameraBufDesc.size = sizeof(CameraData);
|
||||
cameraBufDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Uniform;
|
||||
cameraBufDesc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::Uniform;
|
||||
cameraBuffer = device.CreateBuffer(&cameraBufDesc);
|
||||
|
||||
glm::mat4 transform(1.0);
|
||||
transformBuffer[0] = utils::CreateBufferFromData(device, &transform, sizeof(glm::mat4), dawn::BufferUsageBit::Uniform);
|
||||
transformBuffer[0] = utils::CreateBufferFromData(device, &transform, sizeof(glm::mat4),
|
||||
dawn::BufferUsage::Uniform);
|
||||
|
||||
transform = glm::translate(transform, glm::vec3(0.f, -2.f, 0.f));
|
||||
transformBuffer[1] = utils::CreateBufferFromData(device, &transform, sizeof(glm::mat4), dawn::BufferUsageBit::Uniform);
|
||||
transformBuffer[1] = utils::CreateBufferFromData(device, &transform, sizeof(glm::mat4),
|
||||
dawn::BufferUsage::Uniform);
|
||||
|
||||
bindGroup[0] = utils::MakeBindGroup(device, bgl, {
|
||||
{0, cameraBuffer, 0, sizeof(CameraData)},
|
||||
|
|
|
@ -173,7 +173,7 @@ dawn::TextureView CreateDefaultDepthStencilView(const dawn::Device& device) {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment;
|
||||
auto depthStencilTexture = device.CreateTexture(&descriptor);
|
||||
return depthStencilTexture.CreateDefaultView();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ DawnSwapChainImplementation CreateSwapChainImplementation(T* swapChain) {
|
|||
reinterpret_cast<T*>(userData)->Init(ctx);
|
||||
};
|
||||
impl.Destroy = [](void* userData) { delete reinterpret_cast<T*>(userData); };
|
||||
impl.Configure = [](void* userData, DawnTextureFormat format, DawnTextureUsageBit allowedUsage,
|
||||
impl.Configure = [](void* userData, DawnTextureFormat format, DawnTextureUsage allowedUsage,
|
||||
uint32_t width, uint32_t height) {
|
||||
return static_cast<T*>(userData)->Configure(format, allowedUsage, width, height);
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace dawn_native {
|
|||
|
||||
MaybeError ValidateBufferBinding(const DeviceBase* device,
|
||||
const BindGroupBinding& binding,
|
||||
dawn::BufferUsageBit requiredUsage) {
|
||||
dawn::BufferUsage requiredUsage) {
|
||||
if (binding.buffer == nullptr || binding.sampler != nullptr ||
|
||||
binding.textureView != nullptr) {
|
||||
return DAWN_VALIDATION_ERROR("expected buffer binding");
|
||||
|
@ -63,7 +63,7 @@ namespace dawn_native {
|
|||
|
||||
MaybeError ValidateTextureBinding(const DeviceBase* device,
|
||||
const BindGroupBinding& binding,
|
||||
dawn::TextureUsageBit requiredUsage,
|
||||
dawn::TextureUsage requiredUsage,
|
||||
bool multisampledBinding,
|
||||
dawn::TextureComponentType requiredComponentType) {
|
||||
if (binding.textureView == nullptr || binding.sampler != nullptr ||
|
||||
|
@ -139,14 +139,14 @@ namespace dawn_native {
|
|||
// Perform binding-type specific validation.
|
||||
switch (layoutInfo.types[bindingIndex]) {
|
||||
case dawn::BindingType::UniformBuffer:
|
||||
DAWN_TRY(ValidateBufferBinding(device, binding, dawn::BufferUsageBit::Uniform));
|
||||
DAWN_TRY(ValidateBufferBinding(device, binding, dawn::BufferUsage::Uniform));
|
||||
break;
|
||||
case dawn::BindingType::StorageBuffer:
|
||||
DAWN_TRY(ValidateBufferBinding(device, binding, dawn::BufferUsageBit::Storage));
|
||||
DAWN_TRY(ValidateBufferBinding(device, binding, dawn::BufferUsage::Storage));
|
||||
break;
|
||||
case dawn::BindingType::SampledTexture:
|
||||
DAWN_TRY(
|
||||
ValidateTextureBinding(device, binding, dawn::TextureUsageBit::Sampled,
|
||||
ValidateTextureBinding(device, binding, dawn::TextureUsage::Sampled,
|
||||
layoutInfo.multisampled[bindingIndex],
|
||||
layoutInfo.textureComponentTypes[bindingIndex]));
|
||||
break;
|
||||
|
|
|
@ -89,19 +89,19 @@ namespace dawn_native {
|
|||
return DAWN_VALIDATION_ERROR("nextInChain must be nullptr");
|
||||
}
|
||||
|
||||
DAWN_TRY(ValidateBufferUsageBit(descriptor->usage));
|
||||
DAWN_TRY(ValidateBufferUsage(descriptor->usage));
|
||||
|
||||
dawn::BufferUsageBit usage = descriptor->usage;
|
||||
dawn::BufferUsage usage = descriptor->usage;
|
||||
|
||||
const dawn::BufferUsageBit kMapWriteAllowedUsages =
|
||||
dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
|
||||
if (usage & dawn::BufferUsageBit::MapWrite && (usage & kMapWriteAllowedUsages) != usage) {
|
||||
const dawn::BufferUsage kMapWriteAllowedUsages =
|
||||
dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
|
||||
if (usage & dawn::BufferUsage::MapWrite && (usage & kMapWriteAllowedUsages) != usage) {
|
||||
return DAWN_VALIDATION_ERROR("Only CopySrc is allowed with MapWrite");
|
||||
}
|
||||
|
||||
const dawn::BufferUsageBit kMapReadAllowedUsages =
|
||||
dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
|
||||
if (usage & dawn::BufferUsageBit::MapRead && (usage & kMapReadAllowedUsages) != usage) {
|
||||
const dawn::BufferUsage kMapReadAllowedUsages =
|
||||
dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
|
||||
if (usage & dawn::BufferUsage::MapRead && (usage & kMapReadAllowedUsages) != usage) {
|
||||
return DAWN_VALIDATION_ERROR("Only CopyDst is allowed with MapRead");
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ namespace dawn_native {
|
|||
return mSize;
|
||||
}
|
||||
|
||||
dawn::BufferUsageBit BufferBase::GetUsage() const {
|
||||
dawn::BufferUsage BufferBase::GetUsage() const {
|
||||
ASSERT(!IsError());
|
||||
return mUsage;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
void BufferBase::MapReadAsync(DawnBufferMapReadCallback callback, void* userdata) {
|
||||
if (GetDevice()->ConsumedError(ValidateMap(dawn::BufferUsageBit::MapRead))) {
|
||||
if (GetDevice()->ConsumedError(ValidateMap(dawn::BufferUsage::MapRead))) {
|
||||
callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, 0, userdata);
|
||||
return;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
void BufferBase::MapWriteAsync(DawnBufferMapWriteCallback callback, void* userdata) {
|
||||
if (GetDevice()->ConsumedError(ValidateMap(dawn::BufferUsageBit::MapWrite))) {
|
||||
if (GetDevice()->ConsumedError(ValidateMap(dawn::BufferUsage::MapWrite))) {
|
||||
callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, 0, userdata);
|
||||
return;
|
||||
}
|
||||
|
@ -381,14 +381,14 @@ namespace dawn_native {
|
|||
return DAWN_VALIDATION_ERROR("Buffer subdata out of range");
|
||||
}
|
||||
|
||||
if (!(mUsage & dawn::BufferUsageBit::CopyDst)) {
|
||||
if (!(mUsage & dawn::BufferUsage::CopyDst)) {
|
||||
return DAWN_VALIDATION_ERROR("Buffer needs the CopyDst usage bit");
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
MaybeError BufferBase::ValidateMap(dawn::BufferUsageBit requiredUsage) const {
|
||||
MaybeError BufferBase::ValidateMap(dawn::BufferUsage requiredUsage) const {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(this));
|
||||
|
||||
switch (mState) {
|
||||
|
@ -416,8 +416,7 @@ namespace dawn_native {
|
|||
// even if it did not have a mappable usage.
|
||||
return {};
|
||||
case BufferState::Unmapped:
|
||||
if ((mUsage & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) ==
|
||||
0) {
|
||||
if ((mUsage & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) == 0) {
|
||||
return DAWN_VALIDATION_ERROR("Buffer does not have map usage");
|
||||
}
|
||||
return {};
|
||||
|
|
|
@ -27,13 +27,12 @@ namespace dawn_native {
|
|||
|
||||
MaybeError ValidateBufferDescriptor(DeviceBase* device, const BufferDescriptor* descriptor);
|
||||
|
||||
static constexpr dawn::BufferUsageBit kReadOnlyBufferUsages =
|
||||
dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc |
|
||||
dawn::BufferUsageBit::Index | dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Uniform;
|
||||
static constexpr dawn::BufferUsage kReadOnlyBufferUsages =
|
||||
dawn::BufferUsage::MapRead | dawn::BufferUsage::CopySrc | dawn::BufferUsage::Index |
|
||||
dawn::BufferUsage::Vertex | dawn::BufferUsage::Uniform;
|
||||
|
||||
static constexpr dawn::BufferUsageBit kWritableBufferUsages = dawn::BufferUsageBit::MapWrite |
|
||||
dawn::BufferUsageBit::CopyDst |
|
||||
dawn::BufferUsageBit::Storage;
|
||||
static constexpr dawn::BufferUsage kWritableBufferUsages =
|
||||
dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopyDst | dawn::BufferUsage::Storage;
|
||||
|
||||
class BufferBase : public ObjectBase {
|
||||
enum class BufferState {
|
||||
|
@ -52,7 +51,7 @@ namespace dawn_native {
|
|||
uint8_t** mappedPointer);
|
||||
|
||||
uint64_t GetSize() const;
|
||||
dawn::BufferUsageBit GetUsage() const;
|
||||
dawn::BufferUsage GetUsage() const;
|
||||
|
||||
MaybeError MapAtCreation(uint8_t** mappedPointer);
|
||||
|
||||
|
@ -91,12 +90,12 @@ namespace dawn_native {
|
|||
MaybeError CopyFromStagingBuffer();
|
||||
|
||||
MaybeError ValidateSetSubData(uint32_t start, uint32_t count) const;
|
||||
MaybeError ValidateMap(dawn::BufferUsageBit requiredUsage) const;
|
||||
MaybeError ValidateMap(dawn::BufferUsage requiredUsage) const;
|
||||
MaybeError ValidateUnmap() const;
|
||||
MaybeError ValidateDestroy() const;
|
||||
|
||||
uint64_t mSize = 0;
|
||||
dawn::BufferUsageBit mUsage = dawn::BufferUsageBit::None;
|
||||
dawn::BufferUsage mUsage = dawn::BufferUsage::None;
|
||||
|
||||
DawnBufferMapReadCallback mMapReadCallback = nullptr;
|
||||
DawnBufferMapWriteCallback mMapWriteCallback = nullptr;
|
||||
|
|
|
@ -242,7 +242,7 @@ namespace dawn_native {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError ValidateCanUseAs(BufferBase* buffer, dawn::BufferUsageBit usage) {
|
||||
MaybeError ValidateCanUseAs(BufferBase* buffer, dawn::BufferUsage usage) {
|
||||
ASSERT(HasZeroOrOneBits(usage));
|
||||
if (!(buffer->GetUsage() & usage)) {
|
||||
return DAWN_VALIDATION_ERROR("buffer doesn't have the required usage.");
|
||||
|
@ -251,7 +251,7 @@ namespace dawn_native {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError ValidateCanUseAs(TextureBase* texture, dawn::TextureUsageBit usage) {
|
||||
MaybeError ValidateCanUseAs(TextureBase* texture, dawn::TextureUsage usage) {
|
||||
ASSERT(HasZeroOrOneBits(usage));
|
||||
if (!(texture->GetUsage() & usage)) {
|
||||
return DAWN_VALIDATION_ERROR("texture doesn't have the required usage.");
|
||||
|
@ -715,9 +715,8 @@ namespace dawn_native {
|
|||
DAWN_TRY(ValidateB2BCopySizeAlignment(copy->size, copy->sourceOffset,
|
||||
copy->destinationOffset));
|
||||
|
||||
DAWN_TRY(ValidateCanUseAs(copy->source.Get(), dawn::BufferUsageBit::CopySrc));
|
||||
DAWN_TRY(
|
||||
ValidateCanUseAs(copy->destination.Get(), dawn::BufferUsageBit::CopyDst));
|
||||
DAWN_TRY(ValidateCanUseAs(copy->source.Get(), dawn::BufferUsage::CopySrc));
|
||||
DAWN_TRY(ValidateCanUseAs(copy->destination.Get(), dawn::BufferUsage::CopyDst));
|
||||
|
||||
mResourceUsages.topLevelBuffers.insert(copy->source.Get());
|
||||
mResourceUsages.topLevelBuffers.insert(copy->destination.Get());
|
||||
|
@ -750,9 +749,9 @@ namespace dawn_native {
|
|||
copy->destination.texture->GetFormat()));
|
||||
|
||||
DAWN_TRY(
|
||||
ValidateCanUseAs(copy->source.buffer.Get(), dawn::BufferUsageBit::CopySrc));
|
||||
ValidateCanUseAs(copy->source.buffer.Get(), dawn::BufferUsage::CopySrc));
|
||||
DAWN_TRY(ValidateCanUseAs(copy->destination.texture.Get(),
|
||||
dawn::TextureUsageBit::CopyDst));
|
||||
dawn::TextureUsage::CopyDst));
|
||||
|
||||
mResourceUsages.topLevelBuffers.insert(copy->source.buffer.Get());
|
||||
mResourceUsages.topLevelTextures.insert(copy->destination.texture.Get());
|
||||
|
@ -784,10 +783,10 @@ namespace dawn_native {
|
|||
DAWN_TRY(ValidateTexelBufferOffset(copy->destination,
|
||||
copy->source.texture->GetFormat()));
|
||||
|
||||
DAWN_TRY(ValidateCanUseAs(copy->source.texture.Get(),
|
||||
dawn::TextureUsageBit::CopySrc));
|
||||
DAWN_TRY(
|
||||
ValidateCanUseAs(copy->source.texture.Get(), dawn::TextureUsage::CopySrc));
|
||||
DAWN_TRY(ValidateCanUseAs(copy->destination.buffer.Get(),
|
||||
dawn::BufferUsageBit::CopyDst));
|
||||
dawn::BufferUsage::CopyDst));
|
||||
|
||||
mResourceUsages.topLevelTextures.insert(copy->source.texture.Get());
|
||||
mResourceUsages.topLevelBuffers.insert(copy->destination.buffer.Get());
|
||||
|
@ -812,10 +811,10 @@ namespace dawn_native {
|
|||
DAWN_TRY(ValidateCopySizeFitsInTexture(copy->source, copy->copySize));
|
||||
DAWN_TRY(ValidateCopySizeFitsInTexture(copy->destination, copy->copySize));
|
||||
|
||||
DAWN_TRY(ValidateCanUseAs(copy->source.texture.Get(),
|
||||
dawn::TextureUsageBit::CopySrc));
|
||||
DAWN_TRY(
|
||||
ValidateCanUseAs(copy->source.texture.Get(), dawn::TextureUsage::CopySrc));
|
||||
DAWN_TRY(ValidateCanUseAs(copy->destination.texture.Get(),
|
||||
dawn::TextureUsageBit::CopyDst));
|
||||
dawn::TextureUsage::CopyDst));
|
||||
|
||||
mResourceUsages.topLevelTextures.insert(copy->source.texture.Get());
|
||||
mResourceUsages.topLevelTextures.insert(copy->destination.texture.Get());
|
||||
|
|
|
@ -59,17 +59,17 @@ namespace dawn_native {
|
|||
switch (type) {
|
||||
case dawn::BindingType::UniformBuffer: {
|
||||
BufferBase* buffer = group->GetBindingAsBufferBinding(i).buffer;
|
||||
usageTracker->BufferUsedAs(buffer, dawn::BufferUsageBit::Uniform);
|
||||
usageTracker->BufferUsedAs(buffer, dawn::BufferUsage::Uniform);
|
||||
} break;
|
||||
|
||||
case dawn::BindingType::StorageBuffer: {
|
||||
BufferBase* buffer = group->GetBindingAsBufferBinding(i).buffer;
|
||||
usageTracker->BufferUsedAs(buffer, dawn::BufferUsageBit::Storage);
|
||||
usageTracker->BufferUsedAs(buffer, dawn::BufferUsage::Storage);
|
||||
} break;
|
||||
|
||||
case dawn::BindingType::SampledTexture: {
|
||||
TextureBase* texture = group->GetBindingAsTextureView(i)->GetTexture();
|
||||
usageTracker->TextureUsedAs(texture, dawn::TextureUsageBit::Sampled);
|
||||
usageTracker->TextureUsedAs(texture, dawn::TextureUsage::Sampled);
|
||||
} break;
|
||||
|
||||
case dawn::BindingType::Sampler:
|
||||
|
@ -105,14 +105,14 @@ namespace dawn_native {
|
|||
DrawIndirectCmd* cmd = commands->NextCommand<DrawIndirectCmd>();
|
||||
DAWN_TRY(commandBufferState->ValidateCanDraw());
|
||||
usageTracker->BufferUsedAs(cmd->indirectBuffer.Get(),
|
||||
dawn::BufferUsageBit::Indirect);
|
||||
dawn::BufferUsage::Indirect);
|
||||
} break;
|
||||
|
||||
case Command::DrawIndexedIndirect: {
|
||||
DrawIndexedIndirectCmd* cmd = commands->NextCommand<DrawIndexedIndirectCmd>();
|
||||
DAWN_TRY(commandBufferState->ValidateCanDrawIndexed());
|
||||
usageTracker->BufferUsedAs(cmd->indirectBuffer.Get(),
|
||||
dawn::BufferUsageBit::Indirect);
|
||||
dawn::BufferUsage::Indirect);
|
||||
} break;
|
||||
|
||||
case Command::InsertDebugMarker: {
|
||||
|
@ -154,7 +154,7 @@ namespace dawn_native {
|
|||
case Command::SetIndexBuffer: {
|
||||
SetIndexBufferCmd* cmd = commands->NextCommand<SetIndexBufferCmd>();
|
||||
|
||||
usageTracker->BufferUsedAs(cmd->buffer.Get(), dawn::BufferUsageBit::Index);
|
||||
usageTracker->BufferUsedAs(cmd->buffer.Get(), dawn::BufferUsage::Index);
|
||||
commandBufferState->SetIndexBuffer();
|
||||
} break;
|
||||
|
||||
|
@ -164,7 +164,7 @@ namespace dawn_native {
|
|||
commands->NextData<uint64_t>(cmd->count);
|
||||
|
||||
for (uint32_t i = 0; i < cmd->count; ++i) {
|
||||
usageTracker->BufferUsedAs(buffers[i].Get(), dawn::BufferUsageBit::Vertex);
|
||||
usageTracker->BufferUsedAs(buffers[i].Get(), dawn::BufferUsage::Vertex);
|
||||
}
|
||||
commandBufferState->SetVertexBuffer(cmd->startSlot, cmd->count);
|
||||
} break;
|
||||
|
@ -211,18 +211,18 @@ namespace dawn_native {
|
|||
for (uint32_t i : IterateBitSet(renderPass->attachmentState->GetColorAttachmentsMask())) {
|
||||
RenderPassColorAttachmentInfo* colorAttachment = &renderPass->colorAttachments[i];
|
||||
TextureBase* texture = colorAttachment->view->GetTexture();
|
||||
usageTracker.TextureUsedAs(texture, dawn::TextureUsageBit::OutputAttachment);
|
||||
usageTracker.TextureUsedAs(texture, dawn::TextureUsage::OutputAttachment);
|
||||
|
||||
TextureViewBase* resolveTarget = colorAttachment->resolveTarget.Get();
|
||||
if (resolveTarget != nullptr) {
|
||||
usageTracker.TextureUsedAs(resolveTarget->GetTexture(),
|
||||
dawn::TextureUsageBit::OutputAttachment);
|
||||
dawn::TextureUsage::OutputAttachment);
|
||||
}
|
||||
}
|
||||
|
||||
if (renderPass->attachmentState->HasDepthStencilAttachment()) {
|
||||
TextureBase* texture = renderPass->depthStencilAttachment.view->GetTexture();
|
||||
usageTracker.TextureUsedAs(texture, dawn::TextureUsageBit::OutputAttachment);
|
||||
usageTracker.TextureUsedAs(texture, dawn::TextureUsage::OutputAttachment);
|
||||
}
|
||||
|
||||
Command type;
|
||||
|
@ -324,7 +324,7 @@ namespace dawn_native {
|
|||
DispatchIndirectCmd* cmd = commands->NextCommand<DispatchIndirectCmd>();
|
||||
DAWN_TRY(commandBufferState.ValidateCanDispatch());
|
||||
usageTracker.BufferUsedAs(cmd->indirectBuffer.Get(),
|
||||
dawn::BufferUsageBit::Indirect);
|
||||
dawn::BufferUsage::Indirect);
|
||||
} break;
|
||||
|
||||
case Command::InsertDebugMarker: {
|
||||
|
|
|
@ -30,10 +30,10 @@ namespace dawn_native {
|
|||
// re-compute it.
|
||||
struct PassResourceUsage {
|
||||
std::vector<BufferBase*> buffers;
|
||||
std::vector<dawn::BufferUsageBit> bufferUsages;
|
||||
std::vector<dawn::BufferUsage> bufferUsages;
|
||||
|
||||
std::vector<TextureBase*> textures;
|
||||
std::vector<dawn::TextureUsageBit> textureUsages;
|
||||
std::vector<dawn::TextureUsage> textureUsages;
|
||||
};
|
||||
|
||||
struct CommandBufferResourceUsage {
|
||||
|
|
|
@ -19,26 +19,24 @@
|
|||
|
||||
namespace dawn_native {
|
||||
|
||||
void PassResourceUsageTracker::BufferUsedAs(BufferBase* buffer, dawn::BufferUsageBit usage) {
|
||||
void PassResourceUsageTracker::BufferUsedAs(BufferBase* buffer, dawn::BufferUsage usage) {
|
||||
// std::map's operator[] will create the key and return 0 if the key didn't exist
|
||||
// before.
|
||||
dawn::BufferUsageBit& storedUsage = mBufferUsages[buffer];
|
||||
dawn::BufferUsage& storedUsage = mBufferUsages[buffer];
|
||||
|
||||
if (usage == dawn::BufferUsageBit::Storage && storedUsage & dawn::BufferUsageBit::Storage) {
|
||||
if (usage == dawn::BufferUsage::Storage && storedUsage & dawn::BufferUsage::Storage) {
|
||||
mStorageUsedMultipleTimes = true;
|
||||
}
|
||||
|
||||
storedUsage |= usage;
|
||||
}
|
||||
|
||||
void PassResourceUsageTracker::TextureUsedAs(TextureBase* texture,
|
||||
dawn::TextureUsageBit usage) {
|
||||
void PassResourceUsageTracker::TextureUsedAs(TextureBase* texture, dawn::TextureUsage usage) {
|
||||
// std::map's operator[] will create the key and return 0 if the key didn't exist
|
||||
// before.
|
||||
dawn::TextureUsageBit& storedUsage = mTextureUsages[texture];
|
||||
dawn::TextureUsage& storedUsage = mTextureUsages[texture];
|
||||
|
||||
if (usage == dawn::TextureUsageBit::Storage &&
|
||||
storedUsage & dawn::TextureUsageBit::Storage) {
|
||||
if (usage == dawn::TextureUsage::Storage && storedUsage & dawn::TextureUsage::Storage) {
|
||||
mStorageUsedMultipleTimes = true;
|
||||
}
|
||||
|
||||
|
@ -62,7 +60,7 @@ namespace dawn_native {
|
|||
// Buffers can only be used as single-write or multiple read.
|
||||
for (auto& it : mBufferUsages) {
|
||||
BufferBase* buffer = it.first;
|
||||
dawn::BufferUsageBit usage = it.second;
|
||||
dawn::BufferUsage usage = it.second;
|
||||
|
||||
if (usage & ~buffer->GetUsage()) {
|
||||
return DAWN_VALIDATION_ERROR("Buffer missing usage for the pass");
|
||||
|
@ -81,7 +79,7 @@ namespace dawn_native {
|
|||
// TODO(cwallez@chromium.org): implement per-subresource tracking
|
||||
for (auto& it : mTextureUsages) {
|
||||
TextureBase* texture = it.first;
|
||||
dawn::TextureUsageBit usage = it.second;
|
||||
dawn::TextureUsage usage = it.second;
|
||||
|
||||
if (usage & ~texture->GetUsage()) {
|
||||
return DAWN_VALIDATION_ERROR("Texture missing usage for the pass");
|
||||
|
|
|
@ -33,8 +33,8 @@ namespace dawn_native {
|
|||
// information.
|
||||
class PassResourceUsageTracker {
|
||||
public:
|
||||
void BufferUsedAs(BufferBase* buffer, dawn::BufferUsageBit usage);
|
||||
void TextureUsedAs(TextureBase* texture, dawn::TextureUsageBit usage);
|
||||
void BufferUsedAs(BufferBase* buffer, dawn::BufferUsage usage);
|
||||
void TextureUsedAs(TextureBase* texture, dawn::TextureUsage usage);
|
||||
|
||||
MaybeError ValidateComputePassUsages() const;
|
||||
MaybeError ValidateRenderPassUsages() const;
|
||||
|
@ -46,8 +46,8 @@ namespace dawn_native {
|
|||
// Performs the per-pass usage validation checks
|
||||
MaybeError ValidateUsages() const;
|
||||
|
||||
std::map<BufferBase*, dawn::BufferUsageBit> mBufferUsages;
|
||||
std::map<TextureBase*, dawn::TextureUsageBit> mTextureUsages;
|
||||
std::map<BufferBase*, dawn::BufferUsage> mBufferUsages;
|
||||
std::map<TextureBase*, dawn::TextureUsage> mTextureUsages;
|
||||
bool mStorageUsedMultipleTimes = false;
|
||||
};
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
void SwapChainBase::Configure(dawn::TextureFormat format,
|
||||
dawn::TextureUsageBit allowedUsage,
|
||||
dawn::TextureUsage allowedUsage,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
if (GetDevice()->ConsumedError(ValidateConfigure(format, allowedUsage, width, height))) {
|
||||
|
@ -89,14 +89,14 @@ namespace dawn_native {
|
|||
}
|
||||
ASSERT(!IsError());
|
||||
|
||||
allowedUsage |= dawn::TextureUsageBit::Present;
|
||||
allowedUsage |= dawn::TextureUsage::Present;
|
||||
|
||||
mFormat = format;
|
||||
mAllowedUsage = allowedUsage;
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
mImplementation.Configure(mImplementation.userData, static_cast<DawnTextureFormat>(format),
|
||||
static_cast<DawnTextureUsageBit>(allowedUsage), width, height);
|
||||
static_cast<DawnTextureUsage>(allowedUsage), width, height);
|
||||
}
|
||||
|
||||
TextureBase* SwapChainBase::GetNextTexture() {
|
||||
|
@ -138,12 +138,12 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
MaybeError SwapChainBase::ValidateConfigure(dawn::TextureFormat format,
|
||||
dawn::TextureUsageBit allowedUsage,
|
||||
dawn::TextureUsage allowedUsage,
|
||||
uint32_t width,
|
||||
uint32_t height) const {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(this));
|
||||
|
||||
DAWN_TRY(ValidateTextureUsageBit(allowedUsage));
|
||||
DAWN_TRY(ValidateTextureUsage(allowedUsage));
|
||||
DAWN_TRY(ValidateTextureFormat(format));
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace dawn_native {
|
|||
|
||||
// Dawn API
|
||||
void Configure(dawn::TextureFormat format,
|
||||
dawn::TextureUsageBit allowedUsage,
|
||||
dawn::TextureUsage allowedUsage,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
TextureBase* GetNextTexture();
|
||||
|
@ -51,7 +51,7 @@ namespace dawn_native {
|
|||
|
||||
private:
|
||||
MaybeError ValidateConfigure(dawn::TextureFormat format,
|
||||
dawn::TextureUsageBit allowedUsage,
|
||||
dawn::TextureUsage allowedUsage,
|
||||
uint32_t width,
|
||||
uint32_t height) const;
|
||||
MaybeError ValidateGetNextTexture() const;
|
||||
|
@ -59,7 +59,7 @@ namespace dawn_native {
|
|||
|
||||
DawnSwapChainImplementation mImplementation = {};
|
||||
dawn::TextureFormat mFormat = {};
|
||||
dawn::TextureUsageBit mAllowedUsage;
|
||||
dawn::TextureUsage mAllowedUsage;
|
||||
uint32_t mWidth = 0;
|
||||
uint32_t mHeight = 0;
|
||||
TextureBase* mLastNextTexture = nullptr;
|
||||
|
|
|
@ -173,23 +173,23 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
MaybeError ValidateTextureUsage(const TextureDescriptor* descriptor, const Format* format) {
|
||||
DAWN_TRY(ValidateTextureUsageBit(descriptor->usage));
|
||||
DAWN_TRY(dawn_native::ValidateTextureUsage(descriptor->usage));
|
||||
|
||||
constexpr dawn::TextureUsageBit kValidCompressedUsages =
|
||||
dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::CopySrc |
|
||||
dawn::TextureUsageBit::CopyDst;
|
||||
constexpr dawn::TextureUsage kValidCompressedUsages = dawn::TextureUsage::Sampled |
|
||||
dawn::TextureUsage::CopySrc |
|
||||
dawn::TextureUsage::CopyDst;
|
||||
if (format->isCompressed && (descriptor->usage & (~kValidCompressedUsages))) {
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Compressed texture format is incompatible with the texture usage");
|
||||
}
|
||||
|
||||
if (!format->isRenderable &&
|
||||
(descriptor->usage & dawn::TextureUsageBit::OutputAttachment)) {
|
||||
(descriptor->usage & dawn::TextureUsage::OutputAttachment)) {
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Non-renderable format used with OutputAttachment usage");
|
||||
}
|
||||
|
||||
if (descriptor->usage & dawn::TextureUsageBit::Storage) {
|
||||
if (descriptor->usage & dawn::TextureUsage::Storage) {
|
||||
return DAWN_VALIDATION_ERROR("storage textures aren't supported (yet)");
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,7 @@ namespace dawn_native {
|
|||
ASSERT(!IsError());
|
||||
return mSampleCount;
|
||||
}
|
||||
dawn::TextureUsageBit TextureBase::GetUsage() const {
|
||||
dawn::TextureUsage TextureBase::GetUsage() const {
|
||||
ASSERT(!IsError());
|
||||
return mUsage;
|
||||
}
|
||||
|
|
|
@ -34,13 +34,12 @@ namespace dawn_native {
|
|||
|
||||
bool IsValidSampleCount(uint32_t sampleCount);
|
||||
|
||||
static constexpr dawn::TextureUsageBit kReadOnlyTextureUsages = dawn::TextureUsageBit::CopySrc |
|
||||
dawn::TextureUsageBit::Sampled |
|
||||
dawn::TextureUsageBit::Present;
|
||||
static constexpr dawn::TextureUsage kReadOnlyTextureUsages =
|
||||
dawn::TextureUsage::CopySrc | dawn::TextureUsage::Sampled | dawn::TextureUsage::Present;
|
||||
|
||||
static constexpr dawn::TextureUsageBit kWritableTextureUsages =
|
||||
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Storage |
|
||||
dawn::TextureUsageBit::OutputAttachment;
|
||||
static constexpr dawn::TextureUsage kWritableTextureUsages =
|
||||
dawn::TextureUsage::CopyDst | dawn::TextureUsage::Storage |
|
||||
dawn::TextureUsage::OutputAttachment;
|
||||
|
||||
class TextureBase : public ObjectBase {
|
||||
public:
|
||||
|
@ -56,7 +55,7 @@ namespace dawn_native {
|
|||
uint32_t GetArrayLayers() const;
|
||||
uint32_t GetNumMipLevels() const;
|
||||
uint32_t GetSampleCount() const;
|
||||
dawn::TextureUsageBit GetUsage() const;
|
||||
dawn::TextureUsage GetUsage() const;
|
||||
TextureState GetTextureState() const;
|
||||
uint32_t GetSubresourceIndex(uint32_t mipLevel, uint32_t arraySlice) const;
|
||||
bool IsSubresourceContentInitialized(uint32_t baseMipLevel,
|
||||
|
@ -100,7 +99,7 @@ namespace dawn_native {
|
|||
uint32_t mArrayLayerCount;
|
||||
uint32_t mMipLevelCount;
|
||||
uint32_t mSampleCount;
|
||||
dawn::TextureUsageBit mUsage = dawn::TextureUsageBit::None;
|
||||
dawn::TextureUsage mUsage = dawn::TextureUsage::None;
|
||||
TextureState mState;
|
||||
|
||||
// TODO(natlee@microsoft.com): Use a more optimized data structure to save space
|
||||
|
|
|
@ -23,45 +23,45 @@
|
|||
namespace dawn_native { namespace d3d12 {
|
||||
|
||||
namespace {
|
||||
D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::BufferUsageBit usage) {
|
||||
D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::BufferUsage usage) {
|
||||
D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE;
|
||||
|
||||
if (usage & dawn::BufferUsageBit::Storage) {
|
||||
if (usage & dawn::BufferUsage::Storage) {
|
||||
flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
D3D12_RESOURCE_STATES D3D12BufferUsage(dawn::BufferUsageBit usage) {
|
||||
D3D12_RESOURCE_STATES D3D12BufferUsage(dawn::BufferUsage usage) {
|
||||
D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON;
|
||||
|
||||
if (usage & dawn::BufferUsageBit::CopySrc) {
|
||||
if (usage & dawn::BufferUsage::CopySrc) {
|
||||
resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::CopyDst) {
|
||||
if (usage & dawn::BufferUsage::CopyDst) {
|
||||
resourceState |= D3D12_RESOURCE_STATE_COPY_DEST;
|
||||
}
|
||||
if (usage & (dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Uniform)) {
|
||||
if (usage & (dawn::BufferUsage::Vertex | dawn::BufferUsage::Uniform)) {
|
||||
resourceState |= D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Index) {
|
||||
if (usage & dawn::BufferUsage::Index) {
|
||||
resourceState |= D3D12_RESOURCE_STATE_INDEX_BUFFER;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Storage) {
|
||||
if (usage & dawn::BufferUsage::Storage) {
|
||||
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Indirect) {
|
||||
if (usage & dawn::BufferUsage::Indirect) {
|
||||
resourceState |= D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT;
|
||||
}
|
||||
|
||||
return resourceState;
|
||||
}
|
||||
|
||||
D3D12_HEAP_TYPE D3D12HeapType(dawn::BufferUsageBit allowedUsage) {
|
||||
if (allowedUsage & dawn::BufferUsageBit::MapRead) {
|
||||
D3D12_HEAP_TYPE D3D12HeapType(dawn::BufferUsage allowedUsage) {
|
||||
if (allowedUsage & dawn::BufferUsage::MapRead) {
|
||||
return D3D12_HEAP_TYPE_READBACK;
|
||||
} else if (allowedUsage & dawn::BufferUsageBit::MapWrite) {
|
||||
} else if (allowedUsage & dawn::BufferUsage::MapWrite) {
|
||||
return D3D12_HEAP_TYPE_UPLOAD;
|
||||
} else {
|
||||
return D3D12_HEAP_TYPE_DEFAULT;
|
||||
|
@ -84,7 +84,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
resourceDescriptor.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
|
||||
// Add CopyDst for non-mappable buffer initialization in CreateBufferMapped
|
||||
// and robust resource initialization.
|
||||
resourceDescriptor.Flags = D3D12ResourceFlags(GetUsage() | dawn::BufferUsageBit::CopyDst);
|
||||
resourceDescriptor.Flags = D3D12ResourceFlags(GetUsage() | dawn::BufferUsage::CopyDst);
|
||||
|
||||
auto heapType = D3D12HeapType(GetUsage());
|
||||
auto bufferUsage = D3D12_RESOURCE_STATE_COMMON;
|
||||
|
@ -94,7 +94,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
if (heapType == D3D12_HEAP_TYPE_READBACK) {
|
||||
bufferUsage |= D3D12_RESOURCE_STATE_COPY_DEST;
|
||||
mFixedResourceState = true;
|
||||
mLastUsage = dawn::BufferUsageBit::CopyDst;
|
||||
mLastUsage = dawn::BufferUsage::CopyDst;
|
||||
}
|
||||
|
||||
// D3D12 requires buffers on the UPLOAD heap to have the D3D12_RESOURCE_STATE_GENERIC_READ
|
||||
|
@ -102,7 +102,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
if (heapType == D3D12_HEAP_TYPE_UPLOAD) {
|
||||
bufferUsage |= D3D12_RESOURCE_STATE_GENERIC_READ;
|
||||
mFixedResourceState = true;
|
||||
mLastUsage = dawn::BufferUsageBit::CopySrc;
|
||||
mLastUsage = dawn::BufferUsage::CopySrc;
|
||||
}
|
||||
|
||||
mResource =
|
||||
|
@ -126,7 +126,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
// ResourceBarrier call. Failing to do so will cause the tracked state to become invalid and can
|
||||
// cause subsequent errors.
|
||||
bool Buffer::TransitionUsageAndGetResourceBarrier(D3D12_RESOURCE_BARRIER* barrier,
|
||||
dawn::BufferUsageBit newUsage) {
|
||||
dawn::BufferUsage newUsage) {
|
||||
// Resources in upload and readback heaps must be kept in the COPY_SOURCE/DEST state
|
||||
if (mFixedResourceState) {
|
||||
ASSERT(mLastUsage == newUsage);
|
||||
|
@ -183,7 +183,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
}
|
||||
|
||||
void Buffer::TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
|
||||
dawn::BufferUsageBit usage) {
|
||||
dawn::BufferUsage usage) {
|
||||
D3D12_RESOURCE_BARRIER barrier;
|
||||
|
||||
if (TransitionUsageAndGetResourceBarrier(&barrier, usage)) {
|
||||
|
@ -205,7 +205,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
bool Buffer::IsMapWritable() const {
|
||||
// TODO(enga): Handle CPU-visible memory on UMA
|
||||
return (GetUsage() & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) != 0;
|
||||
return (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
|
||||
}
|
||||
|
||||
MaybeError Buffer::MapAtCreationImpl(uint8_t** mappedPointer) {
|
||||
|
|
|
@ -34,9 +34,9 @@ namespace dawn_native { namespace d3d12 {
|
|||
D3D12_GPU_VIRTUAL_ADDRESS GetVA() const;
|
||||
void OnMapCommandSerialFinished(uint32_t mapSerial, void* data, bool isWrite);
|
||||
bool TransitionUsageAndGetResourceBarrier(D3D12_RESOURCE_BARRIER* barrier,
|
||||
dawn::BufferUsageBit newUsage);
|
||||
dawn::BufferUsage newUsage);
|
||||
void TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
|
||||
dawn::BufferUsageBit usage);
|
||||
dawn::BufferUsage usage);
|
||||
|
||||
private:
|
||||
// Dawn API
|
||||
|
@ -50,7 +50,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
ComPtr<ID3D12Resource> mResource;
|
||||
bool mFixedResourceState = false;
|
||||
dawn::BufferUsageBit mLastUsage = dawn::BufferUsageBit::None;
|
||||
dawn::BufferUsage mLastUsage = dawn::BufferUsage::None;
|
||||
Serial mLastUsedSerial = UINT64_MAX;
|
||||
D3D12_RANGE mWrittenMappedRange;
|
||||
};
|
||||
|
|
|
@ -539,7 +539,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
// Clear textures that are not output attachments. Output attachments will be
|
||||
// cleared during record render pass if the texture subresource has not been
|
||||
// initialized before the render pass.
|
||||
if (!(usages.textureUsages[i] & dawn::TextureUsageBit::OutputAttachment)) {
|
||||
if (!(usages.textureUsages[i] & dawn::TextureUsage::OutputAttachment)) {
|
||||
texture->EnsureSubresourceContentInitialized(
|
||||
commandList, 0, texture->GetNumMipLevels(), 0, texture->GetArrayLayers());
|
||||
}
|
||||
|
@ -591,8 +591,8 @@ namespace dawn_native { namespace d3d12 {
|
|||
Buffer* srcBuffer = ToBackend(copy->source.Get());
|
||||
Buffer* dstBuffer = ToBackend(copy->destination.Get());
|
||||
|
||||
srcBuffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopySrc);
|
||||
dstBuffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopyDst);
|
||||
srcBuffer->TransitionUsageNow(commandList, dawn::BufferUsage::CopySrc);
|
||||
dstBuffer->TransitionUsageNow(commandList, dawn::BufferUsage::CopyDst);
|
||||
|
||||
commandList->CopyBufferRegion(
|
||||
dstBuffer->GetD3D12Resource().Get(), copy->destinationOffset,
|
||||
|
@ -614,8 +614,8 @@ namespace dawn_native { namespace d3d12 {
|
|||
copy->destination.arrayLayer, 1);
|
||||
}
|
||||
|
||||
buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopySrc);
|
||||
texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopyDst);
|
||||
buffer->TransitionUsageNow(commandList, dawn::BufferUsage::CopySrc);
|
||||
texture->TransitionUsageNow(commandList, dawn::TextureUsage::CopyDst);
|
||||
|
||||
auto copySplit = ComputeTextureCopySplit(
|
||||
copy->destination.origin, copy->copySize, texture->GetFormat(),
|
||||
|
@ -660,8 +660,8 @@ namespace dawn_native { namespace d3d12 {
|
|||
texture->EnsureSubresourceContentInitialized(commandList, copy->source.mipLevel,
|
||||
1, copy->source.arrayLayer, 1);
|
||||
|
||||
texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopySrc);
|
||||
buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopyDst);
|
||||
texture->TransitionUsageNow(commandList, dawn::TextureUsage::CopySrc);
|
||||
buffer->TransitionUsageNow(commandList, dawn::BufferUsage::CopyDst);
|
||||
|
||||
auto copySplit = ComputeTextureCopySplit(
|
||||
copy->source.origin, copy->copySize, texture->GetFormat(),
|
||||
|
@ -718,8 +718,8 @@ namespace dawn_native { namespace d3d12 {
|
|||
commandList, copy->destination.mipLevel, 1,
|
||||
copy->destination.arrayLayer, 1);
|
||||
}
|
||||
source->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopySrc);
|
||||
destination->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopyDst);
|
||||
source->TransitionUsageNow(commandList, dawn::TextureUsage::CopySrc);
|
||||
destination->TransitionUsageNow(commandList, dawn::TextureUsage::CopyDst);
|
||||
|
||||
if (CanUseCopyResource(source->GetNumMipLevels(), source->GetSize(),
|
||||
destination->GetSize(), copy->copySize)) {
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
DawnSwapChainImplementation impl;
|
||||
impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, window));
|
||||
impl.textureUsage = DAWN_TEXTURE_USAGE_BIT_PRESENT;
|
||||
impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
|
|
@ -317,7 +317,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
uint64_t destinationOffset,
|
||||
uint64_t size) {
|
||||
ToBackend(destination)
|
||||
->TransitionUsageNow(GetPendingCommandList(), dawn::BufferUsageBit::CopyDst);
|
||||
->TransitionUsageNow(GetPendingCommandList(), dawn::BufferUsage::CopyDst);
|
||||
|
||||
GetPendingCommandList()->CopyBufferRegion(
|
||||
ToBackend(destination)->GetD3D12Resource().Get(), destinationOffset,
|
||||
|
|
|
@ -21,15 +21,15 @@
|
|||
namespace dawn_native { namespace d3d12 {
|
||||
|
||||
namespace {
|
||||
DXGI_USAGE D3D12SwapChainBufferUsage(DawnTextureUsageBit allowedUsages) {
|
||||
DXGI_USAGE D3D12SwapChainBufferUsage(DawnTextureUsage allowedUsages) {
|
||||
DXGI_USAGE usage = DXGI_CPU_ACCESS_NONE;
|
||||
if (allowedUsages & DAWN_TEXTURE_USAGE_BIT_SAMPLED) {
|
||||
if (allowedUsages & DAWN_TEXTURE_USAGE_SAMPLED) {
|
||||
usage |= DXGI_USAGE_SHADER_INPUT;
|
||||
}
|
||||
if (allowedUsages & DAWN_TEXTURE_USAGE_BIT_STORAGE) {
|
||||
if (allowedUsages & DAWN_TEXTURE_USAGE_STORAGE) {
|
||||
usage |= DXGI_USAGE_UNORDERED_ACCESS;
|
||||
}
|
||||
if (allowedUsages & DAWN_TEXTURE_USAGE_BIT_OUTPUT_ATTACHMENT) {
|
||||
if (allowedUsages & DAWN_TEXTURE_USAGE_OUTPUT_ATTACHMENT) {
|
||||
usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
}
|
||||
return usage;
|
||||
|
@ -49,7 +49,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
}
|
||||
|
||||
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
|
||||
DawnTextureUsageBit usage,
|
||||
DawnTextureUsage usage,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
ASSERT(width > 0);
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
void Init(DawnWSIContextD3D12* context);
|
||||
DawnSwapChainError Configure(DawnTextureFormat format,
|
||||
DawnTextureUsageBit,
|
||||
DawnTextureUsage,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
|
||||
|
|
|
@ -28,8 +28,8 @@ namespace dawn_native { namespace d3d12 {
|
|||
wsiContext.device = reinterpret_cast<DawnDevice>(GetDevice());
|
||||
im.Init(im.userData, &wsiContext);
|
||||
|
||||
ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_BIT_NONE);
|
||||
mTextureUsage = static_cast<dawn::TextureUsageBit>(im.textureUsage);
|
||||
ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_NONE);
|
||||
mTextureUsage = static_cast<dawn::TextureUsage>(im.textureUsage);
|
||||
}
|
||||
|
||||
SwapChain::~SwapChain() {
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
TextureBase* GetNextTextureImpl(const TextureDescriptor* descriptor) override;
|
||||
void OnBeforePresent(TextureBase* texture) override;
|
||||
|
||||
dawn::TextureUsageBit mTextureUsage;
|
||||
dawn::TextureUsage mTextureUsage;
|
||||
};
|
||||
|
||||
}} // namespace dawn_native::d3d12
|
||||
|
|
|
@ -21,28 +21,28 @@
|
|||
namespace dawn_native { namespace d3d12 {
|
||||
|
||||
namespace {
|
||||
D3D12_RESOURCE_STATES D3D12TextureUsage(dawn::TextureUsageBit usage, const Format& format) {
|
||||
D3D12_RESOURCE_STATES D3D12TextureUsage(dawn::TextureUsage usage, const Format& format) {
|
||||
D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON;
|
||||
|
||||
// Present is an exclusive flag.
|
||||
if (usage & dawn::TextureUsageBit::Present) {
|
||||
if (usage & dawn::TextureUsage::Present) {
|
||||
return D3D12_RESOURCE_STATE_PRESENT;
|
||||
}
|
||||
|
||||
if (usage & dawn::TextureUsageBit::CopySrc) {
|
||||
if (usage & dawn::TextureUsage::CopySrc) {
|
||||
resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::CopyDst) {
|
||||
if (usage & dawn::TextureUsage::CopyDst) {
|
||||
resourceState |= D3D12_RESOURCE_STATE_COPY_DEST;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::Sampled) {
|
||||
if (usage & dawn::TextureUsage::Sampled) {
|
||||
resourceState |= (D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE |
|
||||
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::Storage) {
|
||||
if (usage & dawn::TextureUsage::Storage) {
|
||||
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::OutputAttachment) {
|
||||
if (usage & dawn::TextureUsage::OutputAttachment) {
|
||||
if (format.HasDepthOrStencil()) {
|
||||
resourceState |= D3D12_RESOURCE_STATE_DEPTH_WRITE;
|
||||
} else {
|
||||
|
@ -53,12 +53,12 @@ namespace dawn_native { namespace d3d12 {
|
|||
return resourceState;
|
||||
}
|
||||
|
||||
D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::TextureUsageBit usage,
|
||||
D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::TextureUsage usage,
|
||||
const Format& format,
|
||||
bool isMultisampledTexture) {
|
||||
D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE;
|
||||
|
||||
if (usage & dawn::TextureUsageBit::Storage) {
|
||||
if (usage & dawn::TextureUsage::Storage) {
|
||||
flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
// flag is invalid.
|
||||
// TODO(natlee@microsoft.com, jiawei.shao@intel.com): do not require render target for
|
||||
// lazy clearing.
|
||||
if ((usage & dawn::TextureUsageBit::OutputAttachment) || isMultisampledTexture ||
|
||||
if ((usage & dawn::TextureUsage::OutputAttachment) || isMultisampledTexture ||
|
||||
!format.isCompressed) {
|
||||
if (format.HasDepthOrStencil()) {
|
||||
flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
|
||||
|
@ -319,7 +319,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
// ResourceBarrier call. Failing to do so will cause the tracked state to become invalid and can
|
||||
// cause subsequent errors.
|
||||
bool Texture::TransitionUsageAndGetResourceBarrier(D3D12_RESOURCE_BARRIER* barrier,
|
||||
dawn::TextureUsageBit newUsage) {
|
||||
dawn::TextureUsage newUsage) {
|
||||
return TransitionUsageAndGetResourceBarrier(barrier,
|
||||
D3D12TextureUsage(newUsage, GetFormat()));
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
}
|
||||
|
||||
void Texture::TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
|
||||
dawn::TextureUsageBit usage) {
|
||||
dawn::TextureUsage usage) {
|
||||
TransitionUsageNow(commandList, D3D12TextureUsage(usage, GetFormat()));
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ namespace dawn_native { namespace d3d12 {
|
|||
DXGI_FORMAT GetD3D12Format() const;
|
||||
ID3D12Resource* GetD3D12Resource() const;
|
||||
bool TransitionUsageAndGetResourceBarrier(D3D12_RESOURCE_BARRIER* barrier,
|
||||
dawn::TextureUsageBit newUsage);
|
||||
dawn::TextureUsage newUsage);
|
||||
void TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
|
||||
dawn::TextureUsageBit usage);
|
||||
dawn::TextureUsage usage);
|
||||
void TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
|
||||
D3D12_RESOURCE_STATES newState);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#ifndef DAWNNATIVE_DAWNPLATFORM_H_
|
||||
#define DAWNNATIVE_DAWNPLATFORM_H_
|
||||
|
||||
// Use cawncpp to have the enum and bitfield definitions
|
||||
// Use dawncpp to have the enum and bitfield definitions
|
||||
#include <dawn/dawncpp.h>
|
||||
|
||||
// Use our autogenerated version of the dawn structures that point to dawn_native object types
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace dawn_native { namespace metal {
|
|||
Buffer::Buffer(Device* device, const BufferDescriptor* descriptor)
|
||||
: BufferBase(device, descriptor) {
|
||||
MTLResourceOptions storageMode;
|
||||
if (GetUsage() & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) {
|
||||
if (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) {
|
||||
storageMode = MTLResourceStorageModeShared;
|
||||
} else {
|
||||
storageMode = MTLResourceStorageModePrivate;
|
||||
|
@ -49,7 +49,7 @@ namespace dawn_native { namespace metal {
|
|||
|
||||
bool Buffer::IsMapWritable() const {
|
||||
// TODO(enga): Handle CPU-visible memory on UMA
|
||||
return (GetUsage() & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) != 0;
|
||||
return (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
|
||||
}
|
||||
|
||||
MaybeError Buffer::MapAtCreationImpl(uint8_t** mappedPointer) {
|
||||
|
|
|
@ -21,24 +21,24 @@
|
|||
namespace dawn_native { namespace metal {
|
||||
|
||||
namespace {
|
||||
bool UsageNeedsTextureView(dawn::TextureUsageBit usage) {
|
||||
constexpr dawn::TextureUsageBit kUsageNeedsTextureView =
|
||||
dawn::TextureUsageBit::Storage | dawn::TextureUsageBit::Sampled;
|
||||
bool UsageNeedsTextureView(dawn::TextureUsage usage) {
|
||||
constexpr dawn::TextureUsage kUsageNeedsTextureView =
|
||||
dawn::TextureUsage::Storage | dawn::TextureUsage::Sampled;
|
||||
return usage & kUsageNeedsTextureView;
|
||||
}
|
||||
|
||||
MTLTextureUsage MetalTextureUsage(dawn::TextureUsageBit usage) {
|
||||
MTLTextureUsage MetalTextureUsage(dawn::TextureUsage usage) {
|
||||
MTLTextureUsage result = MTLTextureUsageUnknown; // This is 0
|
||||
|
||||
if (usage & (dawn::TextureUsageBit::Storage)) {
|
||||
if (usage & (dawn::TextureUsage::Storage)) {
|
||||
result |= MTLTextureUsageShaderWrite | MTLTextureUsageShaderRead;
|
||||
}
|
||||
|
||||
if (usage & (dawn::TextureUsageBit::Sampled)) {
|
||||
if (usage & (dawn::TextureUsage::Sampled)) {
|
||||
result |= MTLTextureUsageShaderRead;
|
||||
}
|
||||
|
||||
if (usage & (dawn::TextureUsageBit::OutputAttachment)) {
|
||||
if (usage & (dawn::TextureUsage::OutputAttachment)) {
|
||||
result |= MTLTextureUsageRenderTarget;
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ namespace dawn_native { namespace null {
|
|||
bool Buffer::IsMapWritable() const {
|
||||
// Only return true for mappable buffers so we can test cases that need / don't need a
|
||||
// staging buffer.
|
||||
return (GetUsage() & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) != 0;
|
||||
return (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
|
||||
}
|
||||
|
||||
MaybeError Buffer::MapAtCreationImpl(uint8_t** mappedPointer) {
|
||||
|
@ -345,7 +345,7 @@ namespace dawn_native { namespace null {
|
|||
}
|
||||
|
||||
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
|
||||
DawnTextureUsageBit,
|
||||
DawnTextureUsage,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
return DAWN_SWAP_CHAIN_NO_ERROR;
|
||||
|
|
|
@ -209,7 +209,7 @@ namespace dawn_native { namespace null {
|
|||
using WSIContext = struct {};
|
||||
void Init(WSIContext* context);
|
||||
DawnSwapChainError Configure(DawnTextureFormat format,
|
||||
DawnTextureUsageBit,
|
||||
DawnTextureUsage,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace dawn_native { namespace null {
|
|||
DawnSwapChainImplementation CreateNativeSwapChainImpl() {
|
||||
DawnSwapChainImplementation impl;
|
||||
impl = CreateSwapChainImplementation(new NativeSwapChainImpl());
|
||||
impl.textureUsage = DAWN_TEXTURE_USAGE_BIT_PRESENT;
|
||||
impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
|
||||
return impl;
|
||||
}
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ namespace dawn_native { namespace opengl {
|
|||
// We count the lazy clears for non output attachment textures and depth stencil
|
||||
// textures in order to match the backdoor lazy clear counts in Vulkan and D3D12.
|
||||
bool isLazyClear =
|
||||
((!(usages.textureUsages[i] & dawn::TextureUsageBit::OutputAttachment) &&
|
||||
((!(usages.textureUsages[i] & dawn::TextureUsage::OutputAttachment) &&
|
||||
texture->GetFormat().IsColor()) ||
|
||||
texture->GetFormat().HasDepthOrStencil());
|
||||
texture->EnsureSubresourceContentInitialized(
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace dawn_native { namespace opengl {
|
|||
}
|
||||
|
||||
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
|
||||
DawnTextureUsageBit usage,
|
||||
DawnTextureUsage usage,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
if (format != DAWN_TEXTURE_FORMAT_RGBA8_UNORM) {
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace dawn_native { namespace opengl {
|
|||
|
||||
void Init(DawnWSIContextGL* context);
|
||||
DawnSwapChainError Configure(DawnTextureFormat format,
|
||||
DawnTextureUsageBit,
|
||||
DawnTextureUsage,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace dawn_native { namespace opengl {
|
|||
DawnSwapChainImplementation impl;
|
||||
impl = CreateSwapChainImplementation(
|
||||
new NativeSwapChainImpl(backendDevice, present, presentUserdata));
|
||||
impl.textureUsage = DAWN_TEXTURE_USAGE_BIT_PRESENT;
|
||||
impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
|
|
@ -66,9 +66,9 @@ namespace dawn_native { namespace opengl {
|
|||
return handle;
|
||||
}
|
||||
|
||||
bool UsageNeedsTextureView(dawn::TextureUsageBit usage) {
|
||||
constexpr dawn::TextureUsageBit kUsageNeedingTextureView =
|
||||
dawn::TextureUsageBit::Storage | dawn::TextureUsageBit::Sampled;
|
||||
bool UsageNeedsTextureView(dawn::TextureUsage usage) {
|
||||
constexpr dawn::TextureUsage kUsageNeedingTextureView =
|
||||
dawn::TextureUsage::Storage | dawn::TextureUsage::Sampled;
|
||||
return usage & kUsageNeedingTextureView;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,86 +23,86 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
namespace {
|
||||
|
||||
VkBufferUsageFlags VulkanBufferUsage(dawn::BufferUsageBit usage) {
|
||||
VkBufferUsageFlags VulkanBufferUsage(dawn::BufferUsage usage) {
|
||||
VkBufferUsageFlags flags = 0;
|
||||
|
||||
if (usage & dawn::BufferUsageBit::CopySrc) {
|
||||
if (usage & dawn::BufferUsage::CopySrc) {
|
||||
flags |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::CopyDst) {
|
||||
if (usage & dawn::BufferUsage::CopyDst) {
|
||||
flags |= VK_BUFFER_USAGE_TRANSFER_DST_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Index) {
|
||||
if (usage & dawn::BufferUsage::Index) {
|
||||
flags |= VK_BUFFER_USAGE_INDEX_BUFFER_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Vertex) {
|
||||
if (usage & dawn::BufferUsage::Vertex) {
|
||||
flags |= VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Uniform) {
|
||||
if (usage & dawn::BufferUsage::Uniform) {
|
||||
flags |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Storage) {
|
||||
if (usage & dawn::BufferUsage::Storage) {
|
||||
flags |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Indirect) {
|
||||
if (usage & dawn::BufferUsage::Indirect) {
|
||||
flags |= VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
VkPipelineStageFlags VulkanPipelineStage(dawn::BufferUsageBit usage) {
|
||||
VkPipelineStageFlags VulkanPipelineStage(dawn::BufferUsage usage) {
|
||||
VkPipelineStageFlags flags = 0;
|
||||
|
||||
if (usage & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) {
|
||||
if (usage & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) {
|
||||
flags |= VK_PIPELINE_STAGE_HOST_BIT;
|
||||
}
|
||||
if (usage & (dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst)) {
|
||||
if (usage & (dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst)) {
|
||||
flags |= VK_PIPELINE_STAGE_TRANSFER_BIT;
|
||||
}
|
||||
if (usage & (dawn::BufferUsageBit::Index | dawn::BufferUsageBit::Vertex)) {
|
||||
if (usage & (dawn::BufferUsage::Index | dawn::BufferUsage::Vertex)) {
|
||||
flags |= VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
|
||||
}
|
||||
if (usage & (dawn::BufferUsageBit::Uniform | dawn::BufferUsageBit::Storage)) {
|
||||
if (usage & (dawn::BufferUsage::Uniform | dawn::BufferUsage::Storage)) {
|
||||
flags |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT |
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
|
||||
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Indirect) {
|
||||
if (usage & dawn::BufferUsage::Indirect) {
|
||||
flags |= VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
VkAccessFlags VulkanAccessFlags(dawn::BufferUsageBit usage) {
|
||||
VkAccessFlags VulkanAccessFlags(dawn::BufferUsage usage) {
|
||||
VkAccessFlags flags = 0;
|
||||
|
||||
if (usage & dawn::BufferUsageBit::MapRead) {
|
||||
if (usage & dawn::BufferUsage::MapRead) {
|
||||
flags |= VK_ACCESS_HOST_READ_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::MapWrite) {
|
||||
if (usage & dawn::BufferUsage::MapWrite) {
|
||||
flags |= VK_ACCESS_HOST_WRITE_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::CopySrc) {
|
||||
if (usage & dawn::BufferUsage::CopySrc) {
|
||||
flags |= VK_ACCESS_TRANSFER_READ_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::CopyDst) {
|
||||
if (usage & dawn::BufferUsage::CopyDst) {
|
||||
flags |= VK_ACCESS_TRANSFER_WRITE_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Index) {
|
||||
if (usage & dawn::BufferUsage::Index) {
|
||||
flags |= VK_ACCESS_INDEX_READ_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Vertex) {
|
||||
if (usage & dawn::BufferUsage::Vertex) {
|
||||
flags |= VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Uniform) {
|
||||
if (usage & dawn::BufferUsage::Uniform) {
|
||||
flags |= VK_ACCESS_UNIFORM_READ_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Storage) {
|
||||
if (usage & dawn::BufferUsage::Storage) {
|
||||
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
|
||||
}
|
||||
if (usage & dawn::BufferUsageBit::Indirect) {
|
||||
if (usage & dawn::BufferUsage::Indirect) {
|
||||
flags |= VK_ACCESS_INDIRECT_COMMAND_READ_BIT;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ namespace dawn_native { namespace vulkan {
|
|||
createInfo.size = GetSize();
|
||||
// Add CopyDst for non-mappable buffer initialization in CreateBufferMapped
|
||||
// and robust resource initialization.
|
||||
createInfo.usage = VulkanBufferUsage(GetUsage() | dawn::BufferUsageBit::CopyDst);
|
||||
createInfo.usage = VulkanBufferUsage(GetUsage() | dawn::BufferUsage::CopyDst);
|
||||
createInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
createInfo.queueFamilyIndexCount = 0;
|
||||
createInfo.pQueueFamilyIndices = 0;
|
||||
|
@ -134,7 +134,7 @@ namespace dawn_native { namespace vulkan {
|
|||
device->fn.GetBufferMemoryRequirements(device->GetVkDevice(), mHandle, &requirements);
|
||||
|
||||
bool requestMappable =
|
||||
(GetUsage() & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) != 0;
|
||||
(GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
|
||||
if (!device->GetMemoryAllocator()->Allocate(requirements, requestMappable,
|
||||
&mMemoryAllocation)) {
|
||||
ASSERT(false);
|
||||
|
@ -164,7 +164,7 @@ namespace dawn_native { namespace vulkan {
|
|||
}
|
||||
|
||||
void Buffer::TransitionUsageNow(CommandRecordingContext* recordingContext,
|
||||
dawn::BufferUsageBit usage) {
|
||||
dawn::BufferUsage usage) {
|
||||
bool lastIncludesTarget = (mLastUsage & usage) == usage;
|
||||
bool lastReadOnly = (mLastUsage & kReadOnlyBufferUsages) == mLastUsage;
|
||||
|
||||
|
@ -174,7 +174,7 @@ namespace dawn_native { namespace vulkan {
|
|||
}
|
||||
|
||||
// Special-case for the initial transition: Vulkan doesn't allow access flags to be 0.
|
||||
if (mLastUsage == dawn::BufferUsageBit::None) {
|
||||
if (mLastUsage == dawn::BufferUsage::None) {
|
||||
mLastUsage = usage;
|
||||
return;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ namespace dawn_native { namespace vulkan {
|
|||
Device* device = ToBackend(GetDevice());
|
||||
|
||||
CommandRecordingContext* recordingContext = device->GetPendingRecordingContext();
|
||||
TransitionUsageNow(recordingContext, dawn::BufferUsageBit::MapRead);
|
||||
TransitionUsageNow(recordingContext, dawn::BufferUsage::MapRead);
|
||||
|
||||
uint8_t* memory = mMemoryAllocation.GetMappedPointer();
|
||||
ASSERT(memory != nullptr);
|
||||
|
@ -228,7 +228,7 @@ namespace dawn_native { namespace vulkan {
|
|||
Device* device = ToBackend(GetDevice());
|
||||
|
||||
CommandRecordingContext* recordingContext = device->GetPendingRecordingContext();
|
||||
TransitionUsageNow(recordingContext, dawn::BufferUsageBit::MapWrite);
|
||||
TransitionUsageNow(recordingContext, dawn::BufferUsage::MapWrite);
|
||||
|
||||
uint8_t* memory = mMemoryAllocation.GetMappedPointer();
|
||||
ASSERT(memory != nullptr);
|
||||
|
|
|
@ -39,8 +39,7 @@ namespace dawn_native { namespace vulkan {
|
|||
// Transitions the buffer to be used as `usage`, recording any necessary barrier in
|
||||
// `commands`.
|
||||
// TODO(cwallez@chromium.org): coalesce barriers and do them early when possible.
|
||||
void TransitionUsageNow(CommandRecordingContext* recordingContext,
|
||||
dawn::BufferUsageBit usage);
|
||||
void TransitionUsageNow(CommandRecordingContext* recordingContext, dawn::BufferUsage usage);
|
||||
|
||||
private:
|
||||
// Dawn API
|
||||
|
@ -55,7 +54,7 @@ namespace dawn_native { namespace vulkan {
|
|||
VkBuffer mHandle = VK_NULL_HANDLE;
|
||||
DeviceMemoryAllocation mMemoryAllocation;
|
||||
|
||||
dawn::BufferUsageBit mLastUsage = dawn::BufferUsageBit::None;
|
||||
dawn::BufferUsage mLastUsage = dawn::BufferUsage::None;
|
||||
};
|
||||
|
||||
class MapRequestTracker {
|
||||
|
|
|
@ -327,7 +327,7 @@ namespace dawn_native { namespace vulkan {
|
|||
format.blockByteSize;
|
||||
BufferDescriptor tempBufferDescriptor;
|
||||
tempBufferDescriptor.size = tempBufferSize;
|
||||
tempBufferDescriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
tempBufferDescriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
|
||||
Device* device = ToBackend(GetDevice());
|
||||
Ref<Buffer> tempBuffer = ToBackend(device->CreateBuffer(&tempBufferDescriptor));
|
||||
|
@ -347,7 +347,7 @@ namespace dawn_native { namespace vulkan {
|
|||
VkImage srcImage = ToBackend(srcCopy.texture)->GetHandle();
|
||||
VkImage dstImage = ToBackend(dstCopy.texture)->GetHandle();
|
||||
|
||||
tempBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopyDst);
|
||||
tempBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopyDst);
|
||||
VkBufferImageCopy srcToTempBufferRegion =
|
||||
ComputeBufferImageCopyRegion(tempBufferCopy, srcCopy, copySize);
|
||||
|
||||
|
@ -355,7 +355,7 @@ namespace dawn_native { namespace vulkan {
|
|||
device->fn.CmdCopyImageToBuffer(commands, srcImage, VK_IMAGE_LAYOUT_GENERAL,
|
||||
tempBuffer->GetHandle(), 1, &srcToTempBufferRegion);
|
||||
|
||||
tempBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopySrc);
|
||||
tempBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopySrc);
|
||||
VkBufferImageCopy tempBufferToDstRegion =
|
||||
ComputeBufferImageCopyRegion(tempBufferCopy, dstCopy, copySize);
|
||||
|
||||
|
@ -384,7 +384,7 @@ namespace dawn_native { namespace vulkan {
|
|||
// Clear textures that are not output attachments. Output attachments will be
|
||||
// cleared in RecordBeginRenderPass by setting the loadop to clear when the
|
||||
// texture subresource has not been initialized before the render pass.
|
||||
if (!(usages.textureUsages[i] & dawn::TextureUsageBit::OutputAttachment)) {
|
||||
if (!(usages.textureUsages[i] & dawn::TextureUsage::OutputAttachment)) {
|
||||
texture->EnsureSubresourceContentInitialized(recordingContext, 0,
|
||||
texture->GetNumMipLevels(), 0,
|
||||
texture->GetArrayLayers());
|
||||
|
@ -403,8 +403,8 @@ namespace dawn_native { namespace vulkan {
|
|||
Buffer* srcBuffer = ToBackend(copy->source.Get());
|
||||
Buffer* dstBuffer = ToBackend(copy->destination.Get());
|
||||
|
||||
srcBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopySrc);
|
||||
dstBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopyDst);
|
||||
srcBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopySrc);
|
||||
dstBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopyDst);
|
||||
|
||||
VkBufferCopy region;
|
||||
region.srcOffset = copy->sourceOffset;
|
||||
|
@ -437,9 +437,9 @@ namespace dawn_native { namespace vulkan {
|
|||
subresource.baseArrayLayer, 1);
|
||||
}
|
||||
ToBackend(src.buffer)
|
||||
->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopySrc);
|
||||
->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopySrc);
|
||||
ToBackend(dst.texture)
|
||||
->TransitionUsageNow(recordingContext, dawn::TextureUsageBit::CopyDst);
|
||||
->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopyDst);
|
||||
VkBuffer srcBuffer = ToBackend(src.buffer)->GetHandle();
|
||||
VkImage dstImage = ToBackend(dst.texture)->GetHandle();
|
||||
|
||||
|
@ -465,9 +465,9 @@ namespace dawn_native { namespace vulkan {
|
|||
subresource.baseArrayLayer, 1);
|
||||
|
||||
ToBackend(src.texture)
|
||||
->TransitionUsageNow(recordingContext, dawn::TextureUsageBit::CopySrc);
|
||||
->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopySrc);
|
||||
ToBackend(dst.buffer)
|
||||
->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopyDst);
|
||||
->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopyDst);
|
||||
|
||||
VkImage srcImage = ToBackend(src.texture)->GetHandle();
|
||||
VkBuffer dstBuffer = ToBackend(dst.buffer)->GetHandle();
|
||||
|
@ -497,9 +497,9 @@ namespace dawn_native { namespace vulkan {
|
|||
}
|
||||
|
||||
ToBackend(src.texture)
|
||||
->TransitionUsageNow(recordingContext, dawn::TextureUsageBit::CopySrc);
|
||||
->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopySrc);
|
||||
ToBackend(dst.texture)
|
||||
->TransitionUsageNow(recordingContext, dawn::TextureUsageBit::CopyDst);
|
||||
->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// In some situations we cannot do texture-to-texture copies with vkCmdCopyImage
|
||||
// because as Vulkan SPEC always validates image copies with the virtual size of
|
||||
|
|
|
@ -568,7 +568,7 @@ namespace dawn_native { namespace vulkan {
|
|||
// Insert pipeline barrier to ensure correct ordering with previous memory operations on the
|
||||
// buffer.
|
||||
ToBackend(destination)
|
||||
->TransitionUsageNow(GetPendingRecordingContext(), dawn::BufferUsageBit::CopyDst);
|
||||
->TransitionUsageNow(GetPendingRecordingContext(), dawn::BufferUsage::CopyDst);
|
||||
|
||||
VkBufferCopy copy;
|
||||
copy.srcOffset = sourceOffset;
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace dawn_native { namespace vulkan {
|
|||
}
|
||||
|
||||
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
|
||||
DawnTextureUsageBit usage,
|
||||
DawnTextureUsage usage,
|
||||
uint32_t width,
|
||||
uint32_t height) {
|
||||
UpdateSurfaceConfig();
|
||||
|
@ -99,7 +99,7 @@ namespace dawn_native { namespace vulkan {
|
|||
createInfo.imageExtent.width = width;
|
||||
createInfo.imageExtent.height = height;
|
||||
createInfo.imageArrayLayers = 1;
|
||||
createInfo.imageUsage = VulkanImageUsage(static_cast<dawn::TextureUsageBit>(usage),
|
||||
createInfo.imageUsage = VulkanImageUsage(static_cast<dawn::TextureUsage>(usage),
|
||||
mDevice->GetValidInternalFormat(mConfig.format));
|
||||
createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
createInfo.queueFamilyIndexCount = 0;
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
void Init(DawnWSIContextVulkan* context);
|
||||
DawnSwapChainError Configure(DawnTextureFormat format,
|
||||
DawnTextureUsageBit,
|
||||
DawnTextureUsage,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
|
||||
|
|
|
@ -25,8 +25,8 @@ namespace dawn_native { namespace vulkan {
|
|||
DawnWSIContextVulkan wsiContext = {};
|
||||
im.Init(im.userData, &wsiContext);
|
||||
|
||||
ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_BIT_NONE);
|
||||
mTextureUsage = static_cast<dawn::TextureUsageBit>(im.textureUsage);
|
||||
ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_NONE);
|
||||
mTextureUsage = static_cast<dawn::TextureUsage>(im.textureUsage);
|
||||
}
|
||||
|
||||
SwapChain::~SwapChain() {
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace dawn_native { namespace vulkan {
|
|||
void OnBeforePresent(TextureBase* texture) override;
|
||||
|
||||
private:
|
||||
dawn::TextureUsageBit mTextureUsage;
|
||||
dawn::TextureUsage mTextureUsage;
|
||||
};
|
||||
|
||||
}} // namespace dawn_native::vulkan
|
||||
|
|
|
@ -55,22 +55,22 @@ namespace dawn_native { namespace vulkan {
|
|||
}
|
||||
|
||||
// Computes which vulkan access type could be required for the given Dawn usage.
|
||||
VkAccessFlags VulkanAccessFlags(dawn::TextureUsageBit usage, const Format& format) {
|
||||
VkAccessFlags VulkanAccessFlags(dawn::TextureUsage usage, const Format& format) {
|
||||
VkAccessFlags flags = 0;
|
||||
|
||||
if (usage & dawn::TextureUsageBit::CopySrc) {
|
||||
if (usage & dawn::TextureUsage::CopySrc) {
|
||||
flags |= VK_ACCESS_TRANSFER_READ_BIT;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::CopyDst) {
|
||||
if (usage & dawn::TextureUsage::CopyDst) {
|
||||
flags |= VK_ACCESS_TRANSFER_WRITE_BIT;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::Sampled) {
|
||||
if (usage & dawn::TextureUsage::Sampled) {
|
||||
flags |= VK_ACCESS_SHADER_READ_BIT;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::Storage) {
|
||||
if (usage & dawn::TextureUsage::Storage) {
|
||||
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::OutputAttachment) {
|
||||
if (usage & dawn::TextureUsage::OutputAttachment) {
|
||||
if (format.HasDepthOrStencil()) {
|
||||
flags |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
|
||||
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
|
||||
|
@ -79,7 +79,7 @@ namespace dawn_native { namespace vulkan {
|
|||
VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
|
||||
}
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::Present) {
|
||||
if (usage & dawn::TextureUsage::Present) {
|
||||
// There is no access flag for present because the VK_KHR_SWAPCHAIN extension says
|
||||
// that vkQueuePresentKHR makes the memory of the image visible to the presentation
|
||||
// engine. There's also a note explicitly saying dstAccessMask should be 0. On the
|
||||
|
@ -92,8 +92,8 @@ namespace dawn_native { namespace vulkan {
|
|||
}
|
||||
|
||||
// Chooses which Vulkan image layout should be used for the given Dawn usage
|
||||
VkImageLayout VulkanImageLayout(dawn::TextureUsageBit usage, const Format& format) {
|
||||
if (usage == dawn::TextureUsageBit::None) {
|
||||
VkImageLayout VulkanImageLayout(dawn::TextureUsage usage, const Format& format) {
|
||||
if (usage == dawn::TextureUsage::None) {
|
||||
return VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
}
|
||||
|
||||
|
@ -103,27 +103,27 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
// Usage has a single bit so we can switch on its value directly.
|
||||
switch (usage) {
|
||||
case dawn::TextureUsageBit::CopyDst:
|
||||
case dawn::TextureUsage::CopyDst:
|
||||
return VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||
case dawn::TextureUsageBit::Sampled:
|
||||
case dawn::TextureUsage::Sampled:
|
||||
return VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
// Vulkan texture copy functions require the image to be in _one_ known layout.
|
||||
// Depending on whether parts of the texture have been transitioned to only
|
||||
// CopySrc or a combination with something else, the texture could be in a
|
||||
// combination of GENERAL and TRANSFER_SRC_OPTIMAL. This would be a problem, so we
|
||||
// make CopySrc use GENERAL.
|
||||
case dawn::TextureUsageBit::CopySrc:
|
||||
case dawn::TextureUsage::CopySrc:
|
||||
// Writable storage textures must use general. If we could know the texture is read
|
||||
// only we could use SHADER_READ_ONLY_OPTIMAL
|
||||
case dawn::TextureUsageBit::Storage:
|
||||
case dawn::TextureUsage::Storage:
|
||||
return VK_IMAGE_LAYOUT_GENERAL;
|
||||
case dawn::TextureUsageBit::OutputAttachment:
|
||||
case dawn::TextureUsage::OutputAttachment:
|
||||
if (format.HasDepthOrStencil()) {
|
||||
return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
} else {
|
||||
return VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
}
|
||||
case dawn::TextureUsageBit::Present:
|
||||
case dawn::TextureUsage::Present:
|
||||
return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -131,24 +131,23 @@ namespace dawn_native { namespace vulkan {
|
|||
}
|
||||
|
||||
// Computes which Vulkan pipeline stage can access a texture in the given Dawn usage
|
||||
VkPipelineStageFlags VulkanPipelineStage(dawn::TextureUsageBit usage,
|
||||
const Format& format) {
|
||||
VkPipelineStageFlags VulkanPipelineStage(dawn::TextureUsage usage, const Format& format) {
|
||||
VkPipelineStageFlags flags = 0;
|
||||
|
||||
if (usage == dawn::TextureUsageBit::None) {
|
||||
if (usage == dawn::TextureUsage::None) {
|
||||
// This only happens when a texture is initially created (and for srcAccessMask) in
|
||||
// which case there is no need to wait on anything to stop accessing this texture.
|
||||
return VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
|
||||
}
|
||||
if (usage & (dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst)) {
|
||||
if (usage & (dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst)) {
|
||||
flags |= VK_PIPELINE_STAGE_TRANSFER_BIT;
|
||||
}
|
||||
if (usage & (dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::Storage)) {
|
||||
if (usage & (dawn::TextureUsage::Sampled | dawn::TextureUsage::Storage)) {
|
||||
flags |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT |
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
|
||||
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::OutputAttachment) {
|
||||
if (usage & dawn::TextureUsage::OutputAttachment) {
|
||||
if (format.HasDepthOrStencil()) {
|
||||
flags |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
|
||||
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
|
||||
|
@ -158,7 +157,7 @@ namespace dawn_native { namespace vulkan {
|
|||
flags |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
||||
}
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::Present) {
|
||||
if (usage & dawn::TextureUsage::Present) {
|
||||
// There is no pipeline stage for present but a pipeline stage is required so we use
|
||||
// "bottom of pipe" to block as little as possible and vkQueuePresentKHR will make
|
||||
// the memory visible to the presentation engine. The spec explicitly mentions that
|
||||
|
@ -333,22 +332,22 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
// Converts the Dawn usage flags to Vulkan usage flags. Also needs the format to choose
|
||||
// between color and depth attachment usages.
|
||||
VkImageUsageFlags VulkanImageUsage(dawn::TextureUsageBit usage, const Format& format) {
|
||||
VkImageUsageFlags VulkanImageUsage(dawn::TextureUsage usage, const Format& format) {
|
||||
VkImageUsageFlags flags = 0;
|
||||
|
||||
if (usage & dawn::TextureUsageBit::CopySrc) {
|
||||
if (usage & dawn::TextureUsage::CopySrc) {
|
||||
flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::CopyDst) {
|
||||
if (usage & dawn::TextureUsage::CopyDst) {
|
||||
flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::Sampled) {
|
||||
if (usage & dawn::TextureUsage::Sampled) {
|
||||
flags |= VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::Storage) {
|
||||
if (usage & dawn::TextureUsage::Storage) {
|
||||
flags |= VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
}
|
||||
if (usage & dawn::TextureUsageBit::OutputAttachment) {
|
||||
if (usage & dawn::TextureUsage::OutputAttachment) {
|
||||
if (format.HasDepthOrStencil()) {
|
||||
flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||
} else {
|
||||
|
@ -527,7 +526,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
// Release the texture
|
||||
mExternalState = ExternalState::PendingRelease;
|
||||
TransitionUsageNow(device->GetPendingRecordingContext(), dawn::TextureUsageBit::None);
|
||||
TransitionUsageNow(device->GetPendingRecordingContext(), dawn::TextureUsage::None);
|
||||
|
||||
// Queue submit to signal we are done with the texture
|
||||
device->GetPendingRecordingContext()->signalSemaphores.push_back(mSignalSemaphore);
|
||||
|
@ -580,7 +579,7 @@ namespace dawn_native { namespace vulkan {
|
|||
}
|
||||
|
||||
void Texture::TransitionUsageNow(CommandRecordingContext* recordingContext,
|
||||
dawn::TextureUsageBit usage) {
|
||||
dawn::TextureUsage usage) {
|
||||
// Avoid encoding barriers when it isn't needed.
|
||||
bool lastReadOnly = (mLastUsage & kReadOnlyTextureUsages) == mLastUsage;
|
||||
if (lastReadOnly && mLastUsage == usage && mLastExternalState == mExternalState) {
|
||||
|
@ -654,7 +653,7 @@ namespace dawn_native { namespace vulkan {
|
|||
range.layerCount = layerCount;
|
||||
uint8_t clearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0 : 1;
|
||||
|
||||
TransitionUsageNow(recordingContext, dawn::TextureUsageBit::CopyDst);
|
||||
TransitionUsageNow(recordingContext, dawn::TextureUsage::CopyDst);
|
||||
if (GetFormat().HasDepthOrStencil()) {
|
||||
VkClearDepthStencilValue clearDepthStencilValue[1];
|
||||
clearDepthStencilValue[0].depth = clearColor;
|
||||
|
@ -679,7 +678,7 @@ namespace dawn_native { namespace vulkan {
|
|||
(GetSize().height / GetFormat().blockHeight) *
|
||||
GetFormat().blockByteSize;
|
||||
descriptor.nextInChain = nullptr;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::MapWrite;
|
||||
descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::MapWrite;
|
||||
std::unique_ptr<Buffer> srcBuffer =
|
||||
std::make_unique<dawn_native::vulkan::Buffer>(device, &descriptor);
|
||||
uint8_t* clearBuffer = nullptr;
|
||||
|
@ -706,7 +705,7 @@ namespace dawn_native { namespace vulkan {
|
|||
ComputeBufferImageCopyRegion(bufferCopy, textureCopy, copySize);
|
||||
|
||||
// copy the clear buffer to the texture image
|
||||
srcBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopySrc);
|
||||
srcBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopySrc);
|
||||
ToBackend(GetDevice())
|
||||
->fn.CmdCopyBufferToImage(recordingContext->commandBuffer, srcBuffer->GetHandle(),
|
||||
GetHandle(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1,
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace dawn_native { namespace vulkan {
|
|||
struct ExternalImageDescriptor;
|
||||
|
||||
VkFormat VulkanImageFormat(dawn::TextureFormat format);
|
||||
VkImageUsageFlags VulkanImageUsage(dawn::TextureUsageBit usage, const Format& format);
|
||||
VkImageUsageFlags VulkanImageUsage(dawn::TextureUsage usage, const Format& format);
|
||||
VkSampleCountFlagBits VulkanSampleCount(uint32_t sampleCount);
|
||||
|
||||
MaybeError ValidateVulkanImageCanBeWrapped(const DeviceBase* device,
|
||||
|
@ -60,7 +60,7 @@ namespace dawn_native { namespace vulkan {
|
|||
// `commands`.
|
||||
// TODO(cwallez@chromium.org): coalesce barriers and do them early when possible.
|
||||
void TransitionUsageNow(CommandRecordingContext* recordingContext,
|
||||
dawn::TextureUsageBit usage);
|
||||
dawn::TextureUsage usage);
|
||||
void EnsureSubresourceContentInitialized(CommandRecordingContext* recordingContext,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t levelCount,
|
||||
|
@ -89,7 +89,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
// A usage of none will make sure the texture is transitioned before its first use as
|
||||
// required by the spec.
|
||||
dawn::TextureUsageBit mLastUsage = dawn::TextureUsageBit::None;
|
||||
dawn::TextureUsage mLastUsage = dawn::TextureUsage::None;
|
||||
};
|
||||
|
||||
class TextureView : public TextureViewBase {
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace dawn_native { namespace vulkan {
|
|||
|
||||
DawnSwapChainImplementation impl;
|
||||
impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, surface));
|
||||
impl.textureUsage = DAWN_TEXTURE_USAGE_BIT_PRESENT;
|
||||
impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
|
||||
|
||||
return impl;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ typedef struct {
|
|||
/// Configure/reconfigure the swap chain.
|
||||
DawnSwapChainError (*Configure)(void* userData,
|
||||
DawnTextureFormat format,
|
||||
DawnTextureUsageBit allowedUsage,
|
||||
DawnTextureUsage allowedUsage,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
|
||||
|
@ -55,7 +55,7 @@ typedef struct {
|
|||
void* userData;
|
||||
|
||||
/// For use by the D3D12 and Vulkan backends: how the swapchain will use the texture.
|
||||
DawnTextureUsageBit textureUsage;
|
||||
DawnTextureUsage textureUsage;
|
||||
} DawnSwapChainImplementation;
|
||||
|
||||
#if defined(DAWN_ENABLE_BACKEND_D3D12) && defined(__cplusplus)
|
||||
|
|
|
@ -587,7 +587,7 @@ DawnTest::ReadbackReservation DawnTest::ReserveReadback(uint64_t readbackSize) {
|
|||
// TODO(cwallez@chromium.org): eventually make bigger buffers and allocate linearly?
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = readbackSize;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
|
||||
|
||||
ReadbackSlot slot;
|
||||
slot.bufferSize = readbackSize;
|
||||
|
|
|
@ -24,7 +24,7 @@ class BasicTests : public DawnTest {
|
|||
TEST_P(BasicTests, BufferSetSubData) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
uint32_t value = 0x01020304;
|
||||
|
@ -38,7 +38,7 @@ TEST_P(BasicTests, BufferSetSubData) {
|
|||
TEST_P(BasicTests, BufferSetSubDataError) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
uint8_t value = 187;
|
||||
|
|
|
@ -79,7 +79,7 @@ TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) {
|
|||
|
||||
dawn::BufferDescriptor bufferDesc;
|
||||
bufferDesc.size = sizeof(float);
|
||||
bufferDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Uniform;
|
||||
bufferDesc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::Uniform;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&bufferDesc);
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(device, bgl, {{0, buffer, 0, sizeof(float)}});
|
||||
|
||||
|
@ -148,7 +148,8 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
|||
{ 0 },
|
||||
{ 0.f, 1.f, 0.f, 1.f },
|
||||
};
|
||||
dawn::Buffer buffer = utils::CreateBufferFromData(device, &data, sizeof(data), dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer buffer =
|
||||
utils::CreateBufferFromData(device, &data, sizeof(data), dawn::BufferUsage::Uniform);
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(device, bgl, {
|
||||
{0, buffer, 0, sizeof(Data::transform)},
|
||||
{1, buffer, 256, sizeof(Data::color)}
|
||||
|
@ -222,7 +223,8 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||
|
||||
constexpr float dummy = 0.0f;
|
||||
constexpr float transform[] = { 1.f, 0.f, dummy, dummy, 0.f, 1.f, dummy, dummy };
|
||||
dawn::Buffer buffer = utils::CreateBufferFromData(device, &transform, sizeof(transform), dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer buffer = utils::CreateBufferFromData(device, &transform, sizeof(transform),
|
||||
dawn::BufferUsage::Uniform);
|
||||
|
||||
dawn::SamplerDescriptor samplerDescriptor;
|
||||
samplerDescriptor.minFilter = dawn::FilterMode::Nearest;
|
||||
|
@ -246,7 +248,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled;
|
||||
descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
dawn::TextureView textureView = texture.CreateDefaultView();
|
||||
|
||||
|
@ -259,8 +261,8 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||
for (int i = 0; i < size; i++) {
|
||||
data[i] = RGBA8(0, 255, 0, 255);
|
||||
}
|
||||
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), sizeInBytes,
|
||||
dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer stagingBuffer =
|
||||
utils::CreateBufferFromData(device, data.data(), sizeInBytes, dawn::BufferUsage::CopySrc);
|
||||
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(device, bgl, {
|
||||
{0, buffer, 0, sizeof(transform)},
|
||||
|
@ -360,8 +362,8 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
|||
{{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}, {0}, {1.0f, 0.0f, 0.0f, 1.0f}});
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
dawn::Buffer buffer = utils::CreateBufferFromData(device, &data[i], sizeof(Data),
|
||||
dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer buffer =
|
||||
utils::CreateBufferFromData(device, &data[i], sizeof(Data), dawn::BufferUsage::Uniform);
|
||||
buffers.push_back(buffer);
|
||||
bindGroups.push_back(utils::MakeBindGroup(device, layout,
|
||||
{{0, buffers[i], 0, sizeof(Data::transform)},
|
||||
|
@ -441,8 +443,8 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets)
|
|||
pass.SetPipeline(pipeline);
|
||||
|
||||
std::array<float, 4> color = { 0.25, 0, 0, 0.25 };
|
||||
dawn::Buffer uniformBuffer = utils::CreateBufferFromData(
|
||||
device, &color, sizeof(color), dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer uniformBuffer =
|
||||
utils::CreateBufferFromData(device, &color, sizeof(color), dawn::BufferUsage::Uniform);
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(
|
||||
device, layout, { { 0, uniformBuffer, 0, sizeof(color) } });
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class BufferMapReadTests : public DawnTest {
|
|||
TEST_P(BufferMapReadTests, SmallReadAtZero) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
uint32_t myData = 0x01020304;
|
||||
|
@ -68,7 +68,7 @@ TEST_P(BufferMapReadTests, LargeRead) {
|
|||
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = static_cast<uint32_t>(kDataSize * sizeof(uint32_t));
|
||||
descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
buffer.SetSubData(0, kDataSize * sizeof(uint32_t), myData.data());
|
||||
|
@ -115,7 +115,7 @@ class BufferMapWriteTests : public DawnTest {
|
|||
TEST_P(BufferMapWriteTests, SmallWriteAtZero) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
uint32_t myData = 2934875;
|
||||
|
@ -136,7 +136,7 @@ TEST_P(BufferMapWriteTests, LargeWrite) {
|
|||
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = static_cast<uint32_t>(kDataSize * sizeof(uint32_t));
|
||||
descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
void* mappedData = MapWriteAsyncAndWait(buffer);
|
||||
|
@ -160,7 +160,7 @@ TEST_P(BufferMapWriteTests, ManyWrites) {
|
|||
for (uint32_t i = 0; i < kBuffers; ++i) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = static_cast<uint32_t>(kDataSize * sizeof(uint32_t));
|
||||
descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
void* mappedData = MapWriteAsyncAndWait(buffer);
|
||||
|
@ -184,7 +184,7 @@ class BufferSetSubDataTests : public DawnTest {
|
|||
TEST_P(BufferSetSubDataTests, SmallDataAtZero) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
uint32_t value = 0x01020304;
|
||||
|
@ -197,7 +197,7 @@ TEST_P(BufferSetSubDataTests, SmallDataAtZero) {
|
|||
TEST_P(BufferSetSubDataTests, SmallDataAtOffset) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4000;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
constexpr uint64_t kOffset = 2000;
|
||||
|
@ -222,7 +222,7 @@ TEST_P(BufferSetSubDataTests, ManySetSubData) {
|
|||
constexpr uint32_t kElements = 500 * 500;
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = kSize;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
std::vector<uint32_t> expectedData;
|
||||
|
@ -240,7 +240,7 @@ TEST_P(BufferSetSubDataTests, LargeSetSubData) {
|
|||
constexpr uint32_t kElements = 1000 * 1000;
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = kSize;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
std::vector<uint32_t> expectedData;
|
||||
|
@ -290,7 +290,7 @@ class CreateBufferMappedTests : public DawnTest {
|
|||
}
|
||||
}
|
||||
|
||||
dawn::CreateBufferMappedResult CreateBufferMapped(dawn::BufferUsageBit usage, uint64_t size) {
|
||||
dawn::CreateBufferMappedResult CreateBufferMapped(dawn::BufferUsage usage, uint64_t size) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.nextInChain = nullptr;
|
||||
descriptor.size = size;
|
||||
|
@ -301,7 +301,7 @@ class CreateBufferMappedTests : public DawnTest {
|
|||
return result;
|
||||
}
|
||||
|
||||
dawn::CreateBufferMappedResult CreateBufferMappedWithData(dawn::BufferUsageBit usage,
|
||||
dawn::CreateBufferMappedResult CreateBufferMappedWithData(dawn::BufferUsage usage,
|
||||
const std::vector<uint32_t>& data) {
|
||||
size_t byteLength = data.size() * sizeof(uint32_t);
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMapped(usage, byteLength);
|
||||
|
@ -311,7 +311,7 @@ class CreateBufferMappedTests : public DawnTest {
|
|||
}
|
||||
|
||||
template <DawnBufferMapAsyncStatus expectedStatus = DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS>
|
||||
dawn::CreateBufferMappedResult CreateBufferMappedAsyncAndWait(dawn::BufferUsageBit usage,
|
||||
dawn::CreateBufferMappedResult CreateBufferMappedAsyncAndWait(dawn::BufferUsage usage,
|
||||
uint64_t size) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.nextInChain = nullptr;
|
||||
|
@ -346,7 +346,7 @@ class CreateBufferMappedTests : public DawnTest {
|
|||
}
|
||||
|
||||
dawn::CreateBufferMappedResult CreateBufferMappedAsyncWithDataAndWait(
|
||||
dawn::BufferUsageBit usage,
|
||||
dawn::BufferUsage usage,
|
||||
const std::vector<uint32_t>& data) {
|
||||
size_t byteLength = data.size() * sizeof(uint32_t);
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncAndWait(usage, byteLength);
|
||||
|
@ -363,7 +363,7 @@ class CreateBufferMappedTests : public DawnTest {
|
|||
TEST_P(CreateBufferMappedTests, MapWriteUsageSmall) {
|
||||
uint32_t myData = 230502;
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMappedWithData(
|
||||
dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
|
||||
dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
|
||||
result.buffer.Unmap();
|
||||
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ TEST_P(CreateBufferMappedTests, MapWriteUsageSmall) {
|
|||
TEST_P(CreateBufferMappedTests, MapReadUsageSmall) {
|
||||
uint32_t myData = 230502;
|
||||
dawn::CreateBufferMappedResult result =
|
||||
CreateBufferMappedWithData(dawn::BufferUsageBit::MapRead, {myData});
|
||||
CreateBufferMappedWithData(dawn::BufferUsage::MapRead, {myData});
|
||||
result.buffer.Unmap();
|
||||
|
||||
const void* mappedData = MapReadAsyncAndWait(result.buffer);
|
||||
|
@ -384,7 +384,7 @@ TEST_P(CreateBufferMappedTests, MapReadUsageSmall) {
|
|||
TEST_P(CreateBufferMappedTests, NonMappableUsageSmall) {
|
||||
uint32_t myData = 4239;
|
||||
dawn::CreateBufferMappedResult result =
|
||||
CreateBufferMappedWithData(dawn::BufferUsageBit::CopySrc, {myData});
|
||||
CreateBufferMappedWithData(dawn::BufferUsage::CopySrc, {myData});
|
||||
result.buffer.Unmap();
|
||||
|
||||
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
|
||||
|
@ -399,7 +399,7 @@ TEST_P(CreateBufferMappedTests, MapWriteUsageLarge) {
|
|||
}
|
||||
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMappedWithData(
|
||||
dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
|
||||
dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
|
||||
result.buffer.Unmap();
|
||||
|
||||
EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize);
|
||||
|
@ -414,7 +414,7 @@ TEST_P(CreateBufferMappedTests, MapReadUsageLarge) {
|
|||
}
|
||||
|
||||
dawn::CreateBufferMappedResult result =
|
||||
CreateBufferMappedWithData(dawn::BufferUsageBit::MapRead, myData);
|
||||
CreateBufferMappedWithData(dawn::BufferUsage::MapRead, myData);
|
||||
result.buffer.Unmap();
|
||||
|
||||
const void* mappedData = MapReadAsyncAndWait(result.buffer);
|
||||
|
@ -431,7 +431,7 @@ TEST_P(CreateBufferMappedTests, NonMappableUsageLarge) {
|
|||
}
|
||||
|
||||
dawn::CreateBufferMappedResult result =
|
||||
CreateBufferMappedWithData(dawn::BufferUsageBit::CopySrc, {myData});
|
||||
CreateBufferMappedWithData(dawn::BufferUsage::CopySrc, {myData});
|
||||
result.buffer.Unmap();
|
||||
|
||||
EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize);
|
||||
|
@ -442,7 +442,7 @@ TEST_P(CreateBufferMappedTests, CreateThenMapSuccess) {
|
|||
static uint32_t myData = 230502;
|
||||
static uint32_t myData2 = 1337;
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMappedWithData(
|
||||
dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
|
||||
dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
|
||||
result.buffer.Unmap();
|
||||
|
||||
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
|
||||
|
@ -470,7 +470,7 @@ TEST_P(CreateBufferMappedTests, CreateThenMapSuccess) {
|
|||
TEST_P(CreateBufferMappedTests, CreateThenMapBeforeUnmapFailure) {
|
||||
uint32_t myData = 230502;
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMappedWithData(
|
||||
dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
|
||||
dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
|
||||
|
||||
ASSERT_DEVICE_ERROR([&]() {
|
||||
bool done = false;
|
||||
|
@ -497,7 +497,7 @@ TEST_P(CreateBufferMappedTests, CreateThenMapBeforeUnmapFailure) {
|
|||
TEST_P(CreateBufferMappedTests, MapWriteUsageSmallAsync) {
|
||||
uint32_t myData = 230502;
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait(
|
||||
dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
|
||||
dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
|
||||
result.buffer.Unmap();
|
||||
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ TEST_P(CreateBufferMappedTests, MapWriteUsageSmallAsync) {
|
|||
TEST_P(CreateBufferMappedTests, MapReadUsageSmallAsync) {
|
||||
uint32_t myData = 230502;
|
||||
dawn::CreateBufferMappedResult result =
|
||||
CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::MapRead, {myData});
|
||||
CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsage::MapRead, {myData});
|
||||
result.buffer.Unmap();
|
||||
|
||||
const void* mappedData = MapReadAsyncAndWait(result.buffer);
|
||||
|
@ -518,7 +518,7 @@ TEST_P(CreateBufferMappedTests, MapReadUsageSmallAsync) {
|
|||
TEST_P(CreateBufferMappedTests, NonMappableUsageSmallAsync) {
|
||||
uint32_t myData = 4239;
|
||||
dawn::CreateBufferMappedResult result =
|
||||
CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::CopySrc, {myData});
|
||||
CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsage::CopySrc, {myData});
|
||||
result.buffer.Unmap();
|
||||
|
||||
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
|
||||
|
@ -533,7 +533,7 @@ TEST_P(CreateBufferMappedTests, MapWriteUsageLargeAsync) {
|
|||
}
|
||||
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait(
|
||||
dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
|
||||
dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
|
||||
result.buffer.Unmap();
|
||||
|
||||
EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize);
|
||||
|
@ -548,7 +548,7 @@ TEST_P(CreateBufferMappedTests, MapReadUsageLargeAsync) {
|
|||
}
|
||||
|
||||
dawn::CreateBufferMappedResult result =
|
||||
CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::MapRead, {myData});
|
||||
CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsage::MapRead, {myData});
|
||||
result.buffer.Unmap();
|
||||
|
||||
const void* mappedData = MapReadAsyncAndWait(result.buffer);
|
||||
|
@ -565,7 +565,7 @@ TEST_P(CreateBufferMappedTests, NonMappableUsageLargeAsync) {
|
|||
}
|
||||
|
||||
dawn::CreateBufferMappedResult result =
|
||||
CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::CopySrc, {myData});
|
||||
CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsage::CopySrc, {myData});
|
||||
result.buffer.Unmap();
|
||||
|
||||
EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize);
|
||||
|
@ -576,7 +576,7 @@ TEST_P(CreateBufferMappedTests, CreateThenMapSuccessAsync) {
|
|||
static uint32_t myData = 230502;
|
||||
static uint32_t myData2 = 1337;
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait(
|
||||
dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
|
||||
dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
|
||||
result.buffer.Unmap();
|
||||
|
||||
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
|
||||
|
@ -604,7 +604,7 @@ TEST_P(CreateBufferMappedTests, CreateThenMapSuccessAsync) {
|
|||
TEST_P(CreateBufferMappedTests, CreateThenMapBeforeUnmapFailureAsync) {
|
||||
uint32_t myData = 230502;
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait(
|
||||
dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
|
||||
dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
|
||||
|
||||
ASSERT_DEVICE_ERROR([&]() {
|
||||
bool done = false;
|
||||
|
|
|
@ -59,7 +59,7 @@ class ClipSpaceTest : public DawnTest {
|
|||
textureDescriptor.dimension = dawn::TextureDimension::e2D;
|
||||
textureDescriptor.format = format;
|
||||
textureDescriptor.usage =
|
||||
dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
textureDescriptor.arrayLayerCount = 1;
|
||||
textureDescriptor.mipLevelCount = 1;
|
||||
textureDescriptor.sampleCount = 1;
|
||||
|
|
|
@ -101,7 +101,7 @@ class ColorStateTest : public DawnTest {
|
|||
uint32_t bufferSize = static_cast<uint32_t>(4 * N * sizeof(float));
|
||||
|
||||
dawn::Buffer buffer =
|
||||
utils::CreateBufferFromData(device, &data, bufferSize, dawn::BufferUsageBit::Uniform);
|
||||
utils::CreateBufferFromData(device, &data, bufferSize, dawn::BufferUsage::Uniform);
|
||||
return utils::MakeBindGroup(device, bindGroupLayout, {{0, buffer, 0, bufferSize}});
|
||||
}
|
||||
|
||||
|
@ -762,7 +762,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
|
||||
for (uint32_t i = 0; i < 4; ++i) {
|
||||
renderTargets[i] = device.CreateTexture(&descriptor);
|
||||
|
|
|
@ -93,7 +93,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
|||
|
||||
// Copy texture data from a staging buffer to the destination texture.
|
||||
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, uploadData.data(), uploadBufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
device, uploadData.data(), uploadBufferSize, dawn::BufferUsage::CopySrc);
|
||||
dawn::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, copyConfig.bufferOffset,
|
||||
copyConfig.rowPitchAlignment, copyConfig.imageHeight);
|
||||
|
@ -449,8 +449,8 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
|||
static constexpr uint32_t kBCBlockWidthInTexels = 4;
|
||||
static constexpr uint32_t kBCBlockHeightInTexels = 4;
|
||||
|
||||
static constexpr dawn::TextureUsageBit kDefaultBCFormatTextureUsage =
|
||||
dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::CopyDst;
|
||||
static constexpr dawn::TextureUsage kDefaultBCFormatTextureUsage =
|
||||
dawn::TextureUsage::Sampled | dawn::TextureUsage::CopyDst;
|
||||
|
||||
dawn::BindGroupLayout mBindGroupLayout;
|
||||
|
||||
|
@ -633,9 +633,8 @@ TEST_P(CompressedTextureBCFormatTest, CopyWholeTextureSubResourceIntoNonZeroMipm
|
|||
config.textureDescriptor.format = format;
|
||||
// Add the usage bit for both source and destination textures so that we don't need to
|
||||
// create two copy configs.
|
||||
config.textureDescriptor.usage = dawn::TextureUsageBit::CopySrc |
|
||||
dawn::TextureUsageBit::CopyDst |
|
||||
dawn::TextureUsageBit::Sampled;
|
||||
config.textureDescriptor.usage =
|
||||
dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
|
||||
|
||||
dawn::Texture bcTextureSrc = CreateTextureWithCompressedData(config);
|
||||
|
||||
|
@ -695,7 +694,7 @@ TEST_P(CompressedTextureBCFormatTest, CopyIntoSubresourceWithPhysicalSizeNotEqua
|
|||
// compressed data.
|
||||
srcConfig.textureDescriptor.format = format;
|
||||
srcConfig.textureDescriptor.usage =
|
||||
dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
|
||||
dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
|
||||
dawn::Texture bcTextureSrc = CreateTextureWithCompressedData(srcConfig);
|
||||
dawn::TextureCopyView textureCopyViewSrc =
|
||||
utils::CreateTextureCopyView(bcTextureSrc, srcConfig.viewMipmapLevel,
|
||||
|
@ -755,7 +754,7 @@ TEST_P(CompressedTextureBCFormatTest, CopyFromSubresourceWithPhysicalSizeNotEqua
|
|||
for (dawn::TextureFormat format : kBCFormats) {
|
||||
srcConfig.textureDescriptor.format = dstConfig.textureDescriptor.format = format;
|
||||
srcConfig.textureDescriptor.usage =
|
||||
dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
|
||||
dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
|
||||
dstConfig.textureDescriptor.usage = kDefaultBCFormatTextureUsage;
|
||||
|
||||
// Create bcTextureSrc as the source texture and initialize it with pre-prepared BC
|
||||
|
@ -828,7 +827,7 @@ TEST_P(CompressedTextureBCFormatTest, MultipleCopiesWithPhysicalSizeNotEqualToVi
|
|||
srcConfigs[i].textureDescriptor.format = dstConfigs[i].textureDescriptor.format =
|
||||
format;
|
||||
srcConfigs[i].textureDescriptor.usage =
|
||||
dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
|
||||
dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
|
||||
dstConfigs[i].textureDescriptor.usage = kDefaultBCFormatTextureUsage;
|
||||
|
||||
// Create bcSrcTextures as the source textures and initialize them with pre-prepared BC
|
||||
|
|
|
@ -51,8 +51,8 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
|
|||
// Set up src storage buffer
|
||||
dawn::BufferDescriptor srcDesc;
|
||||
srcDesc.size = kNumUints * sizeof(uint32_t);
|
||||
srcDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::CopySrc |
|
||||
dawn::BufferUsageBit::CopyDst;
|
||||
srcDesc.usage =
|
||||
dawn::BufferUsage::Storage | dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer src = device.CreateBuffer(&srcDesc);
|
||||
|
||||
std::array<uint32_t, kNumUints> expected;
|
||||
|
@ -65,8 +65,8 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
|
|||
// Set up dst storage buffer
|
||||
dawn::BufferDescriptor dstDesc;
|
||||
dstDesc.size = kNumUints * sizeof(uint32_t);
|
||||
dstDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::CopySrc |
|
||||
dawn::BufferUsageBit::CopyDst;
|
||||
dstDesc.usage =
|
||||
dawn::BufferUsage::Storage | dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer dst = device.CreateBuffer(&dstDesc);
|
||||
|
||||
std::array<uint32_t, kNumUints> zero{};
|
||||
|
|
|
@ -67,20 +67,19 @@ void ComputeIndirectTests::BasicTest(std::initializer_list<uint32_t> bufferList,
|
|||
dawn::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc);
|
||||
|
||||
// Set up dst storage buffer to contain dispatch x, y, z
|
||||
dawn::Buffer dst = utils::CreateBufferFromData<uint32_t>(device,
|
||||
dawn::BufferUsageBit::Storage |
|
||||
dawn::BufferUsageBit::CopySrc |
|
||||
dawn::BufferUsageBit::CopyDst,
|
||||
dawn::Buffer dst = utils::CreateBufferFromData<uint32_t>(
|
||||
device,
|
||||
dawn::BufferUsage::Storage | dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst,
|
||||
{0, 0, 0});
|
||||
|
||||
std::vector<uint32_t> indirectBufferData = bufferList;
|
||||
|
||||
dawn::Buffer indirectBuffer =
|
||||
utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsageBit::Indirect, bufferList);
|
||||
utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Indirect, bufferList);
|
||||
|
||||
dawn::Buffer expectedBuffer =
|
||||
utils::CreateBufferFromData(device, &indirectBufferData[indirectOffset / sizeof(uint32_t)],
|
||||
3 * sizeof(uint32_t), dawn::BufferUsageBit::Uniform);
|
||||
3 * sizeof(uint32_t), dawn::BufferUsage::Uniform);
|
||||
|
||||
// Set up bind group and issue dispatch
|
||||
dawn::BindGroup bindGroup =
|
||||
|
|
|
@ -48,8 +48,8 @@ void ComputeSharedMemoryTests::BasicTest(const char* shader) {
|
|||
// Set up dst storage buffer
|
||||
dawn::BufferDescriptor dstDesc;
|
||||
dstDesc.size = sizeof(uint32_t);
|
||||
dstDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::CopySrc |
|
||||
dawn::BufferUsageBit::CopyDst;
|
||||
dstDesc.usage =
|
||||
dawn::BufferUsage::Storage | dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer dst = device.CreateBuffer(&dstDesc);
|
||||
|
||||
const uint32_t zero = 0;
|
||||
|
|
|
@ -85,7 +85,7 @@ class CopyTests_T2B : public CopyTests {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = textureSpec.level + 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::CopySrc;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
uint32_t width = textureSpec.width >> textureSpec.level;
|
||||
|
@ -106,7 +106,7 @@ class CopyTests_T2B : public CopyTests {
|
|||
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(
|
||||
device, textureArrayData[slice].data(),
|
||||
static_cast<uint32_t>(sizeof(RGBA8) * textureArrayData[slice].size()),
|
||||
dawn::BufferUsageBit::CopySrc);
|
||||
dawn::BufferUsage::CopySrc);
|
||||
dawn::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
|
@ -120,7 +120,7 @@ class CopyTests_T2B : public CopyTests {
|
|||
// and helps ensure that the padding due to the row pitch is not modified by the copy
|
||||
dawn::BufferDescriptor bufDescriptor;
|
||||
bufDescriptor.size = bufferSpec.size * textureSpec.arraySize;
|
||||
bufDescriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
bufDescriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&bufDescriptor);
|
||||
std::vector<RGBA8> emptyData(bufferSpec.size / kBytesPerTexel * textureSpec.arraySize);
|
||||
buffer.SetSubData(0, static_cast<uint32_t>(emptyData.size() * sizeof(RGBA8)),
|
||||
|
@ -182,7 +182,7 @@ protected:
|
|||
// Create a buffer of size `size` and populate it with data
|
||||
dawn::BufferDescriptor bufDescriptor;
|
||||
bufDescriptor.size = bufferSpec.size;
|
||||
bufDescriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
bufDescriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&bufDescriptor);
|
||||
|
||||
std::vector<RGBA8> bufferData(bufferSpec.size / kBytesPerTexel);
|
||||
|
@ -200,7 +200,7 @@ protected:
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = textureSpec.level + 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::CopySrc;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -218,7 +218,7 @@ protected:
|
|||
std::vector<RGBA8> emptyData(texelCount);
|
||||
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(
|
||||
device, emptyData.data(), static_cast<uint32_t>(sizeof(RGBA8) * emptyData.size()),
|
||||
dawn::BufferUsageBit::CopySrc);
|
||||
dawn::BufferUsage::CopySrc);
|
||||
dawn::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
|
@ -281,7 +281,7 @@ class CopyTests_T2T : public CopyTests {
|
|||
srcDescriptor.sampleCount = 1;
|
||||
srcDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
srcDescriptor.mipLevelCount = srcSpec.level + 1;
|
||||
srcDescriptor.usage = dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
|
||||
srcDescriptor.usage = dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
|
||||
dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
||||
|
||||
dawn::TextureDescriptor dstDescriptor;
|
||||
|
@ -293,7 +293,7 @@ class CopyTests_T2T : public CopyTests {
|
|||
dstDescriptor.sampleCount = 1;
|
||||
dstDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
dstDescriptor.mipLevelCount = dstSpec.level + 1;
|
||||
dstDescriptor.usage = dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
|
||||
dstDescriptor.usage = dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
|
||||
dawn::Texture dstTexture = device.CreateTexture(&dstDescriptor);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -315,7 +315,7 @@ class CopyTests_T2T : public CopyTests {
|
|||
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(
|
||||
device, textureArrayData[slice].data(),
|
||||
static_cast<uint32_t>(sizeof(RGBA8) * textureArrayData[slice].size()),
|
||||
dawn::BufferUsageBit::CopySrc);
|
||||
dawn::BufferUsage::CopySrc);
|
||||
dawn::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
|
@ -339,7 +339,7 @@ class CopyTests_T2T : public CopyTests {
|
|||
std::vector<RGBA8> emptyData(dstTexelCount);
|
||||
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(
|
||||
device, emptyData.data(), static_cast<uint32_t>(sizeof(RGBA8) * emptyData.size()),
|
||||
dawn::BufferUsageBit::CopySrc);
|
||||
dawn::BufferUsage::CopySrc);
|
||||
dawn::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(uploadBuffer, 0, dstRowPitch, 0);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
|
|
|
@ -63,7 +63,7 @@ class CullingTest : public DawnTest {
|
|||
textureDescriptor.dimension = dawn::TextureDimension::e2D;
|
||||
textureDescriptor.format = format;
|
||||
textureDescriptor.usage =
|
||||
dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
textureDescriptor.arrayLayerCount = 1;
|
||||
textureDescriptor.mipLevelCount = 1;
|
||||
textureDescriptor.sampleCount = 1;
|
||||
|
|
|
@ -35,7 +35,7 @@ class DepthStencilStateTest : public DawnTest {
|
|||
renderTargetDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
renderTargetDescriptor.mipLevelCount = 1;
|
||||
renderTargetDescriptor.usage =
|
||||
dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
renderTarget = device.CreateTexture(&renderTargetDescriptor);
|
||||
|
||||
renderTargetView = renderTarget.CreateDefaultView();
|
||||
|
@ -49,7 +49,7 @@ class DepthStencilStateTest : public DawnTest {
|
|||
depthDescriptor.sampleCount = 1;
|
||||
depthDescriptor.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
depthDescriptor.mipLevelCount = 1;
|
||||
depthDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
depthDescriptor.usage = dawn::TextureUsage::OutputAttachment;
|
||||
depthTexture = device.CreateTexture(&depthDescriptor);
|
||||
|
||||
depthTextureView = depthTexture.CreateDefaultView();
|
||||
|
@ -265,7 +265,8 @@ class DepthStencilStateTest : public DawnTest {
|
|||
test.depth,
|
||||
};
|
||||
// Upload a buffer for each triangle's depth and color data
|
||||
dawn::Buffer buffer = utils::CreateBufferFromData(device, &data, sizeof(TriangleData), dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer buffer = utils::CreateBufferFromData(
|
||||
device, &data, sizeof(TriangleData), dawn::BufferUsage::Uniform);
|
||||
|
||||
// Create a bind group for the data
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(device, bindGroupLayout, {{0, buffer, 0, sizeof(TriangleData)}});
|
||||
|
|
|
@ -55,7 +55,7 @@ class DestroyTest : public DawnTest {
|
|||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsageBit::Vertex,
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{// The bottom left triangle
|
||||
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f});
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class DrawIndexedIndirectTest : public DawnTest {
|
|||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsageBit::Vertex,
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{// First quad: the first 3 vertices represent the bottom left triangle
|
||||
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f,
|
||||
0.0f, 1.0f,
|
||||
|
@ -64,7 +64,7 @@ class DrawIndexedIndirectTest : public DawnTest {
|
|||
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 1.0f,
|
||||
0.0f, 1.0f});
|
||||
indexBuffer = utils::CreateBufferFromData<uint32_t>(
|
||||
device, dawn::BufferUsageBit::Index,
|
||||
device, dawn::BufferUsage::Index,
|
||||
{0, 1, 2, 0, 3, 1,
|
||||
// The indices below are added to test negatve baseVertex
|
||||
0 + 4, 1 + 4, 2 + 4, 0 + 4, 3 + 4, 1 + 4});
|
||||
|
@ -80,8 +80,8 @@ class DrawIndexedIndirectTest : public DawnTest {
|
|||
uint64_t indirectOffset,
|
||||
RGBA8 bottomLeftExpected,
|
||||
RGBA8 topRightExpected) {
|
||||
dawn::Buffer indirectBuffer = utils::CreateBufferFromData<uint32_t>(
|
||||
device, dawn::BufferUsageBit::Indirect, bufferList);
|
||||
dawn::Buffer indirectBuffer =
|
||||
utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Indirect, bufferList);
|
||||
|
||||
uint64_t zeroOffset = 0;
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
|
|
@ -54,21 +54,17 @@ class DrawIndexedTest : public DawnTest {
|
|||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
|
||||
// First quad: the first 3 vertices represent the bottom left triangle
|
||||
-1.0f, -1.0f, 0.0f, 1.0f,
|
||||
1.0f, 1.0f, 0.0f, 1.0f,
|
||||
-1.0f, 1.0f, 0.0f, 1.0f,
|
||||
1.0f, -1.0f, 0.0f, 1.0f,
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{// First quad: the first 3 vertices represent the bottom left triangle
|
||||
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
|
||||
-1.0f, 0.0f, 1.0f,
|
||||
|
||||
// Second quad: the first 3 vertices represent the top right triangle
|
||||
-1.0f, -1.0f, 0.0f, 1.0f,
|
||||
1.0f, 1.0f, 0.0f, 1.0f,
|
||||
1.0f, -1.0f, 0.0f, 1.0f,
|
||||
-1.0f, 1.0f, 0.0f, 1.0f
|
||||
});
|
||||
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, -1.0f,
|
||||
1.0f, 0.0f, 1.0f});
|
||||
indexBuffer = utils::CreateBufferFromData<uint32_t>(
|
||||
device, dawn::BufferUsageBit::Index,
|
||||
device, dawn::BufferUsage::Index,
|
||||
{0, 1, 2, 0, 3, 1,
|
||||
// The indices below are added to test negatve baseVertex
|
||||
0 + 4, 1 + 4, 2 + 4, 0 + 4, 3 + 4, 1 + 4});
|
||||
|
|
|
@ -55,7 +55,7 @@ class DrawIndirectTest : public DawnTest {
|
|||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsageBit::Vertex,
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{// The bottom left triangle
|
||||
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f,
|
||||
|
||||
|
@ -71,8 +71,8 @@ class DrawIndirectTest : public DawnTest {
|
|||
uint64_t indirectOffset,
|
||||
RGBA8 bottomLeftExpected,
|
||||
RGBA8 topRightExpected) {
|
||||
dawn::Buffer indirectBuffer = utils::CreateBufferFromData<uint32_t>(
|
||||
device, dawn::BufferUsageBit::Indirect, bufferList);
|
||||
dawn::Buffer indirectBuffer =
|
||||
utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Indirect, bufferList);
|
||||
|
||||
uint64_t zeroOffset = 0;
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
|
|
@ -55,7 +55,7 @@ class DrawTest : public DawnTest {
|
|||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsageBit::Vertex,
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{// The bottom left triangle
|
||||
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f,
|
||||
|
||||
|
|
|
@ -34,20 +34,19 @@ class DynamicBufferOffsetTests : public DawnTest {
|
|||
uniformData[1] = 2;
|
||||
|
||||
mUniformBuffers[0] = utils::CreateBufferFromData(device, uniformData.data(), kBufferSize,
|
||||
dawn::BufferUsageBit::Uniform);
|
||||
dawn::BufferUsage::Uniform);
|
||||
|
||||
uniformData[uniformData.size() - 2] = 5;
|
||||
uniformData[uniformData.size() - 1] = 6;
|
||||
|
||||
// Dynamic uniform buffer
|
||||
mUniformBuffers[1] = utils::CreateBufferFromData(device, uniformData.data(), kBufferSize,
|
||||
dawn::BufferUsageBit::Uniform);
|
||||
dawn::BufferUsage::Uniform);
|
||||
|
||||
dawn::BufferDescriptor storageBufferDescriptor;
|
||||
storageBufferDescriptor.size = kBufferSize;
|
||||
storageBufferDescriptor.usage = dawn::BufferUsageBit::Storage |
|
||||
dawn::BufferUsageBit::CopyDst |
|
||||
dawn::BufferUsageBit::CopySrc;
|
||||
storageBufferDescriptor.usage =
|
||||
dawn::BufferUsage::Storage | dawn::BufferUsage::CopyDst | dawn::BufferUsage::CopySrc;
|
||||
|
||||
mStorageBuffers[0] = device.CreateBuffer(&storageBufferDescriptor);
|
||||
|
||||
|
@ -74,7 +73,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
|||
|
||||
// Extra uniform buffer for inheriting test
|
||||
mUniformBuffers[2] = utils::CreateBufferFromData(device, uniformData.data(), kBufferSize,
|
||||
dawn::BufferUsageBit::Uniform);
|
||||
dawn::BufferUsage::Uniform);
|
||||
|
||||
// Bind group layout for inheriting test
|
||||
mBindGroupLayouts[1] = utils::MakeBindGroupLayout(
|
||||
|
|
|
@ -118,7 +118,7 @@ class IOSurfaceValidationTests : public IOSurfaceTestBase {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -248,7 +248,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
|||
textureDescriptor.sampleCount = 1;
|
||||
textureDescriptor.arrayLayerCount = 1;
|
||||
textureDescriptor.mipLevelCount = 1;
|
||||
textureDescriptor.usage = dawn::TextureUsageBit::Sampled;
|
||||
textureDescriptor.usage = dawn::TextureUsage::Sampled;
|
||||
dawn::Texture wrappingTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
|
||||
|
||||
dawn::TextureView textureView = wrappingTexture.CreateDefaultView();
|
||||
|
@ -341,7 +341,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
|||
textureDescriptor.sampleCount = 1;
|
||||
textureDescriptor.arrayLayerCount = 1;
|
||||
textureDescriptor.mipLevelCount = 1;
|
||||
textureDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
textureDescriptor.usage = dawn::TextureUsage::OutputAttachment;
|
||||
dawn::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
|
||||
|
||||
dawn::TextureView ioSurfaceView = ioSurfaceTexture.CreateDefaultView();
|
||||
|
|
|
@ -66,16 +66,13 @@ class IndexFormatTest : public DawnTest {
|
|||
TEST_P(IndexFormatTest, Uint32) {
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint32);
|
||||
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
|
||||
-1.0f, 1.0f, 0.0f, 1.0f, // Note Vertices[0] = Vertices[1]
|
||||
-1.0f, 1.0f, 0.0f, 1.0f,
|
||||
1.0f, 1.0f, 0.0f, 1.0f,
|
||||
-1.0f, -1.0f, 0.0f, 1.0f
|
||||
});
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{-1.0f, 1.0f, 0.0f, 1.0f, // Note Vertices[0] = Vertices[1]
|
||||
-1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f});
|
||||
// If this is interpreted as Uint16, then it would be 0, 1, 0, ... and would draw nothing.
|
||||
dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsageBit::Index, {
|
||||
1, 2, 3
|
||||
});
|
||||
dawn::Buffer indexBuffer =
|
||||
utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Index, {1, 2, 3});
|
||||
|
||||
uint64_t zeroOffset = 0;
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -98,15 +95,12 @@ TEST_P(IndexFormatTest, Uint32) {
|
|||
TEST_P(IndexFormatTest, Uint16) {
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint16);
|
||||
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
|
||||
-1.0f, 1.0f, 0.0f, 1.0f,
|
||||
1.0f, 1.0f, 0.0f, 1.0f,
|
||||
-1.0f, -1.0f, 0.0f, 1.0f
|
||||
});
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{-1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f});
|
||||
// If this is interpreted as uint32, it will have index 1 and 2 be both 0 and render nothing
|
||||
dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint16_t>(device, dawn::BufferUsageBit::Index, {
|
||||
1, 2, 0, 0, 0, 0
|
||||
});
|
||||
dawn::Buffer indexBuffer =
|
||||
utils::CreateBufferFromData<uint16_t>(device, dawn::BufferUsage::Index, {1, 2, 0, 0, 0, 0});
|
||||
|
||||
uint64_t zeroOffset = 0;
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -141,15 +135,22 @@ TEST_P(IndexFormatTest, Uint16) {
|
|||
TEST_P(IndexFormatTest, Uint32PrimitiveRestart) {
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint32);
|
||||
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
|
||||
0.0f, 1.0f, 0.0f, 1.0f,
|
||||
1.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, -1.0f, 0.0f, 1.0f,
|
||||
-1.0f, -1.0f, 0.0f, 1.0f,
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{
|
||||
0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f,
|
||||
});
|
||||
dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsageBit::Index, {
|
||||
0, 1, 2, 0xFFFFFFFFu, 3, 4, 2,
|
||||
dawn::Buffer indexBuffer =
|
||||
utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Index,
|
||||
{
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
0xFFFFFFFFu,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
});
|
||||
|
||||
uint64_t zeroOffset = 0;
|
||||
|
@ -175,15 +176,22 @@ TEST_P(IndexFormatTest, Uint32PrimitiveRestart) {
|
|||
TEST_P(IndexFormatTest, Uint16PrimitiveRestart) {
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint16);
|
||||
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
|
||||
0.0f, 1.0f, 0.0f, 1.0f,
|
||||
1.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
0.0f, -1.0f, 0.0f, 1.0f,
|
||||
-1.0f, -1.0f, 0.0f, 1.0f,
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{
|
||||
0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f,
|
||||
});
|
||||
dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint16_t>(device, dawn::BufferUsageBit::Index, {
|
||||
0, 1, 2, 0xFFFFu, 3, 4, 2,
|
||||
dawn::Buffer indexBuffer =
|
||||
utils::CreateBufferFromData<uint16_t>(device, dawn::BufferUsage::Index,
|
||||
{
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
0xFFFFu,
|
||||
3,
|
||||
4,
|
||||
2,
|
||||
// This value is for padding.
|
||||
0xFFFFu,
|
||||
});
|
||||
|
@ -216,16 +224,13 @@ TEST_P(IndexFormatTest, ChangePipelineAfterSetIndexBuffer) {
|
|||
dawn::RenderPipeline pipeline32 = MakeTestPipeline(dawn::IndexFormat::Uint32);
|
||||
dawn::RenderPipeline pipeline16 = MakeTestPipeline(dawn::IndexFormat::Uint16);
|
||||
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
|
||||
-1.0f, 1.0f, 0.0f, 1.0f, // Note Vertices[0] = Vertices[1]
|
||||
-1.0f, 1.0f, 0.0f, 1.0f,
|
||||
1.0f, 1.0f, 0.0f, 1.0f,
|
||||
-1.0f, -1.0f, 0.0f, 1.0f
|
||||
});
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{-1.0f, 1.0f, 0.0f, 1.0f, // Note Vertices[0] = Vertices[1]
|
||||
-1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f});
|
||||
// If this is interpreted as Uint16, then it would be 0, 1, 0, ... and would draw nothing.
|
||||
dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsageBit::Index, {
|
||||
1, 2, 3
|
||||
});
|
||||
dawn::Buffer indexBuffer =
|
||||
utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Index, {1, 2, 3});
|
||||
|
||||
uint64_t zeroOffset = 0;
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -253,14 +258,11 @@ TEST_P(IndexFormatTest, ChangePipelineAfterSetIndexBuffer) {
|
|||
TEST_P(IndexFormatTest, DISABLED_SetIndexBufferBeforeSetPipeline) {
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint32);
|
||||
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
|
||||
-1.0f, 1.0f, 0.0f, 1.0f,
|
||||
1.0f, 1.0f, 0.0f, 1.0f,
|
||||
-1.0f, -1.0f, 0.0f, 1.0f
|
||||
});
|
||||
dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsageBit::Index, {
|
||||
0, 1, 2
|
||||
});
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{-1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f});
|
||||
dawn::Buffer indexBuffer =
|
||||
utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Index, {0, 1, 2});
|
||||
|
||||
uint64_t zeroOffset = 0;
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
|
|
@ -95,7 +95,7 @@ class MultisampledRenderingTest : public DawnTest {
|
|||
descriptor.sampleCount = sampleCount;
|
||||
descriptor.format = format;
|
||||
descriptor.mipLevelCount = mipLevelCount;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
return device.CreateTexture(&descriptor);
|
||||
}
|
||||
|
||||
|
@ -104,9 +104,8 @@ class MultisampledRenderingTest : public DawnTest {
|
|||
const dawn::RenderPipeline& pipeline,
|
||||
const float* uniformData,
|
||||
uint32_t uniformDataSize) {
|
||||
dawn::Buffer uniformBuffer =
|
||||
utils::CreateBufferFromData(device, uniformData, uniformDataSize,
|
||||
dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer uniformBuffer = utils::CreateBufferFromData(
|
||||
device, uniformData, uniformDataSize, dawn::BufferUsage::Uniform);
|
||||
dawn::BindGroup bindGroup =
|
||||
utils::MakeBindGroup(device, mBindGroupLayout,
|
||||
{{0, uniformBuffer, 0, uniformDataSize}});
|
||||
|
|
|
@ -37,7 +37,7 @@ TEST_P(NonzeroTextureCreationTests, TextureCreationClearsOneBits) {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
RGBA8 filledWithOnes(255, 255, 255, 255);
|
||||
|
@ -57,7 +57,7 @@ TEST_P(NonzeroTextureCreationTests, MipMapClears) {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = mipLevels;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
std::vector<RGBA8> expected;
|
||||
|
@ -82,7 +82,7 @@ TEST_P(NonzeroTextureCreationTests, ArrayLayerClears) {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
std::vector<RGBA8> expected;
|
||||
|
@ -107,14 +107,14 @@ TEST_P(NonzeroTextureCreationTests, NonrenderableTextureFormat) {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Snorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::TextureUsage::CopySrc;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
// Set buffer with dirty data so we know it is cleared by the lazy cleared texture copy
|
||||
uint32_t bufferSize = 4 * kSize * kSize;
|
||||
std::vector<uint8_t> data(bufferSize, 100);
|
||||
dawn::Buffer bufferDst = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::CopySrc);
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::CopySrc);
|
||||
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, 0, 0);
|
||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
|
||||
|
|
|
@ -26,7 +26,7 @@ class OpArrayLengthTest : public DawnTest {
|
|||
// Create buffers of various size to check the length() implementation
|
||||
dawn::BufferDescriptor bufferDesc;
|
||||
bufferDesc.size = 4;
|
||||
bufferDesc.usage = dawn::BufferUsageBit::Storage;
|
||||
bufferDesc.usage = dawn::BufferUsage::Storage;
|
||||
mStorageBuffer4 = device.CreateBuffer(&bufferDesc);
|
||||
|
||||
bufferDesc.size = 256;
|
||||
|
@ -95,7 +95,7 @@ TEST_P(OpArrayLengthTest, Compute) {
|
|||
|
||||
// Create a buffer to hold the result sizes and create a bindgroup for it.
|
||||
dawn::BufferDescriptor bufferDesc;
|
||||
bufferDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::CopySrc;
|
||||
bufferDesc.usage = dawn::BufferUsage::Storage | dawn::BufferUsage::CopySrc;
|
||||
bufferDesc.size = sizeof(uint32_t) * mExpectedLengths.size();
|
||||
dawn::Buffer resultBuffer = device.CreateBuffer(&bufferDesc);
|
||||
|
||||
|
|
|
@ -165,7 +165,8 @@ class PrimitiveTopologyTest : public DawnTest {
|
|||
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
|
||||
})");
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), dawn::BufferUsageBit::Vertex);
|
||||
vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
||||
dawn::BufferUsage::Vertex);
|
||||
}
|
||||
|
||||
struct LocationSpec {
|
||||
|
|
|
@ -59,9 +59,9 @@ class RenderBundleTest : public DawnTest {
|
|||
kColors[1].a / 255.f};
|
||||
|
||||
dawn::Buffer buffer0 = utils::CreateBufferFromData(device, colors0, 4 * sizeof(float),
|
||||
dawn::BufferUsageBit::Uniform);
|
||||
dawn::BufferUsage::Uniform);
|
||||
dawn::Buffer buffer1 = utils::CreateBufferFromData(device, colors1, 4 * sizeof(float),
|
||||
dawn::BufferUsageBit::Uniform);
|
||||
dawn::BufferUsage::Uniform);
|
||||
|
||||
bindGroups[0] = utils::MakeBindGroup(device, bgl, {{0, buffer0, 0, 4 * sizeof(float)}});
|
||||
bindGroups[1] = utils::MakeBindGroup(device, bgl, {{0, buffer1, 0, 4 * sizeof(float)}});
|
||||
|
@ -86,7 +86,7 @@ class RenderBundleTest : public DawnTest {
|
|||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData<float>(
|
||||
device, dawn::BufferUsageBit::Vertex,
|
||||
device, dawn::BufferUsage::Vertex,
|
||||
{// The bottom left triangle
|
||||
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f,
|
||||
|
||||
|
|
|
@ -66,8 +66,7 @@ class RenderPassLoadOpTests : public DawnTest {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage =
|
||||
dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
renderTarget = device.CreateTexture(&descriptor);
|
||||
|
||||
renderTargetView = renderTarget.CreateDefaultView();
|
||||
|
|
|
@ -62,7 +62,7 @@ protected:
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = kFormat;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
return device.CreateTexture(&descriptor);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ protected:
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled;
|
||||
descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
// Create a 2x2 checkerboard texture, with black in the top left and bottom right corners.
|
||||
|
@ -102,7 +102,7 @@ protected:
|
|||
data[1] = data[rowPixels] = white;
|
||||
|
||||
dawn::Buffer stagingBuffer =
|
||||
utils::CreateBufferFromData(device, data, sizeof(data), dawn::BufferUsageBit::CopySrc);
|
||||
utils::CreateBufferFromData(device, data, sizeof(data), dawn::BufferUsage::CopySrc);
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 256, 0);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
|
||||
|
|
|
@ -245,20 +245,19 @@ class TextureFormatTest : public DawnTest {
|
|||
|
||||
// Create the texture we will sample from
|
||||
dawn::TextureDescriptor sampleTextureDesc;
|
||||
sampleTextureDesc.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled;
|
||||
sampleTextureDesc.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
|
||||
sampleTextureDesc.size = {width, 1, 1};
|
||||
sampleTextureDesc.format = sampleFormatInfo.format;
|
||||
dawn::Texture sampleTexture = device.CreateTexture(&sampleTextureDesc);
|
||||
|
||||
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(device, sampleData, sampleDataSize,
|
||||
dawn::BufferUsageBit::CopySrc);
|
||||
dawn::BufferUsage::CopySrc);
|
||||
|
||||
// Create the texture that we will render results to
|
||||
ASSERT(expectedRenderDataSize == width * renderFormatInfo.texelByteSize);
|
||||
|
||||
dawn::TextureDescriptor renderTargetDesc;
|
||||
renderTargetDesc.usage =
|
||||
dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::OutputAttachment;
|
||||
renderTargetDesc.usage = dawn::TextureUsage::CopySrc | dawn::TextureUsage::OutputAttachment;
|
||||
renderTargetDesc.size = {width, 1, 1};
|
||||
renderTargetDesc.format = renderFormatInfo.format;
|
||||
|
||||
|
@ -266,7 +265,7 @@ class TextureFormatTest : public DawnTest {
|
|||
|
||||
// Create the readback buffer for the data in renderTarget
|
||||
dawn::BufferDescriptor readbackBufferDesc;
|
||||
readbackBufferDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::CopySrc;
|
||||
readbackBufferDesc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::CopySrc;
|
||||
readbackBufferDesc.size = 4 * width * sampleFormatInfo.componentCount;
|
||||
dawn::Buffer readbackBuffer = device.CreateBuffer(&readbackBufferDesc);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace {
|
|||
uint32_t height,
|
||||
uint32_t arrayLayerCount,
|
||||
uint32_t mipLevelCount,
|
||||
dawn::TextureUsageBit usage) {
|
||||
dawn::TextureUsage usage) {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
descriptor.size.width = width;
|
||||
|
@ -114,8 +114,8 @@ protected:
|
|||
|
||||
const uint32_t textureWidthLevel0 = 1 << mipLevelCount;
|
||||
const uint32_t textureHeightLevel0 = 1 << mipLevelCount;
|
||||
constexpr dawn::TextureUsageBit kUsage =
|
||||
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled;
|
||||
constexpr dawn::TextureUsage kUsage =
|
||||
dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
|
||||
mTexture = Create2DTexture(
|
||||
device, textureWidthLevel0, textureHeightLevel0, arrayLayerCount, mipLevelCount, kUsage);
|
||||
|
||||
|
@ -143,9 +143,8 @@ protected:
|
|||
|
||||
constexpr uint32_t kPaddedTexWidth = kPixelsPerRowPitch;
|
||||
std::vector<RGBA8> data(kPaddedTexWidth * texHeight, RGBA8(0, 0, 0, pixelValue));
|
||||
dawn::Buffer stagingBuffer =
|
||||
utils::CreateBufferFromData(device, data.data(), data.size() * sizeof(RGBA8),
|
||||
dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), data.size() * sizeof(RGBA8), dawn::BufferUsage::CopySrc);
|
||||
dawn::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, kTextureRowPitchAlignment, 0);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
|
@ -474,8 +473,8 @@ class TextureViewRenderingTest : public DawnTest {
|
|||
|
||||
const uint32_t textureWidthLevel0 = 1 << levelCount;
|
||||
const uint32_t textureHeightLevel0 = 1 << levelCount;
|
||||
constexpr dawn::TextureUsageBit kUsage =
|
||||
dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
constexpr dawn::TextureUsage kUsage =
|
||||
dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
dawn::Texture texture = Create2DTexture(
|
||||
device, textureWidthLevel0, textureHeightLevel0, layerCount, levelCount, kUsage);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class TextureZeroInitTest : public DawnTest {
|
|||
}
|
||||
dawn::TextureDescriptor CreateTextureDescriptor(uint32_t mipLevelCount,
|
||||
uint32_t arrayLayerCount,
|
||||
dawn::TextureUsageBit usage,
|
||||
dawn::TextureUsage usage,
|
||||
dawn::TextureFormat format) {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
|
@ -93,8 +93,7 @@ class TextureZeroInitTest : public DawnTest {
|
|||
// This tests that the code path of CopyTextureToBuffer clears correctly to Zero after first usage
|
||||
TEST_P(TextureZeroInitTest, CopyTextureToBufferSource) {
|
||||
dawn::TextureDescriptor descriptor = CreateTextureDescriptor(
|
||||
1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
|
||||
kColorFormat);
|
||||
1, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc, kColorFormat);
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
// Texture's first usage is in EXPECT_PIXEL_RGBA8_EQ's call to CopyTextureToBuffer
|
||||
|
@ -106,8 +105,7 @@ TEST_P(TextureZeroInitTest, CopyTextureToBufferSource) {
|
|||
// This goes through the BeginRenderPass's code path
|
||||
TEST_P(TextureZeroInitTest, RenderingMipMapClearsToZero) {
|
||||
dawn::TextureDescriptor descriptor = CreateTextureDescriptor(
|
||||
4, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
|
||||
kColorFormat);
|
||||
4, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc, kColorFormat);
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
dawn::TextureViewDescriptor viewDescriptor = CreateTextureViewDescriptor(2, 0);
|
||||
|
@ -135,8 +133,7 @@ TEST_P(TextureZeroInitTest, RenderingMipMapClearsToZero) {
|
|||
// This goes through the BeginRenderPass's code path
|
||||
TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) {
|
||||
dawn::TextureDescriptor descriptor = CreateTextureDescriptor(
|
||||
1, 4, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
|
||||
kColorFormat);
|
||||
1, 4, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc, kColorFormat);
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
dawn::TextureViewDescriptor viewDescriptor = CreateTextureViewDescriptor(0, 2);
|
||||
|
@ -162,16 +159,15 @@ TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) {
|
|||
// TODO(natlee@microsoft.com): Add backdoor to dawn native to query the number of zero-inited
|
||||
// subresources
|
||||
TEST_P(TextureZeroInitTest, CopyBufferToTexture) {
|
||||
dawn::TextureDescriptor descriptor =
|
||||
CreateTextureDescriptor(4, 1,
|
||||
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled |
|
||||
dawn::TextureUsageBit::CopySrc,
|
||||
dawn::TextureDescriptor descriptor = CreateTextureDescriptor(
|
||||
4, 1,
|
||||
dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled | dawn::TextureUsage::CopySrc,
|
||||
kColorFormat);
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
std::vector<uint8_t> data(4 * kSize * kSize, 100);
|
||||
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::CopySrc);
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::CopySrc);
|
||||
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
|
||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
|
||||
|
@ -190,16 +186,15 @@ TEST_P(TextureZeroInitTest, CopyBufferToTexture) {
|
|||
// Test for a copy only to a subset of the subresource, lazy init is necessary to clear the other
|
||||
// half.
|
||||
TEST_P(TextureZeroInitTest, CopyBufferToTextureHalf) {
|
||||
dawn::TextureDescriptor descriptor =
|
||||
CreateTextureDescriptor(4, 1,
|
||||
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled |
|
||||
dawn::TextureUsageBit::CopySrc,
|
||||
dawn::TextureDescriptor descriptor = CreateTextureDescriptor(
|
||||
4, 1,
|
||||
dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled | dawn::TextureUsage::CopySrc,
|
||||
kColorFormat);
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
std::vector<uint8_t> data(4 * kSize * kSize, 100);
|
||||
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::CopySrc);
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::CopySrc);
|
||||
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
|
||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
|
||||
|
@ -221,7 +216,7 @@ TEST_P(TextureZeroInitTest, CopyBufferToTextureHalf) {
|
|||
// This tests CopyTextureToTexture fully overwrites copy so lazy init is not needed.
|
||||
TEST_P(TextureZeroInitTest, CopyTextureToTexture) {
|
||||
dawn::TextureDescriptor srcDescriptor = CreateTextureDescriptor(
|
||||
1, 1, dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::CopySrc, kColorFormat);
|
||||
1, 1, dawn::TextureUsage::Sampled | dawn::TextureUsage::CopySrc, kColorFormat);
|
||||
dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
||||
|
||||
dawn::TextureCopyView srcTextureCopyView =
|
||||
|
@ -229,8 +224,8 @@ TEST_P(TextureZeroInitTest, CopyTextureToTexture) {
|
|||
|
||||
dawn::TextureDescriptor dstDescriptor =
|
||||
CreateTextureDescriptor(1, 1,
|
||||
dawn::TextureUsageBit::OutputAttachment |
|
||||
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc,
|
||||
dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopyDst |
|
||||
dawn::TextureUsage::CopySrc,
|
||||
kColorFormat);
|
||||
dawn::Texture dstTexture = device.CreateTexture(&dstDescriptor);
|
||||
|
||||
|
@ -253,10 +248,9 @@ TEST_P(TextureZeroInitTest, CopyTextureToTexture) {
|
|||
// This Tests the CopyTextureToTexture's copy only to a subset of the subresource, lazy init is
|
||||
// necessary to clear the other half.
|
||||
TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) {
|
||||
dawn::TextureDescriptor srcDescriptor =
|
||||
CreateTextureDescriptor(1, 1,
|
||||
dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::CopySrc |
|
||||
dawn::TextureUsageBit::CopyDst,
|
||||
dawn::TextureDescriptor srcDescriptor = CreateTextureDescriptor(
|
||||
1, 1,
|
||||
dawn::TextureUsage::Sampled | dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst,
|
||||
kColorFormat);
|
||||
dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
||||
|
||||
|
@ -264,7 +258,7 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) {
|
|||
{
|
||||
std::vector<uint8_t> data(4 * kSize * kSize, 100);
|
||||
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::CopySrc);
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::CopySrc);
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, 0, 0, {0, 0, 0});
|
||||
|
@ -280,8 +274,8 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) {
|
|||
|
||||
dawn::TextureDescriptor dstDescriptor =
|
||||
CreateTextureDescriptor(1, 1,
|
||||
dawn::TextureUsageBit::OutputAttachment |
|
||||
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc,
|
||||
dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopyDst |
|
||||
dawn::TextureUsage::CopySrc,
|
||||
kColorFormat);
|
||||
dawn::Texture dstTexture = device.CreateTexture(&dstDescriptor);
|
||||
|
||||
|
@ -308,13 +302,13 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) {
|
|||
TEST_P(TextureZeroInitTest, RenderingLoadingDepth) {
|
||||
dawn::TextureDescriptor srcDescriptor =
|
||||
CreateTextureDescriptor(1, 1,
|
||||
dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst |
|
||||
dawn::TextureUsageBit::OutputAttachment,
|
||||
dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst |
|
||||
dawn::TextureUsage::OutputAttachment,
|
||||
kColorFormat);
|
||||
dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
||||
|
||||
dawn::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
||||
1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
|
||||
1, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc,
|
||||
kDepthStencilFormat);
|
||||
dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
||||
|
||||
|
@ -343,13 +337,13 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepth) {
|
|||
TEST_P(TextureZeroInitTest, RenderingLoadingStencil) {
|
||||
dawn::TextureDescriptor srcDescriptor =
|
||||
CreateTextureDescriptor(1, 1,
|
||||
dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst |
|
||||
dawn::TextureUsageBit::OutputAttachment,
|
||||
dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst |
|
||||
dawn::TextureUsage::OutputAttachment,
|
||||
kColorFormat);
|
||||
dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
||||
|
||||
dawn::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
||||
1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
|
||||
1, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc,
|
||||
kDepthStencilFormat);
|
||||
dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
||||
|
||||
|
@ -378,13 +372,13 @@ TEST_P(TextureZeroInitTest, RenderingLoadingStencil) {
|
|||
TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencil) {
|
||||
dawn::TextureDescriptor srcDescriptor =
|
||||
CreateTextureDescriptor(1, 1,
|
||||
dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst |
|
||||
dawn::TextureUsageBit::OutputAttachment,
|
||||
dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst |
|
||||
dawn::TextureUsage::OutputAttachment,
|
||||
kColorFormat);
|
||||
dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
||||
|
||||
dawn::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
||||
1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
|
||||
1, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc,
|
||||
kDepthStencilFormat);
|
||||
dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
||||
|
||||
|
@ -410,8 +404,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencil) {
|
|||
// This tests the color attachments clear to 0s
|
||||
TEST_P(TextureZeroInitTest, ColorAttachmentsClear) {
|
||||
dawn::TextureDescriptor descriptor = CreateTextureDescriptor(
|
||||
1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
|
||||
kColorFormat);
|
||||
1, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc, kColorFormat);
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
utils::BasicRenderPass renderPass = utils::BasicRenderPass(kSize, kSize, texture, kColorFormat);
|
||||
renderPass.renderPassInfo.cColorAttachmentsInfoPtr[0]->loadOp = dawn::LoadOp::Load;
|
||||
|
@ -431,12 +424,11 @@ TEST_P(TextureZeroInitTest, ColorAttachmentsClear) {
|
|||
TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
|
||||
// Create needed resources
|
||||
dawn::TextureDescriptor descriptor =
|
||||
CreateTextureDescriptor(1, 1, dawn::TextureUsageBit::Sampled, kColorFormat);
|
||||
CreateTextureDescriptor(1, 1, dawn::TextureUsage::Sampled, kColorFormat);
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
dawn::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
|
||||
1, 1, dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::OutputAttachment,
|
||||
kColorFormat);
|
||||
1, 1, dawn::TextureUsage::CopySrc | dawn::TextureUsage::OutputAttachment, kColorFormat);
|
||||
dawn::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||
|
||||
dawn::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||
|
@ -501,7 +493,7 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
|
|||
TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
|
||||
// Create needed resources
|
||||
dawn::TextureDescriptor descriptor =
|
||||
CreateTextureDescriptor(1, 1, dawn::TextureUsageBit::Sampled, kColorFormat);
|
||||
CreateTextureDescriptor(1, 1, dawn::TextureUsage::Sampled, kColorFormat);
|
||||
descriptor.size.width = 1;
|
||||
descriptor.size.height = 1;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
@ -509,8 +501,8 @@ TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
|
|||
uint32_t bufferSize = 4 * sizeof(uint32_t);
|
||||
dawn::BufferDescriptor bufferDescriptor;
|
||||
bufferDescriptor.size = bufferSize;
|
||||
bufferDescriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::Storage |
|
||||
dawn::BufferUsageBit::CopyDst;
|
||||
bufferDescriptor.usage =
|
||||
dawn::BufferUsage::CopySrc | dawn::BufferUsage::Storage | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer bufferTex = device.CreateBuffer(&bufferDescriptor);
|
||||
// Add data to buffer to ensure it is initialized
|
||||
uint32_t data = 100;
|
||||
|
@ -571,14 +563,14 @@ TEST_P(TextureZeroInitTest, NonRenderableTextureClear) {
|
|||
DAWN_SKIP_TEST_IF(IsOpenGL() || IsD3D12());
|
||||
|
||||
dawn::TextureDescriptor descriptor =
|
||||
CreateTextureDescriptor(1, 1, dawn::TextureUsageBit::CopySrc, kNonrenderableColorFormat);
|
||||
CreateTextureDescriptor(1, 1, dawn::TextureUsage::CopySrc, kNonrenderableColorFormat);
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
// Set buffer with dirty data so we know it is cleared by the lazy cleared texture copy
|
||||
uint32_t bufferSize = 4 * kSize * kSize;
|
||||
std::vector<uint8_t> data(bufferSize, 100);
|
||||
dawn::Buffer bufferDst = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::CopySrc);
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::CopySrc);
|
||||
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, 0, 0);
|
||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
|
||||
|
|
|
@ -376,9 +376,8 @@ class VertexFormatTest : public DawnTest {
|
|||
std::vector<VertexType> vertex,
|
||||
std::vector<ExpectedType> expectedData) {
|
||||
dawn::RenderPipeline pipeline = MakeTestPipeline(format, expectedData);
|
||||
dawn::Buffer vertexBuffer =
|
||||
utils::CreateBufferFromData(device, vertex.data(), vertex.size() * sizeof(VertexType),
|
||||
dawn::BufferUsageBit::Vertex);
|
||||
dawn::Buffer vertexBuffer = utils::CreateBufferFromData(
|
||||
device, vertex.data(), vertex.size() * sizeof(VertexType), dawn::BufferUsage::Vertex);
|
||||
uint64_t zeroOffset = 0;
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
|
|
|
@ -179,7 +179,7 @@ class VertexInputTest : public DawnTest {
|
|||
dawn::Buffer MakeVertexBuffer(std::vector<T> data) {
|
||||
return utils::CreateBufferFromData(device, data.data(),
|
||||
static_cast<uint32_t>(data.size() * sizeof(T)),
|
||||
dawn::BufferUsageBit::Vertex);
|
||||
dawn::BufferUsage::Vertex);
|
||||
}
|
||||
|
||||
struct DrawVertexBuffer {
|
||||
|
|
|
@ -68,7 +68,7 @@ class ViewportTest : public DawnTest {
|
|||
textureDescriptor.dimension = dawn::TextureDimension::e2D;
|
||||
textureDescriptor.format = format;
|
||||
textureDescriptor.usage =
|
||||
dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
|
||||
dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
|
||||
textureDescriptor.arrayLayerCount = 1;
|
||||
textureDescriptor.mipLevelCount = 1;
|
||||
textureDescriptor.sampleCount = 1;
|
||||
|
|
|
@ -25,13 +25,13 @@ class BindGroupValidationTest : public ValidationTest {
|
|||
{
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 1024;
|
||||
descriptor.usage = dawn::BufferUsageBit::Uniform;
|
||||
descriptor.usage = dawn::BufferUsage::Uniform;
|
||||
mUBO = device.CreateBuffer(&descriptor);
|
||||
}
|
||||
{
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 1024;
|
||||
descriptor.usage = dawn::BufferUsageBit::Storage;
|
||||
descriptor.usage = dawn::BufferUsage::Storage;
|
||||
mSSBO = device.CreateBuffer(&descriptor);
|
||||
}
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ class BindGroupValidationTest : public ValidationTest {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::Sampled;
|
||||
descriptor.usage = dawn::TextureUsage::Sampled;
|
||||
mSampledTexture = device.CreateTexture(&descriptor);
|
||||
mSampledTextureView = mSampledTexture.CreateDefaultView();
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ TEST_F(BindGroupValidationTest, BufferBindingType) {
|
|||
{
|
||||
dawn::BufferDescriptor bufferDesc;
|
||||
bufferDesc.size = 1024;
|
||||
bufferDesc.usage = static_cast<dawn::BufferUsageBit>(0xFFFFFFFF);
|
||||
bufferDesc.usage = static_cast<dawn::BufferUsage>(0xFFFFFFFF);
|
||||
|
||||
dawn::Buffer errorBuffer;
|
||||
ASSERT_DEVICE_ERROR(errorBuffer = device.CreateBuffer(&bufferDesc));
|
||||
|
@ -300,7 +300,7 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
descriptor.usage = dawn::TextureUsage::OutputAttachment;
|
||||
dawn::Texture outputTexture = device.CreateTexture(&descriptor);
|
||||
dawn::TextureView outputTextureView = outputTexture.CreateDefaultView();
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, outputTextureView}}));
|
||||
|
@ -323,7 +323,7 @@ TEST_F(BindGroupValidationTest, TextureComponentType) {
|
|||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Uint;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::Sampled;
|
||||
descriptor.usage = dawn::TextureUsage::Sampled;
|
||||
dawn::Texture uintTexture = device.CreateTexture(&descriptor);
|
||||
dawn::TextureView uintTextureView = uintTexture.CreateDefaultView();
|
||||
|
||||
|
@ -382,7 +382,7 @@ TEST_F(BindGroupValidationTest, BufferBindingOOB) {
|
|||
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 1024;
|
||||
descriptor.usage = dawn::BufferUsageBit::Uniform;
|
||||
descriptor.usage = dawn::BufferUsage::Uniform;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
// Success case, touching the start of the buffer works
|
||||
|
@ -602,7 +602,7 @@ class SetBindGroupValidationTest : public ValidationTest {
|
|||
dawn::BindingType::StorageBuffer, true}});
|
||||
}
|
||||
|
||||
dawn::Buffer CreateBuffer(uint64_t bufferSize, dawn::BufferUsageBit usage) {
|
||||
dawn::Buffer CreateBuffer(uint64_t bufferSize, dawn::BufferUsage usage) {
|
||||
dawn::BufferDescriptor bufferDescriptor;
|
||||
bufferDescriptor.size = bufferSize;
|
||||
bufferDescriptor.usage = usage;
|
||||
|
@ -717,8 +717,8 @@ class SetBindGroupValidationTest : public ValidationTest {
|
|||
// This is the test case that should work.
|
||||
TEST_F(SetBindGroupValidationTest, Basic) {
|
||||
// Set up the bind group.
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(
|
||||
device, mBindGroupLayout,
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
@ -733,8 +733,8 @@ TEST_F(SetBindGroupValidationTest, Basic) {
|
|||
// Test cases that test dynamic offsets count mismatch with bind group layout.
|
||||
TEST_F(SetBindGroupValidationTest, DynamicOffsetsMismatch) {
|
||||
// Set up bind group.
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(
|
||||
device, mBindGroupLayout,
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
@ -750,8 +750,8 @@ TEST_F(SetBindGroupValidationTest, DynamicOffsetsMismatch) {
|
|||
// Test cases that test dynamic offsets not aligned
|
||||
TEST_F(SetBindGroupValidationTest, DynamicOffsetsNotAligned) {
|
||||
// Set up bind group.
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(
|
||||
device, mBindGroupLayout,
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
@ -767,8 +767,8 @@ TEST_F(SetBindGroupValidationTest, DynamicOffsetsNotAligned) {
|
|||
// Test cases that test dynamic uniform buffer out of bound situation.
|
||||
TEST_F(SetBindGroupValidationTest, OffsetOutOfBoundDynamicUniformBuffer) {
|
||||
// Set up bind group.
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(
|
||||
device, mBindGroupLayout,
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
@ -784,8 +784,8 @@ TEST_F(SetBindGroupValidationTest, OffsetOutOfBoundDynamicUniformBuffer) {
|
|||
// Test cases that test dynamic storage buffer out of bound situation.
|
||||
TEST_F(SetBindGroupValidationTest, OffsetOutOfBoundDynamicStorageBuffer) {
|
||||
// Set up bind group.
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(
|
||||
device, mBindGroupLayout,
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
@ -801,8 +801,8 @@ TEST_F(SetBindGroupValidationTest, OffsetOutOfBoundDynamicStorageBuffer) {
|
|||
// Test cases that test dynamic uniform buffer out of bound situation because of binding size.
|
||||
TEST_F(SetBindGroupValidationTest, BindingSizeOutOfBoundDynamicUniformBuffer) {
|
||||
// Set up bind group, but binding size is larger than
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(
|
||||
device, mBindGroupLayout,
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
@ -818,8 +818,8 @@ TEST_F(SetBindGroupValidationTest, BindingSizeOutOfBoundDynamicUniformBuffer) {
|
|||
|
||||
// Test cases that test dynamic storage buffer out of bound situation because of binding size.
|
||||
TEST_F(SetBindGroupValidationTest, BindingSizeOutOfBoundDynamicStorageBuffer) {
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
|
||||
dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
|
||||
dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
|
||||
dawn::BindGroup bindGroup = utils::MakeBindGroup(
|
||||
device, mBindGroupLayout,
|
||||
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
|
||||
|
|
|
@ -63,27 +63,26 @@ class BufferValidationTest : public ValidationTest {
|
|||
dawn::Buffer CreateMapReadBuffer(uint64_t size) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = size;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapRead;
|
||||
descriptor.usage = dawn::BufferUsage::MapRead;
|
||||
|
||||
return device.CreateBuffer(&descriptor);
|
||||
}
|
||||
dawn::Buffer CreateMapWriteBuffer(uint64_t size) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = size;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapWrite;
|
||||
descriptor.usage = dawn::BufferUsage::MapWrite;
|
||||
|
||||
return device.CreateBuffer(&descriptor);
|
||||
}
|
||||
dawn::Buffer CreateSetSubDataBuffer(uint64_t size) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = size;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::CopyDst;
|
||||
|
||||
return device.CreateBuffer(&descriptor);
|
||||
}
|
||||
|
||||
dawn::CreateBufferMappedResult CreateBufferMapped(uint64_t size,
|
||||
dawn::BufferUsageBit usage) {
|
||||
dawn::CreateBufferMappedResult CreateBufferMapped(uint64_t size, dawn::BufferUsage usage) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = size;
|
||||
descriptor.usage = usage;
|
||||
|
@ -117,7 +116,7 @@ TEST_F(BufferValidationTest, CreationSuccess) {
|
|||
{
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::Uniform;
|
||||
descriptor.usage = dawn::BufferUsage::Uniform;
|
||||
|
||||
device.CreateBuffer(&descriptor);
|
||||
}
|
||||
|
@ -129,7 +128,7 @@ TEST_F(BufferValidationTest, CreationMapUsageRestrictions) {
|
|||
{
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
|
||||
|
||||
device.CreateBuffer(&descriptor);
|
||||
}
|
||||
|
@ -138,7 +137,7 @@ TEST_F(BufferValidationTest, CreationMapUsageRestrictions) {
|
|||
{
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::Uniform;
|
||||
descriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::Uniform;
|
||||
|
||||
ASSERT_DEVICE_ERROR(device.CreateBuffer(&descriptor));
|
||||
}
|
||||
|
@ -147,7 +146,7 @@ TEST_F(BufferValidationTest, CreationMapUsageRestrictions) {
|
|||
{
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
|
||||
|
||||
device.CreateBuffer(&descriptor);
|
||||
}
|
||||
|
@ -156,7 +155,7 @@ TEST_F(BufferValidationTest, CreationMapUsageRestrictions) {
|
|||
{
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::Uniform;
|
||||
descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::Uniform;
|
||||
|
||||
ASSERT_DEVICE_ERROR(device.CreateBuffer(&descriptor));
|
||||
}
|
||||
|
@ -192,7 +191,7 @@ TEST_F(BufferValidationTest, MapWriteSuccess) {
|
|||
|
||||
// Test the success case for CreateBufferMapped
|
||||
TEST_F(BufferValidationTest, CreateBufferMappedSuccess) {
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMapped(4, dawn::BufferUsageBit::MapWrite);
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMapped(4, dawn::BufferUsage::MapWrite);
|
||||
ASSERT_NE(result.data, nullptr);
|
||||
ASSERT_EQ(result.dataLength, 4u);
|
||||
result.buffer.Unmap();
|
||||
|
@ -200,7 +199,7 @@ TEST_F(BufferValidationTest, CreateBufferMappedSuccess) {
|
|||
|
||||
// Test the success case for non-mappable CreateBufferMapped
|
||||
TEST_F(BufferValidationTest, NonMappableCreateBufferMappedSuccess) {
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMapped(4, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMapped(4, dawn::BufferUsage::CopySrc);
|
||||
ASSERT_NE(result.data, nullptr);
|
||||
ASSERT_EQ(result.dataLength, 4u);
|
||||
result.buffer.Unmap();
|
||||
|
@ -210,7 +209,7 @@ TEST_F(BufferValidationTest, NonMappableCreateBufferMappedSuccess) {
|
|||
TEST_F(BufferValidationTest, MapReadWrongUsage) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::CopyDst;
|
||||
|
||||
dawn::Buffer buf = device.CreateBuffer(&descriptor);
|
||||
|
||||
|
@ -225,7 +224,7 @@ TEST_F(BufferValidationTest, MapReadWrongUsage) {
|
|||
TEST_F(BufferValidationTest, MapWriteWrongUsage) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::BufferUsage::CopySrc;
|
||||
|
||||
dawn::Buffer buf = device.CreateBuffer(&descriptor);
|
||||
|
||||
|
@ -467,7 +466,7 @@ TEST_F(BufferValidationTest, SetSubDataOutOfBoundsOverflow) {
|
|||
TEST_F(BufferValidationTest, SetSubDataWrongUsage) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::Vertex;
|
||||
descriptor.usage = dawn::BufferUsage::Vertex;
|
||||
|
||||
dawn::Buffer buf = device.CreateBuffer(&descriptor);
|
||||
|
||||
|
@ -479,7 +478,7 @@ TEST_F(BufferValidationTest, SetSubDataWrongUsage) {
|
|||
TEST_F(BufferValidationTest, SetSubDataWithUnalignedSize) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
|
||||
dawn::Buffer buf = device.CreateBuffer(&descriptor);
|
||||
|
||||
|
@ -491,7 +490,7 @@ TEST_F(BufferValidationTest, SetSubDataWithUnalignedSize) {
|
|||
TEST_F(BufferValidationTest, SetSubDataWithUnalignedOffset) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4000;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
|
||||
dawn::Buffer buf = device.CreateBuffer(&descriptor);
|
||||
|
||||
|
@ -612,12 +611,12 @@ TEST_F(BufferValidationTest, MapMappedBuffer) {
|
|||
// Test that is is invalid to Map a CreateBufferMapped buffer
|
||||
TEST_F(BufferValidationTest, MapCreateBufferMappedBuffer) {
|
||||
{
|
||||
dawn::Buffer buf = CreateBufferMapped(4, dawn::BufferUsageBit::MapRead).buffer;
|
||||
dawn::Buffer buf = CreateBufferMapped(4, dawn::BufferUsage::MapRead).buffer;
|
||||
ASSERT_DEVICE_ERROR(buf.MapReadAsync(ToMockBufferMapReadCallback, nullptr));
|
||||
queue.Submit(0, nullptr);
|
||||
}
|
||||
{
|
||||
dawn::Buffer buf = CreateBufferMapped(4, dawn::BufferUsageBit::MapWrite).buffer;
|
||||
dawn::Buffer buf = CreateBufferMapped(4, dawn::BufferUsage::MapWrite).buffer;
|
||||
ASSERT_DEVICE_ERROR(buf.MapWriteAsync(ToMockBufferMapWriteCallback, nullptr));
|
||||
queue.Submit(0, nullptr);
|
||||
}
|
||||
|
@ -645,11 +644,11 @@ TEST_F(BufferValidationTest, SetSubDataMappedBuffer) {
|
|||
TEST_F(BufferValidationTest, SubmitBufferWithMapUsage) {
|
||||
dawn::BufferDescriptor descriptorA;
|
||||
descriptorA.size = 4;
|
||||
descriptorA.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::MapWrite;
|
||||
descriptorA.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::MapWrite;
|
||||
|
||||
dawn::BufferDescriptor descriptorB;
|
||||
descriptorB.size = 4;
|
||||
descriptorB.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::MapRead;
|
||||
descriptorB.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::MapRead;
|
||||
|
||||
dawn::Buffer bufA = device.CreateBuffer(&descriptorA);
|
||||
dawn::Buffer bufB = device.CreateBuffer(&descriptorB);
|
||||
|
@ -664,11 +663,11 @@ TEST_F(BufferValidationTest, SubmitBufferWithMapUsage) {
|
|||
TEST_F(BufferValidationTest, SubmitMappedBuffer) {
|
||||
dawn::BufferDescriptor descriptorA;
|
||||
descriptorA.size = 4;
|
||||
descriptorA.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::MapWrite;
|
||||
descriptorA.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::MapWrite;
|
||||
|
||||
dawn::BufferDescriptor descriptorB;
|
||||
descriptorB.size = 4;
|
||||
descriptorB.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::MapRead;
|
||||
descriptorB.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::MapRead;
|
||||
{
|
||||
dawn::Buffer bufA = device.CreateBuffer(&descriptorA);
|
||||
dawn::Buffer bufB = device.CreateBuffer(&descriptorB);
|
||||
|
@ -719,11 +718,11 @@ TEST_F(BufferValidationTest, SubmitMappedBuffer) {
|
|||
TEST_F(BufferValidationTest, SubmitDestroyedBuffer) {
|
||||
dawn::BufferDescriptor descriptorA;
|
||||
descriptorA.size = 4;
|
||||
descriptorA.usage = dawn::BufferUsageBit::CopySrc;
|
||||
descriptorA.usage = dawn::BufferUsage::CopySrc;
|
||||
|
||||
dawn::BufferDescriptor descriptorB;
|
||||
descriptorB.size = 4;
|
||||
descriptorB.usage = dawn::BufferUsageBit::CopyDst;
|
||||
descriptorB.usage = dawn::BufferUsage::CopyDst;
|
||||
|
||||
dawn::Buffer bufA = device.CreateBuffer(&descriptorA);
|
||||
dawn::Buffer bufB = device.CreateBuffer(&descriptorB);
|
||||
|
|
|
@ -152,7 +152,7 @@ TEST_F(CommandBufferValidationTest, CallsAfterASuccessfulFinish) {
|
|||
// A buffer that can be used in CopyBufferToBuffer
|
||||
dawn::BufferDescriptor copyBufferDesc;
|
||||
copyBufferDesc.size = 16;
|
||||
copyBufferDesc.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
copyBufferDesc.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer copyBuffer = device.CreateBuffer(©BufferDesc);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -166,13 +166,13 @@ TEST_F(CommandBufferValidationTest, CallsAfterAFailedFinish) {
|
|||
// A buffer that can be used in CopyBufferToBuffer
|
||||
dawn::BufferDescriptor copyBufferDesc;
|
||||
copyBufferDesc.size = 16;
|
||||
copyBufferDesc.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
copyBufferDesc.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer copyBuffer = device.CreateBuffer(©BufferDesc);
|
||||
|
||||
// A buffer that can't be used in CopyBufferToBuffer
|
||||
dawn::BufferDescriptor bufferDesc;
|
||||
bufferDesc.size = 16;
|
||||
bufferDesc.usage = dawn::BufferUsageBit::Uniform;
|
||||
bufferDesc.usage = dawn::BufferUsage::Uniform;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&bufferDesc);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -186,7 +186,7 @@ TEST_F(CommandBufferValidationTest, CallsAfterAFailedFinish) {
|
|||
TEST_F(CommandBufferValidationTest, BufferWithMultipleReadUsage) {
|
||||
// Create a buffer used as both vertex and index buffer.
|
||||
dawn::BufferDescriptor bufferDescriptor;
|
||||
bufferDescriptor.usage = dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Index;
|
||||
bufferDescriptor.usage = dawn::BufferUsage::Vertex | dawn::BufferUsage::Index;
|
||||
bufferDescriptor.size = 4;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
|
||||
|
||||
|
@ -205,7 +205,7 @@ TEST_F(CommandBufferValidationTest, BufferWithMultipleReadUsage) {
|
|||
TEST_F(CommandBufferValidationTest, BufferWithReadAndWriteUsage) {
|
||||
// Create a buffer that will be used as an index buffer and as a storage buffer
|
||||
dawn::BufferDescriptor bufferDescriptor;
|
||||
bufferDescriptor.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::Index;
|
||||
bufferDescriptor.usage = dawn::BufferUsage::Storage | dawn::BufferUsage::Index;
|
||||
bufferDescriptor.size = 4;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
|
||||
|
||||
|
@ -229,7 +229,7 @@ TEST_F(CommandBufferValidationTest, BufferWithReadAndWriteUsage) {
|
|||
TEST_F(CommandBufferValidationTest, TextureWithReadAndWriteUsage) {
|
||||
// Create a texture that will be used both as a sampled texture and a render target
|
||||
dawn::TextureDescriptor textureDescriptor;
|
||||
textureDescriptor.usage = dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::OutputAttachment;
|
||||
textureDescriptor.usage = dawn::TextureUsage::Sampled | dawn::TextureUsage::OutputAttachment;
|
||||
textureDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
textureDescriptor.dimension = dawn::TextureDimension::e2D;
|
||||
textureDescriptor.size = {1, 1, 1};
|
||||
|
|
|
@ -54,8 +54,8 @@ class ComputeIndirectValidationTest : public ValidationTest {
|
|||
void TestIndirectOffset(utils::Expectation expectation,
|
||||
std::initializer_list<uint32_t> bufferList,
|
||||
uint64_t indirectOffset) {
|
||||
dawn::Buffer indirectBuffer = utils::CreateBufferFromData<uint32_t>(
|
||||
device, dawn::BufferUsageBit::Indirect, bufferList);
|
||||
dawn::Buffer indirectBuffer =
|
||||
utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Indirect, bufferList);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
dawn::ComputePassEncoder pass = encoder.BeginComputePass();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
class CopyCommandTest : public ValidationTest {
|
||||
protected:
|
||||
dawn::Buffer CreateBuffer(uint64_t size, dawn::BufferUsageBit usage) {
|
||||
dawn::Buffer CreateBuffer(uint64_t size, dawn::BufferUsage usage) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = size;
|
||||
descriptor.usage = usage;
|
||||
|
@ -33,7 +33,7 @@ class CopyCommandTest : public ValidationTest {
|
|||
uint32_t mipLevelCount,
|
||||
uint32_t arrayLayerCount,
|
||||
dawn::TextureFormat format,
|
||||
dawn::TextureUsageBit usage,
|
||||
dawn::TextureUsage usage,
|
||||
uint32_t sampleCount = 1) {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
|
@ -150,8 +150,8 @@ class CopyCommandTest_B2B : public CopyCommandTest {};
|
|||
|
||||
// Test a successfull B2B copy
|
||||
TEST_F(CopyCommandTest_B2B, Success) {
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsage::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsage::CopyDst);
|
||||
|
||||
// Copy different copies, including some that touch the OOB condition
|
||||
{
|
||||
|
@ -174,8 +174,8 @@ TEST_F(CopyCommandTest_B2B, Success) {
|
|||
|
||||
// Test B2B copies with OOB
|
||||
TEST_F(CopyCommandTest_B2B, OutOfBounds) {
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsage::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsage::CopyDst);
|
||||
|
||||
// OOB on the source
|
||||
{
|
||||
|
@ -194,9 +194,9 @@ TEST_F(CopyCommandTest_B2B, OutOfBounds) {
|
|||
|
||||
// Test B2B copies with incorrect buffer usage
|
||||
TEST_F(CopyCommandTest_B2B, BadUsage) {
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Buffer vertex = CreateBuffer(16, dawn::BufferUsageBit::Vertex);
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsage::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsage::CopyDst);
|
||||
dawn::Buffer vertex = CreateBuffer(16, dawn::BufferUsage::Vertex);
|
||||
|
||||
// Source with incorrect usage
|
||||
{
|
||||
|
@ -215,8 +215,8 @@ TEST_F(CopyCommandTest_B2B, BadUsage) {
|
|||
|
||||
// Test B2B copies with unaligned data size
|
||||
TEST_F(CopyCommandTest_B2B, UnalignedSize) {
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsage::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsage::CopyDst);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToBuffer(source, 8, destination, 0, sizeof(uint8_t));
|
||||
|
@ -225,8 +225,8 @@ TEST_F(CopyCommandTest_B2B, UnalignedSize) {
|
|||
|
||||
// Test B2B copies with unaligned offset
|
||||
TEST_F(CopyCommandTest_B2B, UnalignedOffset) {
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsage::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsage::CopyDst);
|
||||
|
||||
// Unaligned source offset
|
||||
{
|
||||
|
@ -247,11 +247,11 @@ TEST_F(CopyCommandTest_B2B, UnalignedOffset) {
|
|||
TEST_F(CopyCommandTest_B2B, BuffersInErrorState) {
|
||||
dawn::BufferDescriptor errorBufferDescriptor;
|
||||
errorBufferDescriptor.size = 4;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopySrc;
|
||||
ASSERT_DEVICE_ERROR(dawn::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
|
||||
|
||||
constexpr uint64_t bufferSize = 4;
|
||||
dawn::Buffer validBuffer = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer validBuffer = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
|
||||
{
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -271,9 +271,9 @@ class CopyCommandTest_B2T : public CopyCommandTest {};
|
|||
// Test a successfull B2T copy
|
||||
TEST_F(CopyCommandTest_B2T, Success) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Different copies, including some that touch the OOB condition
|
||||
{
|
||||
|
@ -324,9 +324,9 @@ TEST_F(CopyCommandTest_B2T, Success) {
|
|||
// Test OOB conditions on the buffer
|
||||
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// OOB on the buffer because we copy too many pixels
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
|
@ -346,7 +346,7 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
|||
{
|
||||
uint32_t sourceBufferSize = BufferSizeForTextureCopy(7, 3, 1);
|
||||
ASSERT_TRUE(256 * 3 > sourceBufferSize) << "row pitch * height should overflow buffer";
|
||||
dawn::Buffer sourceBuffer = CreateBuffer(sourceBufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer sourceBuffer = CreateBuffer(sourceBufferSize, dawn::BufferUsage::CopySrc);
|
||||
|
||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
{7, 3, 1});
|
||||
|
@ -356,9 +356,9 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
|||
// Test OOB conditions on the texture
|
||||
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// OOB on the texture because x + width overflows
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {13, 12, 0},
|
||||
|
@ -383,9 +383,9 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
|
|||
|
||||
// Test that we force Z=0 and Depth=1 on copies to 2D textures
|
||||
TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) {
|
||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Z=1 on an empty copy still errors
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 1},
|
||||
|
@ -398,12 +398,12 @@ TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) {
|
|||
|
||||
// Test B2T copies with incorrect buffer usage
|
||||
TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
|
||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer vertex = CreateBuffer(16 * 4, dawn::BufferUsageBit::Vertex);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::Sampled);
|
||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsage::CopySrc);
|
||||
dawn::Buffer vertex = CreateBuffer(16 * 4, dawn::BufferUsage::Vertex);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
dawn::Texture sampled =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::Sampled);
|
||||
|
||||
// Incorrect source usage
|
||||
TestB2TCopy(utils::Expectation::Failure, vertex, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
|
@ -416,9 +416,9 @@ TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
|
|||
|
||||
TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Default row pitch is not 256-byte aligned
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
|
||||
|
@ -435,9 +435,9 @@ TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
|||
|
||||
TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Image height is zero (Valid)
|
||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
|
@ -459,9 +459,9 @@ TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
|||
// Test B2T copies with incorrect buffer offset usage
|
||||
TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Correct usage
|
||||
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 0, destination, 0, 0,
|
||||
|
@ -481,9 +481,9 @@ TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
|||
// Test multisampled textures cannot be used in B2T copies.
|
||||
TEST_F(CopyCommandTest_B2T, CopyToMultisampledTexture) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst, 4);
|
||||
dawn::TextureUsage::CopyDst, 4);
|
||||
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
{2, 2, 1});
|
||||
|
@ -493,7 +493,7 @@ TEST_F(CopyCommandTest_B2T, CopyToMultisampledTexture) {
|
|||
TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
|
||||
dawn::BufferDescriptor errorBufferDescriptor;
|
||||
errorBufferDescriptor.size = 4;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopySrc;
|
||||
ASSERT_DEVICE_ERROR(dawn::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
|
||||
|
||||
dawn::TextureDescriptor errorTextureDescriptor;
|
||||
|
@ -508,7 +508,7 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
|
|||
|
||||
{
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::TextureUsage::CopyDst);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
|
||||
|
||||
|
@ -519,7 +519,7 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
|
|||
|
||||
{
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);
|
||||
|
||||
|
@ -544,9 +544,9 @@ TEST_F(CopyCommandTest_B2T, TextureCopyBufferSizeLastRowComputation) {
|
|||
constexpr uint32_t kInvalidBufferSize = kRowPitch * (kHeight - 1) + kWidth;
|
||||
|
||||
for (dawn::TextureFormat format : kFormats) {
|
||||
dawn::Buffer source = CreateBuffer(kInvalidBufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer source = CreateBuffer(kInvalidBufferSize, dawn::BufferUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopyDst);
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsage::CopyDst);
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, kRowPitch, 0, destination, 0, 0,
|
||||
{0, 0, 0}, {kWidth, kHeight, 1});
|
||||
}
|
||||
|
@ -556,20 +556,19 @@ TEST_F(CopyCommandTest_B2T, TextureCopyBufferSizeLastRowComputation) {
|
|||
for (dawn::TextureFormat format : kFormats) {
|
||||
uint32_t validBufferSize = BufferSizeForTextureCopy(kWidth, kHeight, 1, format);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopyDst);
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Verify the return value of BufferSizeForTextureCopy() is exactly the minimum valid
|
||||
// buffer size in this test.
|
||||
{
|
||||
uint32_t invalidBuffferSize = validBufferSize - 1;
|
||||
dawn::Buffer source =
|
||||
CreateBuffer(invalidBuffferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer source = CreateBuffer(invalidBuffferSize, dawn::BufferUsage::CopySrc);
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, kRowPitch, 0, destination, 0, 0,
|
||||
{0, 0, 0}, {kWidth, kHeight, 1});
|
||||
}
|
||||
|
||||
{
|
||||
dawn::Buffer source = CreateBuffer(validBufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer source = CreateBuffer(validBufferSize, dawn::BufferUsage::CopySrc);
|
||||
TestB2TCopy(utils::Expectation::Success, source, 0, kRowPitch, 0, destination, 0, 0,
|
||||
{0, 0, 0}, {kWidth, kHeight, 1});
|
||||
}
|
||||
|
@ -580,10 +579,10 @@ TEST_F(CopyCommandTest_B2T, TextureCopyBufferSizeLastRowComputation) {
|
|||
// Test copy from buffer to mip map of non square texture
|
||||
TEST_F(CopyCommandTest_B2T, CopyToMipmapOfNonSquareTexture) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 2, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
uint32_t maxMipmapLevel = 3;
|
||||
dawn::Texture destination = Create2DTexture(
|
||||
4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopyDst);
|
||||
4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Copy to top level mip map
|
||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, maxMipmapLevel - 1, 0,
|
||||
|
@ -607,9 +606,9 @@ class CopyCommandTest_T2B : public CopyCommandTest {};
|
|||
// Test a successfull T2B copy
|
||||
TEST_F(CopyCommandTest_T2B, Success) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
|
||||
|
||||
// Different copies, including some that touch the OOB condition
|
||||
{
|
||||
|
@ -660,9 +659,9 @@ TEST_F(CopyCommandTest_T2B, Success) {
|
|||
// Test OOB conditions on the texture
|
||||
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
|
||||
|
||||
// OOB on the texture because x + width overflows
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {13, 12, 0}, destination, 0, 256, 0,
|
||||
|
@ -684,9 +683,9 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
|||
// Test OOB conditions on the buffer
|
||||
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
|
||||
|
||||
// OOB on the buffer because we copy too many pixels
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||
|
@ -707,7 +706,7 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
|||
uint32_t destinationBufferSize = BufferSizeForTextureCopy(7, 3, 1);
|
||||
ASSERT_TRUE(256 * 3 > destinationBufferSize) << "row pitch * height should overflow buffer";
|
||||
dawn::Buffer destinationBuffer =
|
||||
CreateBuffer(destinationBufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
CreateBuffer(destinationBufferSize, dawn::BufferUsage::CopyDst);
|
||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destinationBuffer, 0, 256,
|
||||
0, {7, 3, 1});
|
||||
}
|
||||
|
@ -716,9 +715,9 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
|||
// Test that we force Z=0 and Depth=1 on copies from to 2D textures
|
||||
TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
|
||||
|
||||
// Z=1 on an empty copy still errors
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 1}, destination, 0, 0, 0,
|
||||
|
@ -732,12 +731,12 @@ TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
|
|||
// Test T2B copies with incorrect buffer usage
|
||||
TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::Sampled);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Buffer vertex = CreateBuffer(bufferSize, dawn::BufferUsageBit::Vertex);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
|
||||
dawn::Texture sampled =
|
||||
Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::Sampled);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
|
||||
dawn::Buffer vertex = CreateBuffer(bufferSize, dawn::BufferUsage::Vertex);
|
||||
|
||||
// Incorrect source usage
|
||||
TestT2BCopy(utils::Expectation::Failure, sampled, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||
|
@ -750,8 +749,8 @@ TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
|
|||
TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::TextureUsage::CopyDst);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
|
||||
// Default row pitch is not 256-byte aligned
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||
|
@ -768,9 +767,9 @@ TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
|||
|
||||
TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
|
||||
|
||||
// Image height is zero (Valid)
|
||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||
|
@ -793,8 +792,8 @@ TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
|||
TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::TextureUsage::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
|
||||
|
||||
// Correct usage
|
||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, bufferSize - 4,
|
||||
|
@ -812,9 +811,9 @@ TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
|||
// Test multisampled textures cannot be used in T2B copies.
|
||||
TEST_F(CopyCommandTest_T2B, CopyFromMultisampledTexture) {
|
||||
dawn::Texture source = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc, 4);
|
||||
dawn::TextureUsage::CopySrc, 4);
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
|
||||
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||
{2, 2, 1});
|
||||
|
@ -824,7 +823,7 @@ TEST_F(CopyCommandTest_T2B, CopyFromMultisampledTexture) {
|
|||
TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
|
||||
dawn::BufferDescriptor errorBufferDescriptor;
|
||||
errorBufferDescriptor.size = 4;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopySrc;
|
||||
ASSERT_DEVICE_ERROR(dawn::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
|
||||
|
||||
dawn::TextureDescriptor errorTextureDescriptor;
|
||||
|
@ -839,7 +838,7 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
|
|||
|
||||
{
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
|
||||
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);
|
||||
|
||||
|
@ -850,7 +849,7 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
|
|||
|
||||
{
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::TextureUsage::CopyDst);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
|
||||
|
||||
|
@ -876,10 +875,9 @@ TEST_F(CopyCommandTest_T2B, TextureCopyBufferSizeLastRowComputation) {
|
|||
|
||||
for (dawn::TextureFormat format : kFormats) {
|
||||
dawn::Texture source =
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopyDst);
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsage::CopyDst);
|
||||
|
||||
dawn::Buffer destination =
|
||||
CreateBuffer(kInvalidBufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(kInvalidBufferSize, dawn::BufferUsage::CopySrc);
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0,
|
||||
kRowPitch, 0, {kWidth, kHeight, 1});
|
||||
}
|
||||
|
@ -889,21 +887,21 @@ TEST_F(CopyCommandTest_T2B, TextureCopyBufferSizeLastRowComputation) {
|
|||
for (dawn::TextureFormat format : kFormats) {
|
||||
uint32_t validBufferSize = BufferSizeForTextureCopy(kWidth, kHeight, 1, format);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopySrc);
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsage::CopySrc);
|
||||
|
||||
// Verify the return value of BufferSizeForTextureCopy() is exactly the minimum valid
|
||||
// buffer size in this test.
|
||||
{
|
||||
uint32_t invalidBufferSize = validBufferSize - 1;
|
||||
dawn::Buffer destination =
|
||||
CreateBuffer(invalidBufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
CreateBuffer(invalidBufferSize, dawn::BufferUsage::CopyDst);
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0,
|
||||
kRowPitch, 0, {kWidth, kHeight, 1});
|
||||
}
|
||||
|
||||
{
|
||||
dawn::Buffer destination =
|
||||
CreateBuffer(validBufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
CreateBuffer(validBufferSize, dawn::BufferUsage::CopyDst);
|
||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0,
|
||||
kRowPitch, 0, {kWidth, kHeight, 1});
|
||||
}
|
||||
|
@ -915,9 +913,9 @@ TEST_F(CopyCommandTest_T2B, TextureCopyBufferSizeLastRowComputation) {
|
|||
TEST_F(CopyCommandTest_T2B, CopyFromMipmapOfNonSquareTexture) {
|
||||
uint32_t maxMipmapLevel = 3;
|
||||
dawn::Texture source = Create2DTexture(4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::TextureUsage::CopySrc);
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 2, 1);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
|
||||
|
||||
// Copy from top level mip map
|
||||
TestT2BCopy(utils::Expectation::Success, source, maxMipmapLevel - 1, 0, {0, 0, 0}, destination,
|
||||
|
@ -939,10 +937,10 @@ TEST_F(CopyCommandTest_T2B, CopyFromMipmapOfNonSquareTexture) {
|
|||
class CopyCommandTest_T2T : public CopyCommandTest {};
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, Success) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Different copies, including some that touch the OOB condition
|
||||
{
|
||||
|
@ -992,10 +990,10 @@ TEST_F(CopyCommandTest_T2T, Success) {
|
|||
}
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, IncorrectUsage) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Incorrect source usage causes failure
|
||||
TestT2TCopy(utils::Expectation::Failure, destination, 0, 0, {0, 0, 0}, destination, 0, 0,
|
||||
|
@ -1007,10 +1005,10 @@ TEST_F(CopyCommandTest_T2T, IncorrectUsage) {
|
|||
}
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, OutOfBounds) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// OOB on source
|
||||
{
|
||||
|
@ -1060,10 +1058,10 @@ TEST_F(CopyCommandTest_T2T, OutOfBounds) {
|
|||
}
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, 2DTextureDepthConstraints) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Empty copy on source with z > 0 fails
|
||||
TestT2TCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 1}, destination, 0, 0, {0, 0, 0},
|
||||
|
@ -1080,9 +1078,9 @@ TEST_F(CopyCommandTest_T2T, 2DTextureDepthConstraints) {
|
|||
|
||||
TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::TextureUsage::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8, dawn::TextureUsageBit::CopyDst);
|
||||
16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Success when entire depth stencil subresource is copied
|
||||
TestT2TCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 0, {0, 0, 0},
|
||||
|
@ -1094,10 +1092,10 @@ TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {
|
|||
}
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, FormatsMismatch) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Uint,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Uint, dawn::TextureUsage::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
|
||||
// Failure when formats don't match
|
||||
TestT2TCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 0, {0, 0, 0},
|
||||
|
@ -1106,11 +1104,11 @@ TEST_F(CopyCommandTest_T2T, FormatsMismatch) {
|
|||
|
||||
TEST_F(CopyCommandTest_T2T, MultisampledCopies) {
|
||||
dawn::Texture sourceMultiSampled1x = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopySrc, 1);
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc, 1);
|
||||
dawn::Texture sourceMultiSampled4x = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopySrc, 4);
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc, 4);
|
||||
dawn::Texture destinationMultiSampled4x = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopyDst, 4);
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst, 4);
|
||||
|
||||
// Success when entire multisampled subresource is copied
|
||||
{
|
||||
|
@ -1134,9 +1132,9 @@ TEST_F(CopyCommandTest_T2T, MultisampledCopies) {
|
|||
TEST_F(CopyCommandTest_T2T, CopyToMipmapOfNonSquareTexture) {
|
||||
uint32_t maxMipmapLevel = 3;
|
||||
dawn::Texture source = Create2DTexture(4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::TextureUsage::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(
|
||||
4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopyDst);
|
||||
4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
|
||||
// Copy to top level mip map
|
||||
TestT2TCopy(utils::Expectation::Success, source, maxMipmapLevel - 1, 0, {0, 0, 0}, destination,
|
||||
maxMipmapLevel - 1, 0, {0, 0, 0}, {1, 1, 1});
|
||||
|
@ -1165,9 +1163,8 @@ class CopyCommandTest_CompressedTextureFormats : public CopyCommandTest {
|
|||
uint32_t mipmapLevels = 1,
|
||||
uint32_t width = kWidth,
|
||||
uint32_t height = kHeight) {
|
||||
constexpr dawn::TextureUsageBit kUsage = dawn::TextureUsageBit::CopyDst |
|
||||
dawn::TextureUsageBit::CopySrc |
|
||||
dawn::TextureUsageBit::Sampled;
|
||||
constexpr dawn::TextureUsage kUsage =
|
||||
dawn::TextureUsage::CopyDst | dawn::TextureUsage::CopySrc | dawn::TextureUsage::Sampled;
|
||||
constexpr uint32_t kArrayLayers = 1;
|
||||
return CopyCommandTest::Create2DTexture(width, height, mipmapLevels, kArrayLayers, format,
|
||||
kUsage, 1);
|
||||
|
@ -1246,7 +1243,7 @@ class CopyCommandTest_CompressedTextureFormats : public CopyCommandTest {
|
|||
// in buffer-to-texture or texture-to-buffer copies with compressed texture formats.
|
||||
TEST_F(CopyCommandTest_CompressedTextureFormats, BufferOffset) {
|
||||
dawn::Buffer buffer =
|
||||
CreateBuffer(512, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
|
||||
CreateBuffer(512, dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst);
|
||||
|
||||
for (dawn::TextureFormat bcFormat : kBCFormats) {
|
||||
dawn::Texture texture = Create2DTexture(bcFormat);
|
||||
|
@ -1274,7 +1271,7 @@ TEST_F(CopyCommandTest_CompressedTextureFormats, BufferOffset) {
|
|||
// the multiple of compressed texture block width in bytes.
|
||||
TEST_F(CopyCommandTest_CompressedTextureFormats, RowPitch) {
|
||||
dawn::Buffer buffer =
|
||||
CreateBuffer(1024, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
|
||||
CreateBuffer(1024, dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst);
|
||||
|
||||
{
|
||||
constexpr uint32_t kTestWidth = 160;
|
||||
|
@ -1343,7 +1340,7 @@ TEST_F(CopyCommandTest_CompressedTextureFormats, RowPitch) {
|
|||
// buffer-to-texture or texture-to-buffer copies with compressed texture formats.
|
||||
TEST_F(CopyCommandTest_CompressedTextureFormats, ImageHeight) {
|
||||
dawn::Buffer buffer =
|
||||
CreateBuffer(512, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
|
||||
CreateBuffer(512, dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst);
|
||||
|
||||
for (dawn::TextureFormat bcFormat : kBCFormats) {
|
||||
dawn::Texture texture = Create2DTexture(bcFormat);
|
||||
|
@ -1369,7 +1366,7 @@ TEST_F(CopyCommandTest_CompressedTextureFormats, ImageHeight) {
|
|||
// texture-to-buffer or texture-to-texture copies with compressed texture formats.
|
||||
TEST_F(CopyCommandTest_CompressedTextureFormats, ImageOffset) {
|
||||
dawn::Buffer buffer =
|
||||
CreateBuffer(512, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
|
||||
CreateBuffer(512, dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst);
|
||||
|
||||
for (dawn::TextureFormat bcFormat : kBCFormats) {
|
||||
dawn::Texture texture = Create2DTexture(bcFormat);
|
||||
|
@ -1412,7 +1409,7 @@ TEST_F(CopyCommandTest_CompressedTextureFormats, ImageOffset) {
|
|||
// texture-to-buffer or texture-to-texture copies with compressed texture formats.
|
||||
TEST_F(CopyCommandTest_CompressedTextureFormats, ImageExtent) {
|
||||
dawn::Buffer buffer =
|
||||
CreateBuffer(512, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
|
||||
CreateBuffer(512, dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst);
|
||||
|
||||
constexpr uint32_t kMipmapLevels = 3;
|
||||
constexpr uint32_t kTestWidth = 60;
|
||||
|
|
|
@ -73,8 +73,8 @@ class DrawIndirectValidationTest : public ValidationTest {
|
|||
std::initializer_list<uint32_t> bufferList,
|
||||
uint64_t indirectOffset,
|
||||
bool indexed) {
|
||||
dawn::Buffer indirectBuffer = utils::CreateBufferFromData<uint32_t>(
|
||||
device, dawn::BufferUsageBit::Indirect, bufferList);
|
||||
dawn::Buffer indirectBuffer =
|
||||
utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Indirect, bufferList);
|
||||
|
||||
DummyRenderPass renderPass(device);
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -82,8 +82,8 @@ class DrawIndirectValidationTest : public ValidationTest {
|
|||
pass.SetPipeline(pipeline);
|
||||
if (indexed) {
|
||||
uint32_t zeros[100] = {};
|
||||
dawn::Buffer indexBuffer = utils::CreateBufferFromData(device, zeros, sizeof(zeros),
|
||||
dawn::BufferUsageBit::Index);
|
||||
dawn::Buffer indexBuffer =
|
||||
utils::CreateBufferFromData(device, zeros, sizeof(zeros), dawn::BufferUsage::Index);
|
||||
pass.SetIndexBuffer(indexBuffer, 0);
|
||||
pass.DrawIndexedIndirect(indirectBuffer, indirectOffset);
|
||||
} else {
|
||||
|
|
|
@ -32,12 +32,12 @@ static void StoreTrueMapWriteCallback(DawnBufferMapAsyncStatus status,
|
|||
TEST_F(QueueSubmitValidationTest, SubmitWithMappedBuffer) {
|
||||
// Create a map-write buffer.
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
|
||||
descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
|
||||
descriptor.size = 4;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
// Create a fake copy destination buffer
|
||||
descriptor.usage = dawn::BufferUsageBit::CopyDst;
|
||||
descriptor.usage = dawn::BufferUsage::CopyDst;
|
||||
dawn::Buffer targetBuffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
// Create a command buffer that reads from the mappable buffer.
|
||||
|
|
|
@ -69,21 +69,21 @@ namespace {
|
|||
|
||||
float data[4];
|
||||
dawn::Buffer buffer = utils::CreateBufferFromData(device, data, 4 * sizeof(float),
|
||||
dawn::BufferUsageBit::Uniform);
|
||||
dawn::BufferUsage::Uniform);
|
||||
|
||||
constexpr static float kVertices[] = {-1.f, 1.f, 1.f, -1.f, -1.f, 1.f};
|
||||
|
||||
vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
||||
dawn::BufferUsageBit::Vertex);
|
||||
dawn::BufferUsage::Vertex);
|
||||
|
||||
// Dummy storage buffer.
|
||||
dawn::Buffer storageBuffer = utils::CreateBufferFromData(
|
||||
device, kVertices, sizeof(kVertices), dawn::BufferUsageBit::Storage);
|
||||
device, kVertices, sizeof(kVertices), dawn::BufferUsage::Storage);
|
||||
|
||||
// Vertex buffer with storage usage for testing read+write error usage.
|
||||
vertexStorageBuffer = utils::CreateBufferFromData(
|
||||
device, kVertices, sizeof(kVertices),
|
||||
dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Storage);
|
||||
vertexStorageBuffer =
|
||||
utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
|
||||
dawn::BufferUsage::Vertex | dawn::BufferUsage::Storage);
|
||||
|
||||
bg0 = utils::MakeBindGroup(device, bgls[0], {{0, buffer, 0, 4 * sizeof(float)}});
|
||||
bg1 = utils::MakeBindGroup(
|
||||
|
@ -843,7 +843,7 @@ TEST_F(RenderBundleValidationTest, RenderPassColorFormatMismatch) {
|
|||
dawn::RenderBundle renderBundle = renderBundleEncoder.Finish();
|
||||
|
||||
dawn::TextureDescriptor textureDesc = {};
|
||||
textureDesc.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
textureDesc.usage = dawn::TextureUsage::OutputAttachment;
|
||||
textureDesc.size = dawn::Extent3D({400, 400, 1});
|
||||
|
||||
textureDesc.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
@ -914,7 +914,7 @@ TEST_F(RenderBundleValidationTest, RenderPassDepthStencilFormatMismatch) {
|
|||
dawn::RenderBundle renderBundle = renderBundleEncoder.Finish();
|
||||
|
||||
dawn::TextureDescriptor textureDesc = {};
|
||||
textureDesc.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
textureDesc.usage = dawn::TextureUsage::OutputAttachment;
|
||||
textureDesc.size = dawn::Extent3D({400, 400, 1});
|
||||
|
||||
textureDesc.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
@ -973,7 +973,7 @@ TEST_F(RenderBundleValidationTest, RenderPassSampleCountMismatch) {
|
|||
dawn::RenderBundle renderBundle = renderBundleEncoder.Finish();
|
||||
|
||||
dawn::TextureDescriptor textureDesc = {};
|
||||
textureDesc.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
textureDesc.usage = dawn::TextureUsage::OutputAttachment;
|
||||
textureDesc.size = dawn::Extent3D({400, 400, 1});
|
||||
|
||||
textureDesc.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
|
|
@ -48,7 +48,7 @@ dawn::Texture CreateTexture(dawn::Device& device,
|
|||
uint32_t arrayLayerCount,
|
||||
uint32_t mipLevelCount,
|
||||
uint32_t sampleCount = 1,
|
||||
dawn::TextureUsageBit usage = dawn::TextureUsageBit::OutputAttachment) {
|
||||
dawn::TextureUsage usage = dawn::TextureUsage::OutputAttachment) {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dimension;
|
||||
descriptor.size.width = width;
|
||||
|
@ -488,10 +488,9 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetMipmapLevelM
|
|||
}
|
||||
|
||||
// It is not allowed to use a resolve target which is created from a texture whose usage does not
|
||||
// include dawn::TextureUsageBit::OutputAttachment.
|
||||
// include dawn::TextureUsage::OutputAttachment.
|
||||
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetUsageNoOutputAttachment) {
|
||||
constexpr dawn::TextureUsageBit kUsage =
|
||||
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc;
|
||||
constexpr dawn::TextureUsage kUsage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::CopySrc;
|
||||
dawn::Texture nonColorUsageResolveTexture = CreateTexture(
|
||||
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers,
|
||||
kLevelCount, 1, kUsage);
|
||||
|
|
|
@ -66,8 +66,8 @@ void main() {
|
|||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
float data[4];
|
||||
dawn::Buffer buffer = utils::CreateBufferFromData(device, data, 4 * sizeof(float),
|
||||
dawn::BufferUsageBit::Uniform);
|
||||
dawn::Buffer buffer =
|
||||
utils::CreateBufferFromData(device, data, 4 * sizeof(float), dawn::BufferUsage::Uniform);
|
||||
|
||||
dawn::BindGroup bg1 =
|
||||
utils::MakeBindGroup(device, bgls[0], {{0, buffer, 0, 4 * sizeof(float)}});
|
||||
|
|
|
@ -130,7 +130,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
|||
baseTextureDescriptor.arrayLayerCount = 1;
|
||||
baseTextureDescriptor.mipLevelCount = 1;
|
||||
baseTextureDescriptor.dimension = dawn::TextureDimension::e2D;
|
||||
baseTextureDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
baseTextureDescriptor.usage = dawn::TextureUsage::OutputAttachment;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor nonMultisampledPipelineDescriptor(device);
|
||||
nonMultisampledPipelineDescriptor.sampleCount = 1;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue