small code cleanup

This commit is contained in:
Denis Pauk 2020-01-26 21:49:28 +02:00 committed by Yamagi
parent 2add32b5a8
commit f508584067
5 changed files with 17 additions and 14 deletions

View file

@ -281,7 +281,6 @@ void QVk_CreateColorBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *col
void QVk_CreateTexture(qvktexture_t *texture, const unsigned char *data, uint32_t width, uint32_t height, qvksampler_t samplerType);
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);
void QVk_ReleaseTexture(qvktexture_t *texture);
void QVk_ReadPixels(uint8_t *dstBuffer, uint32_t width, uint32_t height);
VkResult QVk_BeginCommand(const VkCommandBuffer *commandBuffer);
void QVk_SubmitCommand(const VkCommandBuffer *commandBuffer, const VkQueue *queue);
@ -290,7 +289,6 @@ const char* QVk_GetError(VkResult errorCode);
VkResult QVk_BeginFrame(void);
VkResult QVk_EndFrame(qboolean force);
void QVk_BeginRenderpass(qvkrenderpasstype_t rpType);
void QVk_RecreateSwapchain(void);
VkResult QVk_CreateBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, const qvkbufferopts_t options);
void QVk_FreeBuffer(qvkbuffer_t *buffer);
VkResult QVk_CreateStagingBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags);
@ -301,12 +299,11 @@ qvkshader_t QVk_CreateShader(const uint32_t *shaderSrc, size_t shaderCodeSize, V
void QVk_CreatePipeline(const VkDescriptorSetLayout *descriptorLayout, const uint32_t desLayoutCount, const VkPipelineVertexInputStateCreateInfo *vertexInputInfo, qvkpipeline_t *pipeline, const qvkrenderpass_t *renderpass, const qvkshader_t *shaders, uint32_t shaderCount, VkPushConstantRange *pcRange);
void QVk_DestroyPipeline(qvkpipeline_t *pipeline);
uint8_t* QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSize *dstOffset);
uint8_t* QVk_GetIndexBuffer(VkDeviceSize size, VkDeviceSize *dstOffset);
uint8_t* QVk_GetUniformBuffer(VkDeviceSize size, uint32_t *dstOffset, VkDescriptorSet *dstUboDescriptorSet);
uint8_t* QVk_GetStagingBuffer(VkDeviceSize size, int alignment, VkCommandBuffer *cmdBuffer, VkBuffer *buffer, uint32_t *dstOffset);
VkBuffer QVk_GetTriangleFanIbo(VkDeviceSize indexCount);
void QVk_DrawColorRect(float *ubo, VkDeviceSize uboSize, qvkrenderpasstype_t rpType);
void QVk_DrawTexRect(float *ubo, VkDeviceSize uboSize, qvktexture_t *texture);
void QVk_DrawTexRect(const float *ubo, VkDeviceSize uboSize, qvktexture_t *texture);
void QVk_BindPipeline(qvkpipeline_t *pipeline);
void QVk_SubmitStagingBuffers(void);
// debug label related functions

View file

@ -236,8 +236,6 @@ void R_EndFrame( void );
void R_EndWorldRenderpass( void );
void R_SetPalette ( const unsigned char *palette);
int Draw_GetPalette (void);
void Vk_ResampleTexture (unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight);
struct image_s *R_RegisterSkin (char *name);

View file

