Add Device::CreateQueue() instead of the builder

We are changing all object creation to use descriptors but there is no
creation argument to pass for queue, so instead Device::CreateQueue
takes no argument.
This commit is contained in:
Corentin Wallez 2018-06-14 20:26:27 -04:00 committed by Corentin Wallez
parent 40e72d79ca
commit b703def640
35 changed files with 65 additions and 115 deletions

View File

@ -46,7 +46,7 @@ static std::vector<ShaderData> shaderData;
void init() { void init() {
device = CreateCppNXTDevice(); device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), swapchain.Configure(GetPreferredSwapChainTextureFormat(),
nxt::TextureUsageBit::OutputAttachment, 640, 480); nxt::TextureUsageBit::OutputAttachment, 640, 480);

View File

@ -26,12 +26,7 @@ nxtTextureFormat swapChainFormat;
void init() { void init() {
device = CreateCppNXTDevice().Release(); device = CreateCppNXTDevice().Release();
queue = nxtDeviceCreateQueue(device);
{
nxtQueueBuilder builder = nxtDeviceCreateQueueBuilder(device);
queue = nxtQueueBuilderGetResult(builder);
nxtQueueBuilderRelease(builder);
}
{ {
nxtSwapChainBuilder builder = nxtDeviceCreateSwapChainBuilder(device); nxtSwapChainBuilder builder = nxtDeviceCreateSwapChainBuilder(device);

View File

@ -286,7 +286,7 @@ nxt::CommandBuffer createCommandBuffer(const nxt::RenderPassDescriptor& renderPa
void init() { void init() {
device = CreateCppNXTDevice(); device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), swapchain.Configure(GetPreferredSwapChainTextureFormat(),
nxt::TextureUsageBit::OutputAttachment, 640, 480); nxt::TextureUsageBit::OutputAttachment, 640, 480);

View File

@ -32,7 +32,7 @@ nxt::BindGroup computeBindGroup;
void init() { void init() {
device = CreateCppNXTDevice(); device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), swapchain.Configure(GetPreferredSwapChainTextureFormat(),
nxt::TextureUsageBit::OutputAttachment, 640, 480); nxt::TextureUsageBit::OutputAttachment, 640, 480);

View File

@ -113,7 +113,7 @@ struct CameraData {
void init() { void init() {
device = CreateCppNXTDevice(); device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), swapchain.Configure(GetPreferredSwapChainTextureFormat(),
nxt::TextureUsageBit::OutputAttachment, 640, 480); nxt::TextureUsageBit::OutputAttachment, 640, 480);

View File

@ -46,7 +46,7 @@ void initBuffers() {
void init() { void init() {
device = CreateCppNXTDevice(); device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), swapchain.Configure(GetPreferredSwapChainTextureFormat(),
nxt::TextureUsageBit::OutputAttachment, 640, 480); nxt::TextureUsageBit::OutputAttachment, 640, 480);

View File

@ -49,7 +49,7 @@ void initBuffers() {
void init() { void init() {
device = CreateCppNXTDevice(); device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), swapchain.Configure(GetPreferredSwapChainTextureFormat(),
nxt::TextureUsageBit::OutputAttachment, 640, 480); nxt::TextureUsageBit::OutputAttachment, 640, 480);

View File

@ -79,7 +79,7 @@ void initTextures() {
void init() { void init() {
device = CreateCppNXTDevice(); device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), swapchain.Configure(GetPreferredSwapChainTextureFormat(),
nxt::TextureUsageBit::OutputAttachment, 640, 480); nxt::TextureUsageBit::OutputAttachment, 640, 480);

View File

@ -30,7 +30,7 @@ struct {uint32_t a; float b;} s;
void init() { void init() {
device = CreateCppNXTDevice(); device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), swapchain.Configure(GetPreferredSwapChainTextureFormat(),
nxt::TextureUsageBit::OutputAttachment, 640, 480); nxt::TextureUsageBit::OutputAttachment, 640, 480);

View File

@ -40,7 +40,7 @@ void initBuffers() {
void init() { void init() {
device = CreateCppNXTDevice(); device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), swapchain.Configure(GetPreferredSwapChainTextureFormat(),
nxt::TextureUsageBit::OutputAttachment, 640, 480); nxt::TextureUsageBit::OutputAttachment, 640, 480);

View File

@ -150,7 +150,7 @@ void initPipelinePost() {
void init() { void init() {
device = CreateCppNXTDevice(); device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), swapchain.Configure(GetPreferredSwapChainTextureFormat(),
nxt::TextureUsageBit::OutputAttachment, 640, 480); nxt::TextureUsageBit::OutputAttachment, 640, 480);

View File

@ -458,7 +458,7 @@ namespace {
void init() { void init() {
device = CreateCppNXTDevice(); device = CreateCppNXTDevice();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
swapchain = GetSwapChain(device); swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), swapchain.Configure(GetPreferredSwapChainTextureFormat(),
nxt::TextureUsageBit::OutputAttachment, 640, 480); nxt::TextureUsageBit::OutputAttachment, 640, 480);

View File

@ -612,8 +612,8 @@
"returns": "pipeline layout builder" "returns": "pipeline layout builder"
}, },
{ {
"name": "create queue builder", "name": "create queue",
"returns": "queue builder" "returns": "queue"
}, },
{ {
"name": "create sampler", "name": "create sampler",
@ -808,15 +808,6 @@
} }
] ]
}, },
"queue builder": {
"category": "object",
"methods": [
{
"name": "get result",
"returns": "queue"
}
]
},
"render pass descriptor builder": { "render pass descriptor builder": {
"category": "object", "category": "object",
"methods": [ "methods": [

View File

@ -122,8 +122,14 @@ namespace backend {
PipelineLayoutBuilder* DeviceBase::CreatePipelineLayoutBuilder() { PipelineLayoutBuilder* DeviceBase::CreatePipelineLayoutBuilder() {
return new PipelineLayoutBuilder(this); return new PipelineLayoutBuilder(this);
} }
QueueBuilder* DeviceBase::CreateQueueBuilder() { QueueBase* DeviceBase::CreateQueue() {
return new QueueBuilder(this); ResultOrError<QueueBase*> maybeQueue = CreateQueueImpl();
if (maybeQueue.IsError()) {
// TODO(cwallez@chromium.org): Implement the WebGPU error handling mechanism.
delete maybeQueue.AcquireError();
return nullptr;
}
return maybeQueue.AcquireSuccess();
} }
RenderPassDescriptorBuilder* DeviceBase::CreateRenderPassDescriptorBuilder() { RenderPassDescriptorBuilder* DeviceBase::CreateRenderPassDescriptorBuilder() {
return new RenderPassDescriptorBuilder(this); return new RenderPassDescriptorBuilder(this);
@ -142,7 +148,7 @@ namespace backend {
ResultOrError<SamplerBase*> maybeSampler = CreateSamplerImpl(descriptor); ResultOrError<SamplerBase*> maybeSampler = CreateSamplerImpl(descriptor);
if (maybeSampler.IsError()) { if (maybeSampler.IsError()) {
// TODO(cwallez@chromium.org): Implement the WebGPU error handling mechanism. // TODO(cwallez@chromium.org): Implement the WebGPU error handling mechanism.
delete validation.AcquireError(); delete maybeSampler.AcquireError();
return nullptr; return nullptr;
} }
return maybeSampler.AcquireSuccess(); return maybeSampler.AcquireSuccess();

View File

@ -46,7 +46,6 @@ namespace backend {
DepthStencilStateBuilder* builder) = 0; DepthStencilStateBuilder* builder) = 0;
virtual InputStateBase* CreateInputState(InputStateBuilder* builder) = 0; virtual InputStateBase* CreateInputState(InputStateBuilder* builder) = 0;
virtual PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) = 0; virtual PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) = 0;
virtual QueueBase* CreateQueue(QueueBuilder* builder) = 0;
virtual RenderPassDescriptorBase* CreateRenderPassDescriptor( virtual RenderPassDescriptorBase* CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) = 0; RenderPassDescriptorBuilder* builder) = 0;
virtual RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) = 0; virtual RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) = 0;
@ -85,7 +84,7 @@ namespace backend {
DepthStencilStateBuilder* CreateDepthStencilStateBuilder(); DepthStencilStateBuilder* CreateDepthStencilStateBuilder();
InputStateBuilder* CreateInputStateBuilder(); InputStateBuilder* CreateInputStateBuilder();
PipelineLayoutBuilder* CreatePipelineLayoutBuilder(); PipelineLayoutBuilder* CreatePipelineLayoutBuilder();
QueueBuilder* CreateQueueBuilder(); QueueBase* CreateQueue();
RenderPassDescriptorBuilder* CreateRenderPassDescriptorBuilder(); RenderPassDescriptorBuilder* CreateRenderPassDescriptorBuilder();
RenderPipelineBuilder* CreateRenderPipelineBuilder(); RenderPipelineBuilder* CreateRenderPipelineBuilder();
SamplerBase* CreateSampler(const nxt::SamplerDescriptor* descriptor); SamplerBase* CreateSampler(const nxt::SamplerDescriptor* descriptor);
@ -99,6 +98,7 @@ namespace backend {
void Release(); void Release();
private: private:
virtual ResultOrError<QueueBase*> CreateQueueImpl() = 0;
virtual ResultOrError<SamplerBase*> CreateSamplerImpl( virtual ResultOrError<SamplerBase*> CreateSamplerImpl(
const nxt::SamplerDescriptor* descriptor) = 0; const nxt::SamplerDescriptor* descriptor) = 0;

View File

@ -40,7 +40,6 @@ namespace backend {
class PipelineLayoutBase; class PipelineLayoutBase;
class PipelineLayoutBuilder; class PipelineLayoutBuilder;
class QueueBase; class QueueBase;
class QueueBuilder;
class RenderPassDescriptorBase; class RenderPassDescriptorBase;
class RenderPassDescriptorBuilder; class RenderPassDescriptorBuilder;
class RenderPipelineBase; class RenderPipelineBase;

View File

@ -21,7 +21,7 @@ namespace backend {
// QueueBase // QueueBase
QueueBase::QueueBase(QueueBuilder* builder) : mDevice(builder->mDevice) { QueueBase::QueueBase(DeviceBase* device) : mDevice(device) {
} }
DeviceBase* QueueBase::GetDevice() { DeviceBase* QueueBase::GetDevice() {
@ -32,13 +32,4 @@ namespace backend {
return command->ValidateResourceUsagesImmediate(); return command->ValidateResourceUsagesImmediate();
} }
// QueueBuilder
QueueBuilder::QueueBuilder(DeviceBase* device) : Builder(device) {
}
QueueBase* QueueBuilder::GetResultImpl() {
return mDevice->CreateQueue(this);
}
} // namespace backend } // namespace backend

View File

@ -25,7 +25,7 @@ namespace backend {
class QueueBase : public RefCounted { class QueueBase : public RefCounted {
public: public:
QueueBase(QueueBuilder* builder); QueueBase(DeviceBase* device);
DeviceBase* GetDevice(); DeviceBase* GetDevice();
@ -48,15 +48,6 @@ namespace backend {
DeviceBase* mDevice; DeviceBase* mDevice;
}; };
class QueueBuilder : public Builder<QueueBase> {
public:
QueueBuilder(DeviceBase* device);
private:
friend class QueueBase;
QueueBase* GetResultImpl() override;
};
} // namespace backend } // namespace backend
#endif // BACKEND_QUEUE_H_ #endif // BACKEND_QUEUE_H_

View File

@ -288,8 +288,8 @@ namespace backend { namespace d3d12 {
PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) { PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) {
return new PipelineLayout(this, builder); return new PipelineLayout(this, builder);
} }
QueueBase* Device::CreateQueue(QueueBuilder* builder) { ResultOrError<QueueBase*> Device::CreateQueueImpl() {
return new Queue(this, builder); return new Queue(this);
} }
RenderPassDescriptorBase* Device::CreateRenderPassDescriptor( RenderPassDescriptorBase* Device::CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) { RenderPassDescriptorBuilder* builder) {

View File

@ -96,7 +96,6 @@ namespace backend { namespace d3d12 {
DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override; DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override;
InputStateBase* CreateInputState(InputStateBuilder* builder) override; InputStateBase* CreateInputState(InputStateBuilder* builder) override;
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override; PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
QueueBase* CreateQueue(QueueBuilder* builder) override;
RenderPassDescriptorBase* CreateRenderPassDescriptor( RenderPassDescriptorBase* CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) override; RenderPassDescriptorBuilder* builder) override;
RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override; RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override;
@ -128,6 +127,7 @@ namespace backend { namespace d3d12 {
void ExecuteCommandLists(std::initializer_list<ID3D12CommandList*> commandLists); void ExecuteCommandLists(std::initializer_list<ID3D12CommandList*> commandLists);
private: private:
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl( ResultOrError<SamplerBase*> CreateSamplerImpl(
const nxt::SamplerDescriptor* descriptor) override; const nxt::SamplerDescriptor* descriptor) override;

View File

@ -19,21 +19,23 @@
namespace backend { namespace d3d12 { namespace backend { namespace d3d12 {
Queue::Queue(Device* device, QueueBuilder* builder) : QueueBase(builder), mDevice(device) { Queue::Queue(Device* device) : QueueBase(device) {
} }
void Queue::Submit(uint32_t numCommands, CommandBuffer* const* commands) { void Queue::Submit(uint32_t numCommands, CommandBuffer* const* commands) {
mDevice->Tick(); Device* device = ToBackend(GetDevice());
mDevice->OpenCommandList(&mCommandList); device->Tick();
device->OpenCommandList(&mCommandList);
for (uint32_t i = 0; i < numCommands; ++i) { for (uint32_t i = 0; i < numCommands; ++i) {
commands[i]->FillCommands(mCommandList); commands[i]->FillCommands(mCommandList);
} }
ASSERT_SUCCESS(mCommandList->Close()); ASSERT_SUCCESS(mCommandList->Close());
mDevice->ExecuteCommandLists({mCommandList.Get()}); device->ExecuteCommandLists({mCommandList.Get()});
mDevice->NextSerial(); device->NextSerial();
} }
}} // namespace backend::d3d12 }} // namespace backend::d3d12

View File

@ -26,14 +26,12 @@ namespace backend { namespace d3d12 {
class Queue : public QueueBase { class Queue : public QueueBase {
public: public:
Queue(Device* device, QueueBuilder* builder); Queue(Device* device);
// NXT API // NXT API
void Submit(uint32_t numCommands, CommandBuffer* const* commands); void Submit(uint32_t numCommands, CommandBuffer* const* commands);
private: private:
Device* mDevice;
ComPtr<ID3D12GraphicsCommandList> mCommandList; ComPtr<ID3D12GraphicsCommandList> mCommandList;
}; };

View File

@ -97,7 +97,6 @@ namespace backend { namespace metal {
DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override; DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override;
InputStateBase* CreateInputState(InputStateBuilder* builder) override; InputStateBase* CreateInputState(InputStateBuilder* builder) override;
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override; PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
QueueBase* CreateQueue(QueueBuilder* builder) override;
RenderPassDescriptorBase* CreateRenderPassDescriptor( RenderPassDescriptorBase* CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) override; RenderPassDescriptorBuilder* builder) override;
RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override; RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override;
@ -118,6 +117,7 @@ namespace backend { namespace metal {
ResourceUploader* GetResourceUploader() const; ResourceUploader* GetResourceUploader() const;
private: private:
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl( ResultOrError<SamplerBase*> CreateSamplerImpl(
const nxt::SamplerDescriptor* descriptor) override; const nxt::SamplerDescriptor* descriptor) override;
@ -145,16 +145,10 @@ namespace backend { namespace metal {
class Queue : public QueueBase { class Queue : public QueueBase {
public: public:
Queue(QueueBuilder* builder); Queue(Device* device);
~Queue();
id<MTLCommandQueue> GetMTLCommandQueue();
// NXT API // NXT API
void Submit(uint32_t numCommands, CommandBuffer* const* commands); void Submit(uint32_t numCommands, CommandBuffer* const* commands);
private:
id<MTLCommandQueue> mCommandQueue = nil;
}; };
class RenderPassDescriptor : public RenderPassDescriptorBase { class RenderPassDescriptor : public RenderPassDescriptorBase {

View File

@ -107,9 +107,6 @@ namespace backend { namespace metal {
PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) { PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) {
return new PipelineLayout(builder); return new PipelineLayout(builder);
} }
QueueBase* Device::CreateQueue(QueueBuilder* builder) {
return new Queue(builder);
}
RenderPassDescriptorBase* Device::CreateRenderPassDescriptor( RenderPassDescriptorBase* Device::CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) { RenderPassDescriptorBuilder* builder) {
return new RenderPassDescriptor(builder); return new RenderPassDescriptor(builder);
@ -117,6 +114,9 @@ namespace backend { namespace metal {
RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) { RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) {
return new RenderPipeline(builder); return new RenderPipeline(builder);
} }
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
return new Queue(this);
}
ResultOrError<SamplerBase*> Device::CreateSamplerImpl( ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
const nxt::SamplerDescriptor* descriptor) { const nxt::SamplerDescriptor* descriptor) {
return new Sampler(this, descriptor); return new Sampler(this, descriptor);
@ -203,18 +203,7 @@ namespace backend { namespace metal {
// Queue // Queue
Queue::Queue(QueueBuilder* builder) : QueueBase(builder) { Queue::Queue(Device* device) : QueueBase(device) {
Device* device = ToBackend(builder->GetDevice());
mCommandQueue = [device->GetMTLDevice() newCommandQueue];
}
Queue::~Queue() {
[mCommandQueue release];
mCommandQueue = nil;
}
id<MTLCommandQueue> Queue::GetMTLCommandQueue() {
return mCommandQueue;
} }
void Queue::Submit(uint32_t numCommands, CommandBuffer* const* commands) { void Queue::Submit(uint32_t numCommands, CommandBuffer* const* commands) {

View File

@ -66,8 +66,8 @@ namespace backend { namespace null {
PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) { PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) {
return new PipelineLayout(builder); return new PipelineLayout(builder);
} }
QueueBase* Device::CreateQueue(QueueBuilder* builder) { ResultOrError<QueueBase*> Device::CreateQueueImpl() {
return new Queue(builder); return new Queue(this);
} }
RenderPassDescriptorBase* Device::CreateRenderPassDescriptor( RenderPassDescriptorBase* Device::CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) { RenderPassDescriptorBuilder* builder) {
@ -205,7 +205,7 @@ namespace backend { namespace null {
// Queue // Queue
Queue::Queue(QueueBuilder* builder) : QueueBase(builder) { Queue::Queue(Device* device) : QueueBase(device) {
} }
Queue::~Queue() { Queue::~Queue() {

View File

@ -105,7 +105,6 @@ namespace backend { namespace null {
DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override; DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override;
InputStateBase* CreateInputState(InputStateBuilder* builder) override; InputStateBase* CreateInputState(InputStateBuilder* builder) override;
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override; PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
QueueBase* CreateQueue(QueueBuilder* builder) override;
RenderPassDescriptorBase* CreateRenderPassDescriptor( RenderPassDescriptorBase* CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) override; RenderPassDescriptorBuilder* builder) override;
RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override; RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override;
@ -120,6 +119,7 @@ namespace backend { namespace null {
std::vector<std::unique_ptr<PendingOperation>> AcquirePendingOperations(); std::vector<std::unique_ptr<PendingOperation>> AcquirePendingOperations();
private: private:
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl( ResultOrError<SamplerBase*> CreateSamplerImpl(
const nxt::SamplerDescriptor* descriptor) override; const nxt::SamplerDescriptor* descriptor) override;
@ -159,7 +159,7 @@ namespace backend { namespace null {
class Queue : public QueueBase { class Queue : public QueueBase {
public: public:
Queue(QueueBuilder* builder); Queue(Device* device);
~Queue(); ~Queue();
// NXT API // NXT API

View File

@ -76,8 +76,8 @@ namespace backend { namespace opengl {
PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) { PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) {
return new PipelineLayout(builder); return new PipelineLayout(builder);
} }
QueueBase* Device::CreateQueue(QueueBuilder* builder) { ResultOrError<QueueBase*> Device::CreateQueueImpl() {
return new Queue(builder); return new Queue(this);
} }
RenderPassDescriptorBase* Device::CreateRenderPassDescriptor( RenderPassDescriptorBase* Device::CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) { RenderPassDescriptorBuilder* builder) {
@ -119,7 +119,7 @@ namespace backend { namespace opengl {
// Queue // Queue
Queue::Queue(QueueBuilder* builder) : QueueBase(builder) { Queue::Queue(Device* device) : QueueBase(device) {
} }
void Queue::Submit(uint32_t numCommands, CommandBuffer* const* commands) { void Queue::Submit(uint32_t numCommands, CommandBuffer* const* commands) {

View File

@ -93,7 +93,6 @@ namespace backend { namespace opengl {
DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override; DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override;
InputStateBase* CreateInputState(InputStateBuilder* builder) override; InputStateBase* CreateInputState(InputStateBuilder* builder) override;
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override; PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
QueueBase* CreateQueue(QueueBuilder* builder) override;
RenderPassDescriptorBase* CreateRenderPassDescriptor( RenderPassDescriptorBase* CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) override; RenderPassDescriptorBuilder* builder) override;
RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override; RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override;
@ -105,6 +104,7 @@ namespace backend { namespace opengl {
void TickImpl() override; void TickImpl() override;
private: private:
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl( ResultOrError<SamplerBase*> CreateSamplerImpl(
const nxt::SamplerDescriptor* descriptor) override; const nxt::SamplerDescriptor* descriptor) override;
}; };
@ -121,7 +121,7 @@ namespace backend { namespace opengl {
class Queue : public QueueBase { class Queue : public QueueBase {
public: public:
Queue(QueueBuilder* builder); Queue(Device* device);
// NXT API // NXT API
void Submit(uint32_t numCommands, CommandBuffer* const* commands); void Submit(uint32_t numCommands, CommandBuffer* const* commands);

View File

@ -243,8 +243,8 @@ namespace backend { namespace vulkan {
PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) { PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) {
return new PipelineLayout(builder); return new PipelineLayout(builder);
} }
QueueBase* Device::CreateQueue(QueueBuilder* builder) { ResultOrError<QueueBase*> Device::CreateQueueImpl() {
return new Queue(builder); return new Queue(this);
} }
RenderPassDescriptorBase* Device::CreateRenderPassDescriptor( RenderPassDescriptorBase* Device::CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) { RenderPassDescriptorBuilder* builder) {
@ -677,7 +677,7 @@ namespace backend { namespace vulkan {
// Queue // Queue
Queue::Queue(QueueBuilder* builder) : QueueBase(builder) { Queue::Queue(Device* device) : QueueBase(device) {
} }
Queue::~Queue() { Queue::~Queue() {

View File

@ -121,7 +121,6 @@ namespace backend { namespace vulkan {
DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override; DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override;
InputStateBase* CreateInputState(InputStateBuilder* builder) override; InputStateBase* CreateInputState(InputStateBuilder* builder) override;
PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override; PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
QueueBase* CreateQueue(QueueBuilder* builder) override;
RenderPassDescriptorBase* CreateRenderPassDescriptor( RenderPassDescriptorBase* CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) override; RenderPassDescriptorBuilder* builder) override;
RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override; RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override;
@ -133,6 +132,7 @@ namespace backend { namespace vulkan {
void TickImpl() override; void TickImpl() override;
private: private:
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl( ResultOrError<SamplerBase*> CreateSamplerImpl(
const nxt::SamplerDescriptor* descriptor) override; const nxt::SamplerDescriptor* descriptor) override;
@ -203,7 +203,7 @@ namespace backend { namespace vulkan {
class Queue : public QueueBase { class Queue : public QueueBase {
public: public:
Queue(QueueBuilder* builder); Queue(Device* device);
~Queue(); ~Queue();
// NXT API // NXT API

View File

@ -167,7 +167,7 @@ void NXTTest::SetUp() {
// deferred expectations. // deferred expectations.
nxtSetProcs(&procs); nxtSetProcs(&procs);
device = nxt::Device::Acquire(cDevice); device = nxt::Device::Acquire(cDevice);
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
// The swapchain isn't used by tests but is useful when debugging with graphics debuggers that // The swapchain isn't used by tests but is useful when debugging with graphics debuggers that
// capture at frame boundaries. // capture at frame boundaries.

View File

@ -367,15 +367,9 @@ TEST_F(WireTests, ObjectsAsPointerArgument) {
} }
// Create queue // Create queue
nxtQueueBuilder queueBuilder = nxtDeviceCreateQueueBuilder(device); nxtQueue queue = nxtDeviceCreateQueue(device);
nxtQueue queue = nxtQueueBuilderGetResult(queueBuilder);
nxtQueueBuilder apiQueueBuilder = api.GetNewQueueBuilder();
EXPECT_CALL(api, DeviceCreateQueueBuilder(apiDevice))
.WillOnce(Return(apiQueueBuilder));
nxtQueue apiQueue = api.GetNewQueue(); nxtQueue apiQueue = api.GetNewQueue();
EXPECT_CALL(api, QueueBuilderGetResult(apiQueueBuilder)) EXPECT_CALL(api, DeviceCreateQueue(apiDevice))
.WillOnce(Return(apiQueue)); .WillOnce(Return(apiQueue));
// Submit command buffer and check we got a call with both API-side command buffers // Submit command buffer and check we got a call with both API-side command buffers

View File

@ -72,7 +72,7 @@ class BufferValidationTest : public ValidationTest {
mockBufferMapReadCallback = new MockBufferMapReadCallback; mockBufferMapReadCallback = new MockBufferMapReadCallback;
mockBufferMapWriteCallback = new MockBufferMapWriteCallback; mockBufferMapWriteCallback = new MockBufferMapWriteCallback;
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
} }
void TearDown() override { void TearDown() override {

View File

@ -40,7 +40,7 @@ class PushConstantTest : public ValidationTest {
private: private:
void SetUp() override { void SetUp() override {
ValidationTest::SetUp(); ValidationTest::SetUp();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
} }
}; };

View File

@ -25,7 +25,7 @@ class UsageValidationTest : public ValidationTest {
private: private:
void SetUp() override { void SetUp() override {
ValidationTest::SetUp(); ValidationTest::SetUp();
queue = device.CreateQueueBuilder().GetResult(); queue = device.CreateQueue();
} }
}; };