mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-14 19:31:25 +00:00
These are the CommandEncoder, ComputePass and CommandBuffer descriptors that contains nothing but a debug name for now but are important for later extensibility. Defaults are added so the C++ API doesn't require the descriptors to be passed as arguments. Also renames variables named "info" for RenderPassDescriptor to "descriptor" as is now the standard in the codebase. BUG=dawn:22 Change-Id: I9de4cfbbce952d01fb79ed1d9f34825a6fa174f9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8686 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
95 lines
3.9 KiB
C++
95 lines
3.9 KiB
C++
// Copyright 2018 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.
|
|
|
|
#ifndef DAWNNATIVE_OPENGL_DEVICEGL_H_
|
|
#define DAWNNATIVE_OPENGL_DEVICEGL_H_
|
|
|
|
#include "dawn_native/dawn_platform.h"
|
|
|
|
#include "common/Platform.h"
|
|
#include "dawn_native/Device.h"
|
|
#include "dawn_native/opengl/Forward.h"
|
|
#include "dawn_native/opengl/OpenGLFunctions.h"
|
|
|
|
#include <queue>
|
|
|
|
// Remove windows.h macros after glad's include of windows.h
|
|
#if defined(DAWN_PLATFORM_WINDOWS)
|
|
# include "common/windows_with_undefs.h"
|
|
#endif
|
|
|
|
namespace dawn_native { namespace opengl {
|
|
|
|
class Device : public DeviceBase {
|
|
public:
|
|
Device(AdapterBase* adapter,
|
|
const DeviceDescriptor* descriptor,
|
|
const OpenGLFunctions& functions);
|
|
~Device();
|
|
|
|
// Contains all the OpenGL entry points, glDoFoo is called via device->gl.DoFoo.
|
|
const OpenGLFunctions gl;
|
|
|
|
void SubmitFenceSync();
|
|
|
|
// Dawn API
|
|
CommandBufferBase* CreateCommandBuffer(CommandEncoderBase* encoder,
|
|
const CommandBufferDescriptor* descriptor) override;
|
|
|
|
Serial GetCompletedCommandSerial() const final override;
|
|
Serial GetLastSubmittedCommandSerial() const final override;
|
|
Serial GetPendingCommandSerial() const override;
|
|
void TickImpl() override;
|
|
|
|
ResultOrError<std::unique_ptr<StagingBufferBase>> CreateStagingBuffer(size_t size) override;
|
|
MaybeError CopyFromStagingToBuffer(StagingBufferBase* source,
|
|
uint64_t sourceOffset,
|
|
BufferBase* destination,
|
|
uint64_t destinationOffset,
|
|
uint64_t size) override;
|
|
|
|
private:
|
|
ResultOrError<BindGroupBase*> CreateBindGroupImpl(
|
|
const BindGroupDescriptor* descriptor) override;
|
|
ResultOrError<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
|
|
const BindGroupLayoutDescriptor* descriptor) override;
|
|
ResultOrError<BufferBase*> CreateBufferImpl(const BufferDescriptor* descriptor) override;
|
|
ResultOrError<ComputePipelineBase*> CreateComputePipelineImpl(
|
|
const ComputePipelineDescriptor* descriptor) override;
|
|
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
|
|
const PipelineLayoutDescriptor* descriptor) override;
|
|
ResultOrError<QueueBase*> CreateQueueImpl() override;
|
|
ResultOrError<RenderPipelineBase*> CreateRenderPipelineImpl(
|
|
const RenderPipelineDescriptor* descriptor) override;
|
|
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;
|
|
ResultOrError<ShaderModuleBase*> CreateShaderModuleImpl(
|
|
const ShaderModuleDescriptor* descriptor) override;
|
|
ResultOrError<SwapChainBase*> CreateSwapChainImpl(
|
|
const SwapChainDescriptor* descriptor) override;
|
|
ResultOrError<TextureBase*> CreateTextureImpl(const TextureDescriptor* descriptor) override;
|
|
ResultOrError<TextureViewBase*> CreateTextureViewImpl(
|
|
TextureBase* texture,
|
|
const TextureViewDescriptor* descriptor) override;
|
|
|
|
void CheckPassedFences();
|
|
|
|
Serial mCompletedSerial = 0;
|
|
Serial mLastSubmittedSerial = 0;
|
|
std::queue<std::pair<GLsync, Serial>> mFencesInFlight;
|
|
};
|
|
|
|
}} // namespace dawn_native::opengl
|
|
|
|
#endif // DAWNNATIVE_OPENGL_DEVICEGL_H_
|