[vulkan] Optionally include vertex shader in tex update

The particle renderer uses the palette texture in the vertex shader, so
updating the palette needs the vertex shader stage included in the
barrier, but I imagine not all texture updates will need it, so add a
parameter to Vulkan_UpdateTex to select inclusion.
This commit is contained in:
Bill Currie 2024-04-18 10:16:44 +09:00
parent b632d1dc52
commit 4e2d713400
3 changed files with 6 additions and 3 deletions

View file

@ -26,7 +26,7 @@ qfv_tex_t *Vulkan_LoadEnvSides (struct vulkan_ctx_s *ctx, tex_t **tex,
const char *name);
VkImageView Vulkan_TexImageView (qfv_tex_t *tex) __attribute__((pure));
void Vulkan_UpdateTex (struct vulkan_ctx_s *ctx, qfv_tex_t *tex, tex_t *src,
int x, int y, int layer, int mip);
int x, int y, int layer, int mip, bool vert);
void Vulkan_UnloadTex (struct vulkan_ctx_s *ctx, qfv_tex_t *tex);
void Vulkan_Texture_Init (struct vulkan_ctx_s *ctx);
VkDescriptorSet Vulkan_CreateCombinedImageSampler (struct vulkan_ctx_s *ctx,

View file

@ -60,7 +60,7 @@ Vulkan_Palette_Update (vulkan_ctx_t *ctx, const byte *palette)
.loaded = 1,
.data = (byte *) palette,
};
Vulkan_UpdateTex (ctx, pctx->palette, &tex, 0, 0, 0, 0);
Vulkan_UpdateTex (ctx, pctx->palette, &tex, 0, 0, 0, 0, true);
}
static void

View file

@ -413,7 +413,7 @@ Vulkan_TexImageView (qfv_tex_t *tex)
void
Vulkan_UpdateTex (vulkan_ctx_t *ctx, qfv_tex_t *tex, tex_t *src,
int x, int y, int layer, int mip)
int x, int y, int layer, int mip, bool vert)
{
qfv_device_t *device = ctx->device;
qfv_devfuncs_t *dfunc = device->funcs;
@ -451,6 +451,9 @@ Vulkan_UpdateTex (vulkan_ctx_t *ctx, qfv_tex_t *tex, tex_t *src,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
1, &copy);
ib = imageBarriers[qfv_LT_TransferDst_to_ShaderReadOnly];
if (vert) {
ib.dstStages |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT;
}
ib.barrier.image = tex->image;
ib.barrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS;
ib.barrier.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;