Make dawn_native use its own header for Dawn datatypes

The dawn.h and dawncpp.h structure definitions references dawnFoo or
dawn::Foo respectively when it should reference dawn_native::FooBase* in
dawn_native. Autogenerate files to declare the dawn_native version of
the structs and change the ProcTable generation to use it instead.

This is important to make libdawn_native a shared library because
currently it was depending on dawncpp's definition of .Get().
This commit is contained in:
Corentin Wallez
2018-07-25 17:03:23 +02:00
committed by Corentin Wallez
parent 5d313225ff
commit 36afbb6a0d
67 changed files with 231 additions and 141 deletions

View File

@@ -54,7 +54,7 @@ namespace dawn_native { namespace opengl {
return new BindGroup(builder);
}
ResultOrError<BindGroupLayoutBase*> Device::CreateBindGroupLayoutImpl(
const dawn::BindGroupLayoutDescriptor* descriptor) {
const BindGroupLayoutDescriptor* descriptor) {
return new BindGroupLayout(this, descriptor);
}
BlendStateBase* Device::CreateBlendState(BlendStateBuilder* builder) {
@@ -79,7 +79,7 @@ namespace dawn_native { namespace opengl {
return new InputState(builder);
}
ResultOrError<PipelineLayoutBase*> Device::CreatePipelineLayoutImpl(
const dawn::PipelineLayoutDescriptor* descriptor) {
const PipelineLayoutDescriptor* descriptor) {
return new PipelineLayout(this, descriptor);
}
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
@@ -92,8 +92,7 @@ namespace dawn_native { namespace opengl {
RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) {
return new RenderPipeline(builder);
}
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
const dawn::SamplerDescriptor* descriptor) {
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
return new Sampler(this, descriptor);
}
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {

View File

@@ -15,7 +15,7 @@
#ifndef DAWNNATIVE_OPENGL_DEVICEGL_H_
#define DAWNNATIVE_OPENGL_DEVICEGL_H_
#include "dawn/dawncpp.h"
#include "dawn_native/dawn_platform.h"
#include "common/Platform.h"
#include "dawn_native/Device.h"
@@ -52,12 +52,11 @@ namespace dawn_native { namespace opengl {
private:
ResultOrError<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
const dawn::BindGroupLayoutDescriptor* descriptor) override;
const BindGroupLayoutDescriptor* descriptor) override;
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
const dawn::PipelineLayoutDescriptor* descriptor) override;
const PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl(
const dawn::SamplerDescriptor* descriptor) override;
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;
};
}} // namespace dawn_native::opengl

View File

@@ -15,7 +15,7 @@
#ifndef DAWNNATIVE_OPENGL_PERSISTENTPIPELINESTATEGL_H_
#define DAWNNATIVE_OPENGL_PERSISTENTPIPELINESTATEGL_H_
#include "dawn/dawncpp.h"
#include "dawn_native/dawn_platform.h"
#include "glad/glad.h"

View File

@@ -20,7 +20,7 @@
namespace dawn_native { namespace opengl {
PipelineLayout::PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor)
PipelineLayout::PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor)
: PipelineLayoutBase(device, descriptor) {
GLuint uboIndex = 0;
GLuint samplerIndex = 0;

View File

@@ -25,7 +25,7 @@ namespace dawn_native { namespace opengl {
class PipelineLayout : public PipelineLayoutBase {
public:
PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor);
PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor);
using BindingIndexInfo =
std::array<std::array<GLuint, kMaxBindingsPerGroup>, kMaxBindGroups>;

View File

@@ -71,7 +71,7 @@ namespace dawn_native { namespace opengl {
} // namespace
Sampler::Sampler(Device* device, const dawn::SamplerDescriptor* descriptor)
Sampler::Sampler(Device* device, const SamplerDescriptor* descriptor)
: SamplerBase(device, descriptor) {
glGenSamplers(1, &mHandle);
glSamplerParameteri(mHandle, GL_TEXTURE_MAG_FILTER, MagFilterMode(descriptor->magFilter));

View File

@@ -25,7 +25,7 @@ namespace dawn_native { namespace opengl {
class Sampler : public SamplerBase {
public:
Sampler(Device* device, const dawn::SamplerDescriptor* descriptor);
Sampler(Device* device, const SamplerDescriptor* descriptor);
GLuint GetHandle() const;