Skip to content

Commit

Permalink
core/gpu: rm TRANSIENT texture usage;
Browse files Browse the repository at this point in the history
It's implied when the usage is just RENDER
  • Loading branch information
bjornbytes committed Nov 8, 2023
1 parent e894576 commit c4cda0a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/core/gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ enum {
GPU_TEXTURE_RENDER = (1 << 1),
GPU_TEXTURE_STORAGE = (1 << 2),
GPU_TEXTURE_COPY_SRC = (1 << 3),
GPU_TEXTURE_COPY_DST = (1 << 4),
GPU_TEXTURE_TRANSIENT = (1 << 5)
GPU_TEXTURE_COPY_DST = (1 << 4)
};

typedef enum {
Expand Down
4 changes: 2 additions & 2 deletions src/core/gpu_vk.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ bool gpu_texture_init(gpu_texture* texture, gpu_texture_info* info) {
((info->usage & GPU_TEXTURE_STORAGE) ? VK_IMAGE_USAGE_STORAGE_BIT : 0) |
((info->usage & GPU_TEXTURE_COPY_SRC) ? VK_IMAGE_USAGE_TRANSFER_SRC_BIT : 0) |
((info->usage & GPU_TEXTURE_COPY_DST) ? VK_IMAGE_USAGE_TRANSFER_DST_BIT : 0) |
((info->usage & GPU_TEXTURE_TRANSIENT) ? VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT : 0) |
((info->usage == GPU_TEXTURE_RENDER) ? VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT : 0) |
(info->upload.levelCount > 0 ? VK_IMAGE_USAGE_TRANSFER_DST_BIT : 0) |
(info->upload.generateMipmaps ? VK_IMAGE_USAGE_TRANSFER_SRC_BIT : 0)
};
Expand All @@ -512,7 +512,7 @@ bool gpu_texture_init(gpu_texture* texture, gpu_texture_info* info) {
nickname(texture->handle, VK_OBJECT_TYPE_IMAGE, info->label);

gpu_memory_type memoryType;
bool transient = info->usage & GPU_TEXTURE_TRANSIENT;
bool transient = info->usage == GPU_TEXTURE_RENDER;

switch (info->format) {
case GPU_FORMAT_D16: memoryType = transient ? GPU_MEMORY_TEXTURE_LAZY_D16 : GPU_MEMORY_TEXTURE_D16; break;
Expand Down
5 changes: 2 additions & 3 deletions src/modules/graphics/graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -2104,8 +2104,7 @@ Texture* lovrTextureCreate(const TextureInfo* info) {
((info->usage & TEXTURE_SAMPLE) ? GPU_TEXTURE_SAMPLE : 0) |
((info->usage & TEXTURE_RENDER) ? GPU_TEXTURE_RENDER : 0) |
((info->usage & TEXTURE_STORAGE) ? GPU_TEXTURE_STORAGE : 0) |
(transfer ? GPU_TEXTURE_COPY_SRC | GPU_TEXTURE_COPY_DST : 0) |
((info->usage == TEXTURE_RENDER) ? GPU_TEXTURE_TRANSIENT : 0),
(transfer ? GPU_TEXTURE_COPY_SRC | GPU_TEXTURE_COPY_DST : 0),
.srgb = srgb,
.handle = info->handle,
.label = info->label,
Expand Down Expand Up @@ -7543,7 +7542,7 @@ static gpu_texture* getScratchTexture(Canvas* canvas, TextureFormat format, bool
.size = { canvas->width, canvas->height, canvas->views },
.mipmaps = 1,
.samples = canvas->samples,
.usage = GPU_TEXTURE_RENDER | GPU_TEXTURE_TRANSIENT
.usage = GPU_TEXTURE_RENDER
};

lovrAssert(gpu_texture_init(scratch->texture, &info), "Failed to create scratch texture");
Expand Down

0 comments on commit c4cda0a

Please sign in to comment.