38#define DECLARE(a, b, c, blender_enum, d, e, f, g, h) blender_enum = int(DataFormat::blender_enum),
40#define GPU_TEXTURE_FORMAT_EXPAND(impl) \
44 SNORM_8_8_8_8_(impl) \
48 SNORM_16_16_16_(impl) \
49 SNORM_16_16_16_16_(impl) \
54 UNORM_8_8_8_8_(impl) \
58 UNORM_16_16_16_(impl) \
59 UNORM_16_16_16_16_(impl) \
68 SINT_16_16_16_(impl) \
69 SINT_16_16_16_16_(impl) \
73 SINT_32_32_32_(impl) \
74 SINT_32_32_32_32_(impl) \
83 UINT_16_16_16_(impl) \
84 UINT_16_16_16_16_(impl) \
88 UINT_32_32_32_(impl) \
89 UINT_32_32_32_32_(impl) \
93 SFLOAT_16_16_16_(impl) \
94 SFLOAT_16_16_16_16_(impl) \
98 SFLOAT_32_32_32_(impl) \
99 SFLOAT_32_32_32_32_(impl) \
101 UNORM_10_10_10_2_(impl) \
102 UINT_10_10_10_2_(impl) \
104 UFLOAT_11_11_10_(impl) \
105 UFLOAT_9_9_9_EXP_5_(impl) \
107 UNORM_16_DEPTH_(impl) \
108 UNORM_24_DEPTH_(impl) \
109 UNORM_24_DEPTH_UINT_8_(impl) \
110 SFLOAT_32_DEPTH_(impl) \
111 SFLOAT_32_DEPTH_UINT_8_(impl) \
114 SRGBA_8_8_8_8_(impl) \
139#define DECLARE(a, b, c, blender_enum, d, e, f, g, h) \
140 blender_enum = int(TextureFormat::blender_enum),
142#define GPU_TEXTURE_TARGET_FORMAT_EXPAND(impl) \
145 UNORM_8_8_8_8_(impl) \
149 UNORM_16_16_16_16_(impl) \
153 SINT_8_8_8_8_(impl) \
157 SINT_16_16_16_16_(impl) \
161 SINT_32_32_32_32_(impl) \
165 UINT_8_8_8_8_(impl) \
169 UINT_16_16_16_16_(impl) \
173 UINT_32_32_32_32_(impl) \
176 SFLOAT_16_16_(impl) \
177 SFLOAT_16_16_16_16_(impl) \
180 SFLOAT_32_32_(impl) \
181 SFLOAT_32_32_32_32_(impl) \
183 UNORM_10_10_10_2_(impl) \
184 UINT_10_10_10_2_(impl) \
186 UFLOAT_11_11_10_(impl) \
188 UNORM_16_DEPTH_(impl) \
189 UNORM_24_DEPTH_(impl) \
190 UNORM_24_DEPTH_UINT_8_(impl) \
191 SFLOAT_32_DEPTH_(impl) \
192 SFLOAT_32_DEPTH_UINT_8_(impl) \
212#define DECLARE(a, b, c, blender_enum, d, e, f, g, h) \
213 blender_enum = int(TextureFormat::blender_enum),
215#define GPU_TEXTURE_WRITE_FORMAT_EXPAND(impl) \
218 UNORM_8_8_8_8_(impl) \
222 UNORM_16_16_16_16_(impl) \
226 SINT_8_8_8_8_(impl) \
230 SINT_16_16_16_16_(impl) \
234 SINT_32_32_32_32_(impl) \
238 UINT_8_8_8_8_(impl) \
242 UINT_16_16_16_16_(impl) \
246 UINT_32_32_32_32_(impl) \
249 SFLOAT_16_16_(impl) \
250 SFLOAT_16_16_16_16_(impl) \
253 SFLOAT_32_32_(impl) \
254 SFLOAT_32_32_32_32_(impl) \
256 UNORM_10_10_10_2_(impl) \
257 UINT_10_10_10_2_(impl) \
259 UFLOAT_11_11_10_(impl)
344#define GPU_SAMPLER_EXTEND_MODES_COUNT (GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER + 1)
381#define GPU_SAMPLER_CUSTOM_TYPES_COUNT (GPU_SAMPLER_CUSTOM_ICON + 1)
562 std::string serialized_parameters;
565 serialized_parameters +=
"linear-filter_";
569 serialized_parameters +=
"mipmap_";
573 serialized_parameters +=
"anisotropic_";
578 serialized_parameters +=
"extend-x_";
581 serialized_parameters +=
"repeat-x_";
584 serialized_parameters +=
"mirrored-repeat-x_";
587 serialized_parameters +=
"clamp-to-border-x_";
595 serialized_parameters +=
"extend-y_";
598 serialized_parameters +=
"repeat-y_";
601 serialized_parameters +=
"mirrored-repeat-y_";
604 serialized_parameters +=
"clamp-to-border-y_";
612 serialized_parameters +=
"extend-z";
615 serialized_parameters +=
"repeat-z";
618 serialized_parameters +=
"mirrored-repeat-z";
621 serialized_parameters +=
"clamp-to-border-z";
627 return serialized_parameters;
652 GPU_RGBA8I = uint8_t(blender::gpu::TextureFormat::SINT_8_8_8_8),
653 GPU_RGBA8 = uint8_t(blender::gpu::TextureFormat::UNORM_8_8_8_8),
655 GPU_RGBA16I = uint8_t(blender::gpu::TextureFormat::SINT_16_16_16_16),
656 GPU_RGBA16F = uint8_t(blender::gpu::TextureFormat::SFLOAT_16_16_16_16),
657 GPU_RGBA16 = uint8_t(blender::gpu::TextureFormat::UNORM_16_16_16_16),
659 GPU_RGBA32I = uint8_t(blender::gpu::TextureFormat::SINT_32_32_32_32),
660 GPU_RGBA32F = uint8_t(blender::gpu::TextureFormat::SFLOAT_32_32_32_32),
662 GPU_RG8UI = uint8_t(blender::gpu::TextureFormat::UINT_8_8),
663 GPU_RG8I = uint8_t(blender::gpu::TextureFormat::SINT_8_8),
664 GPU_RG8 = uint8_t(blender::gpu::TextureFormat::UNORM_8_8),
665 GPU_RG16UI = uint8_t(blender::gpu::TextureFormat::UINT_16_16),
666 GPU_RG16I = uint8_t(blender::gpu::TextureFormat::SINT_16_16),
667 GPU_RG16F = uint8_t(blender::gpu::TextureFormat::SFLOAT_16_16),
668 GPU_RG16 = uint8_t(blender::gpu::TextureFormat::UNORM_16_16),
669 GPU_RG32UI = uint8_t(blender::gpu::TextureFormat::UINT_32_32),
670 GPU_RG32I = uint8_t(blender::gpu::TextureFormat::SINT_32_32),
671 GPU_RG32F = uint8_t(blender::gpu::TextureFormat::SFLOAT_32_32),
673 GPU_R8UI = uint8_t(blender::gpu::TextureFormat::UINT_8),
674 GPU_R8I = uint8_t(blender::gpu::TextureFormat::SINT_8),
675 GPU_R8 = uint8_t(blender::gpu::TextureFormat::UNORM_8),
676 GPU_R16UI = uint8_t(blender::gpu::TextureFormat::UINT_16),
677 GPU_R16I = uint8_t(blender::gpu::TextureFormat::SINT_16),
678 GPU_R16F = uint8_t(blender::gpu::TextureFormat::SFLOAT_16),
679 GPU_R16 = uint8_t(blender::gpu::TextureFormat::UNORM_16),
680 GPU_R32UI = uint8_t(blender::gpu::TextureFormat::UINT_32),
681 GPU_R32I = uint8_t(blender::gpu::TextureFormat::SINT_32),
682 GPU_R32F = uint8_t(blender::gpu::TextureFormat::SFLOAT_32),
704 GPU_RGB8UI = uint8_t(blender::gpu::TextureFormat::UINT_8_8_8),
705 GPU_RGB8I = uint8_t(blender::gpu::TextureFormat::SINT_8_8_8),
706 GPU_RGB8 = uint8_t(blender::gpu::TextureFormat::UNORM_8_8_8),
707 GPU_RGB16UI = uint8_t(blender::gpu::TextureFormat::UINT_16_16_16),
708 GPU_RGB16I = uint8_t(blender::gpu::TextureFormat::SINT_16_16_16),
709 GPU_RGB16F = uint8_t(blender::gpu::TextureFormat::SFLOAT_16_16_16),
710 GPU_RGB16 = uint8_t(blender::gpu::TextureFormat::UNORM_16_16_16),
711 GPU_RGB32UI = uint8_t(blender::gpu::TextureFormat::UINT_32_32_32),
712 GPU_RGB32I = uint8_t(blender::gpu::TextureFormat::SINT_32_32_32),
713 GPU_RGB32F = uint8_t(blender::gpu::TextureFormat::SFLOAT_32_32_32),
722 GPU_SRGB8 = uint8_t(blender::gpu::TextureFormat::SRGBA_8_8_8),
723 GPU_RGB9_E5 = uint8_t(blender::gpu::TextureFormat::UFLOAT_9_9_9_EXP_5),
725 GPU_COMPRESSED_RG_RGTC2,
726 GPU_COMPRESSED_SIGNED_RG_RGTC2,
727 GPU_COMPRESSED_RED_RGTC1,
728 GPU_COMPRESSED_SIGNED_RED_RGTC1,
908#define GPU_TEXTURE_FREE_SAFE(texture) \
910 if (texture != nullptr) { \
911 GPU_texture_free(texture); \
947 GPUTexture *source_texture,
1011 const void *pixels);
1270#ifndef GPU_NO_USE_PY_REFERENCES
1326struct GPUPixelBuffer;
1382 GPUPixelBuffer *pixel_buf,
#define BLI_assert_unreachable()
#define ENUM_OPERATORS(_type, _max)
@ GPU_SAMPLER_CUSTOM_ICON
@ GPU_SAMPLER_CUSTOM_COMPARE
int GPU_texture_height(const GPUTexture *texture)
GPUTexture * GPU_texture_create_compressed_2d(const char *name, int width, int height, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const void *data)
void GPU_texture_bind(GPUTexture *texture, int unit)
int GPU_texture_original_height(const GPUTexture *texture)
GPUTexture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_extend_mode_y(GPUTexture *texture, GPUSamplerExtendMode extend_mode)
#define GPU_TEXTURE_TARGET_FORMAT_EXPAND(impl)
GPUTexture * GPU_texture_create_1d(const char *name, int width, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
const char * GPU_texture_format_name(eGPUTextureFormat format)
void GPU_texture_free(GPUTexture *texture)
void GPU_pixel_buffer_unmap(GPUPixelBuffer *pixel_buf)
int GPU_texture_width(const GPUTexture *texture)
void GPU_texture_clear(GPUTexture *texture, eGPUDataFormat data_format, const void *data)
void GPU_texture_ref(GPUTexture *texture)
void ** GPU_texture_py_reference_get(GPUTexture *texture)
void GPU_texture_bind_ex(GPUTexture *texture, GPUSamplerState state, int unit)
int GPU_texture_dimensions(const GPUTexture *texture)
void GPU_texture_copy(GPUTexture *dst, GPUTexture *src)
#define GPU_TEXTURE_FORMAT_EXPAND(impl)
size_t GPU_texture_dataformat_size(eGPUDataFormat data_format)
void * GPU_texture_read(GPUTexture *texture, eGPUDataFormat data_format, int mip_level)
bool GPU_texture_has_float_format(const GPUTexture *texture)
bool GPU_texture_is_cube(const GPUTexture *texture)
void GPU_texture_image_unbind_all()
int GPU_texture_depth(const GPUTexture *texture)
GPUPixelBufferNativeHandle GPU_pixel_buffer_get_native_handle(GPUPixelBuffer *pixel_buf)
void GPU_texture_unbind(GPUTexture *texture)
size_t GPU_pixel_buffer_size(GPUPixelBuffer *pixel_buf)
int GPU_texture_mip_count(const GPUTexture *texture)
int GPU_texture_original_width(const GPUTexture *texture)
@ GPU_SAMPLER_STATE_TYPE_CUSTOM
@ GPU_SAMPLER_STATE_TYPE_PARAMETERS
@ GPU_SAMPLER_STATE_TYPE_INTERNAL
void GPU_texture_py_reference_set(GPUTexture *texture, void **py_ref)
void * GPU_pixel_buffer_map(GPUPixelBuffer *pixel_buf)
void GPU_pixel_buffer_free(GPUPixelBuffer *pixel_buf)
void GPU_texture_update_sub_from_pixel_buffer(GPUTexture *texture, eGPUDataFormat data_format, GPUPixelBuffer *pixel_buf, int offset_x, int offset_y, int offset_z, int width, int height, int depth)
void GPU_texture_anisotropic_filter(GPUTexture *texture, bool use_aniso)
GPUTexture * GPU_texture_create_error(int dimension, bool array)
static const int GPU_SAMPLER_FILTERING_TYPES_COUNT
GPUTexture * GPU_texture_create_cube_array(const char *name, int width, int layer_len, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
@ GPU_DATA_2_10_10_10_REV
void GPU_texture_compare_mode(GPUTexture *texture, bool use_compare)
bool GPU_texture_has_normalized_format(const GPUTexture *texture)
void GPU_texture_extend_mode_x(GPUTexture *texture, GPUSamplerExtendMode extend_mode)
void GPU_texture_extend_mode(GPUTexture *texture, GPUSamplerExtendMode extend_mode)
bool GPU_texture_has_integer_format(const GPUTexture *texture)
GPUTexture * GPU_texture_create_from_vertbuf(const char *name, blender::gpu::VertBuf *vertex_buf)
GPUTexture * GPU_texture_create_view(const char *name, GPUTexture *source_texture, eGPUTextureFormat view_format, int mip_start, int mip_len, int layer_start, int layer_len, bool cube_as_array, bool use_stencil)
bool GPU_texture_is_array(const GPUTexture *texture)
int GPU_texture_opengl_bindcode(const GPUTexture *texture)
@ GPU_TEXTURE_USAGE_MEMORY_EXPORT
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_SHADER_WRITE
@ GPU_TEXTURE_USAGE_HOST_READ
@ GPU_TEXTURE_USAGE_MEMORYLESS
@ GPU_TEXTURE_USAGE_ATTACHMENT
@ GPU_TEXTURE_USAGE_GENERAL
@ GPU_TEXTURE_USAGE_ATOMIC
@ GPU_TEXTURE_USAGE_FORMAT_VIEW
bool GPU_texture_has_stencil_format(const GPUTexture *texture)
@ GPU_SAMPLER_EXTEND_MODE_MIRRORED_REPEAT
@ GPU_SAMPLER_EXTEND_MODE_REPEAT
@ GPU_SAMPLER_EXTEND_MODE_EXTEND
@ GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER
void GPU_texture_update_sub(GPUTexture *texture, eGPUDataFormat data_format, const void *pixels, int offset_x, int offset_y, int offset_z, int width, int height, int depth)
void GPU_texture_update_mipmap(GPUTexture *texture, int mip_level, eGPUDataFormat data_format, const void *pixels)
GPUTexture * GPU_texture_create_2d_array(const char *name, int width, int height, int layer_len, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_mipmap_mode(GPUTexture *texture, bool use_mipmap, bool use_filter)
void GPU_texture_image_unbind(GPUTexture *texture)
GPUTexture * GPU_texture_create_3d(const char *name, int width, int height, int depth, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const void *data)
void GPU_texture_image_bind(GPUTexture *texture, int unit)
void GPU_texture_filter_mode(GPUTexture *texture, bool use_filter)
void GPU_texture_unbind_all()
GPUTexture * GPU_texture_create_cube(const char *name, int width, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_update_mipmap_chain(GPUTexture *texture)
eGPUTextureUsage GPU_texture_usage(const GPUTexture *texture)
bool GPU_texture_has_signed_format(const GPUTexture *texture)
#define GPU_TEXTURE_WRITE_FORMAT_EXPAND(impl)
GPUPixelBuffer * GPU_pixel_buffer_create(size_t byte_size)
GPUTexture * GPU_texture_create_1d_array(const char *name, int width, int layer_len, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_unpack_row_length_set(uint len)
@ GPU_SAMPLER_FILTERING_MIPMAP
@ GPU_SAMPLER_FILTERING_ANISOTROPIC
@ GPU_SAMPLER_FILTERING_LINEAR
@ GPU_SAMPLER_FILTERING_DEFAULT
void GPU_texture_original_size_set(GPUTexture *texture, int width, int height)
int GPU_texture_layer_count(const GPUTexture *texture)
bool GPU_texture_has_depth_format(const GPUTexture *texture)
void GPU_samplers_update()
size_t GPU_texture_component_len(eGPUTextureFormat format)
void GPU_texture_update(GPUTexture *texture, eGPUDataFormat data_format, const void *data)
void GPU_texture_get_mipmap_size(GPUTexture *texture, int mip_level, int *r_size)
unsigned int GPU_texture_memory_usage_get()
eGPUTextureFormat GPU_texture_format(const GPUTexture *texture)
void GPU_texture_swizzle_set(GPUTexture *texture, const char swizzle[4])
BMesh const char void * data
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
constexpr DataFormat to_data_format(TextureFormat format)
constexpr TextureFormat to_texture_format(TextureTargetFormat format)
GPUSamplerCustomType custom_type
GPUSamplerExtendMode extend_yz
static constexpr GPUSamplerState internal_sampler()
static constexpr GPUSamplerState icon_sampler()
static constexpr GPUSamplerState default_sampler()
GPUSamplerFiltering filtering
void enable_filtering_flag(GPUSamplerFiltering filtering_flags)
std::string to_string() const
void disable_filtering_flag(GPUSamplerFiltering filtering_flags)
GPUSamplerExtendMode extend_x
static constexpr GPUSamplerState compare_sampler()
bool operator==(GPUSamplerState const &rhs) const
void set_filtering_flag_from_test(GPUSamplerFiltering filtering_flags, bool test)