44#define DECLARE(a, b, c, blender_enum, d, e, f, g, h) blender_enum = int(DataFormat::blender_enum),
46#define GPU_TEXTURE_FORMAT_EXPAND(impl) \
50 SNORM_8_8_8_8_(impl) \
54 SNORM_16_16_16_(impl) \
55 SNORM_16_16_16_16_(impl) \
60 UNORM_8_8_8_8_(impl) \
64 UNORM_16_16_16_(impl) \
65 UNORM_16_16_16_16_(impl) \
74 SINT_16_16_16_(impl) \
75 SINT_16_16_16_16_(impl) \
79 SINT_32_32_32_(impl) \
80 SINT_32_32_32_32_(impl) \
89 UINT_16_16_16_(impl) \
90 UINT_16_16_16_16_(impl) \
94 UINT_32_32_32_(impl) \
95 UINT_32_32_32_32_(impl) \
99 SFLOAT_16_16_16_(impl) \
100 SFLOAT_16_16_16_16_(impl) \
103 SFLOAT_32_32_(impl) \
104 SFLOAT_32_32_32_(impl) \
105 SFLOAT_32_32_32_32_(impl) \
107 UNORM_10_10_10_2_(impl) \
108 UINT_10_10_10_2_(impl) \
110 UFLOAT_11_11_10_(impl) \
111 UFLOAT_9_9_9_EXP_5_(impl) \
113 UNORM_16_DEPTH_(impl) \
114 SFLOAT_32_DEPTH_(impl) \
115 SFLOAT_32_DEPTH_UINT_8_(impl) \
118 SRGBA_8_8_8_8_(impl) \
143#define DECLARE(a, b, c, blender_enum, d, e, f, g, h) \
144 blender_enum = int(TextureFormat::blender_enum),
146#define GPU_TEXTURE_TARGET_FORMAT_EXPAND(impl) \
149 UNORM_8_8_8_8_(impl) \
153 UNORM_16_16_16_16_(impl) \
157 SINT_8_8_8_8_(impl) \
161 SINT_16_16_16_16_(impl) \
165 SINT_32_32_32_32_(impl) \
169 UINT_8_8_8_8_(impl) \
173 UINT_16_16_16_16_(impl) \
177 UINT_32_32_32_32_(impl) \
180 SFLOAT_16_16_(impl) \
181 SFLOAT_16_16_16_16_(impl) \
184 SFLOAT_32_32_(impl) \
185 SFLOAT_32_32_32_32_(impl) \
187 UNORM_10_10_10_2_(impl) \
188 UINT_10_10_10_2_(impl) \
190 UFLOAT_11_11_10_(impl) \
192 UNORM_16_DEPTH_(impl) \
193 SFLOAT_32_DEPTH_(impl) \
194 SFLOAT_32_DEPTH_UINT_8_(impl) \
214#define DECLARE(a, b, c, blender_enum, d, e, f, g, h) \
215 blender_enum = int(TextureFormat::blender_enum),
217#define GPU_TEXTURE_WRITE_FORMAT_EXPAND(impl) \
220 UNORM_8_8_8_8_(impl) \
224 UNORM_16_16_16_16_(impl) \
228 SINT_8_8_8_8_(impl) \
232 SINT_16_16_16_16_(impl) \
236 SINT_32_32_32_32_(impl) \
240 UINT_8_8_8_8_(impl) \
244 UINT_16_16_16_16_(impl) \
248 UINT_32_32_32_32_(impl) \
251 SFLOAT_16_16_(impl) \
252 SFLOAT_16_16_16_16_(impl) \
255 SFLOAT_32_32_(impl) \
256 SFLOAT_32_32_32_32_(impl) \
258 UNORM_10_10_10_2_(impl) \
259 UINT_10_10_10_2_(impl) \
261 UFLOAT_11_11_10_(impl)
342 if (anisotropic_samples <= 1) {
399#define GPU_SAMPLER_EXTEND_MODES_COUNT (GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER + 1)
436#define GPU_SAMPLER_CUSTOM_TYPES_COUNT (GPU_SAMPLER_CUSTOM_ICON + 1)
617 std::string serialized_parameters;
620 serialized_parameters +=
"linear-filter_";
624 serialized_parameters +=
"mipmap_";
630 serialized_parameters +=
"anisotropic2x_";
635 serialized_parameters +=
"anisotropic4x_";
640 serialized_parameters +=
"anisotropic8x_";
645 serialized_parameters +=
"anisotropic16x_";
650 serialized_parameters +=
"extend-x_";
653 serialized_parameters +=
"repeat-x_";
656 serialized_parameters +=
"mirrored-repeat-x_";
659 serialized_parameters +=
"clamp-to-border-x_";
667 serialized_parameters +=
"extend-y_";
670 serialized_parameters +=
"repeat-y_";
673 serialized_parameters +=
"mirrored-repeat-y_";
676 serialized_parameters +=
"clamp-to-border-y_";
684 serialized_parameters +=
"extend-z";
687 serialized_parameters +=
"repeat-z";
690 serialized_parameters +=
"mirrored-repeat-z";
693 serialized_parameters +=
"clamp-to-border-z";
699 return serialized_parameters;
708 value = (value << 8) |
type;
902#define GPU_TEXTURE_FREE_SAFE(texture) \
904 if (texture != nullptr) { \
905 blender::GPU_texture_free(texture); \
941 gpu::Texture *source_texture,
986 uint unpack_row_length = 0);
998 uint unpack_row_length = 0);
1305#ifndef GPU_NO_USE_PY_REFERENCES
1403 GPUPixelBuffer *pixel_buf,
#define ENUM_OPERATORS(_enum_type)
#define GPU_TEXTURE_TARGET_FORMAT_EXPAND(impl)
#define GPU_TEXTURE_FORMAT_EXPAND(impl)
#define GPU_TEXTURE_WRITE_FORMAT_EXPAND(impl)
#define BLI_assert_unreachable()
static constexpr IndexRange from_begin_end_inclusive(const int64_t begin, const int64_t last)
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
ENUM_OPERATORS(Layer::Flags)
constexpr DataFormat to_data_format(TextureFormat format)
constexpr TextureFormat to_texture_format(TextureTargetFormat format)
void GPU_texture_compare_mode(gpu::Texture *texture, bool use_compare)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
size_t GPU_texture_read_size_get(const gpu::Texture *texture, eGPUDataFormat data_format, int mip_level)
gpu::Texture * GPU_texture_create_cube_array(const char *name, int width, int layer_len, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
bool GPU_texture_has_depth_format(const gpu::Texture *texture)
gpu::Texture * GPU_texture_create_1d(const char *name, int width, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
int GPU_texture_depth(const gpu::Texture *texture)
bool GPU_texture_has_integer_format(const gpu::Texture *texture)
void GPU_texture_update(gpu::Texture *texture, eGPUDataFormat data_format, const void *data)
gpu::TextureFormat GPU_texture_format(const gpu::Texture *texture)
gpu::Texture * GPU_texture_create_compressed_2d(const char *name, int width, int height, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const void *data)
bool GPU_texture_is_view(const gpu::Texture *texture)
eGPUTextureUsage GPU_texture_usage(const gpu::Texture *texture)
void GPU_texture_update_mipmap_chain(gpu::Texture *texture)
constexpr int GPU_TEXTURE_MIPMAP_UPDATE_CHUNK_SIZE
static constexpr GPUSamplerFiltering GPU_SAMPLER_FILTERING_ANISOTROPIC_MASK
void GPU_texture_image_unbind(gpu::Texture *texture)
@ GPU_DATA_2_10_10_10_REV
@ GPU_DATA_UINT_24_8_DEPRECATED
void GPU_texture_copy(gpu::Texture *dst, gpu::Texture *src)
@ GPU_SAMPLER_EXTEND_MODE_MIRRORED_REPEAT
@ GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER
@ GPU_SAMPLER_EXTEND_MODE_REPEAT
@ GPU_SAMPLER_EXTEND_MODE_EXTEND
void GPU_texture_unbind_all()
bool GPU_texture_has_signed_format(const gpu::Texture *texture)
static constexpr GPUSamplerFiltering GPU_SAMPLER_FILTERING_ANISOTROPIC_ENABLE
gpu::Texture * GPU_texture_create_2d_array(const char *name, int width, int height, int layer_len, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
@ GPU_SAMPLER_FILTERING_ANISOTROPIC_4
@ GPU_SAMPLER_FILTERING_LINEAR
@ GPU_SAMPLER_FILTERING_DEFAULT
@ GPU_SAMPLER_FILTERING_ANISOTROPIC_8
@ GPU_SAMPLER_FILTERING_MIPMAP
@ GPU_SAMPLER_FILTERING_ANISOTROPIC_2
@ GPU_SAMPLER_FILTERING_ANISOTROPIC_16
void GPU_pixel_buffer_unmap(GPUPixelBuffer *pixel_buf)
void * GPU_pixel_buffer_map(GPUPixelBuffer *pixel_buf)
void GPU_texture_anisotropic_filter(gpu::Texture *texture, bool use_aniso)
void ** GPU_texture_py_reference_get(gpu::Texture *texture)
bool GPU_texture_has_normalized_format(const gpu::Texture *texture)
int GPU_texture_dimensions(const gpu::Texture *texture)
void GPU_texture_update_sub(gpu::Texture *texture, eGPUDataFormat data_format, const void *pixels, int offset_x, int offset_y, int offset_z, int width, int height, int depth, uint unpack_row_length=0)
void GPU_texture_mipmap_mode(gpu::Texture *texture, bool use_mipmap, bool use_filter)
static GPUSamplerFiltering GPU_anisotropic_filtering_flags(int anisotropic_samples)
static int GPU_anisotropic_samples_get(GPUSamplerFiltering filtering_flags)
size_t GPU_texture_dataformat_size(eGPUDataFormat data_format)
@ GPU_TEXTURE_USAGE_FORMAT_VIEW
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_MEMORY_EXPORT
@ GPU_TEXTURE_USAGE_SHADER_WRITE
@ GPU_TEXTURE_USAGE_GENERAL
@ GPU_TEXTURE_USAGE_HOST_READ
@ GPU_TEXTURE_USAGE_ATOMIC
@ GPU_TEXTURE_USAGE_ATTACHMENT
@ GPU_TEXTURE_USAGE_MEMORYLESS
int GPU_texture_mip_count(const gpu::Texture *texture)
gpu::Texture * GPU_texture_create_from_vertbuf(const char *name, gpu::VertBuf *vertex_buf)
BMesh const char void * data
static const int GPU_SAMPLER_FILTERING_TYPES_COUNT
void GPU_texture_update_mipmap_chain_partial(gpu::Texture *texture, int layer, BitSpan modified_chunks)
void GPU_texture_swizzle_set(gpu::Texture *texture, const char swizzle[4])
void GPU_texture_filter_mode(gpu::Texture *texture, bool use_filter)
bool GPU_texture_has_float_format(const gpu::Texture *texture)
gpu::Texture * GPU_texture_create_3d(const char *name, int width, int height, int depth, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const void *data)
void GPU_texture_original_size_set(gpu::Texture *texture, int width, int height)
int GPU_texture_width(const gpu::Texture *texture)
bool GPU_texture_is_cube(const gpu::Texture *texture)
void GPU_texture_update_mipmap(gpu::Texture *texture, int mip_level, eGPUDataFormat data_format, const void *pixels, uint unpack_row_length=0)
size_t GPU_texture_component_len(gpu::TextureFormat format)
void GPU_texture_bind_ex(gpu::Texture *texture, GPUSamplerState state, int unit)
bool GPU_texture_is_array(const gpu::Texture *texture)
void GPU_texture_extend_mode_x(gpu::Texture *texture, GPUSamplerExtendMode extend_mode)
void GPU_texture_extend_mode(gpu::Texture *texture, GPUSamplerExtendMode extend_mode)
gpu::Texture * GPU_texture_create_cube(const char *name, int width, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
bool GPU_texture_has_compressed_format(const gpu::Texture *texture)
void GPU_pixel_buffer_free(GPUPixelBuffer *pixel_buf)
@ GPU_SAMPLER_CUSTOM_ICON
@ GPU_SAMPLER_CUSTOM_COMPARE
size_t GPU_pixel_buffer_size(GPUPixelBuffer *pixel_buf)
void GPU_texture_extend_mode_y(gpu::Texture *texture, GPUSamplerExtendMode extend_mode)
void GPU_texture_clear(gpu::Texture *texture, eGPUDataFormat data_format, const void *data)
void GPU_texture_bind(gpu::Texture *texture, int unit)
int GPU_texture_height(const gpu::Texture *texture)
void GPU_texture_free(gpu::Texture *texture)
@ GPU_SAMPLER_STATE_TYPE_PARAMETERS
@ GPU_SAMPLER_STATE_TYPE_CUSTOM
@ GPU_SAMPLER_STATE_TYPE_INTERNAL
GPUPixelBuffer * GPU_pixel_buffer_create(size_t byte_size)
const char * GPU_texture_format_name(gpu::TextureFormat format)
void GPU_texture_image_unbind_all()
void GPU_texture_image_bind(gpu::Texture *texture, int unit)
gpu::Texture * GPU_texture_create_error(int dimension, bool array)
void GPU_texture_unbind(gpu::Texture *texture)
void * GPU_texture_read(gpu::Texture *texture, eGPUDataFormat data_format, int mip_level)
int GPU_texture_layer_count(const gpu::Texture *texture)
int GPU_texture_original_height(const gpu::Texture *texture)
gpu::Texture * GPU_texture_create_view(const char *name, gpu::Texture *source_texture, gpu::TextureFormat view_format, int mip_start, int mip_len, int layer_start, int layer_len, bool cube_as_array, bool use_stencil)
void GPU_texture_py_reference_set(gpu::Texture *texture, void **py_ref)
int GPU_texture_original_width(const gpu::Texture *texture)
bool GPU_texture_has_stencil_format(const gpu::Texture *texture)
unsigned int GPU_texture_memory_usage_get()
void GPU_texture_update_sub_from_pixel_buffer(gpu::Texture *texture, eGPUDataFormat data_format, GPUPixelBuffer *pixel_buf, int offset_x, int offset_y, int offset_z, int width, int height, int depth)
gpu::Texture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_get_mipmap_size(gpu::Texture *texture, int mip_level, int *r_size)
gpu::Texture * GPU_texture_create_1d_array(const char *name, int width, int layer_len, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_ref(gpu::Texture *texture)
GPUPixelBufferNativeHandle GPU_pixel_buffer_get_native_handle(GPUPixelBuffer *pixel_buf)
eGPUTextureUsage GPU_texture_mipmap_usage(gpu::TextureFormat format)
void disable_filtering_flag(GPUSamplerFiltering filtering_flags)
GPUSamplerExtendMode extend_yz
GPUSamplerFiltering filtering
static constexpr GPUSamplerState internal_sampler()
void enable_filtering_flag(GPUSamplerFiltering filtering_flags)
void set_filtering_flag_from_test(GPUSamplerFiltering filtering_flags, bool test)
GPUSamplerCustomType custom_type
std::string to_string() const
static constexpr GPUSamplerState compare_sampler()
GPUSamplerExtendMode extend_x
static constexpr GPUSamplerState icon_sampler()
bool operator==(GPUSamplerState const &rhs) const
static constexpr GPUSamplerState default_sampler()