@ -989,6 +989,7 @@ static int NextPow2(int v)
}
// internal helper
static uint8_t *QVk_GetIndexBuffer(VkDeviceSize size, VkDeviceSize *dstOffset);
static void RebuildTriangleFanIndexBuffer()
{
int idx = 0;
@ -2000,6 +2001,7 @@ void QVk_BeginRenderpass(qvkrenderpasstype_t rpType)
vkCmdBeginRenderPass(vk_commandbuffers[vk_activeBufferIdx], &renderBeginInfo[rpType], VK_SUBPASS_CONTENTS_INLINE);
}
#if 0
void QVk_RecreateSwapchain()
{
vkDeviceWaitIdle( vk_device.logical );
@ -2014,6 +2016,7 @@ void QVk_RecreateSwapchain()
VK_VERIFY(CreateImageViews());
VK_VERIFY(CreateFramebuffers());
}
#endif
uint8_t *QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSize *dstOffset)
{
@ -2054,7 +2057,7 @@ uint8_t *QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSiz
return (uint8_t *)vk_dynVertexBuffers[vk_activeDynBufferIdx].allocInfo.pMappedData + (*dstOffset);
}
uint8_t *QVk_GetIndexBuffer(VkDeviceSize size, VkDeviceSize *dstOffset)
static uint8_t *QVk_GetIndexBuffer(VkDeviceSize size, VkDeviceSize *dstOffset)
{
// align to 4 bytes, so that we can reuse the buffer for both VK_INDEX_TYPE_UINT16 and VK_INDEX_TYPE_UINT32
const int align_mod = size % 4;
@ -2264,7 +2267,7 @@ void QVk_DrawColorRect(float *ubo, VkDeviceSize uboSize, qvkrenderpasstype_t rpT
vkCmdDrawIndexed(vk_activeCmdbuffer, 6, 1, 0, 0, 0);
}
void QVk_DrawTexRect(float *ubo, VkDeviceSize uboSize, qvktexture_t *texture)
void QVk_DrawTexRect(const float *ubo, VkDeviceSize uboSize, qvktexture_t *texture)
{
uint32_t uboOffset;
VkDescriptorSet uboDescriptorSet;

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "header/vk_local.h"
image_t *draw_chars;
static image_t *draw_chars;
/*
===============
@ -35,6 +35,11 @@ void Draw_InitLocal (void)
// load console characters (don't bilerp characters)
qvksampler_t samplerType = S_NEAREST;
draw_chars = Vk_FindImage("pics/conchars.pcx", it_pic, &samplerType);
if (!draw_chars)
{
ri.Sys_Error(ERR_FATAL, "%s: Couldn't load pics/conchars.pcx", __func__);
}
}

View file

@ -444,7 +444,7 @@ void QVk_UpdateTextureData(qvktexture_t *texture, const unsigned char *data, uin
}
}
void QVk_ReleaseTexture(qvktexture_t *texture)
static void QVk_ReleaseTexture(qvktexture_t *texture)
{
QVk_SubmitStagingBuffers();
if (vk_device.logical != VK_NULL_HANDLE)
@ -595,7 +595,7 @@ byte scrap_texels[MAX_SCRAPS][BLOCK_WIDTH*BLOCK_HEIGHT];
qvktexture_t vk_scrapTextures[MAX_SCRAPS] = { QVVKTEXTURE_INIT };
// returns a texture number and the position inside it
int Scrap_AllocBlock (int w, int h, int *x, int *y)
static int Scrap_AllocBlock (int w, int h, int *x, int *y)
{
int i, j;
int best, best2;
@ -758,7 +758,7 @@ typedef struct _TargaHeader {
LoadTGA
=============
*/
void LoadTGA (char *name, byte **pic, int *width, int *height)
static void LoadTGA (char *name, byte **pic, int *width, int *height)
{
int columns, rows, numPixels;
byte *pixbuf;
@ -980,7 +980,7 @@ typedef struct
else if (pos[off] != 255) fdc = pos[off]; \
}
void R_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
static void R_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
{
byte fillcolor = *skin; // assume this is the pixel to fill
floodfill_t fifo[FLOODFILL_FIFO_SIZE];
@ -1615,7 +1615,7 @@ void Vk_FreeUnusedImages (void)
Draw_GetPalette
===============
*/
int Draw_GetPalette (void)
static int Draw_GetPalette (void)
{
int i;
int r, g, b;