Blender V4.5
mtl_shader.hh File Reference
#include "MEM_guardedalloc.h"
#include "GPU_batch.hh"
#include "GPU_capabilities.hh"
#include "GPU_shader.hh"
#include "GPU_vertex_format.hh"
#include <Metal/Metal.h>
#include <QuartzCore/QuartzCore.h>
#include <functional>
#include <unordered_map>
#include <deque>
#include <mutex>
#include <thread>
#include "mtl_framebuffer.hh"
#include "mtl_shader_interface.hh"
#include "mtl_shader_shared.hh"
#include "mtl_state.hh"
#include "mtl_texture.hh"
#include "gpu_shader_create_info.hh"
#include "gpu_shader_private.hh"

Go to the source code of this file.

Classes

struct  blender::gpu::MTLBufferArgumentData
 
struct  blender::gpu::MTLRenderPipelineStateInstance
 
struct  blender::gpu::MTLComputePipelineStateCommon
 
struct  blender::gpu::MTLComputePipelineStateInstance
 
struct  blender::gpu::MTLShaderBuilder
 
class  blender::gpu::MTLShader
 
class  blender::gpu::MTLShaderCompiler
 

Namespaces

namespace  blender
 
namespace  blender::gpu
 

Macros

#define MTL_SHADER_DEBUG_EXPORT_SOURCE   0
 
#define MTL_SHADER_TRANSLATION_DEBUG_OUTPUT   0
 
#define shader_debug_printf(...)   /* Null print. */
 
#define MTL_SHADER_SPECIALIZATION_CONSTANT_BASE_ID   30
 
#define MTL_SHADER_MAX_SPECIALIZED_PSOS   5
 
#define RESIZE_TYPE(_type, _suffix)
 
#define FORMAT_PER_COMP(_type, _suffix)
 
#define FORMAT_PER_COMP_SMALL_INT(_type)
 
#define FORMAT_PER_COMP_INT(_type)
 
#define FORMAT_PER_TYPE(_comp, _value)
 
#define FORMAT_PER_TYPE(_comp)
 

Functions

MTLVertexFormat blender::gpu::format_resize_comp (MTLVertexFormat mtl_format, uint32_t components)
 
MTLVertexFormat blender::gpu::format_get_component_type (MTLVertexFormat mtl_format)
 
MTLVertexFormat blender::gpu::to_mtl (GPUVertCompType component_type, GPUVertFetchMode fetch_mode, uint32_t component_len)
 
int blender::gpu::mtl_format_component_len (MTLVertexFormat format)
 
bool blender::gpu::mtl_format_is_normalized (MTLVertexFormat format)
 
MTLVertexFormat blender::gpu::mtl_convert_vertex_format_ex (MTLVertexFormat shader_attr_format, GPUVertCompType component_type, uint32_t component_len, GPUVertFetchMode fetch_mode)
 
bool blender::gpu::mtl_convert_vertex_format (MTLVertexFormat shader_attr_format, GPUVertCompType component_type, uint32_t component_len, GPUVertFetchMode fetch_mode, MTLVertexFormat *r_convertedFormat)
 

Macro Definition Documentation

◆ FORMAT_PER_COMP

#define FORMAT_PER_COMP ( _type,
_suffix )
Value:
switch (component_len) { \
case 1: \
return MTLVertexFormat##_type##_suffix; \
case 2: \
return MTLVertexFormat##_type##2##_suffix; \
case 3: \
return MTLVertexFormat##_type##3##_suffix; \
case 4: \
return MTLVertexFormat##_type##4##_suffix; \
default: \
BLI_assert_msg(0, "Invalid attribute component count"); \
break; \
} \
break;

Referenced by blender::gpu::to_mtl().

◆ FORMAT_PER_COMP_INT

#define FORMAT_PER_COMP_INT ( _type)
Value:
switch (fetch_mode) { \
case GPU_FETCH_INT: \
FORMAT_PER_COMP(_type, ) \
BLI_assert_msg(0, "Invalid fetch mode for integer attribute"); \
break; \
/* Fallback to manual conversion */ \
break; \
} \
break;
@ GPU_FETCH_FLOAT
@ GPU_FETCH_INT_TO_FLOAT_UNIT
@ GPU_FETCH_INT

Referenced by blender::gpu::to_mtl().

◆ FORMAT_PER_COMP_SMALL_INT

#define FORMAT_PER_COMP_SMALL_INT ( _type)
Value:
switch (fetch_mode) { \
case GPU_FETCH_INT: \
FORMAT_PER_COMP(_type, ) \
FORMAT_PER_COMP(_type, Normalized) \
BLI_assert_msg(0, "Invalid fetch mode for integer attribute"); \
break; \
} \
break;

Referenced by blender::gpu::to_mtl().

◆ FORMAT_PER_TYPE [1/2]

#define FORMAT_PER_TYPE ( _comp)
Value:
case MTLVertexFormatChar##_comp##Normalized: \
case MTLVertexFormatUChar##_comp##Normalized: \
case MTLVertexFormatShort##_comp##Normalized: \
case MTLVertexFormatUShort##_comp##Normalized: \
return true;

◆ FORMAT_PER_TYPE [2/2]

#define FORMAT_PER_TYPE ( _comp,
_value )
Value:
case MTLVertexFormatChar##_comp: \
case MTLVertexFormatChar##_comp##Normalized: \
case MTLVertexFormatUChar##_comp: \
case MTLVertexFormatUChar##_comp##Normalized: \
case MTLVertexFormatShort##_comp: \
case MTLVertexFormatShort##_comp##Normalized: \
case MTLVertexFormatUShort##_comp: \
case MTLVertexFormatUShort##_comp##Normalized: \
case MTLVertexFormatInt##_comp: \
case MTLVertexFormatUInt##_comp: \
case MTLVertexFormatHalf##_comp: \
case MTLVertexFormatFloat##_comp: \
return _value;

Referenced by blender::gpu::mtl_format_component_len(), and blender::gpu::mtl_format_is_normalized().

◆ MTL_SHADER_DEBUG_EXPORT_SOURCE

#define MTL_SHADER_DEBUG_EXPORT_SOURCE   0

Definition at line 42 of file mtl_shader.hh.

◆ MTL_SHADER_MAX_SPECIALIZED_PSOS

#define MTL_SHADER_MAX_SPECIALIZED_PSOS   5

Definition at line 57 of file mtl_shader.hh.

◆ MTL_SHADER_SPECIALIZATION_CONSTANT_BASE_ID

#define MTL_SHADER_SPECIALIZATION_CONSTANT_BASE_ID   30

◆ MTL_SHADER_TRANSLATION_DEBUG_OUTPUT

#define MTL_SHADER_TRANSLATION_DEBUG_OUTPUT   0

Definition at line 43 of file mtl_shader.hh.

◆ RESIZE_TYPE

#define RESIZE_TYPE ( _type,
_suffix )
Value:
case MTLVertexFormat##_type##_suffix: \
case MTLVertexFormat##_type##2##_suffix: \
case MTLVertexFormat##_type##3##_suffix: \
case MTLVertexFormat##_type##4##_suffix: \
switch (components) { \
case 1: \
return MTLVertexFormat##_type##_suffix; \
case 2: \
return MTLVertexFormat##_type##2##_suffix; \
case 3: \
return MTLVertexFormat##_type##3##_suffix; \
case 4: \
return MTLVertexFormat##_type##4##_suffix; \
} \
break;

Referenced by blender::gpu::format_resize_comp().

◆ shader_debug_printf