diff options
Diffstat (limited to 'source/blender/gpu/metal/mtl_state.hh')
-rw-r--r-- | source/blender/gpu/metal/mtl_state.hh | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/source/blender/gpu/metal/mtl_state.hh b/source/blender/gpu/metal/mtl_state.hh index f2d85f9648b..1af56378c5a 100644 --- a/source/blender/gpu/metal/mtl_state.hh +++ b/source/blender/gpu/metal/mtl_state.hh @@ -1,6 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + /** \file * \ingroup gpu */ +#pragma once #include "MEM_guardedalloc.h" @@ -9,6 +12,8 @@ #include "GPU_state.h" #include "gpu_state_private.hh" +#include "mtl_pso_descriptor_state.hh" + namespace blender::gpu { /* Forward Declarations. */ @@ -19,7 +24,7 @@ class MTLContext; * Metal Implementation. **/ class MTLStateManager : public StateManager { - public: + private: /* Current state of the associated MTLContext. * Avoids resetting the whole state for every change. */ @@ -27,24 +32,33 @@ class MTLStateManager : public StateManager { GPUStateMutable current_mutable_; MTLContext *context_; + /* Global pipeline descriptors. */ + MTLRenderPipelineStateDescriptor pipeline_descriptor_; + public: MTLStateManager(MTLContext *ctx); - void apply_state(void) override; - void force_state(void) override; + void apply_state() override; + void force_state() override; void issue_barrier(eGPUBarrier barrier_bits) override; void texture_bind(Texture *tex, eGPUSamplerState sampler, int unit) override; void texture_unbind(Texture *tex) override; - void texture_unbind_all(void) override; + void texture_unbind_all() override; void image_bind(Texture *tex, int unit) override; void image_unbind(Texture *tex) override; - void image_unbind_all(void) override; + void image_unbind_all() override; void texture_unpack_row_length_set(uint len) override; + /* Global pipeline descriptors. */ + MTLRenderPipelineStateDescriptor &get_pipeline_descriptor() + { + return pipeline_descriptor_; + } + private: void set_write_mask(const eGPUWriteMask value); void set_depth_test(const eGPUDepthTest value); @@ -62,10 +76,10 @@ class MTLStateManager : public StateManager { void set_mutable_state(const GPUStateMutable &state); /* METAL State utility functions. */ - void mtl_state_init(void); + void mtl_state_init(); void mtl_depth_range(float near, float far); - void mtl_stencil_mask(unsigned int mask); - void mtl_stencil_set_func(eGPUStencilTest stencil_func, int ref, unsigned int mask); + void mtl_stencil_mask(uint mask); + void mtl_stencil_set_func(eGPUStencilTest stencil_func, int ref, uint mask); MEM_CXX_CLASS_ALLOC_FUNCS("MTLStateManager") }; |