Use a descriptor for PipelineLayout (#206)
Adds support for structures inside descriptors.
diff --git a/src/backend/opengl/DeviceGL.cpp b/src/backend/opengl/DeviceGL.cpp
index 1eb66dd..008f8ec 100644
--- a/src/backend/opengl/DeviceGL.cpp
+++ b/src/backend/opengl/DeviceGL.cpp
@@ -77,8 +77,9 @@
InputStateBase* Device::CreateInputState(InputStateBuilder* builder) {
return new InputState(builder);
}
- PipelineLayoutBase* Device::CreatePipelineLayout(PipelineLayoutBuilder* builder) {
- return new PipelineLayout(builder);
+ ResultOrError<PipelineLayoutBase*> Device::CreatePipelineLayoutImpl(
+ const nxt::PipelineLayoutDescriptor* descriptor) {
+ return new PipelineLayout(this, descriptor);
}
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
return new Queue(this);
diff --git a/src/backend/opengl/DeviceGL.h b/src/backend/opengl/DeviceGL.h
index fed98b8..9789267 100644
--- a/src/backend/opengl/DeviceGL.h
+++ b/src/backend/opengl/DeviceGL.h
@@ -35,7 +35,6 @@
ComputePipelineBase* CreateComputePipeline(ComputePipelineBuilder* builder) override;
DepthStencilStateBase* CreateDepthStencilState(DepthStencilStateBuilder* builder) override;
InputStateBase* CreateInputState(InputStateBuilder* builder) override;
- PipelineLayoutBase* CreatePipelineLayout(PipelineLayoutBuilder* builder) override;
RenderPassDescriptorBase* CreateRenderPassDescriptor(
RenderPassDescriptorBuilder* builder) override;
RenderPipelineBase* CreateRenderPipeline(RenderPipelineBuilder* builder) override;
@@ -47,6 +46,8 @@
void TickImpl() override;
private:
+ ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
+ const nxt::PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl(
const nxt::SamplerDescriptor* descriptor) override;
diff --git a/src/backend/opengl/PipelineLayoutGL.cpp b/src/backend/opengl/PipelineLayoutGL.cpp
index 444246d..44a08d8 100644
--- a/src/backend/opengl/PipelineLayoutGL.cpp
+++ b/src/backend/opengl/PipelineLayoutGL.cpp
@@ -15,10 +15,12 @@
#include "backend/opengl/PipelineLayoutGL.h"
#include "backend/BindGroupLayout.h"
+#include "backend/opengl/DeviceGL.h"
namespace backend { namespace opengl {
- PipelineLayout::PipelineLayout(PipelineLayoutBuilder* builder) : PipelineLayoutBase(builder) {
+ PipelineLayout::PipelineLayout(Device* device, const nxt::PipelineLayoutDescriptor* descriptor)
+ : PipelineLayoutBase(device, descriptor) {
GLuint uboIndex = 0;
GLuint samplerIndex = 0;
GLuint sampledTextureIndex = 0;
diff --git a/src/backend/opengl/PipelineLayoutGL.h b/src/backend/opengl/PipelineLayoutGL.h
index 3c60787..c084590 100644
--- a/src/backend/opengl/PipelineLayoutGL.h
+++ b/src/backend/opengl/PipelineLayoutGL.h
@@ -25,7 +25,7 @@
class PipelineLayout : public PipelineLayoutBase {
public:
- PipelineLayout(PipelineLayoutBuilder* builder);
+ PipelineLayout(Device* device, const nxt::PipelineLayoutDescriptor* descriptor);
using BindingIndexInfo =
std::array<std::array<GLuint, kMaxBindingsPerGroup>, kMaxBindGroups>;
diff --git a/src/backend/opengl/TextureGL.h b/src/backend/opengl/TextureGL.h
index a6583e8..50756f4 100644
--- a/src/backend/opengl/TextureGL.h
+++ b/src/backend/opengl/TextureGL.h
@@ -21,8 +21,6 @@
namespace backend { namespace opengl {
- class Device;
-
struct TextureFormatInfo {
GLenum internalFormat;
GLenum format;