Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/draw/intern/DRW_gpu_wrapper.hh')
-rw-r--r--source/blender/draw/intern/DRW_gpu_wrapper.hh28
1 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/draw/intern/DRW_gpu_wrapper.hh b/source/blender/draw/intern/DRW_gpu_wrapper.hh
index af262272577..d4491223c10 100644
--- a/source/blender/draw/intern/DRW_gpu_wrapper.hh
+++ b/source/blender/draw/intern/DRW_gpu_wrapper.hh
@@ -286,28 +286,32 @@ template<
/** The number of values that can be stored in this uniform buffer. */
int64_t len
/** True if the buffer only resides on GPU memory and cannot be accessed. */
- /* TODO(fclem): Currently unsupported. */
+ /* TODO(@fclem): Currently unsupported. */
/* bool device_only = false */>
class UniformArrayBuffer : public detail::UniformCommon<T, len, false> {
public:
UniformArrayBuffer()
{
- /* TODO(fclem) We should map memory instead. */
+ /* TODO(@fclem): We should map memory instead. */
this->data_ = (T *)MEM_mallocN_aligned(len * sizeof(T), 16, this->name_);
}
+ ~UniformArrayBuffer()
+ {
+ MEM_freeN(this->data_);
+ }
};
template<
/** Type of the values stored in this uniform buffer. */
typename T
/** True if the buffer only resides on GPU memory and cannot be accessed. */
- /* TODO(fclem): Currently unsupported. */
+ /* TODO(@fclem): Currently unsupported. */
/* bool device_only = false */>
class UniformBuffer : public T, public detail::UniformCommon<T, 1, false> {
public:
UniformBuffer()
{
- /* TODO(fclem) How could we map this? */
+ /* TODO(@fclem): How could we map this? */
this->data_ = static_cast<T *>(this);
}
@@ -641,7 +645,7 @@ class Texture : NonCopyable {
bool cubemap = false)
{
- /* TODO(fclem) In the future, we need to check if mip_count did not change.
+ /* TODO(@fclem): In the future, we need to check if mip_count did not change.
* For now it's ok as we always define all MIP level. */
if (tx_) {
int3 size = this->size();
@@ -653,7 +657,7 @@ class Texture : NonCopyable {
if (tx_ == nullptr) {
tx_ = create(w, h, d, mips, format, data, layered, cubemap);
if (mips > 1) {
- /* TODO(fclem) Remove once we have immutable storage or when mips are
+ /* TODO(@fclem): Remove once we have immutable storage or when mips are
* generated on creation. */
GPU_texture_generate_mipmap(tx_);
}
@@ -674,20 +678,20 @@ class Texture : NonCopyable {
if (h == 0) {
return GPU_texture_create_1d(name_, w, mips, format, data);
}
- else if (d == 0) {
+ else if (cubemap) {
if (layered) {
- return GPU_texture_create_1d_array(name_, w, h, mips, format, data);
+ return GPU_texture_create_cube_array(name_, w, d, mips, format, data);
}
else {
- return GPU_texture_create_2d(name_, w, h, mips, format, data);
+ return GPU_texture_create_cube(name_, w, mips, format, data);
}
}
- else if (cubemap) {
+ else if (d == 0) {
if (layered) {
- return GPU_texture_create_cube_array(name_, w, d, mips, format, data);
+ return GPU_texture_create_1d_array(name_, w, h, mips, format, data);
}
else {
- return GPU_texture_create_cube(name_, w, mips, format, data);
+ return GPU_texture_create_2d(name_, w, h, mips, format, data);
}
}
else {