Consolidation and fixes for MVK_USE_METAL_PRIVATE_API functionality.

- Expose MTLRenderPipelineDescriptor.sampleMaskMVK and
  MTLSamplerDescriptor.lodBiasMVK properties when
  MVK_USE_METAL_PRIVATE_API build setting is disabled.
- MVKCmdSetDepthBias & MVKCmdSetDepthBounds subclass from MVKSingleValueCommand.
- MVKRenderingCommandEncoderState simplify calls to set depth bias
  and depth bounds, and make consistent with other settings.
- Refactor MVKRenderingCommandEncoderState::setContent() and
  setMTLContent() to remove need for intermediate value copies.
- MVKPipeline remove test for depth bounds support since
  it's checked before GPU encoding.
- MVKDepthBias member order same as in Vulkan calls.
- Whats_New.md consolidate notes about MVK_USE_METAL_PRIVATE_API.
This commit is contained in:
Bill Hollings 2024-02-08 16:13:03 -05:00
parent 885960ac99
commit efaae79d90
9 changed files with 53 additions and 119 deletions

View File

@ -19,11 +19,11 @@ MoltenVK 1.2.8
Released TBD Released TBD
- Add `MVK_USE_METAL_PRIVATE_API` build setting to allow **MoltenVK** to be built with access to _Metal_ private API calls. - Add `MVK_USE_METAL_PRIVATE_API` build setting to allow **MoltenVK** to be built with access to _Metal_ private API calls.
- Add support for `VkPhysicalDeviceFeatures::wideLines` feature when `MVK_USE_METAL_PRIVATE_API` is enabled in a **MoltenVK** build. - `VkPhysicalDeviceFeatures::wideLines` enabled when `MVK_USE_METAL_PRIVATE_API` is enabled in a **MoltenVK** build.
- Add support for the `VkPhysicalDeviceFeatures::logicOp` feature when `MVK_USE_METAL_PRIVATE_API` is enabled in a **MoltenVK** build. - `VkPhysicalDeviceFeatures::logicOp` enabled when `MVK_USE_METAL_PRIVATE_API` is enabled in a **MoltenVK** build.
- Add support for the `VkPhysicalDeviceFeatures::depthBounds` feature on AMD GPUs when `MVK_USE_METAL_PRIVATE_API` is enabled in a **MoltenVK** build. - `VkPhysicalDeviceFeatures::depthBounds` enabled on AMD GPUs when `MVK_USE_METAL_PRIVATE_API` is enabled in a **MoltenVK** build.
- Add support for the `VkPhysicalDevicePortabilitySubsetFeaturesKHR::samplerMipLodBias` feature when `MVK_USE_METAL_PRIVATE_API` is enabled in a **MoltenVK** build. - `VkPhysicalDevicePortabilitySubsetFeaturesKHR::samplerMipLodBias` enabled when `MVK_USE_METAL_PRIVATE_API` is enabled in a **MoltenVK** build.
- Add support for Metal native pipeline sample masks when `MVK_USE_METAL_PRIVATE_API` is enabled in a **MoltenVK** build. - _Metal_ native pipeline sample masks supported when `MVK_USE_METAL_PRIVATE_API` is enabled in a **MoltenVK** build.
- Fix potential crash when using multi-planar images. - Fix potential crash when using multi-planar images.
- Ensure buffers available for buffer addresses in push constants. - Ensure buffers available for buffer addresses in push constants.
- Support `libMoltenVK.dylib` for _iOS Simulator_ architecture. - Support `libMoltenVK.dylib` for _iOS Simulator_ architecture.

View File

