Generate a single ProcTable instead of one per backend.

This required putting Queue::Submit on QueueBase which is something we
would want to do anyway, and removes the need for Queue::ValidateSubmit
being called in the ProcTable.

This removes the need for all the "GeneratedCodeIncludes" files and
leads to a bunch of simplifications in BindGroup as well as the
dawn_native CMakeLists.txt.

Finally this was done in order to simplify the writing of BUILD.gn
files.
This commit is contained in:
Corentin Wallez
2018-08-01 15:12:10 +02:00
committed by Corentin Wallez
parent 1ac25e850a
commit fe253f135b
27 changed files with 119 additions and 337 deletions

View File

@@ -32,16 +32,18 @@
#include "dawn_native/opengl/SwapChainGL.h"
#include "dawn_native/opengl/TextureGL.h"
namespace dawn_native {
dawnProcTable GetProcs();
} // namespace dawn_native
namespace dawn_native { namespace opengl {
dawnProcTable GetNonValidatingProcs();
dawnProcTable GetValidatingProcs();
void Init(void* (*getProc)(const char*), dawnProcTable* procs, dawnDevice* device) {
*device = nullptr;
gladLoadGLLoader(reinterpret_cast<GLADloadproc>(getProc));
*procs = GetValidatingProcs();
*procs = GetProcs();
*device = reinterpret_cast<dawnDevice>(new Device);
glEnable(GL_DEPTH_TEST);

View File

@@ -1,32 +0,0 @@
// Copyright 2017 The Dawn 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 "dawn_native/BindGroup.h"
#include "dawn_native/BindGroupLayout.h"
#include "dawn_native/RenderPassDescriptor.h"
#include "dawn_native/opengl/BlendStateGL.h"
#include "dawn_native/opengl/BufferGL.h"
#include "dawn_native/opengl/CommandBufferGL.h"
#include "dawn_native/opengl/ComputePipelineGL.h"
#include "dawn_native/opengl/DepthStencilStateGL.h"
#include "dawn_native/opengl/DeviceGL.h"
#include "dawn_native/opengl/InputStateGL.h"
#include "dawn_native/opengl/PersistentPipelineStateGL.h"
#include "dawn_native/opengl/PipelineLayoutGL.h"
#include "dawn_native/opengl/QueueGL.h"
#include "dawn_native/opengl/RenderPipelineGL.h"
#include "dawn_native/opengl/SamplerGL.h"
#include "dawn_native/opengl/ShaderModuleGL.h"
#include "dawn_native/opengl/SwapChainGL.h"
#include "dawn_native/opengl/TextureGL.h"

View File

@@ -22,9 +22,9 @@ namespace dawn_native { namespace opengl {
Queue::Queue(Device* device) : QueueBase(device) {
}
void Queue::Submit(uint32_t numCommands, CommandBuffer* const* commands) {
void Queue::SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) {
for (uint32_t i = 0; i < numCommands; ++i) {
commands[i]->Execute();
ToBackend(commands[i])->Execute();
}
}

View File

@@ -26,8 +26,8 @@ namespace dawn_native { namespace opengl {
public:
Queue(Device* device);
// Dawn API
void Submit(uint32_t numCommands, CommandBuffer* const* commands);
private:
void SubmitImpl(uint32_t numCommands, CommandBufferBase* const* commands) override;
};
}} // namespace dawn_native::opengl