Path: blob/master/thirdparty/metal-cpp/Metal/MTL4PipelineState.hpp
21345 views
//-------------------------------------------------------------------------------------------------------------------------------------------------------------1//2// Metal/MTL4PipelineState.hpp3//4// Copyright 2020-2025 Apple Inc.5//6// Licensed under the Apache License, Version 2.0 (the "License");7// you may not use this file except in compliance with the License.8// You may obtain a copy of the License at9//10// http://www.apache.org/licenses/LICENSE-2.011//12// Unless required by applicable law or agreed to in writing, software13// distributed under the License is distributed on an "AS IS" BASIS,14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15// See the License for the specific language governing permissions and16// limitations under the License.17//18//-------------------------------------------------------------------------------------------------------------------------------------------------------------1920#pragma once2122#include "../Foundation/Foundation.hpp"23#include "MTLDefines.hpp"24#include "MTLHeaderBridge.hpp"25#include "MTLPipeline.hpp"26#include "MTLPrivate.hpp"2728namespace MTL429{30class PipelineDescriptor;31class PipelineOptions;32_MTL_ENUM(NS::Integer, AlphaToOneState) {33AlphaToOneStateDisabled = 0,34AlphaToOneStateEnabled = 1,35};3637_MTL_ENUM(NS::Integer, AlphaToCoverageState) {38AlphaToCoverageStateDisabled = 0,39AlphaToCoverageStateEnabled = 1,40};4142_MTL_ENUM(NS::Integer, BlendState) {43BlendStateDisabled = 0,44BlendStateEnabled = 1,45BlendStateUnspecialized = 2,46};4748_MTL_ENUM(NS::Integer, IndirectCommandBufferSupportState) {49IndirectCommandBufferSupportStateDisabled = 0,50IndirectCommandBufferSupportStateEnabled = 1,51};5253_MTL_OPTIONS(NS::UInteger, ShaderReflection) {54ShaderReflectionNone = 0,55ShaderReflectionBindingInfo = 1,56ShaderReflectionBufferTypeInfo = 1 << 1,57};5859class PipelineOptions : public NS::Copying<PipelineOptions>60{61public:62static PipelineOptions* alloc();6364PipelineOptions* init();6566void setShaderReflection(MTL4::ShaderReflection shaderReflection);6768void setShaderValidation(MTL::ShaderValidation shaderValidation);6970ShaderReflection shaderReflection() const;7172MTL::ShaderValidation shaderValidation() const;73};74class PipelineDescriptor : public NS::Copying<PipelineDescriptor>75{76public:77static PipelineDescriptor* alloc();7879PipelineDescriptor* init();8081NS::String* label() const;8283PipelineOptions* options() const;8485void setLabel(const NS::String* label);8687void setOptions(const MTL4::PipelineOptions* options);88};8990}91_MTL_INLINE MTL4::PipelineOptions* MTL4::PipelineOptions::alloc()92{93return NS::Object::alloc<MTL4::PipelineOptions>(_MTL_PRIVATE_CLS(MTL4PipelineOptions));94}9596_MTL_INLINE MTL4::PipelineOptions* MTL4::PipelineOptions::init()97{98return NS::Object::init<MTL4::PipelineOptions>();99}100101_MTL_INLINE void MTL4::PipelineOptions::setShaderReflection(MTL4::ShaderReflection shaderReflection)102{103Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setShaderReflection_), shaderReflection);104}105106_MTL_INLINE void MTL4::PipelineOptions::setShaderValidation(MTL::ShaderValidation shaderValidation)107{108Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setShaderValidation_), shaderValidation);109}110111_MTL_INLINE MTL4::ShaderReflection MTL4::PipelineOptions::shaderReflection() const112{113return Object::sendMessage<MTL4::ShaderReflection>(this, _MTL_PRIVATE_SEL(shaderReflection));114}115116_MTL_INLINE MTL::ShaderValidation MTL4::PipelineOptions::shaderValidation() const117{118return Object::sendMessage<MTL::ShaderValidation>(this, _MTL_PRIVATE_SEL(shaderValidation));119}120121_MTL_INLINE MTL4::PipelineDescriptor* MTL4::PipelineDescriptor::alloc()122{123return NS::Object::alloc<MTL4::PipelineDescriptor>(_MTL_PRIVATE_CLS(MTL4PipelineDescriptor));124}125126_MTL_INLINE MTL4::PipelineDescriptor* MTL4::PipelineDescriptor::init()127{128return NS::Object::init<MTL4::PipelineDescriptor>();129}130131_MTL_INLINE NS::String* MTL4::PipelineDescriptor::label() const132{133return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));134}135136_MTL_INLINE MTL4::PipelineOptions* MTL4::PipelineDescriptor::options() const137{138return Object::sendMessage<MTL4::PipelineOptions*>(this, _MTL_PRIVATE_SEL(options));139}140141_MTL_INLINE void MTL4::PipelineDescriptor::setLabel(const NS::String* label)142{143Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);144}145146_MTL_INLINE void MTL4::PipelineDescriptor::setOptions(const MTL4::PipelineOptions* options)147{148Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptions_), options);149}150151152