33 : context_(&context), type_(type), precision_(precision)
294Result::operator GPUTexture *()
const
296 return this->gpu_texture();
314 is_single_value_ =
false;
326 is_single_value_ =
true;
327 this->allocate_data(
int2(1),
true);
414 (*data_reference_count_)++;
429 source =
Result(*context_, type_, precision_);
456 is_single_value_ =
false;
506 reference_count_ =
count;
511 reference_count_ +=
count;
516 reference_count_ -=
count;
524 if (reference_count_ != 0) {
535 delete derived_resources_;
536 derived_resources_ =
nullptr;
547 if (*data_reference_count_ != 1) {
548 (*data_reference_count_)--;
550 switch (storage_type_) {
559 data_reference_count_ =
nullptr;
560 derived_resources_ =
nullptr;
565 switch (storage_type_) {
581 delete data_reference_count_;
582 data_reference_count_ =
nullptr;
584 delete derived_resources_;
585 derived_resources_ =
nullptr;
590 return reference_count_ != 0;
595 if (!derived_resources_) {
598 return *derived_resources_;
627 return is_single_value_;
632 switch (storage_type_) {
644 return reference_count_;
662 switch (storage_type_) {
691void Result::allocate_data(
int2 size,
bool from_pool)
697 is_from_pool_ = from_pool;
715 const int64_t memory_size = array_size * item_size;
723 data_reference_count_ =
new int(1);
#define BLI_assert_unreachable()
int GPU_shader_get_sampler_binding(GPUShader *shader, const char *name)
void GPU_memory_barrier(eGPUBarrier barrier)
@ GPU_BARRIER_TEXTURE_FETCH
@ GPU_BARRIER_SHADER_IMAGE_ACCESS
int GPU_texture_height(const GPUTexture *texture)
void GPU_texture_bind(GPUTexture *texture, int unit)
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_free(GPUTexture *texture)
int GPU_texture_width(const GPUTexture *texture)
void GPU_texture_unbind(GPUTexture *texture)
@ GPU_TEXTURE_USAGE_GENERAL
void GPU_texture_image_unbind(GPUTexture *texture)
void GPU_texture_image_bind(GPUTexture *texture, int unit)
void GPU_texture_update(GPUTexture *texture, eGPUDataFormat data_format, const void *data)
eGPUTextureFormat GPU_texture_format(const GPUTexture *texture)
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static const CPPType & get()
void default_construct_n(void *ptr, int64_t n) const
void copy_assign(const void *src, void *dst) const
const void * data() const
virtual bool use_gpu() const =0
void transform(const float3x3 &input_transformation)
RealizationOptions realization_options
void decrement_reference_count(int count=1)
void share_data(const Result &source)
RealizationOptions & get_realization_options()
eGPUTextureFormat get_gpu_texture_format() const
const CPPType & get_cpp_type() const
void allocate_texture(Domain domain, bool from_pool=true)
int reference_count() const
void unbind_as_texture() const
void bind_as_texture(GPUShader *shader, const char *texture_name) const
static const char * type_name(const ResultType type)
bool is_allocated() const
void set_transformation(const float3x3 &transformation)
GPointer single_value() const
void set_single_value(const T &value)
ResultPrecision precision() const
void update_single_value_data()
static eGPUTextureFormat gpu_texture_format(ResultType type, ResultPrecision precision)
static ResultType float_type(const int channels_count)
void set_precision(ResultPrecision precision)
void transform(const float3x3 &transformation)
void wrap_external(GPUTexture *texture)
GPUTexture * gpu_texture() const
void increment_reference_count(int count=1)
const Domain & domain() const
static const CPPType & cpp_type(const ResultType type)
GPUTexture * gpu_texture_
int64_t channels_count() const
void bind_as_image(GPUShader *shader, const char *image_name, bool read=false) const
void unbind_as_image() const
void allocate_single_value()
DerivedResources & derived_resources()
void set_reference_count(int count)
bool is_single_value() const
void steal_data(Result &source)
const T & get_single_value() const
void set_type(ResultType type)
void release_texture(GPUTexture *tmp_tex)
static TexturePool & get()
GPUTexture * acquire_texture(int width, int height, eGPUTextureFormat format, eGPUTextureUsage usage)
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
void * MEM_mallocN_aligned(size_t len, size_t alignment, const char *str)
void MEM_freeN(void *vmemh)
static bool is_compatible_texture(const GPUTexture *texture, const Result &result)
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< float, 3 > float3