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 SFLOAT_32_DEPTH_(impl) \
109 SFLOAT_32_DEPTH_UINT_8_(impl) \
112 SRGBA_8_8_8_8_(impl) \
137#define DECLARE(a, b, c, blender_enum, d, e, f, g, h) \
138 blender_enum = int(TextureFormat::blender_enum),
140#define GPU_TEXTURE_TARGET_FORMAT_EXPAND(impl) \
143 UNORM_8_8_8_8_(impl) \
147 UNORM_16_16_16_16_(impl) \
151 SINT_8_8_8_8_(impl) \
155 SINT_16_16_16_16_(impl) \
159 SINT_32_32_32_32_(impl) \
163 UINT_8_8_8_8_(impl) \
167 UINT_16_16_16_16_(impl) \
171 UINT_32_32_32_32_(impl) \
174 SFLOAT_16_16_(impl) \
175 SFLOAT_16_16_16_16_(impl) \
178 SFLOAT_32_32_(impl) \
179 SFLOAT_32_32_32_32_(impl) \
181 UNORM_10_10_10_2_(impl) \
182 UINT_10_10_10_2_(impl) \
184 UFLOAT_11_11_10_(impl) \
186 UNORM_16_DEPTH_(impl) \
187 SFLOAT_32_DEPTH_(impl) \
188 SFLOAT_32_DEPTH_UINT_8_(impl) \
208#define DECLARE(a, b, c, blender_enum, d, e, f, g, h) \
209 blender_enum = int(TextureFormat::blender_enum),
211#define GPU_TEXTURE_WRITE_FORMAT_EXPAND(impl) \
214 UNORM_8_8_8_8_(impl) \
218 UNORM_16_16_16_16_(impl) \
222 SINT_8_8_8_8_(impl) \
226 SINT_16_16_16_16_(impl) \
230 SINT_32_32_32_32_(impl) \
234 UINT_8_8_8_8_(impl) \
238 UINT_16_16_16_16_(impl) \
242 UINT_32_32_32_32_(impl) \
245 SFLOAT_16_16_(impl) \
246 SFLOAT_16_16_16_16_(impl) \
249 SFLOAT_32_32_(impl) \
250 SFLOAT_32_32_32_32_(impl) \
252 UNORM_10_10_10_2_(impl) \
253 UINT_10_10_10_2_(impl) \
255 UFLOAT_11_11_10_(impl)
340#define GPU_SAMPLER_EXTEND_MODES_COUNT (GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER + 1)
377#define GPU_SAMPLER_CUSTOM_TYPES_COUNT (GPU_SAMPLER_CUSTOM_ICON + 1)
558 std::string serialized_parameters;
561 serialized_parameters +=
"linear-filter_";
565 serialized_parameters +=
"mipmap_";
569 serialized_parameters +=
"anisotropic_";
574 serialized_parameters +=
"extend-x_";
577 serialized_parameters +=
"repeat-x_";
580 serialized_parameters +=
"mirrored-repeat-x_";
583 serialized_parameters +=
"clamp-to-border-x_";
591 serialized_parameters +=
"extend-y_";
594 serialized_parameters +=
"repeat-y_";
597 serialized_parameters +=
"mirrored-repeat-y_";
600 serialized_parameters +=
"clamp-to-border-y_";
608 serialized_parameters +=
"extend-z";
611 serialized_parameters +=
"repeat-z";
614 serialized_parameters +=
"mirrored-repeat-z";
617 serialized_parameters +=
"clamp-to-border-z";
623 return serialized_parameters;
632 value = (value << 8) |
type;
827#define GPU_TEXTURE_FREE_SAFE(texture) \
829 if (texture != nullptr) { \
830 GPU_texture_free(texture); \
1194#ifndef GPU_NO_USE_PY_REFERENCES
1243struct GPUPixelBuffer;
1299 GPUPixelBuffer *pixel_buf,
#define BLI_assert_unreachable()
#define ENUM_OPERATORS(_type, _max)
@ GPU_SAMPLER_CUSTOM_ICON
@ GPU_SAMPLER_CUSTOM_COMPARE
void GPU_texture_extend_mode_y(blender::gpu::Texture *texture, GPUSamplerExtendMode extend_mode)
int GPU_texture_mip_count(const blender::gpu::Texture *texture)
void GPU_texture_swizzle_set(blender::gpu::Texture *texture, const char swizzle[4])
void GPU_texture_clear(blender::gpu::Texture *texture, eGPUDataFormat data_format, const void *data)
void GPU_texture_update_sub(blender::gpu::Texture *texture, eGPUDataFormat data_format, const void *pixels, int offset_x, int offset_y, int offset_z, int width, int height, int depth)
#define GPU_TEXTURE_TARGET_FORMAT_EXPAND(impl)
int GPU_texture_original_height(const blender::gpu::Texture *texture)
void GPU_pixel_buffer_unmap(GPUPixelBuffer *pixel_buf)
void GPU_texture_extend_mode_x(blender::gpu::Texture *texture, GPUSamplerExtendMode extend_mode)
void GPU_texture_copy(blender::gpu::Texture *dst, blender::gpu::Texture *src)
blender::gpu::Texture * GPU_texture_create_view(const char *name, blender::gpu::Texture *source_texture, blender::gpu::TextureFormat view_format, int mip_start, int mip_len, int layer_start, int layer_len, bool cube_as_array, bool use_stencil)
blender::gpu::Texture * GPU_texture_create_2d_array(const char *name, int width, int height, int layer_len, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_get_mipmap_size(blender::gpu::Texture *texture, int mip_level, int *r_size)
void GPU_texture_update_sub_from_pixel_buffer(blender::gpu::Texture *texture, eGPUDataFormat data_format, GPUPixelBuffer *pixel_buf, int offset_x, int offset_y, int offset_z, int width, int height, int depth)
size_t GPU_texture_component_len(blender::gpu::TextureFormat format)
#define GPU_TEXTURE_FORMAT_EXPAND(impl)
size_t GPU_texture_dataformat_size(eGPUDataFormat data_format)
void ** GPU_texture_py_reference_get(blender::gpu::Texture *texture)
void GPU_texture_image_unbind_all()
GPUPixelBufferNativeHandle GPU_pixel_buffer_get_native_handle(GPUPixelBuffer *pixel_buf)
int GPU_texture_height(const blender::gpu::Texture *texture)
void GPU_texture_anisotropic_filter(blender::gpu::Texture *texture, bool use_aniso)
blender::gpu::Texture * GPU_texture_create_cube(const char *name, int width, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
size_t GPU_pixel_buffer_size(GPUPixelBuffer *pixel_buf)
void GPU_texture_update_mipmap(blender::gpu::Texture *texture, int mip_level, eGPUDataFormat data_format, const void *pixels)
blender::gpu::Texture * GPU_texture_create_compressed_2d(const char *name, int width, int height, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const void *data)
bool GPU_texture_has_integer_format(const blender::gpu::Texture *texture)
bool GPU_texture_has_depth_format(const blender::gpu::Texture *texture)
@ GPU_SAMPLER_STATE_TYPE_CUSTOM
@ GPU_SAMPLER_STATE_TYPE_PARAMETERS
@ GPU_SAMPLER_STATE_TYPE_INTERNAL
blender::gpu::Texture * GPU_texture_create_1d_array(const char *name, int width, int layer_len, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
void * GPU_pixel_buffer_map(GPUPixelBuffer *pixel_buf)
void GPU_texture_update_mipmap_chain(blender::gpu::Texture *texture)
blender::gpu::TextureFormat GPU_texture_format(const blender::gpu::Texture *texture)
int GPU_texture_original_width(const blender::gpu::Texture *texture)
void GPU_texture_unbind(blender::gpu::Texture *texture)
void GPU_pixel_buffer_free(GPUPixelBuffer *pixel_buf)
static const int GPU_SAMPLER_FILTERING_TYPES_COUNT
bool GPU_texture_has_stencil_format(const blender::gpu::Texture *texture)
int GPU_texture_width(const blender::gpu::Texture *texture)
@ GPU_DATA_UINT_24_8_DEPRECATED
@ GPU_DATA_2_10_10_10_REV
void GPU_texture_bind_ex(blender::gpu::Texture *texture, GPUSamplerState state, int unit)
bool GPU_texture_has_signed_format(const blender::gpu::Texture *texture)
void GPU_texture_original_size_set(blender::gpu::Texture *texture, int width, int height)
void GPU_texture_extend_mode(blender::gpu::Texture *texture, GPUSamplerExtendMode extend_mode)
blender::gpu::Texture * GPU_texture_create_cube_array(const char *name, int width, int layer_len, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_mipmap_mode(blender::gpu::Texture *texture, bool use_mipmap, bool use_filter)
void GPU_texture_ref(blender::gpu::Texture *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
@ 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_read(blender::gpu::Texture *texture, eGPUDataFormat data_format, int mip_level)
void GPU_texture_image_bind(blender::gpu::Texture *texture, int unit)
bool GPU_texture_is_cube(const blender::gpu::Texture *texture)
eGPUTextureUsage GPU_texture_usage(const blender::gpu::Texture *texture)
void GPU_texture_py_reference_set(blender::gpu::Texture *texture, void **py_ref)
bool GPU_texture_has_float_format(const blender::gpu::Texture *texture)
void GPU_texture_image_unbind(blender::gpu::Texture *texture)
blender::gpu::Texture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
int GPU_texture_dimensions(const blender::gpu::Texture *texture)
void GPU_texture_unbind_all()
void GPU_texture_compare_mode(blender::gpu::Texture *texture, bool use_compare)
blender::gpu::Texture * GPU_texture_create_from_vertbuf(const char *name, blender::gpu::VertBuf *vertex_buf)
#define GPU_TEXTURE_WRITE_FORMAT_EXPAND(impl)
void GPU_texture_filter_mode(blender::gpu::Texture *texture, bool use_filter)
GPUPixelBuffer * GPU_pixel_buffer_create(size_t byte_size)
void GPU_unpack_row_length_set(uint len)
@ GPU_SAMPLER_FILTERING_MIPMAP
@ GPU_SAMPLER_FILTERING_ANISOTROPIC
@ GPU_SAMPLER_FILTERING_LINEAR
@ GPU_SAMPLER_FILTERING_DEFAULT
const char * GPU_texture_format_name(blender::gpu::TextureFormat format)
int GPU_texture_layer_count(const blender::gpu::Texture *texture)
void GPU_samplers_update()
void GPU_texture_bind(blender::gpu::Texture *texture, int unit)
blender::gpu::Texture * GPU_texture_create_error(int dimension, bool array)
int GPU_texture_depth(const blender::gpu::Texture *texture)
bool GPU_texture_has_normalized_format(const blender::gpu::Texture *texture)
void GPU_texture_free(blender::gpu::Texture *texture)
blender::gpu::Texture * GPU_texture_create_3d(const char *name, int width, int height, int depth, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const void *data)
blender::gpu::Texture * GPU_texture_create_1d(const char *name, int width, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_update(blender::gpu::Texture *texture, eGPUDataFormat data_format, const void *data)
unsigned int GPU_texture_memory_usage_get()
bool GPU_texture_is_array(const blender::gpu::Texture *texture)
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)