mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-09 14:45:58 +00:00
Device: Deprecated GetDefaultQueue in favor of ::GetQueue()
Bug: dawn:22 Change-Id: I103ea933ca5b93f20d8bf11c6671bd9f603d8ff3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40061 Reviewed-by: Brandon Jones <bajones@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
d5a0728b67
commit
6d315daa5d
@ -751,6 +751,10 @@
|
|||||||
{"name": "descriptor", "type": "texture descriptor", "annotation": "const*"}
|
{"name": "descriptor", "type": "texture descriptor", "annotation": "const*"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "get queue",
|
||||||
|
"returns": "queue"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "get default queue",
|
"name": "get default queue",
|
||||||
"returns": "queue"
|
"returns": "queue"
|
||||||
|
@ -151,6 +151,7 @@
|
|||||||
"BufferUnmap",
|
"BufferUnmap",
|
||||||
"DeviceCreateErrorBuffer",
|
"DeviceCreateErrorBuffer",
|
||||||
"DeviceGetDefaultQueue",
|
"DeviceGetDefaultQueue",
|
||||||
|
"DeviceGetQueue",
|
||||||
"DeviceInjectError",
|
"DeviceInjectError",
|
||||||
"DevicePushErrorScope",
|
"DevicePushErrorScope",
|
||||||
"QueueCreateFence"
|
"QueueCreateFence"
|
||||||
|
@ -50,7 +50,7 @@ static std::vector<ShaderData> shaderData;
|
|||||||
void init() {
|
void init() {
|
||||||
device = CreateCppDawnDevice();
|
device = CreateCppDawnDevice();
|
||||||
|
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetQueue();
|
||||||
swapchain = GetSwapChain(device);
|
swapchain = GetSwapChain(device);
|
||||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
||||||
640, 480);
|
640, 480);
|
||||||
|
@ -26,7 +26,7 @@ WGPUTextureFormat swapChainFormat;
|
|||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
device = CreateCppDawnDevice().Release();
|
device = CreateCppDawnDevice().Release();
|
||||||
queue = wgpuDeviceGetDefaultQueue(device);
|
queue = wgpuDeviceGetQueue(device);
|
||||||
|
|
||||||
{
|
{
|
||||||
WGPUSwapChainDescriptor descriptor = {};
|
WGPUSwapChainDescriptor descriptor = {};
|
||||||
|
@ -299,7 +299,7 @@ wgpu::CommandBuffer createCommandBuffer(const wgpu::TextureView backbufferView,
|
|||||||
void init() {
|
void init() {
|
||||||
device = CreateCppDawnDevice();
|
device = CreateCppDawnDevice();
|
||||||
|
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetQueue();
|
||||||
swapchain = GetSwapChain(device);
|
swapchain = GetSwapChain(device);
|
||||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
||||||
640, 480);
|
640, 480);
|
||||||
|
@ -87,7 +87,7 @@ void initTextures() {
|
|||||||
void init() {
|
void init() {
|
||||||
device = CreateCppDawnDevice();
|
device = CreateCppDawnDevice();
|
||||||
|
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetQueue();
|
||||||
swapchain = GetSwapChain(device);
|
swapchain = GetSwapChain(device);
|
||||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
||||||
640, 480);
|
640, 480);
|
||||||
|
@ -94,7 +94,7 @@ struct CameraData {
|
|||||||
void init() {
|
void init() {
|
||||||
device = CreateCppDawnDevice();
|
device = CreateCppDawnDevice();
|
||||||
|
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetQueue();
|
||||||
swapchain = GetSwapChain(device);
|
swapchain = GetSwapChain(device);
|
||||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
||||||
640, 480);
|
640, 480);
|
||||||
|
@ -308,7 +308,7 @@ int main(int argc, const char* argv[]) {
|
|||||||
dawn::ErrorLog() << errorTypeName << " error: " << message;
|
dawn::ErrorLog() << errorTypeName << " error: " << message;
|
||||||
},
|
},
|
||||||
nullptr);
|
nullptr);
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetQueue();
|
||||||
|
|
||||||
// The hacky pipeline to render a triangle.
|
// The hacky pipeline to render a triangle.
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
||||||
|
@ -287,7 +287,7 @@ namespace dawn_native {
|
|||||||
}
|
}
|
||||||
std::unique_ptr<MapRequestTask> request =
|
std::unique_ptr<MapRequestTask> request =
|
||||||
std::make_unique<MapRequestTask>(this, mLastMapID);
|
std::make_unique<MapRequestTask>(this, mLastMapID);
|
||||||
GetDevice()->GetDefaultQueue()->TrackTask(std::move(request),
|
GetDevice()->GetQueue()->TrackTask(std::move(request),
|
||||||
GetDevice()->GetPendingCommandSerial());
|
GetDevice()->GetPendingCommandSerial());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ namespace dawn_native {
|
|||||||
availabilityDesc.size = querySet->GetQueryCount() * sizeof(uint32_t);
|
availabilityDesc.size = querySet->GetQueryCount() * sizeof(uint32_t);
|
||||||
Ref<BufferBase> availabilityBuffer =
|
Ref<BufferBase> availabilityBuffer =
|
||||||
AcquireRef(device->CreateBuffer(&availabilityDesc));
|
AcquireRef(device->CreateBuffer(&availabilityDesc));
|
||||||
device->GetDefaultQueue()->WriteBuffer(availabilityBuffer.Get(), 0, availability.data(),
|
device->GetQueue()->WriteBuffer(availabilityBuffer.Get(), 0, availability.data(),
|
||||||
querySet->GetQueryCount() * sizeof(uint32_t));
|
querySet->GetQueryCount() * sizeof(uint32_t));
|
||||||
|
|
||||||
// Timestamp params uniform buffer
|
// Timestamp params uniform buffer
|
||||||
@ -429,7 +429,7 @@ namespace dawn_native {
|
|||||||
parmsDesc.usage = wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopyDst;
|
parmsDesc.usage = wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopyDst;
|
||||||
parmsDesc.size = sizeof(params);
|
parmsDesc.size = sizeof(params);
|
||||||
Ref<BufferBase> paramsBuffer = AcquireRef(device->CreateBuffer(&parmsDesc));
|
Ref<BufferBase> paramsBuffer = AcquireRef(device->CreateBuffer(&parmsDesc));
|
||||||
device->GetDefaultQueue()->WriteBuffer(paramsBuffer.Get(), 0, ¶ms, sizeof(params));
|
device->GetQueue()->WriteBuffer(paramsBuffer.Get(), 0, ¶ms, sizeof(params));
|
||||||
|
|
||||||
EncodeConvertTimestampsToNanoseconds(encoder, destination, availabilityBuffer.Get(),
|
EncodeConvertTimestampsToNanoseconds(encoder, destination, availabilityBuffer.Get(),
|
||||||
paramsBuffer.Get());
|
paramsBuffer.Get());
|
||||||
|
@ -243,8 +243,7 @@ namespace dawn_native {
|
|||||||
uniformDesc.size = sizeof(uniformData);
|
uniformDesc.size = sizeof(uniformData);
|
||||||
Ref<BufferBase> uniformBuffer = AcquireRef(device->CreateBuffer(&uniformDesc));
|
Ref<BufferBase> uniformBuffer = AcquireRef(device->CreateBuffer(&uniformDesc));
|
||||||
|
|
||||||
device->GetDefaultQueue()->WriteBuffer(uniformBuffer.Get(), 0, uniformData,
|
device->GetQueue()->WriteBuffer(uniformBuffer.Get(), 0, uniformData, sizeof(uniformData));
|
||||||
sizeof(uniformData));
|
|
||||||
|
|
||||||
// Prepare binding 1 resource: sampler
|
// Prepare binding 1 resource: sampler
|
||||||
// Use default configuration, filterMode set to Nearest for min and mag.
|
// Use default configuration, filterMode set to Nearest for min and mag.
|
||||||
@ -306,7 +305,7 @@ namespace dawn_native {
|
|||||||
CommandBufferBase* submitCommandBuffer = commandBuffer.Get();
|
CommandBufferBase* submitCommandBuffer = commandBuffer.Get();
|
||||||
|
|
||||||
// Submit command buffer.
|
// Submit command buffer.
|
||||||
Ref<QueueBase> queue = AcquireRef(device->GetDefaultQueue());
|
Ref<QueueBase> queue = AcquireRef(device->GetQueue());
|
||||||
queue->Submit(1, &submitCommandBuffer);
|
queue->Submit(1, &submitCommandBuffer);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
@ -97,7 +97,7 @@ namespace dawn_native {
|
|||||||
DeviceBase::~DeviceBase() = default;
|
DeviceBase::~DeviceBase() = default;
|
||||||
|
|
||||||
MaybeError DeviceBase::Initialize(QueueBase* defaultQueue) {
|
MaybeError DeviceBase::Initialize(QueueBase* defaultQueue) {
|
||||||
mDefaultQueue = AcquireRef(defaultQueue);
|
mQueue = AcquireRef(defaultQueue);
|
||||||
mRootErrorScope = AcquireRef(new ErrorScope());
|
mRootErrorScope = AcquireRef(new ErrorScope());
|
||||||
mCurrentErrorScope = mRootErrorScope.Get();
|
mCurrentErrorScope = mRootErrorScope.Get();
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ namespace dawn_native {
|
|||||||
// freed by backends in the ShutDownImpl() call. Still tick the ones that might have
|
// freed by backends in the ShutDownImpl() call. Still tick the ones that might have
|
||||||
// pending callbacks.
|
// pending callbacks.
|
||||||
mErrorScopeTracker->Tick(GetCompletedCommandSerial());
|
mErrorScopeTracker->Tick(GetCompletedCommandSerial());
|
||||||
GetDefaultQueue()->Tick(GetCompletedCommandSerial());
|
GetQueue()->Tick(GetCompletedCommandSerial());
|
||||||
|
|
||||||
mCreateReadyPipelineTracker->ClearForShutDown();
|
mCreateReadyPipelineTracker->ClearForShutDown();
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ namespace dawn_native {
|
|||||||
|
|
||||||
// The device was lost, call the application callback.
|
// The device was lost, call the application callback.
|
||||||
if (type == InternalErrorType::DeviceLost && mDeviceLostCallback != nullptr) {
|
if (type == InternalErrorType::DeviceLost && mDeviceLostCallback != nullptr) {
|
||||||
mDefaultQueue->HandleDeviceLoss();
|
mQueue->HandleDeviceLoss();
|
||||||
|
|
||||||
mDeviceLostCallback(message, mDeviceLostUserdata);
|
mDeviceLostCallback(message, mDeviceLostUserdata);
|
||||||
mDeviceLostCallback = nullptr;
|
mDeviceLostCallback = nullptr;
|
||||||
@ -865,7 +865,7 @@ namespace dawn_native {
|
|||||||
// reclaiming resources one tick earlier.
|
// reclaiming resources one tick earlier.
|
||||||
mDynamicUploader->Deallocate(mCompletedSerial);
|
mDynamicUploader->Deallocate(mCompletedSerial);
|
||||||
mErrorScopeTracker->Tick(mCompletedSerial);
|
mErrorScopeTracker->Tick(mCompletedSerial);
|
||||||
GetDefaultQueue()->Tick(mCompletedSerial);
|
GetQueue()->Tick(mCompletedSerial);
|
||||||
|
|
||||||
mCreateReadyPipelineTracker->Tick(mCompletedSerial);
|
mCreateReadyPipelineTracker->Tick(mCompletedSerial);
|
||||||
}
|
}
|
||||||
@ -886,13 +886,19 @@ namespace dawn_native {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueBase* DeviceBase::GetDefaultQueue() {
|
QueueBase* DeviceBase::GetQueue() {
|
||||||
// Backends gave the default queue during initialization.
|
// Backends gave the primary queue during initialization.
|
||||||
ASSERT(mDefaultQueue != nullptr);
|
ASSERT(mQueue != nullptr);
|
||||||
|
|
||||||
// Returns a new reference to the queue.
|
// Returns a new reference to the queue.
|
||||||
mDefaultQueue->Reference();
|
mQueue->Reference();
|
||||||
return mDefaultQueue.Get();
|
return mQueue.Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
QueueBase* DeviceBase::GetDefaultQueue() {
|
||||||
|
EmitDeprecationWarning(
|
||||||
|
"Device::GetDefaultQueue is deprecated, use Device::GetQueue() instead");
|
||||||
|
return GetQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceBase::ApplyExtensions(const DeviceDescriptor* deviceDescriptor) {
|
void DeviceBase::ApplyExtensions(const DeviceDescriptor* deviceDescriptor) {
|
||||||
|
@ -169,7 +169,9 @@ namespace dawn_native {
|
|||||||
// For Dawn Wire
|
// For Dawn Wire
|
||||||
BufferBase* CreateErrorBuffer();
|
BufferBase* CreateErrorBuffer();
|
||||||
|
|
||||||
|
// TODO(dawn:22): Remove once the deprecation period is finished.
|
||||||
QueueBase* GetDefaultQueue();
|
QueueBase* GetDefaultQueue();
|
||||||
|
QueueBase* GetQueue();
|
||||||
|
|
||||||
void InjectError(wgpu::ErrorType type, const char* message);
|
void InjectError(wgpu::ErrorType type, const char* message);
|
||||||
bool Tick();
|
bool Tick();
|
||||||
@ -384,7 +386,7 @@ namespace dawn_native {
|
|||||||
std::unique_ptr<DynamicUploader> mDynamicUploader;
|
std::unique_ptr<DynamicUploader> mDynamicUploader;
|
||||||
std::unique_ptr<ErrorScopeTracker> mErrorScopeTracker;
|
std::unique_ptr<ErrorScopeTracker> mErrorScopeTracker;
|
||||||
std::unique_ptr<CreateReadyPipelineTracker> mCreateReadyPipelineTracker;
|
std::unique_ptr<CreateReadyPipelineTracker> mCreateReadyPipelineTracker;
|
||||||
Ref<QueueBase> mDefaultQueue;
|
Ref<QueueBase> mQueue;
|
||||||
|
|
||||||
struct DeprecationWarnings;
|
struct DeprecationWarnings;
|
||||||
std::unique_ptr<DeprecationWarnings> mDeprecationWarnings;
|
std::unique_ptr<DeprecationWarnings> mDeprecationWarnings;
|
||||||
|
@ -136,7 +136,7 @@ namespace dawn_native {
|
|||||||
std::make_unique<FenceInFlight>(fence, value);
|
std::make_unique<FenceInFlight>(fence, value);
|
||||||
|
|
||||||
// TODO: use GetLastSubmittedCommandSerial in the future for perforamnce
|
// TODO: use GetLastSubmittedCommandSerial in the future for perforamnce
|
||||||
GetDevice()->GetDefaultQueue()->TrackTask(std::move(fenceInFlight),
|
GetDevice()->GetQueue()->TrackTask(std::move(fenceInFlight),
|
||||||
GetDevice()->GetPendingCommandSerial());
|
GetDevice()->GetPendingCommandSerial());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,25 +196,29 @@ namespace dawn_wire { namespace client {
|
|||||||
return Buffer::CreateError(this);
|
return Buffer::CreateError(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
WGPUQueue Device::GetDefaultQueue() {
|
WGPUQueue Device::GetQueue() {
|
||||||
// The queue is lazily created because if a Device is created by
|
// The queue is lazily created because if a Device is created by
|
||||||
// Reserve/Inject, we cannot send the getDefaultQueue message until
|
// Reserve/Inject, we cannot send the GetQueue message until
|
||||||
// it has been injected on the Server. It cannot happen immediately
|
// it has been injected on the Server. It cannot happen immediately
|
||||||
// on construction.
|
// on construction.
|
||||||
if (mDefaultQueue == nullptr) {
|
if (mQueue == nullptr) {
|
||||||
// Get the default queue for this device.
|
// Get the primary queue for this device.
|
||||||
auto* allocation = client->QueueAllocator().New(client);
|
auto* allocation = client->QueueAllocator().New(client);
|
||||||
mDefaultQueue = allocation->object.get();
|
mQueue = allocation->object.get();
|
||||||
|
|
||||||
DeviceGetDefaultQueueCmd cmd;
|
DeviceGetQueueCmd cmd;
|
||||||
cmd.self = ToAPI(this);
|
cmd.self = ToAPI(this);
|
||||||
cmd.result = ObjectHandle{allocation->object->id, allocation->generation};
|
cmd.result = ObjectHandle{allocation->object->id, allocation->generation};
|
||||||
|
|
||||||
client->SerializeCommand(cmd);
|
client->SerializeCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
mDefaultQueue->refcount++;
|
mQueue->refcount++;
|
||||||
return ToAPI(mDefaultQueue);
|
return ToAPI(mQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
WGPUQueue Device::GetDefaultQueue() {
|
||||||
|
return GetQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::CreateReadyComputePipeline(WGPUComputePipelineDescriptor const* descriptor,
|
void Device::CreateReadyComputePipeline(WGPUComputePipelineDescriptor const* descriptor,
|
||||||
|
@ -61,7 +61,9 @@ namespace dawn_wire { namespace client {
|
|||||||
WGPUCreateReadyPipelineStatus status,
|
WGPUCreateReadyPipelineStatus status,
|
||||||
const char* message);
|
const char* message);
|
||||||
|
|
||||||
|
// TODO(dawn:22): Remove once the deprecation period is finished.
|
||||||
WGPUQueue GetDefaultQueue();
|
WGPUQueue GetDefaultQueue();
|
||||||
|
WGPUQueue GetQueue();
|
||||||
|
|
||||||
void CancelCallbacksForDisconnect() override;
|
void CancelCallbacksForDisconnect() override;
|
||||||
|
|
||||||
@ -91,7 +93,7 @@ namespace dawn_wire { namespace client {
|
|||||||
void* mErrorUserdata = nullptr;
|
void* mErrorUserdata = nullptr;
|
||||||
void* mDeviceLostUserdata = nullptr;
|
void* mDeviceLostUserdata = nullptr;
|
||||||
|
|
||||||
Queue* mDefaultQueue = nullptr;
|
Queue* mQueue = nullptr;
|
||||||
|
|
||||||
std::shared_ptr<bool> mIsAlive;
|
std::shared_ptr<bool> mIsAlive;
|
||||||
};
|
};
|
||||||
|
@ -163,7 +163,7 @@ int DawnWireServerFuzzer::Run(const uint8_t* data,
|
|||||||
// Wait for all previous commands before destroying the server.
|
// Wait for all previous commands before destroying the server.
|
||||||
// TODO(enga): Improve this when we improve/finalize how processing events happens.
|
// TODO(enga): Improve this when we improve/finalize how processing events happens.
|
||||||
{
|
{
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
wgpu::Fence fence = queue.CreateFence();
|
wgpu::Fence fence = queue.CreateFence();
|
||||||
queue.Signal(fence, 1u);
|
queue.Signal(fence, 1u);
|
||||||
fence.OnCompletion(1u, CommandsCompleteCallback, 0);
|
fence.OnCompletion(1u, CommandsCompleteCallback, 0);
|
||||||
|
@ -828,7 +828,7 @@ void DawnTestBase::SetUp() {
|
|||||||
"_" + ::testing::UnitTest::GetInstance()->current_test_info()->name();
|
"_" + ::testing::UnitTest::GetInstance()->current_test_info()->name();
|
||||||
mWireHelper->BeginWireTrace(traceName.c_str());
|
mWireHelper->BeginWireTrace(traceName.c_str());
|
||||||
|
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetQueue();
|
||||||
|
|
||||||
device.SetUncapturedErrorCallback(OnDeviceError, this);
|
device.SetUncapturedErrorCallback(OnDeviceError, this);
|
||||||
device.SetDeviceLostCallback(OnDeviceLost, this);
|
device.SetDeviceLostCallback(OnDeviceLost, this);
|
||||||
@ -994,7 +994,7 @@ void DawnTestBase::FlushWire() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DawnTestBase::WaitForAllOperations() {
|
void DawnTestBase::WaitForAllOperations() {
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
wgpu::Fence fence = queue.CreateFence();
|
wgpu::Fence fence = queue.CreateFence();
|
||||||
|
|
||||||
// Force the currently submitted operations to completed.
|
// Force the currently submitted operations to completed.
|
||||||
|
@ -105,7 +105,7 @@ class CopyTextureForBrowserTests : public DawnTest {
|
|||||||
textureDataLayout.bytesPerRow = copyLayout.bytesPerRow;
|
textureDataLayout.bytesPerRow = copyLayout.bytesPerRow;
|
||||||
textureDataLayout.rowsPerImage = copyLayout.rowsPerImage;
|
textureDataLayout.rowsPerImage = copyLayout.rowsPerImage;
|
||||||
|
|
||||||
device.GetDefaultQueue().WriteTexture(&textureCopyView, textureArrayCopyData.data(),
|
device.GetQueue().WriteTexture(&textureCopyView, textureArrayCopyData.data(),
|
||||||
textureArrayCopyData.size() * sizeof(RGBA8),
|
textureArrayCopyData.size() * sizeof(RGBA8),
|
||||||
&textureDataLayout, ©Layout.mipSize);
|
&textureDataLayout, ©Layout.mipSize);
|
||||||
|
|
||||||
@ -120,8 +120,8 @@ class CopyTextureForBrowserTests : public DawnTest {
|
|||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
|
|
||||||
// Perform a copy here for testing.
|
// Perform a copy here for testing.
|
||||||
device.GetDefaultQueue().CopyTextureForBrowser(&srcTextureCopyView, &dstTextureCopyView,
|
device.GetQueue().CopyTextureForBrowser(&srcTextureCopyView, &dstTextureCopyView, ©Size,
|
||||||
©Size, options);
|
options);
|
||||||
|
|
||||||
// Texels in single slice.
|
// Texels in single slice.
|
||||||
const uint32_t texelCountInCopyRegion = utils::GetTexelCountInCopyRegion(
|
const uint32_t texelCountInCopyRegion = utils::GetTexelCountInCopyRegion(
|
||||||
|
@ -151,6 +151,19 @@ TEST_P(DeprecationTests, BindGroupLayoutEntryViewDimensionDefaulting) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test Device::GetDefaultQueue deprecation.
|
||||||
|
TEST_P(DeprecationTests, GetDefaultQueueDeprecation) {
|
||||||
|
// Using GetDefaultQueue emits a warning.
|
||||||
|
wgpu::Queue deprecatedQueue;
|
||||||
|
EXPECT_DEPRECATION_WARNING(deprecatedQueue = device.GetDefaultQueue());
|
||||||
|
|
||||||
|
// Using GetQueue doesn't emit a warning.
|
||||||
|
wgpu::Queue queue = device.GetQueue();
|
||||||
|
|
||||||
|
// Both objects are the same, even with dawn_wire.
|
||||||
|
EXPECT_EQ(deprecatedQueue.Get(), queue.Get());
|
||||||
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
DAWN_INSTANTIATE_TEST(DeprecationTests,
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
|
@ -79,7 +79,7 @@ TEST_F(DeviceInitializationTest, DeviceOutlivesInstance) {
|
|||||||
encoder.CopyBufferToBuffer(src, 0, dst, 0, 4 * sizeof(uint32_t));
|
encoder.CopyBufferToBuffer(src, 0, dst, 0, 4 * sizeof(uint32_t));
|
||||||
|
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
device.GetDefaultQueue().Submit(1, &commands);
|
device.GetQueue().Submit(1, &commands);
|
||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
dst.MapAsync(
|
dst.MapAsync(
|
||||||
|
@ -26,10 +26,10 @@
|
|||||||
|
|
||||||
class QueueTests : public DawnTest {};
|
class QueueTests : public DawnTest {};
|
||||||
|
|
||||||
// Test that GetDefaultQueue always returns the same object.
|
// Test that GetQueue always returns the same object.
|
||||||
TEST_P(QueueTests, GetDefaultQueueSameObject) {
|
TEST_P(QueueTests, GetQueueSameObject) {
|
||||||
wgpu::Queue q1 = device.GetDefaultQueue();
|
wgpu::Queue q1 = device.GetQueue();
|
||||||
wgpu::Queue q2 = device.GetDefaultQueue();
|
wgpu::Queue q2 = device.GetQueue();
|
||||||
EXPECT_EQ(q1.Get(), q2.Get());
|
EXPECT_EQ(q1.Get(), q2.Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class BufferValidationTest : public ValidationTest {
|
|||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
mockBufferMapAsyncCallback = std::make_unique<MockBufferMapAsyncCallback>();
|
mockBufferMapAsyncCallback = std::make_unique<MockBufferMapAsyncCallback>();
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {
|
void TearDown() override {
|
||||||
|
@ -143,7 +143,7 @@ TEST_F(ErrorScopeValidationTest, PushPopBalanced) {
|
|||||||
// Test that error scopes do not call their callbacks until after an enclosed Queue::Submit
|
// Test that error scopes do not call their callbacks until after an enclosed Queue::Submit
|
||||||
// completes
|
// completes
|
||||||
TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmit) {
|
TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmit) {
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
|
|
||||||
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
||||||
queue.Submit(0, nullptr);
|
queue.Submit(0, nullptr);
|
||||||
@ -159,7 +159,7 @@ TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmit) {
|
|||||||
// Test that parent error scopes do not call their callbacks until after an enclosed Queue::Submit
|
// Test that parent error scopes do not call their callbacks until after an enclosed Queue::Submit
|
||||||
// completes
|
// completes
|
||||||
TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmitNested) {
|
TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmitNested) {
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
|
|
||||||
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
||||||
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
||||||
@ -178,7 +178,7 @@ TEST_F(ErrorScopeValidationTest, CallbackAfterQueueSubmitNested) {
|
|||||||
|
|
||||||
// Test a callback that returns asynchronously followed by a synchronous one
|
// Test a callback that returns asynchronously followed by a synchronous one
|
||||||
TEST_F(ErrorScopeValidationTest, AsynchronousThenSynchronous) {
|
TEST_F(ErrorScopeValidationTest, AsynchronousThenSynchronous) {
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
|
|
||||||
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
||||||
queue.Submit(0, nullptr);
|
queue.Submit(0, nullptr);
|
||||||
@ -202,7 +202,7 @@ TEST_F(ErrorScopeValidationTest, DeviceDestroyedBeforeCallback) {
|
|||||||
// TODO(crbug.com/dawn/652): This has different behavior on the wire and should be consistent.
|
// TODO(crbug.com/dawn/652): This has different behavior on the wire and should be consistent.
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
|
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
|
|
||||||
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
device.PushErrorScope(wgpu::ErrorFilter::OutOfMemory);
|
||||||
queue.Submit(0, nullptr);
|
queue.Submit(0, nullptr);
|
||||||
|
@ -53,7 +53,7 @@ class FenceValidationTest : public ValidationTest {
|
|||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
mockFenceOnCompletionCallback = std::make_unique<MockFenceOnCompletionCallback>();
|
mockFenceOnCompletionCallback = std::make_unique<MockFenceOnCompletionCallback>();
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {
|
void TearDown() override {
|
||||||
@ -194,7 +194,7 @@ TEST_F(FenceValidationTest, SignalSuccess) {
|
|||||||
// Test it is invalid to signal a fence on a different queue than it was created on
|
// Test it is invalid to signal a fence on a different queue than it was created on
|
||||||
// DISABLED until we have support for multiple queues
|
// DISABLED until we have support for multiple queues
|
||||||
TEST_F(FenceValidationTest, DISABLED_SignalWrongQueue) {
|
TEST_F(FenceValidationTest, DISABLED_SignalWrongQueue) {
|
||||||
wgpu::Queue queue2 = device.GetDefaultQueue();
|
wgpu::Queue queue2 = device.GetQueue();
|
||||||
|
|
||||||
wgpu::FenceDescriptor descriptor;
|
wgpu::FenceDescriptor descriptor;
|
||||||
descriptor.initialValue = 1;
|
descriptor.initialValue = 1;
|
||||||
@ -206,7 +206,7 @@ TEST_F(FenceValidationTest, DISABLED_SignalWrongQueue) {
|
|||||||
// Test that signaling a fence on a wrong queue does not update fence signaled value
|
// Test that signaling a fence on a wrong queue does not update fence signaled value
|
||||||
// DISABLED until we have support for multiple queues
|
// DISABLED until we have support for multiple queues
|
||||||
TEST_F(FenceValidationTest, DISABLED_SignalWrongQueueDoesNotUpdateValue) {
|
TEST_F(FenceValidationTest, DISABLED_SignalWrongQueueDoesNotUpdateValue) {
|
||||||
wgpu::Queue queue2 = device.GetDefaultQueue();
|
wgpu::Queue queue2 = device.GetQueue();
|
||||||
|
|
||||||
wgpu::FenceDescriptor descriptor;
|
wgpu::FenceDescriptor descriptor;
|
||||||
descriptor.initialValue = 1;
|
descriptor.initialValue = 1;
|
||||||
|
@ -133,7 +133,7 @@ TEST_F(OcclusionQueryValidationTest, InvalidOcclusionQuerySet) {
|
|||||||
pass.EndOcclusionQuery();
|
pass.EndOcclusionQuery();
|
||||||
pass.EndPass();
|
pass.EndPass();
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
occlusionQuerySet.Destroy();
|
occlusionQuerySet.Destroy();
|
||||||
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ TEST_F(TimestampQueryValidationTest, WriteTimestampOnCommandEncoder) {
|
|||||||
encoder.WriteTimestamp(timestampQuerySet, 0);
|
encoder.WriteTimestamp(timestampQuerySet, 0);
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
|
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
timestampQuerySet.Destroy();
|
timestampQuerySet.Destroy();
|
||||||
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@ TEST_F(TimestampQueryValidationTest, WriteTimestampOnComputePassEncoder) {
|
|||||||
pass.EndPass();
|
pass.EndPass();
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
|
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
timestampQuerySet.Destroy();
|
timestampQuerySet.Destroy();
|
||||||
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
||||||
}
|
}
|
||||||
@ -419,7 +419,7 @@ TEST_F(TimestampQueryValidationTest, WriteTimestampOnRenderPassEncoder) {
|
|||||||
pass.EndPass();
|
pass.EndPass();
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
|
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
timestampQuerySet.Destroy();
|
timestampQuerySet.Destroy();
|
||||||
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
||||||
}
|
}
|
||||||
@ -517,7 +517,7 @@ TEST_F(ResolveQuerySetValidationTest, ResolveInvalidQuerySetAndIndexCount) {
|
|||||||
encoder.ResolveQuerySet(querySet, 0, kQueryCount, destination, 0);
|
encoder.ResolveQuerySet(querySet, 0, kQueryCount, destination, 0);
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
|
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,7 +542,7 @@ TEST_F(ResolveQuerySetValidationTest, ResolveInvalidQuerySetAndIndexCount) {
|
|||||||
encoder.ResolveQuerySet(querySet, 0, kQueryCount, destination, 0);
|
encoder.ResolveQuerySet(querySet, 0, kQueryCount, destination, 0);
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
|
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
querySet.Destroy();
|
querySet.Destroy();
|
||||||
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
||||||
}
|
}
|
||||||
@ -562,7 +562,7 @@ TEST_F(ResolveQuerySetValidationTest, ResolveToInvalidBufferAndOffset) {
|
|||||||
encoder.ResolveQuerySet(querySet, 1, kQueryCount - 1, destination, 8);
|
encoder.ResolveQuerySet(querySet, 1, kQueryCount - 1, destination, 8);
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
|
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +611,7 @@ TEST_F(ResolveQuerySetValidationTest, ResolveToInvalidBufferAndOffset) {
|
|||||||
encoder.ResolveQuerySet(querySet, 0, kQueryCount, destination, 0);
|
encoder.ResolveQuerySet(querySet, 0, kQueryCount, destination, 0);
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
|
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
destination.Destroy();
|
destination.Destroy();
|
||||||
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace {
|
|||||||
commands = encoder.Finish();
|
commands = encoder.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
|
|
||||||
// Submitting when the buffer has never been mapped should succeed
|
// Submitting when the buffer has never been mapped should succeed
|
||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
@ -84,7 +84,7 @@ namespace {
|
|||||||
private:
|
private:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -193,7 +193,7 @@ namespace {
|
|||||||
// Test it is invalid to submit a command buffer twice
|
// Test it is invalid to submit a command buffer twice
|
||||||
TEST_F(QueueSubmitValidationTest, CommandBufferSubmittedTwice) {
|
TEST_F(QueueSubmitValidationTest, CommandBufferSubmittedTwice) {
|
||||||
wgpu::CommandBuffer commandBuffer = device.CreateCommandEncoder().Finish();
|
wgpu::CommandBuffer commandBuffer = device.CreateCommandEncoder().Finish();
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
|
|
||||||
// Should succeed
|
// Should succeed
|
||||||
queue.Submit(1, &commandBuffer);
|
queue.Submit(1, &commandBuffer);
|
||||||
@ -224,7 +224,7 @@ namespace {
|
|||||||
commands = encoder.Finish();
|
commands = encoder.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
|
|
||||||
// Map the source buffer to force a failure
|
// Map the source buffer to force a failure
|
||||||
buffer.MapAsync(wgpu::MapMode::Write, 0, kBufferSize, nullptr, nullptr);
|
buffer.MapAsync(wgpu::MapMode::Write, 0, kBufferSize, nullptr, nullptr);
|
||||||
|
@ -25,7 +25,7 @@ namespace {
|
|||||||
private:
|
private:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -26,7 +26,7 @@ namespace {
|
|||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
ValidationTest::SetUp();
|
ValidationTest::SetUp();
|
||||||
|
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::TextureDescriptor CreateDefaultTextureDescriptor() {
|
wgpu::TextureDescriptor CreateDefaultTextureDescriptor() {
|
||||||
|
@ -123,7 +123,7 @@ void ValidationTest::FlushWire() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ValidationTest::WaitForAllOperations(const wgpu::Device& device) {
|
void ValidationTest::WaitForAllOperations(const wgpu::Device& device) {
|
||||||
wgpu::Queue queue = device.GetDefaultQueue();
|
wgpu::Queue queue = device.GetQueue();
|
||||||
wgpu::Fence fence = queue.CreateFence();
|
wgpu::Fence fence = queue.CreateFence();
|
||||||
|
|
||||||
// Force the currently submitted operations to completed.
|
// Force the currently submitted operations to completed.
|
||||||
|
@ -231,9 +231,9 @@ TEST_F(WireFenceTests, DestroyBeforeOnCompletionEnd) {
|
|||||||
// Test that signaling a fence on a wrong queue is invalid
|
// Test that signaling a fence on a wrong queue is invalid
|
||||||
// DISABLED until we have support for multiple queues.
|
// DISABLED until we have support for multiple queues.
|
||||||
TEST_F(WireFenceTests, DISABLED_SignalWrongQueue) {
|
TEST_F(WireFenceTests, DISABLED_SignalWrongQueue) {
|
||||||
WGPUQueue queue2 = wgpuDeviceGetDefaultQueue(device);
|
WGPUQueue queue2 = wgpuDeviceGetQueue(device);
|
||||||
WGPUQueue apiQueue2 = api.GetNewQueue();
|
WGPUQueue apiQueue2 = api.GetNewQueue();
|
||||||
EXPECT_CALL(api, DeviceGetDefaultQueue(apiDevice)).WillOnce(Return(apiQueue2));
|
EXPECT_CALL(api, DeviceGetQueue(apiDevice)).WillOnce(Return(apiQueue2));
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
wgpuQueueSignal(queue2, fence, 2u); // error
|
wgpuQueueSignal(queue2, fence, 2u); // error
|
||||||
@ -245,9 +245,9 @@ TEST_F(WireFenceTests, DISABLED_SignalWrongQueue) {
|
|||||||
// Test that signaling a fence on a wrong queue does not update fence signaled value
|
// Test that signaling a fence on a wrong queue does not update fence signaled value
|
||||||
// DISABLED until we have support for multiple queues.
|
// DISABLED until we have support for multiple queues.
|
||||||
TEST_F(WireFenceTests, DISABLED_SignalWrongQueueDoesNotUpdateValue) {
|
TEST_F(WireFenceTests, DISABLED_SignalWrongQueueDoesNotUpdateValue) {
|
||||||
WGPUQueue queue2 = wgpuDeviceGetDefaultQueue(device);
|
WGPUQueue queue2 = wgpuDeviceGetQueue(device);
|
||||||
WGPUQueue apiQueue2 = api.GetNewQueue();
|
WGPUQueue apiQueue2 = api.GetNewQueue();
|
||||||
EXPECT_CALL(api, DeviceGetDefaultQueue(apiDevice)).WillOnce(Return(apiQueue2));
|
EXPECT_CALL(api, DeviceGetQueue(apiDevice)).WillOnce(Return(apiQueue2));
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
wgpuQueueSignal(queue2, fence, 2u); // error
|
wgpuQueueSignal(queue2, fence, 2u); // error
|
||||||
|
@ -107,16 +107,16 @@ TEST_F(WireInjectDeviceTests, InjectedDeviceLifetime) {
|
|||||||
Mock::VerifyAndClearExpectations(&api);
|
Mock::VerifyAndClearExpectations(&api);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that it is an error to get the default queue of a device before it has been
|
// Test that it is an error to get the primary queue of a device before it has been
|
||||||
// injected on the server.
|
// injected on the server.
|
||||||
TEST_F(WireInjectDeviceTests, GetQueueBeforeInject) {
|
TEST_F(WireInjectDeviceTests, GetQueueBeforeInject) {
|
||||||
ReservedDevice reservation = GetWireClient()->ReserveDevice();
|
ReservedDevice reservation = GetWireClient()->ReserveDevice();
|
||||||
|
|
||||||
wgpuDeviceGetDefaultQueue(reservation.device);
|
wgpuDeviceGetQueue(reservation.device);
|
||||||
FlushClient(false);
|
FlushClient(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that it is valid to get the default queue of a device after it has been
|
// Test that it is valid to get the primary queue of a device after it has been
|
||||||
// injected on the server.
|
// injected on the server.
|
||||||
TEST_F(WireInjectDeviceTests, GetQueueAfterInject) {
|
TEST_F(WireInjectDeviceTests, GetQueueAfterInject) {
|
||||||
ReservedDevice reservation = GetWireClient()->ReserveDevice();
|
ReservedDevice reservation = GetWireClient()->ReserveDevice();
|
||||||
@ -128,10 +128,10 @@ TEST_F(WireInjectDeviceTests, GetQueueAfterInject) {
|
|||||||
ASSERT_TRUE(
|
ASSERT_TRUE(
|
||||||
GetWireServer()->InjectDevice(serverDevice, reservation.id, reservation.generation));
|
GetWireServer()->InjectDevice(serverDevice, reservation.id, reservation.generation));
|
||||||
|
|
||||||
wgpuDeviceGetDefaultQueue(reservation.device);
|
wgpuDeviceGetQueue(reservation.device);
|
||||||
|
|
||||||
WGPUQueue apiQueue = api.GetNewQueue();
|
WGPUQueue apiQueue = api.GetNewQueue();
|
||||||
EXPECT_CALL(api, DeviceGetDefaultQueue(serverDevice)).WillOnce(Return(apiQueue));
|
EXPECT_CALL(api, DeviceGetQueue(serverDevice)).WillOnce(Return(apiQueue));
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
// Called on shutdown.
|
// Called on shutdown.
|
||||||
@ -187,7 +187,7 @@ TEST_F(WireInjectDeviceTests, ReflectLiveDevices) {
|
|||||||
// KnownObjects std::vector of devices. The fix was to store pointers to heap allocated
|
// KnownObjects std::vector of devices. The fix was to store pointers to heap allocated
|
||||||
// objects instead.
|
// objects instead.
|
||||||
TEST_F(WireInjectDeviceTests, TrackChildObjectsWithTwoReservedDevices) {
|
TEST_F(WireInjectDeviceTests, TrackChildObjectsWithTwoReservedDevices) {
|
||||||
// Reserve one device, inject it, and get the default queue.
|
// Reserve one device, inject it, and get the primary queue.
|
||||||
ReservedDevice reservation1 = GetWireClient()->ReserveDevice();
|
ReservedDevice reservation1 = GetWireClient()->ReserveDevice();
|
||||||
|
|
||||||
WGPUDevice serverDevice1 = api.GetNewDevice();
|
WGPUDevice serverDevice1 = api.GetNewDevice();
|
||||||
|
@ -70,10 +70,10 @@ class WireMultipleDeviceTests : public testing::Test {
|
|||||||
|
|
||||||
mClientDevice = mWireClient->GetDevice();
|
mClientDevice = mWireClient->GetDevice();
|
||||||
|
|
||||||
// The GetDefaultQueue is done on WireClient startup so we expect it now.
|
// The GetQueue is done on WireClient startup so we expect it now.
|
||||||
mClientQueue = wgpuDeviceGetDefaultQueue(mClientDevice);
|
mClientQueue = wgpuDeviceGetQueue(mClientDevice);
|
||||||
mServerQueue = mApi.GetNewQueue();
|
mServerQueue = mApi.GetNewQueue();
|
||||||
EXPECT_CALL(mApi, DeviceGetDefaultQueue(mServerDevice)).WillOnce(Return(mServerQueue));
|
EXPECT_CALL(mApi, DeviceGetQueue(mServerDevice)).WillOnce(Return(mServerQueue));
|
||||||
FlushClient();
|
FlushClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,10 +71,10 @@ void WireTest::SetUp() {
|
|||||||
|
|
||||||
apiDevice = mockDevice;
|
apiDevice = mockDevice;
|
||||||
|
|
||||||
// The GetDefaultQueue is done on WireClient startup so we expect it now.
|
// The GetQueue is done on WireClient startup so we expect it now.
|
||||||
queue = wgpuDeviceGetDefaultQueue(device);
|
queue = wgpuDeviceGetQueue(device);
|
||||||
apiQueue = api.GetNewQueue();
|
apiQueue = api.GetNewQueue();
|
||||||
EXPECT_CALL(api, DeviceGetDefaultQueue(apiDevice)).WillOnce(Return(apiQueue));
|
EXPECT_CALL(api, DeviceGetQueue(apiDevice)).WillOnce(Return(apiQueue));
|
||||||
FlushClient();
|
FlushClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
|
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
|
|
||||||
wgpu::Queue queue = dawnDevice.GetDefaultQueue();
|
wgpu::Queue queue = dawnDevice.GetQueue();
|
||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
ClearImage(secondDevice, copySrcTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f});
|
ClearImage(secondDevice, copySrcTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f});
|
||||||
|
|
||||||
// Copy color B on |secondDevice|
|
// Copy color B on |secondDevice|
|
||||||
wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
|
wgpu::Queue secondDeviceQueue = secondDevice.GetQueue();
|
||||||
SimpleCopyTextureToTexture(secondDevice, secondDeviceQueue, copySrcTexture,
|
SimpleCopyTextureToTexture(secondDevice, secondDeviceQueue, copySrcTexture,
|
||||||
secondDeviceWrappedTexture);
|
secondDeviceWrappedTexture);
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
exportInfo.releasedOldLayout, exportInfo.releasedNewLayout);
|
exportInfo.releasedOldLayout, exportInfo.releasedNewLayout);
|
||||||
|
|
||||||
// Copy color B on |secondDevice|
|
// Copy color B on |secondDevice|
|
||||||
wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
|
wgpu::Queue secondDeviceQueue = secondDevice.GetQueue();
|
||||||
|
|
||||||
// Create a buffer on |secondDevice|
|
// Create a buffer on |secondDevice|
|
||||||
wgpu::Buffer copySrcBuffer =
|
wgpu::Buffer copySrcBuffer =
|
||||||
@ -681,8 +681,8 @@ namespace dawn_native { namespace vulkan {
|
|||||||
wgpu::Device::Acquire(reinterpret_cast<WGPUDevice>(thirdDeviceVk));
|
wgpu::Device::Acquire(reinterpret_cast<WGPUDevice>(thirdDeviceVk));
|
||||||
|
|
||||||
// Make queue for device 2 and 3
|
// Make queue for device 2 and 3
|
||||||
wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
|
wgpu::Queue secondDeviceQueue = secondDevice.GetQueue();
|
||||||
wgpu::Queue thirdDeviceQueue = thirdDevice.GetDefaultQueue();
|
wgpu::Queue thirdDeviceQueue = thirdDevice.GetQueue();
|
||||||
|
|
||||||
// Create BOs for A, B, C
|
// Create BOs for A, B, C
|
||||||
gbm_bo* gbmBoA = CreateGbmBo(1, 1, true /* linear */);
|
gbm_bo* gbmBoA = CreateGbmBo(1, 1, true /* linear */);
|
||||||
@ -781,7 +781,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
textures.push_back(device.CreateTexture(&descriptor));
|
textures.push_back(device.CreateTexture(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
|
wgpu::Queue secondDeviceQueue = secondDevice.GetQueue();
|
||||||
|
|
||||||
// Make an image on |secondDevice|
|
// Make an image on |secondDevice|
|
||||||
gbm_bo* gbmBo = CreateGbmBo(640, 480, false /* linear */);
|
gbm_bo* gbmBo = CreateGbmBo(640, 480, false /* linear */);
|
||||||
|
@ -446,7 +446,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
|
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
|
|
||||||
wgpu::Queue queue = dawnDevice.GetDefaultQueue();
|
wgpu::Queue queue = dawnDevice.GetQueue();
|
||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,7 +610,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
ClearImage(secondDevice, copySrcTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f});
|
ClearImage(secondDevice, copySrcTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f});
|
||||||
|
|
||||||
// Copy color B on |secondDevice|
|
// Copy color B on |secondDevice|
|
||||||
wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
|
wgpu::Queue secondDeviceQueue = secondDevice.GetQueue();
|
||||||
SimpleCopyTextureToTexture(secondDevice, secondDeviceQueue, copySrcTexture,
|
SimpleCopyTextureToTexture(secondDevice, secondDeviceQueue, copySrcTexture,
|
||||||
secondDeviceWrappedTexture);
|
secondDeviceWrappedTexture);
|
||||||
|
|
||||||
@ -714,7 +714,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
exportInfo.releasedOldLayout, exportInfo.releasedNewLayout);
|
exportInfo.releasedOldLayout, exportInfo.releasedNewLayout);
|
||||||
|
|
||||||
// Copy color B on |secondDevice|
|
// Copy color B on |secondDevice|
|
||||||
wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
|
wgpu::Queue secondDeviceQueue = secondDevice.GetQueue();
|
||||||
|
|
||||||
// Create a buffer on |secondDevice|
|
// Create a buffer on |secondDevice|
|
||||||
wgpu::Buffer copySrcBuffer =
|
wgpu::Buffer copySrcBuffer =
|
||||||
@ -821,8 +821,8 @@ namespace dawn_native { namespace vulkan {
|
|||||||
wgpu::Device::Acquire(reinterpret_cast<WGPUDevice>(thirdDeviceVk));
|
wgpu::Device::Acquire(reinterpret_cast<WGPUDevice>(thirdDeviceVk));
|
||||||
|
|
||||||
// Make queue for device 2 and 3
|
// Make queue for device 2 and 3
|
||||||
wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
|
wgpu::Queue secondDeviceQueue = secondDevice.GetQueue();
|
||||||
wgpu::Queue thirdDeviceQueue = thirdDevice.GetDefaultQueue();
|
wgpu::Queue thirdDeviceQueue = thirdDevice.GetQueue();
|
||||||
|
|
||||||
// Allocate memory for A, B, C
|
// Allocate memory for A, B, C
|
||||||
VkImage imageA;
|
VkImage imageA;
|
||||||
@ -941,7 +941,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
textures.push_back(device.CreateTexture(&descriptor));
|
textures.push_back(device.CreateTexture(&descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::Queue secondDeviceQueue = secondDevice.GetDefaultQueue();
|
wgpu::Queue secondDeviceQueue = secondDevice.GetQueue();
|
||||||
|
|
||||||
// Make an image on |secondDevice|
|
// Make an image on |secondDevice|
|
||||||
VkImage imageA;
|
VkImage imageA;
|
||||||
|
@ -129,7 +129,7 @@ namespace utils {
|
|||||||
wgpu::Extent3D copyExtent = {1, 1, 1};
|
wgpu::Extent3D copyExtent = {1, 1, 1};
|
||||||
|
|
||||||
// WriteTexture with exactly 1 byte of data.
|
// WriteTexture with exactly 1 byte of data.
|
||||||
device.GetDefaultQueue().WriteTexture(&textureCopyView, data.data(), 1, &textureDataLayout,
|
device.GetQueue().WriteTexture(&textureCopyView, data.data(), 1, &textureDataLayout,
|
||||||
©Extent);
|
©Extent);
|
||||||
}
|
}
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
@ -170,7 +170,7 @@ namespace utils {
|
|||||||
descriptor.usage = usage | wgpu::BufferUsage::CopyDst;
|
descriptor.usage = usage | wgpu::BufferUsage::CopyDst;
|
||||||
wgpu::Buffer buffer = device.CreateBuffer(&descriptor);
|
wgpu::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||||
|
|
||||||
device.GetDefaultQueue().WriteBuffer(buffer, 0, data, size);
|
device.GetQueue().WriteBuffer(buffer, 0, data, size);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user