Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/metal/mtl_texture.hh
| Show First 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | public: | ||||
| MTLTexture(const char *name, | MTLTexture(const char *name, | ||||
| eGPUTextureFormat format, | eGPUTextureFormat format, | ||||
| eGPUTextureType type, | eGPUTextureType type, | ||||
| id<MTLTexture> metal_texture); | id<MTLTexture> metal_texture); | ||||
| ~MTLTexture(); | ~MTLTexture(); | ||||
| void update_sub( | void update_sub( | ||||
| int mip, int offset[3], int extent[3], eGPUDataFormat type, const void *data) override; | int mip, int offset[3], int extent[3], eGPUDataFormat type, const void *data) override; | ||||
| void update_sub(int offset[3], | |||||
| int extent[3], | |||||
| eGPUDataFormat format, | |||||
| GPUPixelBuffer *pixbuf) override; | |||||
| void generate_mipmap() override; | void generate_mipmap() override; | ||||
| void copy_to(Texture *dst) override; | void copy_to(Texture *dst) override; | ||||
| void clear(eGPUDataFormat format, const void *data) override; | void clear(eGPUDataFormat format, const void *data) override; | ||||
| void swizzle_set(const char swizzle_mask[4]) override; | void swizzle_set(const char swizzle_mask[4]) override; | ||||
| void stencil_texture_mode_set(bool use_stencil) override{ | void stencil_texture_mode_set(bool use_stencil) override{ | ||||
| /* TODO(Metal): implement. */ | /* TODO(Metal): implement. */ | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | id<MTLComputePipelineState> mtl_texture_read_impl( | ||||
| eGPUTextureType texture_type); | eGPUTextureType texture_type); | ||||
| /* fullscreen blit utilities. */ | /* fullscreen blit utilities. */ | ||||
| GPUShader *fullscreen_blit_sh_get(); | GPUShader *fullscreen_blit_sh_get(); | ||||
| MEM_CXX_CLASS_ALLOC_FUNCS("MTLTexture") | MEM_CXX_CLASS_ALLOC_FUNCS("MTLTexture") | ||||
| }; | }; | ||||
| class MTLPixelBuffer : public PixelBuffer { | |||||
| private: | |||||
| id<MTLBuffer> buffer_ = nil; | |||||
| public: | |||||
| MTLPixelBuffer(uint size); | |||||
| ~MTLPixelBuffer(); | |||||
| void *map() override; | |||||
| void unmap() override; | |||||
| int64_t get_native_handle() override; | |||||
| uint get_size() override; | |||||
| id<MTLBuffer> get_metal_buffer(); | |||||
| MEM_CXX_CLASS_ALLOC_FUNCS("MTLPixelBuffer") | |||||
| }; | |||||
| /* Utility */ | /* Utility */ | ||||
| MTLPixelFormat gpu_texture_format_to_metal(eGPUTextureFormat tex_format); | MTLPixelFormat gpu_texture_format_to_metal(eGPUTextureFormat tex_format); | ||||
| int get_mtl_format_bytesize(MTLPixelFormat tex_format); | int get_mtl_format_bytesize(MTLPixelFormat tex_format); | ||||
| int get_mtl_format_num_components(MTLPixelFormat tex_format); | int get_mtl_format_num_components(MTLPixelFormat tex_format); | ||||
| bool mtl_format_supports_blending(MTLPixelFormat format); | bool mtl_format_supports_blending(MTLPixelFormat format); | ||||
| /* The type used to define the per-component data in the input buffer. */ | /* The type used to define the per-component data in the input buffer. */ | ||||
| inline std::string tex_data_format_to_msl_type_str(eGPUDataFormat type) | inline std::string tex_data_format_to_msl_type_str(eGPUDataFormat type) | ||||
| ▲ Show 20 Lines • Show All 156 Lines • Show Last 20 Lines | |||||