summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhi_p_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-06-12 14:22:33 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-06-17 10:32:57 +0200
commit6f4aa5413183f3f18dd1b15dbc90bcee9ef85bdd (patch)
tree4e0d3d98de98f7a77cc9c52d4b11682093d94958 /src/gui/rhi/qrhi_p_p.h
parent4c297bdca8da543c582d129f12413d29a2a520eb (diff)
rhi: Add compute api and implement for Vulkan and Metal
D3D11 and GL (4.3+, ES 3.1+) will come separately at a later time. Change-Id: If30f2f3d062fa27e57e9912674669225b82a7b93 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhi_p_p.h')
-rw-r--r--src/gui/rhi/qrhi_p_p.h43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/gui/rhi/qrhi_p_p.h b/src/gui/rhi/qrhi_p_p.h
index de9bdae992..4fd01d3ef2 100644
--- a/src/gui/rhi/qrhi_p_p.h
+++ b/src/gui/rhi/qrhi_p_p.h
@@ -70,6 +70,7 @@ public:
virtual void destroy() = 0;
virtual QRhiGraphicsPipeline *createGraphicsPipeline() = 0;
+ virtual QRhiComputePipeline *createComputePipeline() = 0;
virtual QRhiShaderResourceBindings *createShaderResourceBindings() = 0;
virtual QRhiBuffer *createBuffer(QRhiBuffer::Type type,
QRhiBuffer::UsageFlags usage,
@@ -133,6 +134,11 @@ public:
virtual void debugMarkEnd(QRhiCommandBuffer *cb) = 0;
virtual void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) = 0;
+ virtual void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) = 0;
+ virtual void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) = 0;
+ virtual void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) = 0;
+ virtual void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) = 0;
+
virtual const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) = 0;
virtual void beginExternal(QRhiCommandBuffer *cb) = 0;
virtual void endExternal(QRhiCommandBuffer *cb) = 0;
@@ -200,6 +206,7 @@ public:
protected:
bool debugMarkers = false;
int currentFrameSlot = 0; // for vk, mtl, and similar. unused by gl and d3d11.
+ bool inFrame = false;
private:
QRhi::Implementation implType;
@@ -210,7 +217,6 @@ private:
QSet<QRhiResource *> resources;
QSet<QRhiResource *> pendingReleaseAndDestroyResources;
QVector<QRhi::CleanupCallback> cleanupCallbacks;
- bool inFrame = false;
friend class QRhi;
friend class QRhiResourceUpdateBatchPrivate;
@@ -393,9 +399,20 @@ public:
QRhiTexture *tex;
QRhiSampler *sampler;
};
+ struct StorageImageData {
+ QRhiTexture *tex;
+ int level;
+ };
+ struct StorageBufferData {
+ QRhiBuffer *buf;
+ int offset;
+ int maybeSize;
+ };
union {
UniformBufferData ubuf;
SampledTextureData stex;
+ StorageImageData simage;
+ StorageBufferData sbuf;
} u;
};
@@ -487,33 +504,41 @@ public:
enum BufferStage {
BufVertexInputStage,
BufVertexStage,
- BufFragmentStage
+ BufFragmentStage,
+ BufComputeStage
};
enum BufferAccess {
BufVertexInput,
BufIndexRead,
- BufUniformRead
+ BufUniformRead,
+ BufStorageLoad,
+ BufStorageStore,
+ BufStorageLoadStore
};
- void registerBufferOnce(QRhiBuffer *buf, int slot, BufferAccess access, BufferStage stage,
- const UsageState &stateAtPassBegin);
+ void registerBuffer(QRhiBuffer *buf, int slot, BufferAccess *access, BufferStage *stage,
+ const UsageState &state);
enum TextureStage {
TexVertexStage,
TexFragmentStage,
TexColorOutputStage,
- TexDepthOutputStage
+ TexDepthOutputStage,
+ TexComputeStage
};
enum TextureAccess {
TexSample,
TexColorOutput,
- TexDepthOutput
+ TexDepthOutput,
+ TexStorageLoad,
+ TexStorageStore,
+ TexStorageLoadStore
};
- void registerTextureOnce(QRhiTexture *tex, TextureAccess access, TextureStage stage,
- const UsageState &stateAtPassBegin);
+ void registerTexture(QRhiTexture *tex, TextureAccess *access, TextureStage *stage,
+ const UsageState &state);
struct Buffer {
QRhiBuffer *buf;