24 case TextureFormat::SFLOAT_16_16_16_16:
25 case TextureFormat::SFLOAT_16_16_16:
26 case TextureFormat::SFLOAT_16_16:
27 case TextureFormat::SFLOAT_16:
37 case TextureFormat::SINT_16_16_16_16:
38 case TextureFormat::SINT_16_16_16:
39 case TextureFormat::SINT_16_16:
40 case TextureFormat::SINT_16:
99#define GPU_MAX_IMAGE 8
113#ifndef GPU_NO_USE_PY_REFERENCES
188 uint unpack_row_length = 0) = 0;
192 GPUPixelBuffer *pixbuf) = 0;
318 case TextureFormat::SFLOAT_32_DEPTH:
319 case TextureFormat::UNORM_16_DEPTH:
322 case TextureFormat::SFLOAT_32_DEPTH_UINT_8:
329 case TextureFormat::SFLOAT_16_16_16:
330 case TextureFormat::SNORM_16_16_16_16:
331 case TextureFormat::SNORM_8_8_8_8:
332 case TextureFormat::SFLOAT_32_32_32:
333 case TextureFormat::SINT_32_32_32:
334 case TextureFormat::UINT_32_32_32:
335 case TextureFormat::SNORM_16_16_16:
336 case TextureFormat::SINT_16_16_16:
337 case TextureFormat::UINT_16_16_16:
338 case TextureFormat::UNORM_16_16_16:
339 case TextureFormat::SNORM_8_8_8:
340 case TextureFormat::UNORM_8_8_8:
341 case TextureFormat::SINT_8_8_8:
342 case TextureFormat::UINT_8_8_8:
343 case TextureFormat::SNORM_16_16:
344 case TextureFormat::SNORM_8_8:
345 case TextureFormat::SNORM_16:
346 case TextureFormat::SNORM_8:
347 case TextureFormat::SRGB_DXT1:
348 case TextureFormat::SRGB_DXT3:
349 case TextureFormat::SRGB_DXT5:
350 case TextureFormat::SNORM_DXT1:
351 case TextureFormat::SNORM_DXT3:
352 case TextureFormat::SNORM_DXT5:
353 case TextureFormat::SRGBA_8_8_8:
354 case TextureFormat::UFLOAT_9_9_9_EXP_5:
355 BLI_assert_msg(0,
"Texture cannot be attached to a framebuffer because of its type");
384 return reinterpret_cast<GPUPixelBuffer *
>(pixbuf);
392 return reinterpret_cast<const PixelBuffer *
>(pixbuf);
403 case TextureFormat::SRGB_DXT1:
404 case TextureFormat::SNORM_DXT1:
406 case TextureFormat::SRGB_DXT3:
407 case TextureFormat::SRGB_DXT5:
408 case TextureFormat::SNORM_DXT3:
409 case TextureFormat::SNORM_DXT5:
421 case TextureFormat::UINT_8_8_8_8:
423 case TextureFormat::SINT_8_8_8_8:
425 case TextureFormat::UNORM_8_8_8_8:
427 case TextureFormat::UINT_32_32_32_32:
429 case TextureFormat::SINT_32_32_32_32:
431 case TextureFormat::SFLOAT_32_32_32_32:
433 case TextureFormat::UINT_16_16_16_16:
435 case TextureFormat::SINT_16_16_16_16:
437 case TextureFormat::SFLOAT_16_16_16_16:
439 case TextureFormat::UNORM_16_16_16_16:
441 case TextureFormat::UINT_8_8:
443 case TextureFormat::SINT_8_8:
445 case TextureFormat::UNORM_8_8:
447 case TextureFormat::UINT_32_32:
449 case TextureFormat::SINT_32_32:
451 case TextureFormat::SFLOAT_32_32:
453 case TextureFormat::UINT_16_16:
455 case TextureFormat::SINT_16_16:
457 case TextureFormat::SFLOAT_16_16:
459 case TextureFormat::UNORM_16_16:
461 case TextureFormat::UINT_8:
463 case TextureFormat::SINT_8:
465 case TextureFormat::UNORM_8:
467 case TextureFormat::UINT_32:
469 case TextureFormat::SINT_32:
471 case TextureFormat::SFLOAT_32:
473 case TextureFormat::UINT_16:
475 case TextureFormat::SINT_16:
477 case TextureFormat::SFLOAT_16:
479 case TextureFormat::UNORM_16:
483 case TextureFormat::UNORM_10_10_10_2:
485 case TextureFormat::UINT_10_10_10_2:
487 case TextureFormat::UFLOAT_11_11_10:
489 case TextureFormat::SFLOAT_32_DEPTH_UINT_8:
491 case TextureFormat::SRGBA_8_8_8_8:
495 case TextureFormat::SFLOAT_16_16_16:
497 case TextureFormat::SNORM_16_16_16:
499 case TextureFormat::SINT_16_16_16:
501 case TextureFormat::UINT_16_16_16:
503 case TextureFormat::UNORM_16_16_16:
505 case TextureFormat::SNORM_16_16_16_16:
506 case TextureFormat::SNORM_8_8_8_8:
508 case TextureFormat::SFLOAT_32_32_32:
510 case TextureFormat::SINT_32_32_32:
512 case TextureFormat::UINT_32_32_32:
514 case TextureFormat::SNORM_8_8_8:
516 case TextureFormat::UNORM_8_8_8:
518 case TextureFormat::SINT_8_8_8:
520 case TextureFormat::UINT_8_8_8:
522 case TextureFormat::SNORM_16_16:
523 case TextureFormat::SNORM_8_8:
524 case TextureFormat::SNORM_16:
525 case TextureFormat::SNORM_8:
529 case TextureFormat::SRGB_DXT1:
530 case TextureFormat::SRGB_DXT3:
531 case TextureFormat::SRGB_DXT5:
533 case TextureFormat::SNORM_DXT1:
534 case TextureFormat::SNORM_DXT3:
535 case TextureFormat::SNORM_DXT5:
537 case TextureFormat::SRGBA_8_8_8:
539 case TextureFormat::UFLOAT_9_9_9_EXP_5:
543 case TextureFormat::SFLOAT_32_DEPTH:
544 case TextureFormat::UNORM_16_DEPTH:
561 switch (data_format) {
585 ((tex_format == TextureFormat::UNORM_10_10_10_2 ||
586 tex_format == TextureFormat::UINT_10_10_10_2) &&
598 switch (tex_format) {
600 case TextureFormat::UINT_32_32_32_32:
601 case TextureFormat::UINT_32_32:
602 case TextureFormat::UINT_32:
604 case TextureFormat::UINT_16_16_16_16:
605 case TextureFormat::UINT_16_16:
606 case TextureFormat::UINT_16:
608 case TextureFormat::UINT_8_8_8_8:
609 case TextureFormat::UINT_8_8:
610 case TextureFormat::UINT_8:
613 case TextureFormat::SINT_32_32_32_32:
614 case TextureFormat::SINT_32_32:
615 case TextureFormat::SINT_32:
617 case TextureFormat::SINT_16_16_16_16:
618 case TextureFormat::SINT_16_16:
619 case TextureFormat::SINT_16:
621 case TextureFormat::SINT_8_8_8_8:
622 case TextureFormat::SINT_8_8:
623 case TextureFormat::SINT_8:
626 case TextureFormat::SFLOAT_32_32_32_32:
627 case TextureFormat::SFLOAT_32_32:
628 case TextureFormat::SFLOAT_32:
630 case TextureFormat::SFLOAT_16_16_16_16:
631 case TextureFormat::SFLOAT_16_16:
632 case TextureFormat::SFLOAT_16:
634 case TextureFormat::UNORM_16_16_16_16:
635 case TextureFormat::UNORM_16_16:
636 case TextureFormat::UNORM_16:
638 case TextureFormat::UNORM_8_8_8_8:
639 case TextureFormat::UNORM_8_8:
640 case TextureFormat::UNORM_8:
644 case TextureFormat::UNORM_10_10_10_2:
645 case TextureFormat::UINT_10_10_10_2:
647 case TextureFormat::UFLOAT_11_11_10:
649 case TextureFormat::SFLOAT_32_DEPTH_UINT_8:
652 case TextureFormat::SRGBA_8_8_8_8:
656 case TextureFormat::UINT_32_32_32:
658 case TextureFormat::UINT_16_16_16:
660 case TextureFormat::UINT_8_8_8:
662 case TextureFormat::SINT_32_32_32:
664 case TextureFormat::SINT_16_16_16:
666 case TextureFormat::SINT_8_8_8:
668 case TextureFormat::UNORM_16_16_16:
670 case TextureFormat::UNORM_8_8_8:
672 case TextureFormat::SNORM_16_16_16_16:
673 case TextureFormat::SNORM_16_16_16:
674 case TextureFormat::SNORM_16_16:
675 case TextureFormat::SNORM_16:
677 case TextureFormat::SNORM_8_8_8_8:
678 case TextureFormat::SNORM_8_8_8:
679 case TextureFormat::SNORM_8_8:
680 case TextureFormat::SNORM_8:
682 case TextureFormat::SFLOAT_32_32_32:
684 case TextureFormat::SFLOAT_16_16_16:
688 case TextureFormat::SRGB_DXT1:
689 case TextureFormat::SRGB_DXT3:
690 case TextureFormat::SRGB_DXT5:
691 case TextureFormat::SNORM_DXT1:
692 case TextureFormat::SNORM_DXT3:
693 case TextureFormat::SNORM_DXT5:
697 case TextureFormat::SRGBA_8_8_8:
699 case TextureFormat::UFLOAT_9_9_9_EXP_5:
703 case TextureFormat::SFLOAT_32_DEPTH:
704 case TextureFormat::UNORM_16_DEPTH:
717 switch (tex_format) {
719 case TextureFormat::UINT_32_32_32_32:
720 case TextureFormat::UINT_32_32:
721 case TextureFormat::UINT_32:
722 case TextureFormat::UINT_16_16_16_16:
723 case TextureFormat::UINT_16_16:
724 case TextureFormat::UINT_16:
725 case TextureFormat::UINT_8_8_8_8:
726 case TextureFormat::UINT_8_8:
727 case TextureFormat::UINT_8:
730 case TextureFormat::SINT_32_32_32_32:
731 case TextureFormat::SINT_32_32:
732 case TextureFormat::SINT_32:
733 case TextureFormat::SINT_16_16_16_16:
734 case TextureFormat::SINT_16_16:
735 case TextureFormat::SINT_16:
736 case TextureFormat::SINT_8_8_8_8:
737 case TextureFormat::SINT_8_8:
738 case TextureFormat::SINT_8:
741 case TextureFormat::SFLOAT_32_32_32_32:
742 case TextureFormat::SFLOAT_32_32:
743 case TextureFormat::SFLOAT_32:
744 case TextureFormat::SFLOAT_16_16_16_16:
745 case TextureFormat::SFLOAT_16_16:
746 case TextureFormat::SFLOAT_16:
747 case TextureFormat::UNORM_16_16_16_16:
748 case TextureFormat::UNORM_16_16:
749 case TextureFormat::UNORM_16:
750 case TextureFormat::UNORM_8_8_8_8:
751 case TextureFormat::UNORM_8_8:
752 case TextureFormat::UNORM_8:
756 case TextureFormat::UNORM_10_10_10_2:
757 case TextureFormat::UINT_10_10_10_2:
759 case TextureFormat::UFLOAT_11_11_10:
761 case TextureFormat::SFLOAT_32_DEPTH_UINT_8:
764 case TextureFormat::SRGBA_8_8_8_8:
768 case TextureFormat::UINT_32_32_32:
769 case TextureFormat::UINT_16_16_16:
770 case TextureFormat::UINT_8_8_8:
772 case TextureFormat::SINT_32_32_32:
773 case TextureFormat::SINT_16_16_16:
774 case TextureFormat::SINT_8_8_8:
776 case TextureFormat::UNORM_16_16_16:
777 case TextureFormat::UNORM_8_8_8:
779 case TextureFormat::SNORM_16_16_16_16:
780 case TextureFormat::SNORM_16_16_16:
781 case TextureFormat::SNORM_16_16:
782 case TextureFormat::SNORM_16:
784 case TextureFormat::SNORM_8_8_8_8:
785 case TextureFormat::SNORM_8_8_8:
786 case TextureFormat::SNORM_8_8:
787 case TextureFormat::SNORM_8:
789 case TextureFormat::SFLOAT_32_32_32:
790 case TextureFormat::SFLOAT_16_16_16:
794 case TextureFormat::SRGB_DXT1:
795 case TextureFormat::SRGB_DXT3:
796 case TextureFormat::SRGB_DXT5:
797 case TextureFormat::SNORM_DXT1:
798 case TextureFormat::SNORM_DXT3:
799 case TextureFormat::SNORM_DXT5:
803 case TextureFormat::SRGBA_8_8_8:
805 case TextureFormat::UFLOAT_9_9_9_EXP_5:
809 case TextureFormat::SFLOAT_32_DEPTH:
810 case TextureFormat::UNORM_16_DEPTH:
821 switch (tex_format) {
823 case TextureFormat::UINT_32_32_32_32:
824 case TextureFormat::UINT_32_32:
825 case TextureFormat::UINT_32:
826 case TextureFormat::UINT_16_16_16_16:
827 case TextureFormat::UINT_16_16:
828 case TextureFormat::UINT_16:
829 case TextureFormat::UINT_8_8_8_8:
830 case TextureFormat::UINT_8_8:
831 case TextureFormat::UINT_8:
832 case TextureFormat::SINT_32_32_32_32:
833 case TextureFormat::SINT_32_32:
834 case TextureFormat::SINT_32:
835 case TextureFormat::SINT_16_16_16_16:
836 case TextureFormat::SINT_16_16:
837 case TextureFormat::SINT_16:
838 case TextureFormat::SINT_8_8_8_8:
839 case TextureFormat::SINT_8_8:
840 case TextureFormat::SINT_8:
841 case TextureFormat::SFLOAT_32_32_32_32:
842 case TextureFormat::SFLOAT_32_32:
843 case TextureFormat::SFLOAT_32:
844 case TextureFormat::SFLOAT_16_16_16_16:
845 case TextureFormat::SFLOAT_16_16:
846 case TextureFormat::SFLOAT_16:
847 case TextureFormat::UNORM_16_16_16_16:
848 case TextureFormat::UNORM_16_16:
849 case TextureFormat::UNORM_16:
850 case TextureFormat::UNORM_8_8_8_8:
851 case TextureFormat::UNORM_8_8:
852 case TextureFormat::UNORM_8:
856 case TextureFormat::UNORM_10_10_10_2:
857 case TextureFormat::UINT_10_10_10_2:
858 case TextureFormat::UFLOAT_11_11_10:
859 case TextureFormat::SRGBA_8_8_8_8:
861 case TextureFormat::SFLOAT_32_DEPTH_UINT_8:
865 case TextureFormat::SFLOAT_32_DEPTH:
866 case TextureFormat::UNORM_16_DEPTH:
870 case TextureFormat::UINT_32_32_32:
871 case TextureFormat::UINT_16_16_16:
872 case TextureFormat::UINT_8_8_8:
873 case TextureFormat::SINT_32_32_32:
874 case TextureFormat::SINT_16_16_16:
875 case TextureFormat::SINT_8_8_8:
876 case TextureFormat::UNORM_16_16_16:
877 case TextureFormat::UNORM_8_8_8:
878 case TextureFormat::SNORM_16_16_16_16:
879 case TextureFormat::SNORM_16_16_16:
880 case TextureFormat::SNORM_16_16:
881 case TextureFormat::SNORM_16:
882 case TextureFormat::SNORM_8_8_8_8:
883 case TextureFormat::SNORM_8_8_8:
884 case TextureFormat::SNORM_8_8:
885 case TextureFormat::SNORM_8:
886 case TextureFormat::SFLOAT_32_32_32:
887 case TextureFormat::SFLOAT_16_16_16:
888 BLI_assert_msg(0,
"This texture format is not compatible with framebuffer attachment.");
892 case TextureFormat::SRGB_DXT1:
893 case TextureFormat::SRGB_DXT3:
894 case TextureFormat::SRGB_DXT5:
895 case TextureFormat::SNORM_DXT1:
896 case TextureFormat::SNORM_DXT3:
897 case TextureFormat::SNORM_DXT5:
898 case TextureFormat::SRGBA_8_8_8:
899 case TextureFormat::UFLOAT_9_9_9_EXP_5:
900 BLI_assert_msg(0,
"This texture format is not compatible with framebuffer attachment.");
912 if (format->attr_len == 0) {
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
constexpr IndexRange()=default
virtual ~PixelBuffer()=default
virtual GPUPixelBufferNativeHandle get_native_handle()=0
virtual size_t get_size()=0
GPUSamplerState sampler_state
void attach_to(FrameBuffer *fb, GPUAttachmentType type)
Texture * source_texture_
virtual bool init_internal(VertBuf *vbo)=0
bool is_texture_view() const
int mip_width_get(int mip) const
virtual void read(int mip, eGPUDataFormat format, void *dst)=0
int mip_depth_get(int mip) const
bool init_1D(int w, int layers, int mip_len, TextureFormat format)
virtual void generate_mipmap()=0
GPUTextureType type_get() const
GPUTextureFormatFlag format_flag_get() const
int3 mip_size_get(int mip) const
void update(eGPUDataFormat format, const void *data)
IndexRange layer_range() const
virtual bool init_internal(gpu::Texture *src, bool use_stencil)=0
eGPUTextureUsage gpu_image_usage_flags_
eGPUTextureUsage usage_get() const
size_t read_size_get(int mip, eGPUDataFormat format) const
bool init_cubemap(int w, int layers, int mip_len, TextureFormat format)
bool init_view(Texture *src, TextureFormat format, GPUTextureType type, int mip_start, int mip_len, int layer_start, int layer_len, bool cube_as_array, bool use_stencil)
bool init_2D(int w, int h, int layers, int mip_len, TextureFormat format)
int dimensions_count() const
virtual void swizzle_set(const char swizzle_mask[4])=0
virtual void clear(const double4 data)=0
virtual void update_sub(int offset[3], int extent[3], eGPUDataFormat format, GPUPixelBuffer *pixbuf)=0
IndexRange mip_map_range() const
bool init_3D(int w, int h, int d, int mip_len, TextureFormat format)
GPUAttachmentType attachment_type(int slot) const
int mip_height_get(int mip) const
bool init_buffer(VertBuf *vbo, TextureFormat format)
Map< FrameBuffer *, GPUAttachmentType > fb_attachments_
virtual void update_sub(int mip, int offset[3], int extent[3], eGPUDataFormat format, const void *data, uint unpack_row_length=0)=0
virtual bool init_internal()=0
void mip_size_get(int mip, int r_size[3]) const
TextureFormat format_get() const
virtual void copy_to(Texture *tex, IndexRange mip_levels)=0
void usage_set(eGPUTextureUsage usage_flags)
Texture(const char *name)
void detach_from(FrameBuffer *fb)
GPUTextureFormatFlag format_flag_
ENUM_OPERATORS(Layer::Flags)
int format_component_len(const DataFormat format)
static Context * unwrap(GPUContext *ctx)
bool is_half_float(TextureFormat format)
eGPUDataFormat to_texture_data_format(TextureFormat tex_format)
static GPUContext * wrap(Context *ctx)
bool is_half_integer(TextureFormat format)
@ GPU_FORMAT_NORMALIZED_INTEGER
@ GPU_FORMAT_DEPTH_STENCIL
size_t to_block_size(TextureFormat data_type)
int to_bytesize(const DataFormat format)
int to_component_len(TextureFormat format)
constexpr bool validate_data_format(TextureFormat tex_format, eGPUDataFormat data_format)
GPUTextureFormatFlag to_format_flag(TextureFormat format)
constexpr TextureFormat to_texture_format(TextureTargetFormat format)
GPUFrameBufferBits to_framebuffer_bits(TextureFormat tex_format)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
BLI_INLINE float fb(float length, float L)
@ GPU_DATA_2_10_10_10_REV
@ GPU_DATA_UINT_24_8_DEPRECATED
MINLINE int max_ii(int a, int b)
@ GPU_FB_DEPTH_STENCIL_ATTACHMENT
@ GPU_FB_DEPTH_ATTACHMENT
@ GPU_FB_COLOR_ATTACHMENT0
VecBase< int32_t, 3 > int3
BMesh const char void * data
VecBase< double, 4 > double4
static constexpr GPUSamplerState default_sampler()