Rename MVKDescriptorBinding to MVKDescriptor, including subclasses.
This commit is contained in:
parent
3a56901460
commit
3a1b19be51
@ -157,10 +157,10 @@
|
|||||||
A95B7D6A1D3EE486003183D3 /* MVKCommandEncoderState.h in Headers */ = {isa = PBXBuildFile; fileRef = A95B7D671D3EE486003183D3 /* MVKCommandEncoderState.h */; };
|
A95B7D6A1D3EE486003183D3 /* MVKCommandEncoderState.h in Headers */ = {isa = PBXBuildFile; fileRef = A95B7D671D3EE486003183D3 /* MVKCommandEncoderState.h */; };
|
||||||
A95B7D6B1D3EE486003183D3 /* MVKCommandEncoderState.mm in Sources */ = {isa = PBXBuildFile; fileRef = A95B7D681D3EE486003183D3 /* MVKCommandEncoderState.mm */; };
|
A95B7D6B1D3EE486003183D3 /* MVKCommandEncoderState.mm in Sources */ = {isa = PBXBuildFile; fileRef = A95B7D681D3EE486003183D3 /* MVKCommandEncoderState.mm */; };
|
||||||
A95B7D6C1D3EE486003183D3 /* MVKCommandEncoderState.mm in Sources */ = {isa = PBXBuildFile; fileRef = A95B7D681D3EE486003183D3 /* MVKCommandEncoderState.mm */; };
|
A95B7D6C1D3EE486003183D3 /* MVKCommandEncoderState.mm in Sources */ = {isa = PBXBuildFile; fileRef = A95B7D681D3EE486003183D3 /* MVKCommandEncoderState.mm */; };
|
||||||
A966A5DF23C535D000BBF9B4 /* MVKDescriptorBinding.h in Headers */ = {isa = PBXBuildFile; fileRef = A966A5DC23C535D000BBF9B4 /* MVKDescriptorBinding.h */; };
|
A966A5DF23C535D000BBF9B4 /* MVKDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = A966A5DC23C535D000BBF9B4 /* MVKDescriptor.h */; };
|
||||||
A966A5E023C535D000BBF9B4 /* MVKDescriptorBinding.h in Headers */ = {isa = PBXBuildFile; fileRef = A966A5DC23C535D000BBF9B4 /* MVKDescriptorBinding.h */; };
|
A966A5E023C535D000BBF9B4 /* MVKDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = A966A5DC23C535D000BBF9B4 /* MVKDescriptor.h */; };
|
||||||
A966A5E123C535D000BBF9B4 /* MVKDescriptorBinding.mm in Sources */ = {isa = PBXBuildFile; fileRef = A966A5DE23C535D000BBF9B4 /* MVKDescriptorBinding.mm */; };
|
A966A5E123C535D000BBF9B4 /* MVKDescriptor.mm in Sources */ = {isa = PBXBuildFile; fileRef = A966A5DE23C535D000BBF9B4 /* MVKDescriptor.mm */; };
|
||||||
A966A5E223C535D000BBF9B4 /* MVKDescriptorBinding.mm in Sources */ = {isa = PBXBuildFile; fileRef = A966A5DE23C535D000BBF9B4 /* MVKDescriptorBinding.mm */; };
|
A966A5E223C535D000BBF9B4 /* MVKDescriptor.mm in Sources */ = {isa = PBXBuildFile; fileRef = A966A5DE23C535D000BBF9B4 /* MVKDescriptor.mm */; };
|
||||||
A981494D1FB6A3F7005F00B4 /* MVKBaseObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = A98149411FB6A3F7005F00B4 /* MVKBaseObject.mm */; };
|
A981494D1FB6A3F7005F00B4 /* MVKBaseObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = A98149411FB6A3F7005F00B4 /* MVKBaseObject.mm */; };
|
||||||
A981494E1FB6A3F7005F00B4 /* MVKBaseObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = A98149411FB6A3F7005F00B4 /* MVKBaseObject.mm */; };
|
A981494E1FB6A3F7005F00B4 /* MVKBaseObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = A98149411FB6A3F7005F00B4 /* MVKBaseObject.mm */; };
|
||||||
A981494F1FB6A3F7005F00B4 /* MVKBaseObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A98149421FB6A3F7005F00B4 /* MVKBaseObject.h */; };
|
A981494F1FB6A3F7005F00B4 /* MVKBaseObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A98149421FB6A3F7005F00B4 /* MVKBaseObject.h */; };
|
||||||
@ -377,8 +377,8 @@
|
|||||||
A95870F71C90D29F009EB096 /* MVKCommandResourceFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKCommandResourceFactory.mm; sourceTree = "<group>"; };
|
A95870F71C90D29F009EB096 /* MVKCommandResourceFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKCommandResourceFactory.mm; sourceTree = "<group>"; };
|
||||||
A95B7D671D3EE486003183D3 /* MVKCommandEncoderState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKCommandEncoderState.h; sourceTree = "<group>"; };
|
A95B7D671D3EE486003183D3 /* MVKCommandEncoderState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKCommandEncoderState.h; sourceTree = "<group>"; };
|
||||||
A95B7D681D3EE486003183D3 /* MVKCommandEncoderState.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKCommandEncoderState.mm; sourceTree = "<group>"; };
|
A95B7D681D3EE486003183D3 /* MVKCommandEncoderState.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKCommandEncoderState.mm; sourceTree = "<group>"; };
|
||||||
A966A5DC23C535D000BBF9B4 /* MVKDescriptorBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKDescriptorBinding.h; sourceTree = "<group>"; };
|
A966A5DC23C535D000BBF9B4 /* MVKDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKDescriptor.h; sourceTree = "<group>"; };
|
||||||
A966A5DE23C535D000BBF9B4 /* MVKDescriptorBinding.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKDescriptorBinding.mm; sourceTree = "<group>"; };
|
A966A5DE23C535D000BBF9B4 /* MVKDescriptor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKDescriptor.mm; sourceTree = "<group>"; };
|
||||||
A98149411FB6A3F7005F00B4 /* MVKBaseObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKBaseObject.mm; sourceTree = "<group>"; };
|
A98149411FB6A3F7005F00B4 /* MVKBaseObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKBaseObject.mm; sourceTree = "<group>"; };
|
||||||
A98149421FB6A3F7005F00B4 /* MVKBaseObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKBaseObject.h; sourceTree = "<group>"; };
|
A98149421FB6A3F7005F00B4 /* MVKBaseObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKBaseObject.h; sourceTree = "<group>"; };
|
||||||
A98149431FB6A3F7005F00B4 /* MVKEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKEnvironment.h; sourceTree = "<group>"; };
|
A98149431FB6A3F7005F00B4 /* MVKEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKEnvironment.h; sourceTree = "<group>"; };
|
||||||
@ -489,8 +489,8 @@
|
|||||||
children = (
|
children = (
|
||||||
A94FB77F1C7DFB4800632CA3 /* MVKBuffer.h */,
|
A94FB77F1C7DFB4800632CA3 /* MVKBuffer.h */,
|
||||||
A94FB7801C7DFB4800632CA3 /* MVKBuffer.mm */,
|
A94FB7801C7DFB4800632CA3 /* MVKBuffer.mm */,
|
||||||
A966A5DC23C535D000BBF9B4 /* MVKDescriptorBinding.h */,
|
A966A5DC23C535D000BBF9B4 /* MVKDescriptor.h */,
|
||||||
A966A5DE23C535D000BBF9B4 /* MVKDescriptorBinding.mm */,
|
A966A5DE23C535D000BBF9B4 /* MVKDescriptor.mm */,
|
||||||
A94FB7811C7DFB4800632CA3 /* MVKDescriptorSet.h */,
|
A94FB7811C7DFB4800632CA3 /* MVKDescriptorSet.h */,
|
||||||
A94FB7821C7DFB4800632CA3 /* MVKDescriptorSet.mm */,
|
A94FB7821C7DFB4800632CA3 /* MVKDescriptorSet.mm */,
|
||||||
A94FB7831C7DFB4800632CA3 /* MVKDevice.h */,
|
A94FB7831C7DFB4800632CA3 /* MVKDevice.h */,
|
||||||
@ -703,7 +703,7 @@
|
|||||||
A94FB7F01C7DFB4800632CA3 /* MVKImage.h in Headers */,
|
A94FB7F01C7DFB4800632CA3 /* MVKImage.h in Headers */,
|
||||||
4553AEFD2251617100E8EBCD /* MVKBlockObserver.h in Headers */,
|
4553AEFD2251617100E8EBCD /* MVKBlockObserver.h in Headers */,
|
||||||
A94FB7B81C7DFB4800632CA3 /* MVKCmdTransfer.h in Headers */,
|
A94FB7B81C7DFB4800632CA3 /* MVKCmdTransfer.h in Headers */,
|
||||||
A966A5DF23C535D000BBF9B4 /* MVKDescriptorBinding.h in Headers */,
|
A966A5DF23C535D000BBF9B4 /* MVKDescriptor.h in Headers */,
|
||||||
A94FB7C81C7DFB4800632CA3 /* MVKCmdDraw.h in Headers */,
|
A94FB7C81C7DFB4800632CA3 /* MVKCmdDraw.h in Headers */,
|
||||||
A94FB7D01C7DFB4800632CA3 /* MVKCommandBuffer.h in Headers */,
|
A94FB7D01C7DFB4800632CA3 /* MVKCommandBuffer.h in Headers */,
|
||||||
A9E53DF32100B302002781DD /* MTLRenderPassDescriptor+MoltenVK.h in Headers */,
|
A9E53DF32100B302002781DD /* MTLRenderPassDescriptor+MoltenVK.h in Headers */,
|
||||||
@ -772,7 +772,7 @@
|
|||||||
A94FB7F11C7DFB4800632CA3 /* MVKImage.h in Headers */,
|
A94FB7F11C7DFB4800632CA3 /* MVKImage.h in Headers */,
|
||||||
4553AEFE2251617100E8EBCD /* MVKBlockObserver.h in Headers */,
|
4553AEFE2251617100E8EBCD /* MVKBlockObserver.h in Headers */,
|
||||||
A94FB7B91C7DFB4800632CA3 /* MVKCmdTransfer.h in Headers */,
|
A94FB7B91C7DFB4800632CA3 /* MVKCmdTransfer.h in Headers */,
|
||||||
A966A5E023C535D000BBF9B4 /* MVKDescriptorBinding.h in Headers */,
|
A966A5E023C535D000BBF9B4 /* MVKDescriptor.h in Headers */,
|
||||||
A94FB7C91C7DFB4800632CA3 /* MVKCmdDraw.h in Headers */,
|
A94FB7C91C7DFB4800632CA3 /* MVKCmdDraw.h in Headers */,
|
||||||
A94FB7D11C7DFB4800632CA3 /* MVKCommandBuffer.h in Headers */,
|
A94FB7D11C7DFB4800632CA3 /* MVKCommandBuffer.h in Headers */,
|
||||||
A9E53DF42100B302002781DD /* MTLRenderPassDescriptor+MoltenVK.h in Headers */,
|
A9E53DF42100B302002781DD /* MTLRenderPassDescriptor+MoltenVK.h in Headers */,
|
||||||
@ -1014,7 +1014,7 @@
|
|||||||
A98149551FB6A3F7005F00B4 /* MVKFoundation.cpp in Sources */,
|
A98149551FB6A3F7005F00B4 /* MVKFoundation.cpp in Sources */,
|
||||||
A94FB7E61C7DFB4800632CA3 /* MVKDevice.mm in Sources */,
|
A94FB7E61C7DFB4800632CA3 /* MVKDevice.mm in Sources */,
|
||||||
A9E53DF52100B302002781DD /* MTLRenderPassDescriptor+MoltenVK.m in Sources */,
|
A9E53DF52100B302002781DD /* MTLRenderPassDescriptor+MoltenVK.m in Sources */,
|
||||||
A966A5E123C535D000BBF9B4 /* MVKDescriptorBinding.mm in Sources */,
|
A966A5E123C535D000BBF9B4 /* MVKDescriptor.mm in Sources */,
|
||||||
A94FB7FA1C7DFB4800632CA3 /* MVKPipeline.mm in Sources */,
|
A94FB7FA1C7DFB4800632CA3 /* MVKPipeline.mm in Sources */,
|
||||||
A94FB8021C7DFB4800632CA3 /* MVKQueue.mm in Sources */,
|
A94FB8021C7DFB4800632CA3 /* MVKQueue.mm in Sources */,
|
||||||
A9E53DD72100B197002781DD /* MTLSamplerDescriptor+MoltenVK.m in Sources */,
|
A9E53DD72100B197002781DD /* MTLSamplerDescriptor+MoltenVK.m in Sources */,
|
||||||
@ -1071,7 +1071,7 @@
|
|||||||
A98149561FB6A3F7005F00B4 /* MVKFoundation.cpp in Sources */,
|
A98149561FB6A3F7005F00B4 /* MVKFoundation.cpp in Sources */,
|
||||||
A94FB7E71C7DFB4800632CA3 /* MVKDevice.mm in Sources */,
|
A94FB7E71C7DFB4800632CA3 /* MVKDevice.mm in Sources */,
|
||||||
A9E53DF62100B302002781DD /* MTLRenderPassDescriptor+MoltenVK.m in Sources */,
|
A9E53DF62100B302002781DD /* MTLRenderPassDescriptor+MoltenVK.m in Sources */,
|
||||||
A966A5E223C535D000BBF9B4 /* MVKDescriptorBinding.mm in Sources */,
|
A966A5E223C535D000BBF9B4 /* MVKDescriptor.mm in Sources */,
|
||||||
A94FB7FB1C7DFB4800632CA3 /* MVKPipeline.mm in Sources */,
|
A94FB7FB1C7DFB4800632CA3 /* MVKPipeline.mm in Sources */,
|
||||||
A94FB8031C7DFB4800632CA3 /* MVKQueue.mm in Sources */,
|
A94FB8031C7DFB4800632CA3 /* MVKQueue.mm in Sources */,
|
||||||
A9E53DD82100B197002781DD /* MTLSamplerDescriptor+MoltenVK.m in Sources */,
|
A9E53DD82100B197002781DD /* MTLSamplerDescriptor+MoltenVK.m in Sources */,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* MVKDescriptorBinding.h
|
* MVKDescriptor.h
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2020 The Brenwill Workshop Ltd. (http://www.brenwill.com)
|
* Copyright (c) 2015-2020 The Brenwill Workshop Ltd. (http://www.brenwill.com)
|
||||||
*
|
*
|
||||||
@ -22,7 +22,7 @@
|
|||||||
#include "MVKVector.h"
|
#include "MVKVector.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class MVKDescriptorBinding;
|
class MVKDescriptor;
|
||||||
class MVKDescriptorSet;
|
class MVKDescriptorSet;
|
||||||
class MVKDescriptorSetLayout;
|
class MVKDescriptorSetLayout;
|
||||||
class MVKCommandEncoder;
|
class MVKCommandEncoder;
|
||||||
@ -30,7 +30,7 @@ class MVKCommandEncoder;
|
|||||||
|
|
||||||
#pragma mark MVKShaderStageResourceBinding
|
#pragma mark MVKShaderStageResourceBinding
|
||||||
|
|
||||||
/** Indicates the Metal resource indexes used by a single shader stage in a descriptor binding. */
|
/** Indicates the Metal resource indexes used by a single shader stage in a descriptor. */
|
||||||
typedef struct MVKShaderStageResourceBinding {
|
typedef struct MVKShaderStageResourceBinding {
|
||||||
uint32_t bufferIndex = 0;
|
uint32_t bufferIndex = 0;
|
||||||
uint32_t textureIndex = 0;
|
uint32_t textureIndex = 0;
|
||||||
@ -44,7 +44,7 @@ typedef struct MVKShaderStageResourceBinding {
|
|||||||
|
|
||||||
#pragma mark MVKShaderResourceBinding
|
#pragma mark MVKShaderResourceBinding
|
||||||
|
|
||||||
/** Indicates the Metal resource indexes used by each shader stage in a descriptor binding. */
|
/** Indicates the Metal resource indexes used by each shader stage in a descriptor. */
|
||||||
typedef struct MVKShaderResourceBinding {
|
typedef struct MVKShaderResourceBinding {
|
||||||
MVKShaderStageResourceBinding stages[kMVKShaderStageMax];
|
MVKShaderStageResourceBinding stages[kMVKShaderStageMax];
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ public:
|
|||||||
MVKVector<uint32_t>& dynamicOffsets,
|
MVKVector<uint32_t>& dynamicOffsets,
|
||||||
uint32_t* pDynamicOffsetIndex);
|
uint32_t* pDynamicOffsetIndex);
|
||||||
|
|
||||||
/** Encodes this binding layout and the specified descriptor binding on the specified command encoder immediately. */
|
/** Encodes this binding layout and the specified descriptor on the specified command encoder immediately. */
|
||||||
void push(MVKCommandEncoder* cmdEncoder,
|
void push(MVKCommandEncoder* cmdEncoder,
|
||||||
uint32_t& dstArrayElement,
|
uint32_t& dstArrayElement,
|
||||||
uint32_t& descriptorCount,
|
uint32_t& descriptorCount,
|
||||||
@ -118,9 +118,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class MVKDescriptorSet;
|
friend class MVKDescriptorSet;
|
||||||
friend class MVKDescriptorBinding;
|
|
||||||
|
|
||||||
MVKDescriptorBinding* newDescriptorBinding();
|
MVKDescriptor* newDescriptor();
|
||||||
void initMetalResourceIndexOffsets(MVKShaderStageResourceBinding* pBindingIndexes,
|
void initMetalResourceIndexOffsets(MVKShaderStageResourceBinding* pBindingIndexes,
|
||||||
MVKShaderStageResourceBinding* pDescSetCounts,
|
MVKShaderStageResourceBinding* pDescSetCounts,
|
||||||
const VkDescriptorSetLayoutBinding* pBinding);
|
const VkDescriptorSetLayoutBinding* pBinding);
|
||||||
@ -135,10 +134,10 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKDescriptorBinding
|
#pragma mark MVKDescriptor
|
||||||
|
|
||||||
/** Represents a Vulkan descriptor binding. */
|
/** Represents a Vulkan descriptor. */
|
||||||
class MVKDescriptorBinding : public MVKBaseObject {
|
class MVKDescriptor : public MVKBaseObject {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -189,10 +188,10 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKBufferDescriptorBinding
|
#pragma mark MVKBufferDescriptor
|
||||||
|
|
||||||
/** Represents a Vulkan descriptor binding tracking a buffer. */
|
/** Represents a Vulkan descriptor tracking a buffer. */
|
||||||
class MVKBufferDescriptorBinding : public MVKDescriptorBinding {
|
class MVKBufferDescriptor : public MVKDescriptor {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void bind(MVKCommandEncoder* cmdEncoder,
|
void bind(MVKCommandEncoder* cmdEncoder,
|
||||||
@ -217,7 +216,7 @@ public:
|
|||||||
VkBufferView* pTexelBufferView,
|
VkBufferView* pTexelBufferView,
|
||||||
VkWriteDescriptorSetInlineUniformBlockEXT* inlineUniformBlock) override;
|
VkWriteDescriptorSetInlineUniformBlockEXT* inlineUniformBlock) override;
|
||||||
|
|
||||||
~MVKBufferDescriptorBinding();
|
~MVKBufferDescriptor();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MVKBuffer* _mvkBuffer = nullptr;
|
MVKBuffer* _mvkBuffer = nullptr;
|
||||||
@ -227,10 +226,10 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKInlineUniformDescriptorBinding
|
#pragma mark MVKInlineUniformDescriptor
|
||||||
|
|
||||||
/** Represents a Vulkan descriptor binding tracking an inline block of uniform data. */
|
/** Represents a Vulkan descriptor tracking an inline block of uniform data. */
|
||||||
class MVKInlineUniformDescriptorBinding : public MVKDescriptorBinding {
|
class MVKInlineUniformDescriptor : public MVKDescriptor {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void bind(MVKCommandEncoder* cmdEncoder,
|
void bind(MVKCommandEncoder* cmdEncoder,
|
||||||
@ -255,7 +254,7 @@ public:
|
|||||||
VkBufferView* pTexelBufferView,
|
VkBufferView* pTexelBufferView,
|
||||||
VkWriteDescriptorSetInlineUniformBlockEXT* inlineUniformBlock) override;
|
VkWriteDescriptorSetInlineUniformBlockEXT* inlineUniformBlock) override;
|
||||||
|
|
||||||
~MVKInlineUniformDescriptorBinding();
|
~MVKInlineUniformDescriptor();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
id<MTLBuffer> _mtlBuffer = nil;
|
id<MTLBuffer> _mtlBuffer = nil;
|
||||||
@ -264,10 +263,10 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKImageDescriptorBinding
|
#pragma mark MVKImageDescriptor
|
||||||
|
|
||||||
/** Represents a Vulkan descriptor binding tracking an image. */
|
/** Represents a Vulkan descriptor tracking an image. */
|
||||||
class MVKImageDescriptorBinding : public MVKDescriptorBinding {
|
class MVKImageDescriptor : public MVKDescriptor {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void bind(MVKCommandEncoder* cmdEncoder,
|
void bind(MVKCommandEncoder* cmdEncoder,
|
||||||
@ -292,7 +291,7 @@ public:
|
|||||||
VkBufferView* pTexelBufferView,
|
VkBufferView* pTexelBufferView,
|
||||||
VkWriteDescriptorSetInlineUniformBlockEXT* inlineUniformBlock) override;
|
VkWriteDescriptorSetInlineUniformBlockEXT* inlineUniformBlock) override;
|
||||||
|
|
||||||
~MVKImageDescriptorBinding();
|
~MVKImageDescriptor();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MVKImageView* _mvkImageView = nullptr;
|
MVKImageView* _mvkImageView = nullptr;
|
||||||
@ -301,16 +300,16 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKSamplerDescriptorBindingMixin
|
#pragma mark MVKSamplerDescriptorMixin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This mixin class adds the ability for a descriptor binding to track a sampler.
|
* This mixin class adds the ability for a descriptor to track a sampler.
|
||||||
*
|
*
|
||||||
* As a mixin, this class should only be used as a component of multiple inheritance.
|
* As a mixin, this class should only be used as a component of multiple inheritance.
|
||||||
* Any class that inherits from this class should also inherit from MVKDescriptorBinding.
|
* Any class that inherits from this class should also inherit from MVKDescriptor.
|
||||||
* This requirement is to avoid the diamond problem of multiple inheritance.
|
* This requirement is to avoid the diamond problem of multiple inheritance.
|
||||||
*/
|
*/
|
||||||
class MVKSamplerDescriptorBindingMixin {
|
class MVKSamplerDescriptorMixin {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void bind(MVKCommandEncoder* cmdEncoder,
|
void bind(MVKCommandEncoder* cmdEncoder,
|
||||||
@ -337,7 +336,7 @@ protected:
|
|||||||
|
|
||||||
void setLayout(MVKDescriptorSetLayoutBinding* dslBinding, uint32_t index);
|
void setLayout(MVKDescriptorSetLayoutBinding* dslBinding, uint32_t index);
|
||||||
|
|
||||||
virtual ~MVKSamplerDescriptorBindingMixin();
|
virtual ~MVKSamplerDescriptorMixin();
|
||||||
|
|
||||||
MVKSampler* _mvkSampler = nullptr;
|
MVKSampler* _mvkSampler = nullptr;
|
||||||
bool _hasDynamicSampler = true;
|
bool _hasDynamicSampler = true;
|
||||||
@ -345,11 +344,10 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKSamplerDescriptorBinding
|
#pragma mark MVKSamplerDescriptor
|
||||||
|
|
||||||
/** Represents a Vulkan descriptor binding tracking a sampler. */
|
/** Represents a Vulkan descriptor tracking a sampler. */
|
||||||
class MVKSamplerDescriptorBinding : public MVKDescriptorBinding,
|
class MVKSamplerDescriptor : public MVKDescriptor, public MVKSamplerDescriptorMixin {
|
||||||
public MVKSamplerDescriptorBindingMixin {
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void bind(MVKCommandEncoder* cmdEncoder,
|
void bind(MVKCommandEncoder* cmdEncoder,
|
||||||
@ -380,11 +378,10 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKCombinedImageSamplerDescriptorBinding
|
#pragma mark MVKCombinedImageSamplerDescriptor
|
||||||
|
|
||||||
/** Represents a Vulkan descriptor binding tracking a combined image and sampler. */
|
/** Represents a Vulkan descriptor tracking a combined image and sampler. */
|
||||||
class MVKCombinedImageSamplerDescriptorBinding : public MVKImageDescriptorBinding,
|
class MVKCombinedImageSamplerDescriptor : public MVKImageDescriptor, public MVKSamplerDescriptorMixin {
|
||||||
public MVKSamplerDescriptorBindingMixin {
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void bind(MVKCommandEncoder* cmdEncoder,
|
void bind(MVKCommandEncoder* cmdEncoder,
|
||||||
@ -415,10 +412,10 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKTexelBufferDescriptorBinding
|
#pragma mark MVKTexelBufferDescriptor
|
||||||
|
|
||||||
/** Represents a Vulkan descriptor binding tracking a texel buffer. */
|
/** Represents a Vulkan descriptor tracking a texel buffer. */
|
||||||
class MVKTexelBufferDescriptorBinding : public MVKDescriptorBinding {
|
class MVKTexelBufferDescriptor : public MVKDescriptor {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void bind(MVKCommandEncoder* cmdEncoder,
|
void bind(MVKCommandEncoder* cmdEncoder,
|
||||||
@ -443,7 +440,7 @@ public:
|
|||||||
VkBufferView* pTexelBufferView,
|
VkBufferView* pTexelBufferView,
|
||||||
VkWriteDescriptorSetInlineUniformBlockEXT* inlineUniformBlock) override;
|
VkWriteDescriptorSetInlineUniformBlockEXT* inlineUniformBlock) override;
|
||||||
|
|
||||||
~MVKTexelBufferDescriptorBinding();
|
~MVKTexelBufferDescriptor();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MVKBufferView* _mvkBufferView = nullptr;
|
MVKBufferView* _mvkBufferView = nullptr;
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* MVKDescriptorBinding.mm
|
* MVKDescriptor.mm
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2020 The Brenwill Workshop Ltd. (http://www.brenwill.com)
|
* Copyright (c) 2015-2020 The Brenwill Workshop Ltd. (http://www.brenwill.com)
|
||||||
*
|
*
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "MVKDescriptorBinding.h"
|
#include "MVKDescriptor.h"
|
||||||
#include "MVKDescriptorSet.h"
|
#include "MVKDescriptorSet.h"
|
||||||
#include "MVKBuffer.h"
|
#include "MVKBuffer.h"
|
||||||
|
|
||||||
@ -94,38 +94,38 @@ uint32_t MVKDescriptorSetLayoutBinding::bind(MVKCommandEncoder* cmdEncoder,
|
|||||||
|
|
||||||
uint32_t descCnt = _info.descriptorCount;
|
uint32_t descCnt = _info.descriptorCount;
|
||||||
for (uint32_t descIdx = 0; descIdx < descCnt; descIdx++) {
|
for (uint32_t descIdx = 0; descIdx < descCnt; descIdx++) {
|
||||||
MVKDescriptorBinding* descBinding = descSet->getDescriptorBinding(descStartIndex + descIdx);
|
MVKDescriptor* mvkDesc = descSet->getDescriptor(descStartIndex + descIdx);
|
||||||
descBinding->bind(cmdEncoder, _info.descriptorType, descIdx, _applyToStage,
|
mvkDesc->bind(cmdEncoder, _info.descriptorType, descIdx, _applyToStage,
|
||||||
mtlIdxs, dynamicOffsets, pDynamicOffsetIndex);
|
mtlIdxs, dynamicOffsets, pDynamicOffsetIndex);
|
||||||
}
|
}
|
||||||
return descCnt;
|
return descCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
MVKDescriptorBinding* MVKDescriptorSetLayoutBinding::newDescriptorBinding() {
|
MVKDescriptor* MVKDescriptorSetLayoutBinding::newDescriptor() {
|
||||||
switch (_info.descriptorType) {
|
switch (_info.descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||||
return new MVKBufferDescriptorBinding();
|
return new MVKBufferDescriptor();
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT:
|
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT:
|
||||||
return new MVKInlineUniformDescriptorBinding();
|
return new MVKInlineUniformDescriptor();
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
||||||
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
|
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
|
||||||
return new MVKImageDescriptorBinding();
|
return new MVKImageDescriptor();
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
||||||
return new MVKSamplerDescriptorBinding();
|
return new MVKSamplerDescriptor();
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
|
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
|
||||||
return new MVKCombinedImageSamplerDescriptorBinding();
|
return new MVKCombinedImageSamplerDescriptor();
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
||||||
return new MVKTexelBufferDescriptorBinding();
|
return new MVKTexelBufferDescriptor();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -470,16 +470,16 @@ void MVKDescriptorSetLayoutBinding::initMetalResourceIndexOffsets(MVKShaderStage
|
|||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKBufferDescriptorBinding
|
#pragma mark MVKBufferDescriptor
|
||||||
|
|
||||||
// A null cmdEncoder can be passed to perform a validation pass
|
// A null cmdEncoder can be passed to perform a validation pass
|
||||||
void MVKBufferDescriptorBinding::bind(MVKCommandEncoder* cmdEncoder,
|
void MVKBufferDescriptor::bind(MVKCommandEncoder* cmdEncoder,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t descriptorIndex,
|
uint32_t descriptorIndex,
|
||||||
bool stages[],
|
bool stages[],
|
||||||
MVKShaderResourceBinding& mtlIndexes,
|
MVKShaderResourceBinding& mtlIndexes,
|
||||||
MVKVector<uint32_t>& dynamicOffsets,
|
MVKVector<uint32_t>& dynamicOffsets,
|
||||||
uint32_t* pDynamicOffsetIndex) {
|
uint32_t* pDynamicOffsetIndex) {
|
||||||
MVKMTLBufferBinding bb;
|
MVKMTLBufferBinding bb;
|
||||||
NSUInteger bufferDynamicOffset = 0;
|
NSUInteger bufferDynamicOffset = 0;
|
||||||
|
|
||||||
@ -514,11 +514,11 @@ void MVKBufferDescriptorBinding::bind(MVKCommandEncoder* cmdEncoder,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKBufferDescriptorBinding::write(MVKDescriptorSet* mvkDescSet,
|
void MVKBufferDescriptor::write(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t srcIndex,
|
uint32_t srcIndex,
|
||||||
size_t stride,
|
size_t stride,
|
||||||
const void* pData) {
|
const void* pData) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||||
@ -541,13 +541,13 @@ void MVKBufferDescriptorBinding::write(MVKDescriptorSet* mvkDescSet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKBufferDescriptorBinding::read(MVKDescriptorSet* mvkDescSet,
|
void MVKBufferDescriptor::read(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t dstIndex,
|
uint32_t dstIndex,
|
||||||
VkDescriptorImageInfo* pImageInfo,
|
VkDescriptorImageInfo* pImageInfo,
|
||||||
VkDescriptorBufferInfo* pBufferInfo,
|
VkDescriptorBufferInfo* pBufferInfo,
|
||||||
VkBufferView* pTexelBufferView,
|
VkBufferView* pTexelBufferView,
|
||||||
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||||
@ -565,22 +565,22 @@ void MVKBufferDescriptorBinding::read(MVKDescriptorSet* mvkDescSet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MVKBufferDescriptorBinding::~MVKBufferDescriptorBinding() {
|
MVKBufferDescriptor::~MVKBufferDescriptor() {
|
||||||
if (_mvkBuffer) { _mvkBuffer->release(); }
|
if (_mvkBuffer) { _mvkBuffer->release(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKInlineUniformDescriptorBinding
|
#pragma mark MVKInlineUniformDescriptor
|
||||||
|
|
||||||
// A null cmdEncoder can be passed to perform a validation pass
|
// A null cmdEncoder can be passed to perform a validation pass
|
||||||
void MVKInlineUniformDescriptorBinding::bind(MVKCommandEncoder* cmdEncoder,
|
void MVKInlineUniformDescriptor::bind(MVKCommandEncoder* cmdEncoder,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t descriptorIndex,
|
uint32_t descriptorIndex,
|
||||||
bool stages[],
|
bool stages[],
|
||||||
MVKShaderResourceBinding& mtlIndexes,
|
MVKShaderResourceBinding& mtlIndexes,
|
||||||
MVKVector<uint32_t>& dynamicOffsets,
|
MVKVector<uint32_t>& dynamicOffsets,
|
||||||
uint32_t* pDynamicOffsetIndex) {
|
uint32_t* pDynamicOffsetIndex) {
|
||||||
MVKMTLBufferBinding bb;
|
MVKMTLBufferBinding bb;
|
||||||
|
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
@ -605,11 +605,11 @@ void MVKInlineUniformDescriptorBinding::bind(MVKCommandEncoder* cmdEncoder,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKInlineUniformDescriptorBinding::write(MVKDescriptorSet* mvkDescSet,
|
void MVKInlineUniformDescriptor::write(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t srcIndex,
|
uint32_t srcIndex,
|
||||||
size_t stride,
|
size_t stride,
|
||||||
const void* pData) {
|
const void* pData) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT: {
|
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT: {
|
||||||
const auto& srcInlineUniformBlock = get<VkWriteDescriptorSetInlineUniformBlockEXT>(pData, stride, srcIndex);
|
const auto& srcInlineUniformBlock = get<VkWriteDescriptorSetInlineUniformBlockEXT>(pData, stride, srcIndex);
|
||||||
@ -633,13 +633,13 @@ void MVKInlineUniformDescriptorBinding::write(MVKDescriptorSet* mvkDescSet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKInlineUniformDescriptorBinding::read(MVKDescriptorSet* mvkDescSet,
|
void MVKInlineUniformDescriptor::read(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t dstIndex,
|
uint32_t dstIndex,
|
||||||
VkDescriptorImageInfo* pImageInfo,
|
VkDescriptorImageInfo* pImageInfo,
|
||||||
VkDescriptorBufferInfo* pBufferInfo,
|
VkDescriptorBufferInfo* pBufferInfo,
|
||||||
VkBufferView* pTexelBufferView,
|
VkBufferView* pTexelBufferView,
|
||||||
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT: {
|
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT: {
|
||||||
auto& dstInlineUniformBlock = pInlineUniformBlock[dstIndex];
|
auto& dstInlineUniformBlock = pInlineUniformBlock[dstIndex];
|
||||||
@ -659,22 +659,22 @@ void MVKInlineUniformDescriptorBinding::read(MVKDescriptorSet* mvkDescSet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MVKInlineUniformDescriptorBinding::~MVKInlineUniformDescriptorBinding() {
|
MVKInlineUniformDescriptor::~MVKInlineUniformDescriptor() {
|
||||||
[_mtlBuffer release];
|
[_mtlBuffer release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKImageDescriptorBinding
|
#pragma mark MVKImageDescriptor
|
||||||
|
|
||||||
// A null cmdEncoder can be passed to perform a validation pass
|
// A null cmdEncoder can be passed to perform a validation pass
|
||||||
void MVKImageDescriptorBinding::bind(MVKCommandEncoder* cmdEncoder,
|
void MVKImageDescriptor::bind(MVKCommandEncoder* cmdEncoder,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t descriptorIndex,
|
uint32_t descriptorIndex,
|
||||||
bool stages[],
|
bool stages[],
|
||||||
MVKShaderResourceBinding& mtlIndexes,
|
MVKShaderResourceBinding& mtlIndexes,
|
||||||
MVKVector<uint32_t>& dynamicOffsets,
|
MVKVector<uint32_t>& dynamicOffsets,
|
||||||
uint32_t* pDynamicOffsetIndex) {
|
uint32_t* pDynamicOffsetIndex) {
|
||||||
MVKMTLTextureBinding tb;
|
MVKMTLTextureBinding tb;
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
||||||
@ -707,11 +707,11 @@ void MVKImageDescriptorBinding::bind(MVKCommandEncoder* cmdEncoder,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKImageDescriptorBinding::write(MVKDescriptorSet* mvkDescSet,
|
void MVKImageDescriptor::write(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t srcIndex,
|
uint32_t srcIndex,
|
||||||
size_t stride,
|
size_t stride,
|
||||||
const void* pData) {
|
const void* pData) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
||||||
@ -734,13 +734,13 @@ void MVKImageDescriptorBinding::write(MVKDescriptorSet* mvkDescSet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKImageDescriptorBinding::read(MVKDescriptorSet* mvkDescSet,
|
void MVKImageDescriptor::read(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t dstIndex,
|
uint32_t dstIndex,
|
||||||
VkDescriptorImageInfo* pImageInfo,
|
VkDescriptorImageInfo* pImageInfo,
|
||||||
VkDescriptorBufferInfo* pBufferInfo,
|
VkDescriptorBufferInfo* pBufferInfo,
|
||||||
VkBufferView* pTexelBufferView,
|
VkBufferView* pTexelBufferView,
|
||||||
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
||||||
@ -757,22 +757,22 @@ void MVKImageDescriptorBinding::read(MVKDescriptorSet* mvkDescSet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MVKImageDescriptorBinding::~MVKImageDescriptorBinding() {
|
MVKImageDescriptor::~MVKImageDescriptor() {
|
||||||
if (_mvkImageView) { _mvkImageView->release(); }
|
if (_mvkImageView) { _mvkImageView->release(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKSamplerDescriptorBindingMixin
|
#pragma mark MVKSamplerDescriptorMixin
|
||||||
|
|
||||||
// A null cmdEncoder can be passed to perform a validation pass
|
// A null cmdEncoder can be passed to perform a validation pass
|
||||||
void MVKSamplerDescriptorBindingMixin::bind(MVKCommandEncoder* cmdEncoder,
|
void MVKSamplerDescriptorMixin::bind(MVKCommandEncoder* cmdEncoder,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t descriptorIndex,
|
uint32_t descriptorIndex,
|
||||||
bool stages[],
|
bool stages[],
|
||||||
MVKShaderResourceBinding& mtlIndexes,
|
MVKShaderResourceBinding& mtlIndexes,
|
||||||
MVKVector<uint32_t>& dynamicOffsets,
|
MVKVector<uint32_t>& dynamicOffsets,
|
||||||
uint32_t* pDynamicOffsetIndex) {
|
uint32_t* pDynamicOffsetIndex) {
|
||||||
MVKMTLSamplerStateBinding sb;
|
MVKMTLSamplerStateBinding sb;
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
||||||
@ -798,11 +798,11 @@ void MVKSamplerDescriptorBindingMixin::bind(MVKCommandEncoder* cmdEncoder,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKSamplerDescriptorBindingMixin::write(MVKDescriptorSet* mvkDescSet,
|
void MVKSamplerDescriptorMixin::write(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t srcIndex,
|
uint32_t srcIndex,
|
||||||
size_t stride,
|
size_t stride,
|
||||||
const void* pData) {
|
const void* pData) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
||||||
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
|
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
|
||||||
@ -829,13 +829,13 @@ void MVKSamplerDescriptorBindingMixin::write(MVKDescriptorSet* mvkDescSet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKSamplerDescriptorBindingMixin::read(MVKDescriptorSet* mvkDescSet,
|
void MVKSamplerDescriptorMixin::read(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t dstIndex,
|
uint32_t dstIndex,
|
||||||
VkDescriptorImageInfo* pImageInfo,
|
VkDescriptorImageInfo* pImageInfo,
|
||||||
VkDescriptorBufferInfo* pBufferInfo,
|
VkDescriptorBufferInfo* pBufferInfo,
|
||||||
VkBufferView* pTexelBufferView,
|
VkBufferView* pTexelBufferView,
|
||||||
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
||||||
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
|
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
|
||||||
@ -849,7 +849,7 @@ void MVKSamplerDescriptorBindingMixin::read(MVKDescriptorSet* mvkDescSet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKSamplerDescriptorBindingMixin::setLayout(MVKDescriptorSetLayoutBinding* dslBinding, uint32_t index) {
|
void MVKSamplerDescriptorMixin::setLayout(MVKDescriptorSetLayoutBinding* dslBinding, uint32_t index) {
|
||||||
auto* oldSamp = _mvkSampler;
|
auto* oldSamp = _mvkSampler;
|
||||||
|
|
||||||
_mvkSampler = nullptr;
|
_mvkSampler = nullptr;
|
||||||
@ -876,92 +876,26 @@ void MVKSamplerDescriptorBindingMixin::setLayout(MVKDescriptorSetLayoutBinding*
|
|||||||
if (oldSamp) { oldSamp->release(); }
|
if (oldSamp) { oldSamp->release(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
MVKSamplerDescriptorBindingMixin::~MVKSamplerDescriptorBindingMixin() {
|
MVKSamplerDescriptorMixin::~MVKSamplerDescriptorMixin() {
|
||||||
if (_mvkSampler) { _mvkSampler->release(); }
|
if (_mvkSampler) { _mvkSampler->release(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKSamplerDescriptorBinding
|
#pragma mark MVKSamplerDescriptor
|
||||||
|
|
||||||
// A null cmdEncoder can be passed to perform a validation pass
|
// A null cmdEncoder can be passed to perform a validation pass
|
||||||
void MVKSamplerDescriptorBinding::bind(MVKCommandEncoder* cmdEncoder,
|
void MVKSamplerDescriptor::bind(MVKCommandEncoder* cmdEncoder,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t descriptorIndex,
|
uint32_t descriptorIndex,
|
||||||
bool stages[],
|
bool stages[],
|
||||||
MVKShaderResourceBinding& mtlIndexes,
|
MVKShaderResourceBinding& mtlIndexes,
|
||||||
MVKVector<uint32_t>& dynamicOffsets,
|
MVKVector<uint32_t>& dynamicOffsets,
|
||||||
uint32_t* pDynamicOffsetIndex) {
|
uint32_t* pDynamicOffsetIndex) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLER: {
|
case VK_DESCRIPTOR_TYPE_SAMPLER: {
|
||||||
MVKSamplerDescriptorBindingMixin::bind(cmdEncoder, descriptorType, descriptorIndex, stages,
|
MVKSamplerDescriptorMixin::bind(cmdEncoder, descriptorType, descriptorIndex, stages,
|
||||||
mtlIndexes, dynamicOffsets, pDynamicOffsetIndex);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MVKSamplerDescriptorBinding::write(MVKDescriptorSet* mvkDescSet,
|
|
||||||
VkDescriptorType descriptorType,
|
|
||||||
uint32_t srcIndex,
|
|
||||||
size_t stride,
|
|
||||||
const void* pData) {
|
|
||||||
switch (descriptorType) {
|
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLER: {
|
|
||||||
MVKSamplerDescriptorBindingMixin::write(mvkDescSet, descriptorType, srcIndex, stride, pData);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MVKSamplerDescriptorBinding::read(MVKDescriptorSet* mvkDescSet,
|
|
||||||
VkDescriptorType descriptorType,
|
|
||||||
uint32_t dstIndex,
|
|
||||||
VkDescriptorImageInfo* pImageInfo,
|
|
||||||
VkDescriptorBufferInfo* pBufferInfo,
|
|
||||||
VkBufferView* pTexelBufferView,
|
|
||||||
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
|
||||||
switch (descriptorType) {
|
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLER: {
|
|
||||||
MVKSamplerDescriptorBindingMixin::read(mvkDescSet, descriptorType, dstIndex, pImageInfo,
|
|
||||||
pBufferInfo, pTexelBufferView, pInlineUniformBlock);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MVKSamplerDescriptorBinding::setLayout(MVKDescriptorSetLayoutBinding* dslBinding, uint32_t index) {
|
|
||||||
MVKDescriptorBinding::setLayout(dslBinding, index);
|
|
||||||
MVKSamplerDescriptorBindingMixin::setLayout(dslBinding, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
|
||||||
#pragma mark MVKCombinedImageSamplerDescriptorBinding
|
|
||||||
|
|
||||||
// A null cmdEncoder can be passed to perform a validation pass
|
|
||||||
void MVKCombinedImageSamplerDescriptorBinding::bind(MVKCommandEncoder* cmdEncoder,
|
|
||||||
VkDescriptorType descriptorType,
|
|
||||||
uint32_t descriptorIndex,
|
|
||||||
bool stages[],
|
|
||||||
MVKShaderResourceBinding& mtlIndexes,
|
|
||||||
MVKVector<uint32_t>& dynamicOffsets,
|
|
||||||
uint32_t* pDynamicOffsetIndex) {
|
|
||||||
switch (descriptorType) {
|
|
||||||
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
|
|
||||||
MVKImageDescriptorBinding::bind(cmdEncoder, descriptorType, descriptorIndex, stages,
|
|
||||||
mtlIndexes, dynamicOffsets, pDynamicOffsetIndex);
|
mtlIndexes, dynamicOffsets, pDynamicOffsetIndex);
|
||||||
MVKSamplerDescriptorBindingMixin::bind(cmdEncoder, descriptorType, descriptorIndex, stages,
|
|
||||||
mtlIndexes, dynamicOffsets, pDynamicOffsetIndex);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,15 +904,14 @@ void MVKCombinedImageSamplerDescriptorBinding::bind(MVKCommandEncoder* cmdEncode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKCombinedImageSamplerDescriptorBinding::write(MVKDescriptorSet* mvkDescSet,
|
void MVKSamplerDescriptor::write(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t srcIndex,
|
uint32_t srcIndex,
|
||||||
size_t stride,
|
size_t stride,
|
||||||
const void* pData) {
|
const void* pData) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
|
case VK_DESCRIPTOR_TYPE_SAMPLER: {
|
||||||
MVKImageDescriptorBinding::write(mvkDescSet, descriptorType, srcIndex, stride, pData);
|
MVKSamplerDescriptorMixin::write(mvkDescSet, descriptorType, srcIndex, stride, pData);
|
||||||
MVKSamplerDescriptorBindingMixin::write(mvkDescSet, descriptorType, srcIndex, stride, pData);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -987,19 +920,17 @@ void MVKCombinedImageSamplerDescriptorBinding::write(MVKDescriptorSet* mvkDescSe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKCombinedImageSamplerDescriptorBinding::read(MVKDescriptorSet* mvkDescSet,
|
void MVKSamplerDescriptor::read(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t dstIndex,
|
uint32_t dstIndex,
|
||||||
VkDescriptorImageInfo* pImageInfo,
|
VkDescriptorImageInfo* pImageInfo,
|
||||||
VkDescriptorBufferInfo* pBufferInfo,
|
VkDescriptorBufferInfo* pBufferInfo,
|
||||||
VkBufferView* pTexelBufferView,
|
VkBufferView* pTexelBufferView,
|
||||||
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
|
case VK_DESCRIPTOR_TYPE_SAMPLER: {
|
||||||
MVKImageDescriptorBinding::read(mvkDescSet, descriptorType, dstIndex, pImageInfo,
|
MVKSamplerDescriptorMixin::read(mvkDescSet, descriptorType, dstIndex, pImageInfo,
|
||||||
pBufferInfo, pTexelBufferView, pInlineUniformBlock);
|
pBufferInfo, pTexelBufferView, pInlineUniformBlock);
|
||||||
MVKSamplerDescriptorBindingMixin::read(mvkDescSet, descriptorType, dstIndex, pImageInfo,
|
|
||||||
pBufferInfo, pTexelBufferView, pInlineUniformBlock);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1008,23 +939,92 @@ void MVKCombinedImageSamplerDescriptorBinding::read(MVKDescriptorSet* mvkDescSet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKCombinedImageSamplerDescriptorBinding::setLayout(MVKDescriptorSetLayoutBinding* dslBinding, uint32_t index) {
|
void MVKSamplerDescriptor::setLayout(MVKDescriptorSetLayoutBinding* dslBinding, uint32_t index) {
|
||||||
MVKImageDescriptorBinding::setLayout(dslBinding, index);
|
MVKDescriptor::setLayout(dslBinding, index);
|
||||||
MVKSamplerDescriptorBindingMixin::setLayout(dslBinding, index);
|
MVKSamplerDescriptorMixin::setLayout(dslBinding, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark MVKTexelBufferDescriptorBinding
|
#pragma mark MVKCombinedImageSamplerDescriptor
|
||||||
|
|
||||||
// A null cmdEncoder can be passed to perform a validation pass
|
// A null cmdEncoder can be passed to perform a validation pass
|
||||||
void MVKTexelBufferDescriptorBinding::bind(MVKCommandEncoder* cmdEncoder,
|
void MVKCombinedImageSamplerDescriptor::bind(MVKCommandEncoder* cmdEncoder,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t descriptorIndex,
|
uint32_t descriptorIndex,
|
||||||
bool stages[],
|
bool stages[],
|
||||||
MVKShaderResourceBinding& mtlIndexes,
|
MVKShaderResourceBinding& mtlIndexes,
|
||||||
MVKVector<uint32_t>& dynamicOffsets,
|
MVKVector<uint32_t>& dynamicOffsets,
|
||||||
uint32_t* pDynamicOffsetIndex) {
|
uint32_t* pDynamicOffsetIndex) {
|
||||||
|
switch (descriptorType) {
|
||||||
|
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
|
||||||
|
MVKImageDescriptor::bind(cmdEncoder, descriptorType, descriptorIndex, stages,
|
||||||
|
mtlIndexes, dynamicOffsets, pDynamicOffsetIndex);
|
||||||
|
MVKSamplerDescriptorMixin::bind(cmdEncoder, descriptorType, descriptorIndex, stages,
|
||||||
|
mtlIndexes, dynamicOffsets, pDynamicOffsetIndex);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MVKCombinedImageSamplerDescriptor::write(MVKDescriptorSet* mvkDescSet,
|
||||||
|
VkDescriptorType descriptorType,
|
||||||
|
uint32_t srcIndex,
|
||||||
|
size_t stride,
|
||||||
|
const void* pData) {
|
||||||
|
switch (descriptorType) {
|
||||||
|
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
|
||||||
|
MVKImageDescriptor::write(mvkDescSet, descriptorType, srcIndex, stride, pData);
|
||||||
|
MVKSamplerDescriptorMixin::write(mvkDescSet, descriptorType, srcIndex, stride, pData);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MVKCombinedImageSamplerDescriptor::read(MVKDescriptorSet* mvkDescSet,
|
||||||
|
VkDescriptorType descriptorType,
|
||||||
|
uint32_t dstIndex,
|
||||||
|
VkDescriptorImageInfo* pImageInfo,
|
||||||
|
VkDescriptorBufferInfo* pBufferInfo,
|
||||||
|
VkBufferView* pTexelBufferView,
|
||||||
|
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
||||||
|
switch (descriptorType) {
|
||||||
|
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
|
||||||
|
MVKImageDescriptor::read(mvkDescSet, descriptorType, dstIndex, pImageInfo,
|
||||||
|
pBufferInfo, pTexelBufferView, pInlineUniformBlock);
|
||||||
|
MVKSamplerDescriptorMixin::read(mvkDescSet, descriptorType, dstIndex, pImageInfo,
|
||||||
|
pBufferInfo, pTexelBufferView, pInlineUniformBlock);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MVKCombinedImageSamplerDescriptor::setLayout(MVKDescriptorSetLayoutBinding* dslBinding, uint32_t index) {
|
||||||
|
MVKImageDescriptor::setLayout(dslBinding, index);
|
||||||
|
MVKSamplerDescriptorMixin::setLayout(dslBinding, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
#pragma mark MVKTexelBufferDescriptor
|
||||||
|
|
||||||
|
// A null cmdEncoder can be passed to perform a validation pass
|
||||||
|
void MVKTexelBufferDescriptor::bind(MVKCommandEncoder* cmdEncoder,
|
||||||
|
VkDescriptorType descriptorType,
|
||||||
|
uint32_t descriptorIndex,
|
||||||
|
bool stages[],
|
||||||
|
MVKShaderResourceBinding& mtlIndexes,
|
||||||
|
MVKVector<uint32_t>& dynamicOffsets,
|
||||||
|
uint32_t* pDynamicOffsetIndex) {
|
||||||
MVKMTLTextureBinding tb;
|
MVKMTLTextureBinding tb;
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||||
@ -1050,11 +1050,11 @@ void MVKTexelBufferDescriptorBinding::bind(MVKCommandEncoder* cmdEncoder,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKTexelBufferDescriptorBinding::write(MVKDescriptorSet* mvkDescSet,
|
void MVKTexelBufferDescriptor::write(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t srcIndex,
|
uint32_t srcIndex,
|
||||||
size_t stride,
|
size_t stride,
|
||||||
const void* pData) {
|
const void* pData) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: {
|
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: {
|
||||||
@ -1074,13 +1074,13 @@ void MVKTexelBufferDescriptorBinding::write(MVKDescriptorSet* mvkDescSet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKTexelBufferDescriptorBinding::read(MVKDescriptorSet* mvkDescSet,
|
void MVKTexelBufferDescriptor::read(MVKDescriptorSet* mvkDescSet,
|
||||||
VkDescriptorType descriptorType,
|
VkDescriptorType descriptorType,
|
||||||
uint32_t dstIndex,
|
uint32_t dstIndex,
|
||||||
VkDescriptorImageInfo* pImageInfo,
|
VkDescriptorImageInfo* pImageInfo,
|
||||||
VkDescriptorBufferInfo* pBufferInfo,
|
VkDescriptorBufferInfo* pBufferInfo,
|
||||||
VkBufferView* pTexelBufferView,
|
VkBufferView* pTexelBufferView,
|
||||||
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock) {
|
||||||
switch (descriptorType) {
|
switch (descriptorType) {
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: {
|
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: {
|
||||||
@ -1093,6 +1093,6 @@ void MVKTexelBufferDescriptorBinding::read(MVKDescriptorSet* mvkDescSet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MVKTexelBufferDescriptorBinding::~MVKTexelBufferDescriptorBinding() {
|
MVKTexelBufferDescriptor::~MVKTexelBufferDescriptor() {
|
||||||
if (_mvkBufferView) { _mvkBufferView->release(); }
|
if (_mvkBufferView) { _mvkBufferView->release(); }
|
||||||
}
|
}
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "MVKDescriptorBinding.h"
|
#include "MVKDescriptor.h"
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -133,10 +133,10 @@ protected:
|
|||||||
friend class MVKDescriptorPool;
|
friend class MVKDescriptorPool;
|
||||||
|
|
||||||
void propogateDebugName() override {}
|
void propogateDebugName() override {}
|
||||||
inline MVKDescriptorBinding* getDescriptorBinding(uint32_t index) { return _bindings[index]; }
|
inline MVKDescriptor* getDescriptor(uint32_t index) { return _descriptors[index]; }
|
||||||
|
|
||||||
MVKDescriptorSetLayout* _pLayout = nullptr;
|
MVKDescriptorSetLayout* _pLayout = nullptr;
|
||||||
std::vector<MVKDescriptorBinding*> _bindings;
|
std::vector<MVKDescriptor*> _descriptors;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ void MVKDescriptorSet::write(const DescriptorAction* pDescriptorAction,
|
|||||||
pDescriptorAction->dstArrayElement);
|
pDescriptorAction->dstArrayElement);
|
||||||
uint32_t descCnt = pDescriptorAction->descriptorCount;
|
uint32_t descCnt = pDescriptorAction->descriptorCount;
|
||||||
for (uint32_t descIdx = 0; descIdx < descCnt; descIdx++) {
|
for (uint32_t descIdx = 0; descIdx < descCnt; descIdx++) {
|
||||||
_bindings[dstStartIdx + descIdx]->write(this, descType, descIdx, stride, pData);
|
_descriptors[dstStartIdx + descIdx]->write(this, descType, descIdx, stride, pData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,29 +238,29 @@ void MVKDescriptorSet::read(const VkCopyDescriptorSet* pDescriptorCopy,
|
|||||||
pDescriptorCopy->srcArrayElement);
|
pDescriptorCopy->srcArrayElement);
|
||||||
uint32_t descCnt = pDescriptorCopy->descriptorCount;
|
uint32_t descCnt = pDescriptorCopy->descriptorCount;
|
||||||
for (uint32_t descIdx = 0; descIdx < descCnt; descIdx++) {
|
for (uint32_t descIdx = 0; descIdx < descCnt; descIdx++) {
|
||||||
_bindings[srcStartIdx + descIdx]->read(this, descType, descIdx, pImageInfo, pBufferInfo,
|
_descriptors[srcStartIdx + descIdx]->read(this, descType, descIdx, pImageInfo, pBufferInfo,
|
||||||
pTexelBufferView, pInlineUniformBlock);
|
pTexelBufferView, pInlineUniformBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MVKDescriptorSet::MVKDescriptorSet(MVKDescriptorSetLayout* layout) : MVKVulkanAPIDeviceObject(layout->_device) {
|
MVKDescriptorSet::MVKDescriptorSet(MVKDescriptorSetLayout* layout) : MVKVulkanAPIDeviceObject(layout->_device) {
|
||||||
_pLayout = layout;
|
_pLayout = layout;
|
||||||
|
|
||||||
_bindings.reserve(layout->getDescriptorCount());
|
_descriptors.reserve(layout->getDescriptorCount());
|
||||||
uint32_t bindCnt = (uint32_t)layout->_bindings.size();
|
uint32_t bindCnt = (uint32_t)layout->_bindings.size();
|
||||||
for (uint32_t bindIdx = 0; bindIdx < bindCnt; bindIdx++) {
|
for (uint32_t bindIdx = 0; bindIdx < bindCnt; bindIdx++) {
|
||||||
MVKDescriptorSetLayoutBinding* dslBind = &layout->_bindings[bindIdx];
|
MVKDescriptorSetLayoutBinding* mvkDSLBind = &layout->_bindings[bindIdx];
|
||||||
uint32_t descCnt = dslBind->getDescriptorCount();
|
uint32_t descCnt = mvkDSLBind->getDescriptorCount();
|
||||||
for (uint32_t descIdx = 0; descIdx < descCnt; descIdx++) {
|
for (uint32_t descIdx = 0; descIdx < descCnt; descIdx++) {
|
||||||
MVKDescriptorBinding* descBind = dslBind->newDescriptorBinding();
|
MVKDescriptor* mvkDesc = mvkDSLBind->newDescriptor();
|
||||||
descBind->setLayout(dslBind, descIdx);
|
mvkDesc->setLayout(mvkDSLBind, descIdx);
|
||||||
_bindings.push_back(descBind);
|
_descriptors.push_back(mvkDesc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MVKDescriptorSet::~MVKDescriptorSet() {
|
MVKDescriptorSet::~MVKDescriptorSet() {
|
||||||
mvkDestroyContainerContents(_bindings);
|
mvkDestroyContainerContents(_descriptors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1143,7 +1143,7 @@ MTLSamplerDescriptor* MVKSampler::newMTLSamplerDescriptor(const VkSamplerCreateI
|
|||||||
// If compareEnable is true, but dynamic samplers with depth compare are not available
|
// If compareEnable is true, but dynamic samplers with depth compare are not available
|
||||||
// on this device, this sampler must only be used as an immutable sampler, and will
|
// on this device, this sampler must only be used as an immutable sampler, and will
|
||||||
// be automatically hardcoded into the shader MSL. An error will be triggered if this
|
// be automatically hardcoded into the shader MSL. An error will be triggered if this
|
||||||
// sampler is used to update or push a descriptor binding.
|
// sampler is used to update or push a descriptor.
|
||||||
if (pCreateInfo->compareEnable && !_requiresConstExprSampler) {
|
if (pCreateInfo->compareEnable && !_requiresConstExprSampler) {
|
||||||
mtlSampDesc.compareFunctionMVK = mvkMTLCompareFunctionFromVkCompareOp(pCreateInfo->compareOp);
|
mtlSampDesc.compareFunctionMVK = mvkMTLCompareFunctionFromVkCompareOp(pCreateInfo->compareOp);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user