@ -21,6 +21,7 @@
#include "MVKCommand.h" #include "MVKCommand.h"
#include "MVKDevice.h" #include "MVKDevice.h"
#include "MVKSmallVector.h" #include "MVKSmallVector.h"
#include "MVKCommandEncoderState.h"
#import <Metal/Metal.h> #import <Metal/Metal.h>
@ -278,22 +279,13 @@ typedef MVKCmdSetScissor<kMVKMaxViewportScissorCount> MVKCmdSetScissorMulti;
#pragma mark - #pragma mark -
#pragma mark MVKCmdSetDepthBias #pragma mark MVKCmdSetDepthBias
class MVKCmdSetDepthBias : public MVKCommand { class MVKCmdSetDepthBias : public MVKSingleValueCommand<MVKDepthBias> {
public: public:
VkResult setContent(MVKCommandBuffer* cmdBuff,
float depthBiasConstantFactor,
float depthBiasClamp,
float depthBiasSlopeFactor);
void encode(MVKCommandEncoder* cmdEncoder) override; void encode(MVKCommandEncoder* cmdEncoder) override;
protected: protected:
MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override;
float _depthBiasConstantFactor;
float _depthBiasClamp;
float _depthBiasSlopeFactor;
}; };
@ -378,28 +370,19 @@ protected:
#pragma mark - #pragma mark -
#pragma mark MVKCmdSetDepthBounds #pragma mark MVKCmdSetDepthBounds
/** Vulkan command to set depth bounds. */ class MVKCmdSetDepthBounds : public MVKSingleValueCommand<MVKDepthBounds> {
class MVKCmdSetDepthBounds : public MVKCommand {
public: public:
VkResult setContent(MVKCommandBuffer* cmdBuff,
float minDepthBounds,
float maxDepthBounds);
void encode(MVKCommandEncoder* cmdEncoder) override; void encode(MVKCommandEncoder* cmdEncoder) override;
protected: protected:
MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override; MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override;
float _minDepthBounds;
float _maxDepthBounds;
}; };
#pragma mark - #pragma mark -
#pragma mark MVKCmdSetDepthBoundsTestEnable #pragma mark MVKCmdSetDepthBoundsTestEnable
/** Vulkan command to enable depth bounds testing. */
class MVKCmdSetDepthBoundsTestEnable : public MVKSingleValueCommand<VkBool32> { class MVKCmdSetDepthBoundsTestEnable : public MVKSingleValueCommand<VkBool32> {
public: public:

View File

@ -261,21 +261,8 @@ template class MVKCmdSetScissor<kMVKMaxViewportScissorCount>;
#pragma mark - #pragma mark -
#pragma mark MVKCmdSetDepthBias #pragma mark MVKCmdSetDepthBias
VkResult MVKCmdSetDepthBias::setContent(MVKCommandBuffer* cmdBuff,
float depthBiasConstantFactor,
float depthBiasClamp,
float depthBiasSlopeFactor) {
_depthBiasConstantFactor = depthBiasConstantFactor;
_depthBiasSlopeFactor = depthBiasSlopeFactor;
_depthBiasClamp = depthBiasClamp;
return VK_SUCCESS;
}
void MVKCmdSetDepthBias::encode(MVKCommandEncoder* cmdEncoder) { void MVKCmdSetDepthBias::encode(MVKCommandEncoder* cmdEncoder) {
cmdEncoder->_renderingState.setDepthBias(_depthBiasConstantFactor, cmdEncoder->_renderingState.setDepthBias(_value, true);
_depthBiasSlopeFactor,
_depthBiasClamp);
} }
@ -283,7 +270,7 @@ void MVKCmdSetDepthBias::encode(MVKCommandEncoder* cmdEncoder) {
#pragma mark MVKCmdSetDepthBiasEnable #pragma mark MVKCmdSetDepthBiasEnable
void MVKCmdSetDepthBiasEnable::encode(MVKCommandEncoder* cmdEncoder) { void MVKCmdSetDepthBiasEnable::encode(MVKCommandEncoder* cmdEncoder) {
cmdEncoder->_renderingState.setDepthBiasEnable(_value); cmdEncoder->_renderingState.setDepthBiasEnable(_value, true);
} }
@ -330,16 +317,8 @@ void MVKCmdSetDepthCompareOp::encode(MVKCommandEncoder* cmdEncoder) {
#pragma mark - #pragma mark -
#pragma mark MVKCmdSetDepthBounds #pragma mark MVKCmdSetDepthBounds
VkResult MVKCmdSetDepthBounds::setContent(MVKCommandBuffer* cmdBuff,
float minDepthBounds,
float maxDepthBounds) {
_minDepthBounds = minDepthBounds;
_maxDepthBounds = maxDepthBounds;
return VK_SUCCESS;
}
void MVKCmdSetDepthBounds::encode(MVKCommandEncoder* cmdEncoder) { void MVKCmdSetDepthBounds::encode(MVKCommandEncoder* cmdEncoder) {
cmdEncoder->_renderingState.setDepthBounds(_minDepthBounds, _maxDepthBounds, true); cmdEncoder->_renderingState.setDepthBounds(_value, true);
} }

View File

@ -235,8 +235,8 @@ protected:
struct MVKDepthBias { struct MVKDepthBias {
float depthBiasConstantFactor; float depthBiasConstantFactor;
float depthBiasSlopeFactor;
float depthBiasClamp; float depthBiasClamp;
float depthBiasSlopeFactor;
}; };
struct MVKDepthBounds { struct MVKDepthBounds {
@ -273,11 +273,10 @@ public:
void setBlendConstants(MVKColor32 blendConstants, bool isDynamic); void setBlendConstants(MVKColor32 blendConstants, bool isDynamic);
void setDepthBias(const VkPipelineRasterizationStateCreateInfo& vkRasterInfo); void setDepthBias(const VkPipelineRasterizationStateCreateInfo& vkRasterInfo);
void setDepthBias(float depthBiasConstantFactor, float depthBiasSlopeFactor, float depthBiasClamp); void setDepthBias(MVKDepthBias depthBias, bool isDynamic);
void setDepthBiasEnable(VkBool32 depthBiasEnable); void setDepthBiasEnable(VkBool32 depthBiasEnable, bool isDynamic);
void setDepthClipEnable(bool depthClip, bool isDynamic); void setDepthClipEnable(bool depthClip, bool isDynamic);
void setDepthBounds(MVKDepthBounds depthBounds, bool isDynamic);
void setDepthBounds(float minDepthBounds, float maxDepthBounds, bool isDynamic);
void setDepthBoundsTestEnable(VkBool32 depthBoundsTestEnable, bool isDynamic); void setDepthBoundsTestEnable(VkBool32 depthBoundsTestEnable, bool isDynamic);
void setStencilReferenceValues(const VkPipelineDepthStencilStateCreateInfo& vkDepthStencilInfo); void setStencilReferenceValues(const VkPipelineDepthStencilStateCreateInfo& vkDepthStencilInfo);
void setStencilReferenceValues(VkStencilFaceFlags faceMask, uint32_t stencilReference); void setStencilReferenceValues(VkStencilFaceFlags faceMask, uint32_t stencilReference);
@ -310,7 +309,7 @@ public:
protected: protected:
void encodeImpl(uint32_t stage) override; void encodeImpl(uint32_t stage) override;
bool isDrawingTriangles(); bool isDrawingTriangles();
template <typename T> void setContent(T* iVarAry, T* pVal, MVKRenderStateType state, bool isDynamic) { template <typename T> void setContent(MVKRenderStateType state, T* iVarAry, T* pVal, bool isDynamic) {
auto* pIVar = &iVarAry[isDynamic ? StateScope::Dynamic : StateScope::Static]; auto* pIVar = &iVarAry[isDynamic ? StateScope::Dynamic : StateScope::Static];
if( !mvkAreEqual(pVal, pIVar) ) { if( !mvkAreEqual(pVal, pIVar) ) {
*pIVar = *pVal; *pIVar = *pVal;
@ -319,6 +318,9 @@ protected:
MVKCommandEncoderState::markDirty(); // Avoid local markDirty() as it marks all states dirty. MVKCommandEncoderState::markDirty(); // Avoid local markDirty() as it marks all states dirty.
} }
} }
template <typename T> void setContent(MVKRenderStateType state, T* iVarAry, T val, bool isDynamic) {
setContent(state, iVarAry, &val, isDynamic);
}
MVKSmallVector<MTLSamplePosition, kMVKMaxSampleCount> _mtlSampleLocations[StateScope::Count] = {}; MVKSmallVector<MTLSamplePosition, kMVKMaxSampleCount> _mtlSampleLocations[StateScope::Count] = {};
MVKMTLViewports _mtlViewports[StateScope::Count] = {}; MVKMTLViewports _mtlViewports[StateScope::Count] = {};

View File

@ -303,89 +303,59 @@ void MVKDepthStencilCommandEncoderState::encodeImpl(uint32_t stage) {
#pragma mark MVKRenderingCommandEncoderState #pragma mark MVKRenderingCommandEncoderState
#define getMTLContent(state) getContent(_mtl##state, state) #define getMTLContent(state) getContent(_mtl##state, state)
#define setMTLContent(state) setContent(_mtl##state, &mtl##state, state, isDynamic) #define setMTLContent(state, val) setContent(state, _mtl##state, val, isDynamic)
void MVKRenderingCommandEncoderState::setCullMode(VkCullModeFlags cullMode, bool isDynamic) { void MVKRenderingCommandEncoderState::setCullMode(VkCullModeFlags cullMode, bool isDynamic) {
auto mtlCullMode = mvkMTLCullModeFromVkCullModeFlags(cullMode); setMTLContent(CullMode, mvkMTLCullModeFromVkCullModeFlags(cullMode));
setMTLContent(CullMode);
getContent(_cullBothFaces, isDynamic) = (cullMode == VK_CULL_MODE_FRONT_AND_BACK); getContent(_cullBothFaces, isDynamic) = (cullMode == VK_CULL_MODE_FRONT_AND_BACK);
} }
void MVKRenderingCommandEncoderState::setFrontFace(VkFrontFace frontFace, bool isDynamic) { void MVKRenderingCommandEncoderState::setFrontFace(VkFrontFace frontFace, bool isDynamic) {
auto mtlFrontFace = mvkMTLWindingFromVkFrontFace(frontFace); setMTLContent(FrontFace, mvkMTLWindingFromVkFrontFace(frontFace));
setMTLContent(FrontFace);
} }
void MVKRenderingCommandEncoderState::setPolygonMode(VkPolygonMode polygonMode, bool isDynamic) { void MVKRenderingCommandEncoderState::setPolygonMode(VkPolygonMode polygonMode, bool isDynamic) {
auto mtlPolygonMode = mvkMTLTriangleFillModeFromVkPolygonMode(polygonMode); setMTLContent(PolygonMode, mvkMTLTriangleFillModeFromVkPolygonMode(polygonMode));
setMTLContent(PolygonMode);
getContent(_isPolygonModePoint, isDynamic) = (polygonMode == VK_POLYGON_MODE_POINT); getContent(_isPolygonModePoint, isDynamic) = (polygonMode == VK_POLYGON_MODE_POINT);
} }
void MVKRenderingCommandEncoderState::setLineWidth(float lineWidth, bool isDynamic) { void MVKRenderingCommandEncoderState::setLineWidth(float lineWidth, bool isDynamic) {
auto mtlLineWidth = lineWidth; setMTLContent(LineWidth, lineWidth);
setMTLContent(LineWidth);
} }
void MVKRenderingCommandEncoderState::setBlendConstants(MVKColor32 blendConstants, bool isDynamic) { void MVKRenderingCommandEncoderState::setBlendConstants(MVKColor32 blendConstants, bool isDynamic) {
MVKColor32 mtlBlendConstants = blendConstants; setMTLContent(BlendConstants, blendConstants);
setMTLContent(BlendConstants);
} }
void MVKRenderingCommandEncoderState::setDepthBias(const VkPipelineRasterizationStateCreateInfo& vkRasterInfo) { void MVKRenderingCommandEncoderState::setDepthBias(const VkPipelineRasterizationStateCreateInfo& vkRasterInfo) {
bool isDynamic = false; setDepthBiasEnable(vkRasterInfo.depthBiasEnable, false);
setDepthBias( { vkRasterInfo.depthBiasConstantFactor, vkRasterInfo.depthBiasClamp, vkRasterInfo.depthBiasSlopeFactor } , false);
bool mtlDepthBiasEnable = static_cast<bool>(vkRasterInfo.depthBiasEnable);
setMTLContent(DepthBiasEnable);
MVKDepthBias mtlDepthBias = {
.depthBiasConstantFactor = vkRasterInfo.depthBiasConstantFactor,
.depthBiasSlopeFactor = vkRasterInfo.depthBiasSlopeFactor,
.depthBiasClamp = vkRasterInfo.depthBiasClamp
};
setMTLContent(DepthBias);
} }
void MVKRenderingCommandEncoderState::setDepthBias(float depthBiasConstantFactor, void MVKRenderingCommandEncoderState::setDepthBias(MVKDepthBias depthBias, bool isDynamic) {
float depthBiasSlopeFactor, setMTLContent(DepthBias, depthBias);
float depthBiasClamp) {
bool isDynamic = true;
MVKDepthBias mtlDepthBias = {
.depthBiasConstantFactor = depthBiasConstantFactor,
.depthBiasSlopeFactor = depthBiasSlopeFactor,
.depthBiasClamp = depthBiasClamp
};
setMTLContent(DepthBias);
} }
void MVKRenderingCommandEncoderState::setDepthBiasEnable(VkBool32 depthBiasEnable) { void MVKRenderingCommandEncoderState::setDepthBiasEnable(VkBool32 depthBiasEnable, bool isDynamic) {
bool isDynamic = true; setMTLContent(DepthBiasEnable, static_cast<bool>(depthBiasEnable));
bool mtlDepthBiasEnable = static_cast<bool>(depthBiasEnable);
setMTLContent(DepthBiasEnable);
} }
void MVKRenderingCommandEncoderState::setDepthClipEnable(bool depthClip, bool isDynamic) { void MVKRenderingCommandEncoderState::setDepthClipEnable(bool depthClip, bool isDynamic) {
auto mtlDepthClipEnable = depthClip ? MTLDepthClipModeClip : MTLDepthClipModeClamp; setMTLContent(DepthClipEnable, depthClip ? MTLDepthClipModeClip : MTLDepthClipModeClamp);
setMTLContent(DepthClipEnable);
} }
void MVKRenderingCommandEncoderState::setDepthBounds(float minDepthBounds, float maxDepthBounds, bool isDynamic) { void MVKRenderingCommandEncoderState::setDepthBounds(MVKDepthBounds depthBounds, bool isDynamic) {
MVKDepthBounds mtlDepthBounds = { minDepthBounds, maxDepthBounds }; setMTLContent(DepthBounds, depthBounds);
setMTLContent(DepthBounds);
} }
void MVKRenderingCommandEncoderState::setDepthBoundsTestEnable(VkBool32 depthBoundsTestEnable, bool isDynamic) { void MVKRenderingCommandEncoderState::setDepthBoundsTestEnable(VkBool32 depthBoundsTestEnable, bool isDynamic) {
auto mtlDepthBoundsTestEnable = static_cast<bool>(depthBoundsTestEnable); setMTLContent(DepthBoundsTestEnable, static_cast<bool>(depthBoundsTestEnable));
setMTLContent(DepthBoundsTestEnable);
} }
void MVKRenderingCommandEncoderState::setStencilReferenceValues(const VkPipelineDepthStencilStateCreateInfo& vkDepthStencilInfo) { void MVKRenderingCommandEncoderState::setStencilReferenceValues(const VkPipelineDepthStencilStateCreateInfo& vkDepthStencilInfo) {
bool isDynamic = false; bool isDynamic = false;
MVKStencilReference mtlStencilReference = { MVKStencilReference mtlStencilReference = { vkDepthStencilInfo.front.reference, vkDepthStencilInfo.back.reference };
.frontFaceValue = vkDepthStencilInfo.front.reference, setMTLContent(StencilReference, &mtlStencilReference);
.backFaceValue = vkDepthStencilInfo.back.reference
};
setMTLContent(StencilReference);
} }
void MVKRenderingCommandEncoderState::setStencilReferenceValues(VkStencilFaceFlags faceMask, uint32_t stencilReference) { void MVKRenderingCommandEncoderState::setStencilReferenceValues(VkStencilFaceFlags faceMask, uint32_t stencilReference) {
@ -393,7 +363,7 @@ void MVKRenderingCommandEncoderState::setStencilReferenceValues(VkStencilFaceFla
MVKStencilReference mtlStencilReference = _mtlStencilReference[StateScope::Dynamic]; MVKStencilReference mtlStencilReference = _mtlStencilReference[StateScope::Dynamic];
if (shouldUpdateFace(FRONT)) { mtlStencilReference.frontFaceValue = stencilReference; } if (shouldUpdateFace(FRONT)) { mtlStencilReference.frontFaceValue = stencilReference; }
if (shouldUpdateFace(BACK)) { mtlStencilReference.backFaceValue = stencilReference; } if (shouldUpdateFace(BACK)) { mtlStencilReference.backFaceValue = stencilReference; }
setMTLContent(StencilReference); setMTLContent(StencilReference, &mtlStencilReference);
} }
void MVKRenderingCommandEncoderState::setViewports(const MVKArrayRef<VkViewport> viewports, void MVKRenderingCommandEncoderState::setViewports(const MVKArrayRef<VkViewport> viewports,
@ -408,7 +378,7 @@ void MVKRenderingCommandEncoderState::setViewports(const MVKArrayRef<VkViewport>
mtlViewports.viewports[firstViewport + vpIdx] = mvkMTLViewportFromVkViewport(viewports[vpIdx]); mtlViewports.viewports[firstViewport + vpIdx] = mvkMTLViewportFromVkViewport(viewports[vpIdx]);
mtlViewports.viewportCount = max(mtlViewports.viewportCount, vpIdx + 1); mtlViewports.viewportCount = max(mtlViewports.viewportCount, vpIdx + 1);
} }
setMTLContent(Viewports); setMTLContent(Viewports, &mtlViewports);
} }
void MVKRenderingCommandEncoderState::setScissors(const MVKArrayRef<VkRect2D> scissors, void MVKRenderingCommandEncoderState::setScissors(const MVKArrayRef<VkRect2D> scissors,
@ -423,17 +393,15 @@ void MVKRenderingCommandEncoderState::setScissors(const MVKArrayRef<VkRect2D> sc
mtlScissors.scissors[firstScissor + sIdx] = mvkMTLScissorRectFromVkRect2D(scissors[sIdx]); mtlScissors.scissors[firstScissor + sIdx] = mvkMTLScissorRectFromVkRect2D(scissors[sIdx]);
mtlScissors.scissorCount = max(mtlScissors.scissorCount, sIdx + 1); mtlScissors.scissorCount = max(mtlScissors.scissorCount, sIdx + 1);
} }
setMTLContent(Scissors); setMTLContent(Scissors, &mtlScissors);
} }
void MVKRenderingCommandEncoderState::setPrimitiveRestartEnable(VkBool32 primitiveRestartEnable, bool isDynamic) { void MVKRenderingCommandEncoderState::setPrimitiveRestartEnable(VkBool32 primitiveRestartEnable, bool isDynamic) {
bool mtlPrimitiveRestartEnable = static_cast<bool>(primitiveRestartEnable); setMTLContent(PrimitiveRestartEnable, static_cast<bool>(primitiveRestartEnable));
setMTLContent(PrimitiveRestartEnable);
} }
void MVKRenderingCommandEncoderState::setRasterizerDiscardEnable(VkBool32 rasterizerDiscardEnable, bool isDynamic) { void MVKRenderingCommandEncoderState::setRasterizerDiscardEnable(VkBool32 rasterizerDiscardEnable, bool isDynamic) {
bool mtlRasterizerDiscardEnable = static_cast<bool>(rasterizerDiscardEnable); setMTLContent(RasterizerDiscardEnable, static_cast<bool>(rasterizerDiscardEnable));
setMTLContent(RasterizerDiscardEnable);
} }
// This value is retrieved, not encoded, so don't mark this encoder as dirty. // This value is retrieved, not encoded, so don't mark this encoder as dirty.

View File

@ -307,9 +307,7 @@ void MVKGraphicsPipeline::encode(MVKCommandEncoder* cmdEncoder, uint32_t stage)
cmdEncoder->_renderingState.setPrimitiveTopology(_vkPrimitiveTopology, false); cmdEncoder->_renderingState.setPrimitiveTopology(_vkPrimitiveTopology, false);
cmdEncoder->_renderingState.setPrimitiveRestartEnable(_primitiveRestartEnable, false); cmdEncoder->_renderingState.setPrimitiveRestartEnable(_primitiveRestartEnable, false);
cmdEncoder->_renderingState.setBlendConstants(_blendConstants, false); cmdEncoder->_renderingState.setBlendConstants(_blendConstants, false);
if (_device->_enabledFeatures.depthBounds) { cmdEncoder->_renderingState.setDepthBounds({_depthStencilInfo.minDepthBounds, _depthStencilInfo.maxDepthBounds}, false);
cmdEncoder->_renderingState.setDepthBounds(_depthStencilInfo.minDepthBounds, _depthStencilInfo.maxDepthBounds, false);
}
cmdEncoder->_renderingState.setStencilReferenceValues(_depthStencilInfo); cmdEncoder->_renderingState.setStencilReferenceValues(_depthStencilInfo);
cmdEncoder->_renderingState.setViewports(_viewports.contents(), 0, false); cmdEncoder->_renderingState.setViewports(_viewports.contents(), 0, false);
cmdEncoder->_renderingState.setScissors(_scissors.contents(), 0, false); cmdEncoder->_renderingState.setScissors(_scissors.contents(), 0, false);

View File

@ -41,15 +41,17 @@
if ([self respondsToSelector: @selector(setInputPrimitiveTopology:)]) { [self setInputPrimitiveTopology:topology]; } if ([self respondsToSelector: @selector(setInputPrimitiveTopology:)]) { [self setInputPrimitiveTopology:topology]; }
} }
#if MVK_USE_METAL_PRIVATE_API
-(NSUInteger) sampleMaskMVK { -(NSUInteger) sampleMaskMVK {
#if MVK_USE_METAL_PRIVATE_API
if ( [self respondsToSelector: @selector(sampleMask)] ) { return self.sampleMask; } if ( [self respondsToSelector: @selector(sampleMask)] ) { return self.sampleMask; }
#endif
return 0xFFFFFFFFFFFFFFFFULL; return 0xFFFFFFFFFFFFFFFFULL;
} }
-(void) setSampleMaskMVK: (NSUInteger) mask { -(void) setSampleMaskMVK: (NSUInteger) mask {
#if MVK_USE_METAL_PRIVATE_API
if ([self respondsToSelector: @selector(setSampleMask:)]) { self.sampleMask = mask; } if ([self respondsToSelector: @selector(setSampleMask:)]) { self.sampleMask = mask; }
}
#endif #endif
}
@end @end

View File

@ -54,15 +54,17 @@
#endif #endif
} }
#if MVK_USE_METAL_PRIVATE_API
-(float) lodBiasMVK { -(float) lodBiasMVK {
#if MVK_USE_METAL_PRIVATE_API
if ( [self respondsToSelector: @selector(lodBias)] ) { return self.lodBias; } if ( [self respondsToSelector: @selector(lodBias)] ) { return self.lodBias; }
#endif
return 0.0f; return 0.0f;
} }
-(void) setLodBiasMVK: (float) bias { -(void) setLodBiasMVK: (float) bias {
#if MVK_USE_METAL_PRIVATE_API
if ( [self respondsToSelector: @selector(setLodBias:)] ) { self.lodBias = bias; } if ( [self respondsToSelector: @selector(setLodBias:)] ) { self.lodBias = bias; }
}
#endif #endif
}
@end @end

View File

@ -1477,7 +1477,7 @@ MVK_PUBLIC_VULKAN_SYMBOL void vkCmdSetDepthBias(
float depthBiasSlopeFactor) { float depthBiasSlopeFactor) {
MVKTraceVulkanCallStart(); MVKTraceVulkanCallStart();
MVKAddCmd(SetDepthBias, commandBuffer,depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); MVKAddCmd(SetDepthBias, commandBuffer, {depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor} );
MVKTraceVulkanCallEnd(); MVKTraceVulkanCallEnd();
} }
@ -1498,7 +1498,7 @@ MVK_PUBLIC_VULKAN_SYMBOL void vkCmdSetDepthBounds(
float maxDepthBounds) { float maxDepthBounds) {
MVKTraceVulkanCallStart(); MVKTraceVulkanCallStart();
MVKAddCmd(SetDepthBounds, commandBuffer, minDepthBounds, maxDepthBounds); MVKAddCmd(SetDepthBounds, commandBuffer, {minDepthBounds, maxDepthBounds});
MVKTraceVulkanCallEnd(); MVKTraceVulkanCallEnd();
} }