Merge pull request #8 from 0lvin/master

Fix xatrix intro image
This commit is contained in:
Yamagi 2021-07-15 07:24:21 +02:00 committed by GitHub
commit 6a646d0e4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View file

@ -285,6 +285,7 @@ VkResult QVk_CreateImage(uint32_t width, uint32_t height, VkFormat format, VkIma
void QVk_CreateDepthBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *depthBuffer);
void QVk_CreateColorBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *colorBuffer, int extraFlags);
void QVk_CreateTexture(qvktexture_t *texture, const unsigned char *data, uint32_t width, uint32_t height, qvksampler_t samplerType, qboolean clampToEdge);
void QVk_ReleaseTexture(qvktexture_t *texture);
void QVk_UpdateTextureData(qvktexture_t *texture, const unsigned char *data, uint32_t offset_x, uint32_t offset_y, uint32_t width, uint32_t height);
VkSampler QVk_UpdateTextureSampler(qvktexture_t *texture, qvksampler_t samplerType, qboolean clampToEdge);
void QVk_ReadPixels(uint8_t *dstBuffer, const VkOffset2D *offset, const VkExtent2D *extent);

View file

@ -270,6 +270,8 @@ RE_Draw_StretchRaw
*/
extern unsigned r_rawpalette[256];
extern qvktexture_t vk_rawTexture;
static int vk_rawTexture_height;
static int vk_rawTexture_width;
void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data)
{
@ -333,12 +335,22 @@ void RE_Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *d
SmoothColorImage(raw_image32, scaled_size, (scaled_size) >> 7);
}
if (vk_rawTexture.resource.image != VK_NULL_HANDLE &&
(vk_rawTexture_width != cols || vk_rawTexture_height != rows))
{
QVk_ReleaseTexture(&vk_rawTexture);
QVVKTEXTURE_CLEAR(vk_rawTexture);
}
if (vk_rawTexture.resource.image != VK_NULL_HANDLE)
{
QVk_UpdateTextureData(&vk_rawTexture, (unsigned char*)raw_image32, 0, 0, cols, rows);
}
else
{
vk_rawTexture_width = cols;
vk_rawTexture_height = rows;
QVVKTEXTURE_CLEAR(vk_rawTexture);
QVk_CreateTexture(&vk_rawTexture, (unsigned char*)raw_image32, cols, rows,
vk_current_sampler, false);

View file

@ -476,7 +476,7 @@ void QVk_UpdateTextureData(qvktexture_t *texture, const unsigned char *data, uin
}
}
static void QVk_ReleaseTexture(qvktexture_t *texture)
void QVk_ReleaseTexture(qvktexture_t *texture)
{
QVk_SubmitStagingBuffers();
if (vk_device.logical != VK_NULL_HANDLE)
@ -584,7 +584,7 @@ void Vk_ImageList_f (void)
for (i = 0, image = vktextures; i < numvktextures; i++, image++)
{
char *in_use = "";
const char *in_use = "";
if (image->vk_texture.resource.image == VK_NULL_HANDLE)
continue;