From a714f5b459f6b1da53a73107f134fd9301cc5721 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Mon, 18 Jun 2018 17:52:55 -0400 Subject: [PATCH] OpenGL: Split off QueueGL --- src/backend/CMakeLists.txt | 2 ++ src/backend/opengl/DeviceGL.cpp | 3 +- src/backend/opengl/DeviceGL.h | 9 ------ src/backend/opengl/GeneratedCodeIncludes.h | 1 + src/backend/opengl/QueueGL.cpp | 31 +++++++++++++++++++ src/backend/opengl/QueueGL.h | 35 ++++++++++++++++++++++ 6 files changed, 71 insertions(+), 10 deletions(-) create mode 100644 src/backend/opengl/QueueGL.cpp create mode 100644 src/backend/opengl/QueueGL.h diff --git a/src/backend/CMakeLists.txt b/src/backend/CMakeLists.txt index 4436f635d6..5ddeea6a2a 100644 --- a/src/backend/CMakeLists.txt +++ b/src/backend/CMakeLists.txt @@ -77,6 +77,8 @@ if (NXT_ENABLE_OPENGL) ${OPENGL_DIR}/PipelineGL.h ${OPENGL_DIR}/PipelineLayoutGL.cpp ${OPENGL_DIR}/PipelineLayoutGL.h + ${OPENGL_DIR}/QueueGL.cpp + ${OPENGL_DIR}/QueueGL.h ${OPENGL_DIR}/RenderPipelineGL.cpp ${OPENGL_DIR}/RenderPipelineGL.h ${OPENGL_DIR}/SamplerGL.cpp diff --git a/src/backend/opengl/DeviceGL.cpp b/src/backend/opengl/DeviceGL.cpp index 1b77e9b127..1eb66dd291 100644 --- a/src/backend/opengl/DeviceGL.cpp +++ b/src/backend/opengl/DeviceGL.cpp @@ -1,4 +1,4 @@ -// Copyright 2017 The NXT Authors +// Copyright 2018 The NXT Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ #include "backend/opengl/DepthStencilStateGL.h" #include "backend/opengl/InputStateGL.h" #include "backend/opengl/PipelineLayoutGL.h" +#include "backend/opengl/QueueGL.h" #include "backend/opengl/RenderPipelineGL.h" #include "backend/opengl/SamplerGL.h" #include "backend/opengl/ShaderModuleGL.h" diff --git a/src/backend/opengl/DeviceGL.h b/src/backend/opengl/DeviceGL.h index 4fdcea1994..fed98b8431 100644 --- a/src/backend/opengl/DeviceGL.h +++ b/src/backend/opengl/DeviceGL.h @@ -18,7 +18,6 @@ #include "nxt/nxtcpp.h" #include "backend/Device.h" -#include "backend/Queue.h" #include "backend/opengl/Forward.h" #include "glad/glad.h" @@ -53,14 +52,6 @@ namespace backend { namespace opengl { const nxt::SamplerDescriptor* descriptor) override; }; - class Queue : public QueueBase { - public: - Queue(Device* device); - - // NXT API - void Submit(uint32_t numCommands, CommandBuffer* const* commands); - }; - }} // namespace backend::opengl #endif // BACKEND_OPENGL_DEVICEGL_H_ diff --git a/src/backend/opengl/GeneratedCodeIncludes.h b/src/backend/opengl/GeneratedCodeIncludes.h index 33b38d10f8..fc988386c7 100644 --- a/src/backend/opengl/GeneratedCodeIncludes.h +++ b/src/backend/opengl/GeneratedCodeIncludes.h @@ -24,6 +24,7 @@ #include "backend/opengl/InputStateGL.h" #include "backend/opengl/PersistentPipelineStateGL.h" #include "backend/opengl/PipelineLayoutGL.h" +#include "backend/opengl/QueueGL.h" #include "backend/opengl/RenderPipelineGL.h" #include "backend/opengl/SamplerGL.h" #include "backend/opengl/ShaderModuleGL.h" diff --git a/src/backend/opengl/QueueGL.cpp b/src/backend/opengl/QueueGL.cpp new file mode 100644 index 0000000000..4ab333471d --- /dev/null +++ b/src/backend/opengl/QueueGL.cpp @@ -0,0 +1,31 @@ +// Copyright 2018 The NXT Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "backend/opengl/QueueGL.h" + +#include "backend/opengl/CommandBufferGL.h" +#include "backend/opengl/DeviceGL.h" + +namespace backend { namespace opengl { + + Queue::Queue(Device* device) : QueueBase(device) { + } + + void Queue::Submit(uint32_t numCommands, CommandBuffer* const* commands) { + for (uint32_t i = 0; i < numCommands; ++i) { + commands[i]->Execute(); + } + } + +}} // namespace backend::opengl diff --git a/src/backend/opengl/QueueGL.h b/src/backend/opengl/QueueGL.h new file mode 100644 index 0000000000..dfcf72a7ba --- /dev/null +++ b/src/backend/opengl/QueueGL.h @@ -0,0 +1,35 @@ +// Copyright 2018 The NXT Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef BACKEND_OPENGL_QUEUEGL_H_ +#define BACKEND_OPENGL_QUEUEGL_H_ + +#include "backend/Queue.h" + +namespace backend { namespace opengl { + + class CommandBuffer; + class Device; + + class Queue : public QueueBase { + public: + Queue(Device* device); + + // NXT API + void Submit(uint32_t numCommands, CommandBuffer* const* commands); + }; + +}} // namespace backend::opengl + +#endif // BACKEND_OPENGL_QUEUEGL_H_