mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 15:21:44 +00:00
Codestyle cleanup
This commit is contained in:
parent
b1bd71ec7e
commit
706b9a0721
8 changed files with 361 additions and 171 deletions
|
@ -16,8 +16,8 @@ See the GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __VK_LOCAL_H__
|
||||
#define __VK_LOCAL_H__
|
||||
|
||||
|
@ -227,7 +227,9 @@ qboolean R_EndWorldRenderReady( void );
|
|||
struct image_s *R_RegisterSkin (char *name);
|
||||
|
||||
void LoadPCX (char *filename, byte **pic, byte **palette, int *width, int *height);
|
||||
image_t *Vk_LoadPic (char *name, byte *pic, int width, int realwidth, int height, int realheight, imagetype_t type, int bits, qvksampler_t *samplerType);
|
||||
image_t *Vk_LoadPic(char *name, byte *pic, int width, int realwidth,
|
||||
int height, int realheight, imagetype_t type,
|
||||
int bits, qvksampler_t *samplerType);
|
||||
image_t *Vk_FindImage (char *name, imagetype_t type, qvksampler_t *samplerType);
|
||||
void Vk_TextureMode( char *string );
|
||||
void Vk_LmapTextureMode( char *string );
|
||||
|
|
|
@ -15,15 +15,16 @@ See the GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "header/local.h"
|
||||
|
||||
// internal helper
|
||||
static void copyBuffer(const VkBuffer *src, VkBuffer *dst, VkDeviceSize size)
|
||||
static void
|
||||
copyBuffer(const VkBuffer * src, VkBuffer * dst, VkDeviceSize size)
|
||||
{
|
||||
VkCommandBuffer commandBuffer = QVk_CreateCommandBuffer(&vk_transferCommandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
|
||||
VkCommandBuffer commandBuffer = QVk_CreateCommandBuffer(&vk_transferCommandPool,
|
||||
VK_COMMAND_BUFFER_LEVEL_PRIMARY);
|
||||
QVk_BeginCommand(&commandBuffer);
|
||||
|
||||
VkBufferCopy copyRegion = {
|
||||
|
@ -34,22 +35,29 @@ static void copyBuffer(const VkBuffer *src, VkBuffer *dst, VkDeviceSize size)
|
|||
vkCmdCopyBuffer(commandBuffer, *src, *dst, 1, ©Region);
|
||||
|
||||
QVk_SubmitCommand(&commandBuffer, &vk_device.transferQueue);
|
||||
vkFreeCommandBuffers(vk_device.logical, vk_transferCommandPool, 1, &commandBuffer);
|
||||
vkFreeCommandBuffers(vk_device.logical, vk_transferCommandPool, 1,
|
||||
&commandBuffer);
|
||||
}
|
||||
|
||||
// internal helper
|
||||
static void createStagedBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *dstBuffer, qvkbufferopts_t bufferOpts)
|
||||
static void
|
||||
createStagedBuffer(const void *data, VkDeviceSize size, qvkbuffer_t * dstBuffer,
|
||||
qvkbufferopts_t bufferOpts)
|
||||
{
|
||||
qvkstagingbuffer_t *stgBuffer;
|
||||
stgBuffer = (qvkstagingbuffer_t *)malloc(sizeof(qvkstagingbuffer_t));
|
||||
VK_VERIFY(QVk_CreateStagingBuffer(size, stgBuffer, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT));
|
||||
stgBuffer = (qvkstagingbuffer_t *) malloc(sizeof(qvkstagingbuffer_t));
|
||||
VK_VERIFY(QVk_CreateStagingBuffer(size, stgBuffer,
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
|
||||
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
||||
VK_MEMORY_PROPERTY_HOST_CACHED_BIT));
|
||||
|
||||
if (data)
|
||||
{
|
||||
void *dst;
|
||||
// staging buffers in vkQuake2 are required to be host coherent, so no flushing/invalidation is involved
|
||||
// staging buffers in vkQuake2 are required to be host coherent,
|
||||
// so no flushing/invalidation is involved
|
||||
dst = buffer_map(&stgBuffer->resource);
|
||||
memcpy(dst, data, (size_t)size);
|
||||
memcpy(dst, data, (size_t) size);
|
||||
buffer_unmap(&stgBuffer->resource);
|
||||
}
|
||||
|
||||
|
@ -60,7 +68,9 @@ static void createStagedBuffer(const void *data, VkDeviceSize size, qvkbuffer_t
|
|||
free(stgBuffer);
|
||||
}
|
||||
|
||||
VkResult QVk_CreateBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, const qvkbufferopts_t options)
|
||||
VkResult
|
||||
QVk_CreateBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer,
|
||||
const qvkbufferopts_t options)
|
||||
{
|
||||
VkBufferCreateInfo bcInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
|
@ -73,8 +83,13 @@ VkResult QVk_CreateBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, const qvkbu
|
|||
.pQueueFamilyIndices = NULL,
|
||||
};
|
||||
|
||||
// separate transfer queue makes sense only if the buffer is targetted for being transfered to GPU, so ignore it if it's CPU-only
|
||||
uint32_t queueFamilies[] = { (uint32_t)vk_device.gfxFamilyIndex, (uint32_t)vk_device.transferFamilyIndex };
|
||||
// separate transfer queue makes sense only if the buffer is targetted
|
||||
// for being transfered to GPU, so ignore it if it's CPU-only
|
||||
uint32_t queueFamilies[] = {
|
||||
(uint32_t)vk_device.gfxFamilyIndex,
|
||||
(uint32_t)vk_device.transferFamilyIndex
|
||||
};
|
||||
|
||||
if (vk_device.gfxFamilyIndex != vk_device.transferFamilyIndex)
|
||||
{
|
||||
bcInfo.sharingMode = VK_SHARING_MODE_CONCURRENT;
|
||||
|
@ -83,24 +98,30 @@ VkResult QVk_CreateBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, const qvkbu
|
|||
}
|
||||
|
||||
dstBuffer->currentOffset = 0;
|
||||
return buffer_create(&dstBuffer->resource, size, bcInfo, options.reqMemFlags, options.prefMemFlags);
|
||||
return buffer_create(&dstBuffer->resource, size, bcInfo,
|
||||
options.reqMemFlags, options.prefMemFlags);
|
||||
}
|
||||
|
||||
void QVk_FreeBuffer(qvkbuffer_t *buffer)
|
||||
void
|
||||
QVk_FreeBuffer(qvkbuffer_t *buffer)
|
||||
{
|
||||
buffer_destroy(&buffer->resource);
|
||||
buffer->resource.buffer = VK_NULL_HANDLE;
|
||||
buffer->currentOffset = 0;
|
||||
}
|
||||
|
||||
void QVk_FreeStagingBuffer(qvkstagingbuffer_t *buffer)
|
||||
void
|
||||
QVk_FreeStagingBuffer(qvkstagingbuffer_t *buffer)
|
||||
{
|
||||
buffer_destroy(&buffer->resource);
|
||||
buffer->resource.buffer = VK_NULL_HANDLE;
|
||||
buffer->currentOffset = 0;
|
||||
}
|
||||
|
||||
VkResult QVk_CreateStagingBuffer(VkDeviceSize size, qvkstagingbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
|
||||
VkResult
|
||||
QVk_CreateStagingBuffer(VkDeviceSize size, qvkstagingbuffer_t *dstBuffer,
|
||||
VkMemoryPropertyFlags reqMemFlags,
|
||||
VkMemoryPropertyFlags prefMemFlags)
|
||||
{
|
||||
VkBufferCreateInfo bcInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
|
@ -114,10 +135,14 @@ VkResult QVk_CreateStagingBuffer(VkDeviceSize size, qvkstagingbuffer_t *dstBuffe
|
|||
};
|
||||
|
||||
dstBuffer->currentOffset = 0;
|
||||
return buffer_create(&dstBuffer->resource, size, bcInfo, reqMemFlags, prefMemFlags);
|
||||
return buffer_create(&dstBuffer->resource, size, bcInfo, reqMemFlags,
|
||||
prefMemFlags);
|
||||
}
|
||||
|
||||
VkResult QVk_CreateUniformBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
|
||||
VkResult
|
||||
QVk_CreateUniformBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer,
|
||||
VkMemoryPropertyFlags reqMemFlags,
|
||||
VkMemoryPropertyFlags prefMemFlags)
|
||||
{
|
||||
qvkbufferopts_t dstOpts = {
|
||||
.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
|
||||
|
@ -128,10 +153,15 @@ VkResult QVk_CreateUniformBuffer(VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMe
|
|||
return QVk_CreateBuffer(size, dstBuffer, dstOpts);
|
||||
}
|
||||
|
||||
void QVk_CreateVertexBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
|
||||
void
|
||||
QVk_CreateVertexBuffer(const void *data, VkDeviceSize size,
|
||||
qvkbuffer_t *dstBuffer,
|
||||
VkMemoryPropertyFlags reqMemFlags,
|
||||
VkMemoryPropertyFlags prefMemFlags)
|
||||
{
|
||||
qvkbufferopts_t dstOpts = {
|
||||
.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
|
||||
.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT |
|
||||
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,
|
||||
.reqMemFlags = reqMemFlags,
|
||||
.prefMemFlags = prefMemFlags,
|
||||
};
|
||||
|
@ -139,7 +169,11 @@ void QVk_CreateVertexBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *ds
|
|||
createStagedBuffer(data, size, dstBuffer, dstOpts);
|
||||
}
|
||||
|
||||
void QVk_CreateIndexBuffer(const void *data, VkDeviceSize size, qvkbuffer_t *dstBuffer, VkMemoryPropertyFlags reqMemFlags, VkMemoryPropertyFlags prefMemFlags)
|
||||
void
|
||||
QVk_CreateIndexBuffer(const void *data, VkDeviceSize size,
|
||||
qvkbuffer_t *dstBuffer,
|
||||
VkMemoryPropertyFlags reqMemFlags,
|
||||
VkMemoryPropertyFlags prefMemFlags)
|
||||
{
|
||||
qvkbufferopts_t dstOpts = {
|
||||
.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
|
||||
|
|
|
@ -309,9 +309,12 @@ static VkResult CreateImageViews()
|
|||
|
||||
for (size_t i = 0; i < vk_swapchain.imageCount; ++i)
|
||||
{
|
||||
res = QVk_CreateImageView(&vk_swapchain.images[i], VK_IMAGE_ASPECT_COLOR_BIT, &vk_imageviews[i], vk_swapchain.format, 1);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_swapchain.images[i], VK_OBJECT_TYPE_IMAGE, va("Swap Chain Image #%ld", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_imageviews[i], VK_OBJECT_TYPE_IMAGE_VIEW, va("Swap Chain Image View #%ld", i));
|
||||
res = QVk_CreateImageView(&vk_swapchain.images[i],
|
||||
VK_IMAGE_ASPECT_COLOR_BIT, &vk_imageviews[i], vk_swapchain.format, 1);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_swapchain.images[i],
|
||||
VK_OBJECT_TYPE_IMAGE, va("Swap Chain Image #%ld", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_imageviews[i],
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW, va("Swap Chain Image View #%ld", i));
|
||||
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
|
@ -397,7 +400,9 @@ static VkResult CreateFramebuffers()
|
|||
for (int j = 0; j < RP_COUNT; ++j)
|
||||
{
|
||||
VkResult res = vkCreateFramebuffer(vk_device.logical, &fbCreateInfos[j], NULL, &vk_framebuffers[j][i]);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_framebuffers[j][i], VK_OBJECT_TYPE_FRAMEBUFFER, va("Framebuffer #%ld for Render Pass %s", i, j == RP_WORLD ? "RP_WORLD" : j == RP_UI ? "RP_UI" : "RP_WORLD_WARP"));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_framebuffers[j][i],
|
||||
VK_OBJECT_TYPE_FRAMEBUFFER, va("Framebuffer #%ld for Render Pass %s",
|
||||
i, j == RP_WORLD ? "RP_WORLD" : j == RP_UI ? "RP_UI" : "RP_WORLD_WARP"));
|
||||
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
|
@ -694,32 +699,52 @@ static VkResult CreateRenderpasses()
|
|||
// internal helper
|
||||
static void CreateDrawBuffers()
|
||||
{
|
||||
QVk_CreateDepthBuffer(vk_renderpasses[RP_WORLD].sampleCount, &vk_depthbuffer);
|
||||
QVk_CreateDepthBuffer(vk_renderpasses[RP_WORLD].sampleCount,
|
||||
&vk_depthbuffer);
|
||||
R_Printf(PRINT_ALL, "...created world depth buffer\n");
|
||||
QVk_CreateDepthBuffer(VK_SAMPLE_COUNT_1_BIT, &vk_ui_depthbuffer);
|
||||
R_Printf(PRINT_ALL, "...created UI depth buffer\n");
|
||||
QVk_CreateColorBuffer(VK_SAMPLE_COUNT_1_BIT, &vk_colorbuffer, VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||
QVk_CreateColorBuffer(VK_SAMPLE_COUNT_1_BIT, &vk_colorbuffer,
|
||||
VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||
R_Printf(PRINT_ALL, "...created world color buffer\n");
|
||||
QVk_CreateColorBuffer(VK_SAMPLE_COUNT_1_BIT, &vk_colorbufferWarp, VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||
QVk_CreateColorBuffer(VK_SAMPLE_COUNT_1_BIT, &vk_colorbufferWarp,
|
||||
VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||
R_Printf(PRINT_ALL, "...created world postpocess color buffer\n");
|
||||
QVk_CreateColorBuffer(vk_renderpasses[RP_WORLD].sampleCount, &vk_msaaColorbuffer, 0);
|
||||
R_Printf(PRINT_ALL, "...created MSAAx%d color buffer\n", vk_renderpasses[RP_WORLD].sampleCount);
|
||||
QVk_CreateColorBuffer(vk_renderpasses[RP_WORLD].sampleCount, &vk_msaaColorbuffer,
|
||||
0);
|
||||
R_Printf(PRINT_ALL, "...created MSAAx%d color buffer\n",
|
||||
vk_renderpasses[RP_WORLD].sampleCount);
|
||||
|
||||
QVk_DebugSetObjectName((uint64_t)vk_depthbuffer.resource.image, VK_OBJECT_TYPE_IMAGE, "Depth Buffer: World");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_depthbuffer.imageView, VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: World Depth Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_depthbuffer.resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: World Depth Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_ui_depthbuffer.resource.image, VK_OBJECT_TYPE_IMAGE, "Depth Buffer: UI");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_ui_depthbuffer.imageView, VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: UI Depth Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_ui_depthbuffer.resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: UI Depth Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbuffer.resource.image, VK_OBJECT_TYPE_IMAGE, "Color Buffer: World");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbuffer.imageView, VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: World Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbuffer.resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: World Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbufferWarp.resource.image, VK_OBJECT_TYPE_IMAGE, "Color Buffer: Warp Postprocess");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbufferWarp.imageView, VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: Warp Postprocess Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbufferWarp.resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: Warp Postprocess Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.resource.image, VK_OBJECT_TYPE_IMAGE, "Color Buffer: MSAA");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.imageView, VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: MSAA Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: MSAA Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_depthbuffer.resource.image,
|
||||
VK_OBJECT_TYPE_IMAGE, "Depth Buffer: World");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_depthbuffer.imageView,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: World Depth Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_depthbuffer.resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: World Depth Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_ui_depthbuffer.resource.image,
|
||||
VK_OBJECT_TYPE_IMAGE, "Depth Buffer: UI");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_ui_depthbuffer.imageView,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: UI Depth Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_ui_depthbuffer.resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: UI Depth Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbuffer.resource.image,
|
||||
VK_OBJECT_TYPE_IMAGE, "Color Buffer: World");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbuffer.imageView,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: World Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbuffer.resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: World Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbufferWarp.resource.image,
|
||||
VK_OBJECT_TYPE_IMAGE, "Color Buffer: Warp Postprocess");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbufferWarp.imageView,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: Warp Postprocess Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbufferWarp.resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: Warp Postprocess Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.resource.image,
|
||||
VK_OBJECT_TYPE_IMAGE, "Color Buffer: MSAA");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.imageView,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: MSAA Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: MSAA Color Buffer");
|
||||
}
|
||||
|
||||
// internal helper
|
||||
|
@ -928,9 +953,13 @@ static void CreateDynamicBuffers()
|
|||
{
|
||||
for (int i = 0; i < NUM_DYNBUFFERS; ++i)
|
||||
{
|
||||
QVk_CreateVertexBuffer(NULL, vk_config.vertex_buffer_size, &vk_dynVertexBuffers[i], VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
|
||||
QVk_CreateIndexBuffer(NULL, vk_config.index_buffer_size, &vk_dynIndexBuffers[i], VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
|
||||
VK_VERIFY(QVk_CreateUniformBuffer(vk_config.uniform_buffer_size, &vk_dynUniformBuffers[i], VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT));
|
||||
QVk_CreateVertexBuffer(NULL, vk_config.vertex_buffer_size, &vk_dynVertexBuffers[i],
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
|
||||
QVk_CreateIndexBuffer(NULL, vk_config.index_buffer_size, &vk_dynIndexBuffers[i],
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
|
||||
VK_VERIFY(QVk_CreateUniformBuffer(vk_config.uniform_buffer_size,
|
||||
&vk_dynUniformBuffers[i], VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT,
|
||||
VK_MEMORY_PROPERTY_HOST_CACHED_BIT));
|
||||
// keep dynamic buffers persistently mapped
|
||||
vk_dynVertexBuffers[i].pMappedData = buffer_map(&vk_dynVertexBuffers[i].resource);
|
||||
vk_dynIndexBuffers[i].pMappedData = buffer_map(&vk_dynIndexBuffers[i].resource);
|
||||
|
@ -938,13 +967,20 @@ static void CreateDynamicBuffers()
|
|||
// create descriptor set for the uniform buffer
|
||||
CreateUboDescriptorSet(&vk_uboDescriptorSets[i], vk_dynUniformBuffers[i].resource.buffer);
|
||||
|
||||
QVk_DebugSetObjectName((uint64_t)vk_uboDescriptorSets[i], VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Dynamic UBO Descriptor Set #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynVertexBuffers[i].resource.buffer, VK_OBJECT_TYPE_BUFFER, va("Dynamic Vertex Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynVertexBuffers[i].resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Vertex Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynIndexBuffers[i].resource.buffer, VK_OBJECT_TYPE_BUFFER, va("Dynamic Index Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynIndexBuffers[i].resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Index Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynUniformBuffers[i].resource.buffer, VK_OBJECT_TYPE_BUFFER, va("Dynamic Uniform Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynUniformBuffers[i].resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Uniform Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_uboDescriptorSets[i],
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Dynamic UBO Descriptor Set #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynVertexBuffers[i].resource.buffer,
|
||||
VK_OBJECT_TYPE_BUFFER, va("Dynamic Vertex Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynVertexBuffers[i].resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Vertex Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynIndexBuffers[i].resource.buffer,
|
||||
VK_OBJECT_TYPE_BUFFER, va("Dynamic Index Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynIndexBuffers[i].resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Index Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynUniformBuffers[i].resource.buffer,
|
||||
VK_OBJECT_TYPE_BUFFER, va("Dynamic Uniform Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynUniformBuffers[i].resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Uniform Buffer #%d", i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1024,8 +1060,10 @@ static void RebuildTriangleFanIndexBuffer()
|
|||
// internal helper
|
||||
static void CreateStagingBuffers()
|
||||
{
|
||||
VK_VERIFY(QVk_CreateCommandPool(&vk_stagingCommandPool, vk_device.gfxFamilyIndex));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_stagingCommandPool, VK_OBJECT_TYPE_COMMAND_POOL, "Command Pool: Staging Buffers");
|
||||
VK_VERIFY(QVk_CreateCommandPool(&vk_stagingCommandPool,
|
||||
vk_device.gfxFamilyIndex));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_stagingCommandPool,
|
||||
VK_OBJECT_TYPE_COMMAND_POOL, "Command Pool: Staging Buffers");
|
||||
|
||||
VkFenceCreateInfo fCreateInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
|
||||
|
@ -1034,19 +1072,28 @@ static void CreateStagingBuffers()
|
|||
|
||||
for (int i = 0; i < NUM_DYNBUFFERS; ++i)
|
||||
{
|
||||
VK_VERIFY(QVk_CreateStagingBuffer(STAGING_BUFFER_MAXSIZE, &vk_stagingBuffers[i], VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT));
|
||||
VK_VERIFY(QVk_CreateStagingBuffer(STAGING_BUFFER_MAXSIZE,
|
||||
&vk_stagingBuffers[i],
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
||||
VK_MEMORY_PROPERTY_HOST_CACHED_BIT));
|
||||
vk_stagingBuffers[i].pMappedData = buffer_map(&vk_stagingBuffers[i].resource);
|
||||
vk_stagingBuffers[i].submitted = false;
|
||||
|
||||
VK_VERIFY(vkCreateFence(vk_device.logical, &fCreateInfo, NULL, &vk_stagingBuffers[i].fence));
|
||||
VK_VERIFY(vkCreateFence(vk_device.logical, &fCreateInfo,
|
||||
NULL, &vk_stagingBuffers[i].fence));
|
||||
|
||||
vk_stagingBuffers[i].cmdBuffer = QVk_CreateCommandBuffer(&vk_stagingCommandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
|
||||
vk_stagingBuffers[i].cmdBuffer = QVk_CreateCommandBuffer(&vk_stagingCommandPool,
|
||||
VK_COMMAND_BUFFER_LEVEL_PRIMARY);
|
||||
VK_VERIFY(QVk_BeginCommand(&vk_stagingBuffers[i].cmdBuffer));
|
||||
|
||||
QVk_DebugSetObjectName((uint64_t)vk_stagingBuffers[i].fence, VK_OBJECT_TYPE_FENCE, va("Fence: Staging Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_stagingBuffers[i].resource.buffer, VK_OBJECT_TYPE_BUFFER, va("Staging Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_stagingBuffers[i].resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Staging Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_stagingBuffers[i].cmdBuffer, VK_OBJECT_TYPE_COMMAND_BUFFER, va("Command Buffer: Staging Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_stagingBuffers[i].fence,
|
||||
VK_OBJECT_TYPE_FENCE, va("Fence: Staging Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_stagingBuffers[i].resource.buffer,
|
||||
VK_OBJECT_TYPE_BUFFER, va("Staging Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_stagingBuffers[i].resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Staging Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_stagingBuffers[i].cmdBuffer,
|
||||
VK_OBJECT_TYPE_COMMAND_BUFFER, va("Command Buffer: Staging Buffer #%d", i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1095,16 +1142,25 @@ static void CreateStaticBuffers()
|
|||
|
||||
const uint32_t indices[] = { 0, 1, 2, 0, 3, 1 };
|
||||
|
||||
QVk_CreateVertexBuffer(texVerts, sizeof(texVerts), &vk_texRectVbo, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0);
|
||||
QVk_CreateVertexBuffer(colorVerts, sizeof(colorVerts), &vk_colorRectVbo, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0);
|
||||
QVk_CreateIndexBuffer(indices, sizeof(indices), &vk_rectIbo, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0);
|
||||
QVk_CreateVertexBuffer(texVerts, sizeof(texVerts),
|
||||
&vk_texRectVbo, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0);
|
||||
QVk_CreateVertexBuffer(colorVerts, sizeof(colorVerts),
|
||||
&vk_colorRectVbo, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0);
|
||||
QVk_CreateIndexBuffer(indices, sizeof(indices),
|
||||
&vk_rectIbo, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0);
|
||||
|
||||
QVk_DebugSetObjectName((uint64_t)vk_texRectVbo.resource.buffer, VK_OBJECT_TYPE_BUFFER, "Static Buffer: Textured Rectangle VBO");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_texRectVbo.resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: Textured Rectangle VBO");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorRectVbo.resource.buffer, VK_OBJECT_TYPE_BUFFER, "Static Buffer: Colored Rectangle VBO");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorRectVbo.resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: Colored Rectangle VBO");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rectIbo.resource.buffer, VK_OBJECT_TYPE_BUFFER, "Static Buffer: Rectangle IBO");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rectIbo.resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: Rectangle IBO");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_texRectVbo.resource.buffer,
|
||||
VK_OBJECT_TYPE_BUFFER, "Static Buffer: Textured Rectangle VBO");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_texRectVbo.resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: Textured Rectangle VBO");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorRectVbo.resource.buffer,
|
||||
VK_OBJECT_TYPE_BUFFER, "Static Buffer: Colored Rectangle VBO");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorRectVbo.resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: Colored Rectangle VBO");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rectIbo.resource.buffer,
|
||||
VK_OBJECT_TYPE_BUFFER, "Static Buffer: Rectangle IBO");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rectIbo.resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: Rectangle IBO");
|
||||
}
|
||||
|
||||
// internal helper
|
||||
|
@ -1665,9 +1721,12 @@ qboolean QVk_Init(SDL_Window *window)
|
|||
VK_VERIFY(vkCreateSemaphore(vk_device.logical, &sCreateInfo, NULL, &vk_imageAvailableSemaphores[i]));
|
||||
VK_VERIFY(vkCreateSemaphore(vk_device.logical, &sCreateInfo, NULL, &vk_renderFinishedSemaphores[i]));
|
||||
|
||||
QVk_DebugSetObjectName((uint64_t)vk_fences[i], VK_OBJECT_TYPE_FENCE, va("Fence #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_imageAvailableSemaphores[i], VK_OBJECT_TYPE_SEMAPHORE, va("Semaphore: image available #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_renderFinishedSemaphores[i], VK_OBJECT_TYPE_SEMAPHORE, va("Semaphore: render finished #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_fences[i],
|
||||
VK_OBJECT_TYPE_FENCE, va("Fence #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_imageAvailableSemaphores[i],
|
||||
VK_OBJECT_TYPE_SEMAPHORE, va("Semaphore: image available #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_renderFinishedSemaphores[i],
|
||||
VK_OBJECT_TYPE_SEMAPHORE, va("Semaphore: render finished #%d", i));
|
||||
}
|
||||
R_Printf(PRINT_ALL, "...created synchronization objects\n");
|
||||
|
||||
|
@ -1713,8 +1772,10 @@ qboolean QVk_Init(SDL_Window *window)
|
|||
return false;
|
||||
}
|
||||
|
||||
QVk_DebugSetObjectName((uint64_t)vk_commandPool, VK_OBJECT_TYPE_COMMAND_POOL, "Command Pool: Graphics");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_transferCommandPool, VK_OBJECT_TYPE_COMMAND_POOL, "Command Pool: Transfer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_commandPool,
|
||||
VK_OBJECT_TYPE_COMMAND_POOL, "Command Pool: Graphics");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_transferCommandPool,
|
||||
VK_OBJECT_TYPE_COMMAND_POOL, "Command Pool: Transfer");
|
||||
R_Printf(PRINT_ALL, "...created Vulkan command pools\n");
|
||||
|
||||
// setup draw buffers
|
||||
|
@ -1789,8 +1850,10 @@ qboolean QVk_Init(SDL_Window *window)
|
|||
VK_VERIFY(vkAllocateDescriptorSets(vk_device.logical, &dsAllocInfo, &vk_colorbufferWarp.descriptorSet));
|
||||
QVk_UpdateTextureSampler(&vk_colorbufferWarp, S_NEAREST);
|
||||
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbuffer.descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET, "Descriptor Set: World Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbufferWarp.descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET, "Descriptor Set: Warp Postprocess Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbuffer.descriptorSet,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET, "Descriptor Set: World Color Buffer");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_colorbufferWarp.descriptorSet,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET, "Descriptor Set: Warp Postprocess Color Buffer");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2012,11 +2075,14 @@ uint8_t *QVk_GetVertexBuffer(VkDeviceSize size, VkBuffer *dstBuffer, VkDeviceSiz
|
|||
vk_swapBuffers[vk_activeSwapBufferIdx][swapBufferOffset + i] = vk_dynVertexBuffers[i];
|
||||
buffer_unmap(&vk_dynVertexBuffers[i].resource);
|
||||
|
||||
QVk_CreateVertexBuffer(NULL, vk_config.vertex_buffer_size, &vk_dynVertexBuffers[i], VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
|
||||
QVk_CreateVertexBuffer(NULL, vk_config.vertex_buffer_size,
|
||||
&vk_dynVertexBuffers[i], VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
|
||||
vk_dynVertexBuffers[i].pMappedData = buffer_map(&vk_dynVertexBuffers[i].resource);
|
||||
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynVertexBuffers[i].resource.buffer, VK_OBJECT_TYPE_BUFFER, va("Dynamic Vertex Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynVertexBuffers[i].resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Vertex Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynVertexBuffers[i].resource.buffer,
|
||||
VK_OBJECT_TYPE_BUFFER, va("Dynamic Vertex Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynVertexBuffers[i].resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Vertex Buffer #%d", i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2055,11 +2121,14 @@ static uint8_t *QVk_GetIndexBuffer(VkDeviceSize size, VkDeviceSize *dstOffset)
|
|||
vk_swapBuffers[vk_activeSwapBufferIdx][swapBufferOffset + i] = vk_dynIndexBuffers[i];
|
||||
buffer_unmap(&vk_dynIndexBuffers[i].resource);
|
||||
|
||||
QVk_CreateIndexBuffer(NULL, vk_config.index_buffer_size, &vk_dynIndexBuffers[i], VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
|
||||
QVk_CreateIndexBuffer(NULL, vk_config.index_buffer_size,
|
||||
&vk_dynIndexBuffers[i], VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
|
||||
vk_dynIndexBuffers[i].pMappedData = buffer_map(&vk_dynIndexBuffers[i].resource);
|
||||
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynIndexBuffers[i].resource.buffer, VK_OBJECT_TYPE_BUFFER, va("Dynamic Index Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynIndexBuffers[i].resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Index Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynIndexBuffers[i].resource.buffer,
|
||||
VK_OBJECT_TYPE_BUFFER, va("Dynamic Index Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynIndexBuffers[i].resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Index Buffer #%d", i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2105,13 +2174,18 @@ uint8_t *QVk_GetUniformBuffer(VkDeviceSize size, uint32_t *dstOffset, VkDescript
|
|||
vk_swapDescriptorSets[vk_activeSwapBufferIdx][swapDescSetsOffset + i] = vk_uboDescriptorSets[i];
|
||||
buffer_unmap(&vk_dynUniformBuffers[i].resource);
|
||||
|
||||
VK_VERIFY(QVk_CreateUniformBuffer(vk_config.uniform_buffer_size, &vk_dynUniformBuffers[i], VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT));
|
||||
VK_VERIFY(QVk_CreateUniformBuffer(vk_config.uniform_buffer_size,
|
||||
&vk_dynUniformBuffers[i], VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT));
|
||||
vk_dynUniformBuffers[i].pMappedData = buffer_map(&vk_dynUniformBuffers[i].resource);
|
||||
CreateUboDescriptorSet(&vk_uboDescriptorSets[i], vk_dynUniformBuffers[i].resource.buffer);
|
||||
CreateUboDescriptorSet(&vk_uboDescriptorSets[i],
|
||||
vk_dynUniformBuffers[i].resource.buffer);
|
||||
|
||||
QVk_DebugSetObjectName((uint64_t)vk_uboDescriptorSets[i], VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Dynamic UBO Descriptor Set #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynUniformBuffers[i].resource.buffer, VK_OBJECT_TYPE_BUFFER, va("Dynamic Uniform Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynUniformBuffers[i].resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Uniform Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_uboDescriptorSets[i],
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Dynamic UBO Descriptor Set #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynUniformBuffers[i].resource.buffer,
|
||||
VK_OBJECT_TYPE_BUFFER, va("Dynamic Uniform Buffer #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_dynUniformBuffers[i].resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: Dynamic Uniform Buffer #%d", i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2230,14 +2304,18 @@ void QVk_DrawColorRect(float *ubo, VkDeviceSize uboSize, qvkrenderpasstype_t rpT
|
|||
{
|
||||
uint32_t uboOffset;
|
||||
VkDescriptorSet uboDescriptorSet;
|
||||
uint8_t *vertData = QVk_GetUniformBuffer(uboSize, &uboOffset, &uboDescriptorSet);
|
||||
uint8_t *vertData = QVk_GetUniformBuffer(uboSize,
|
||||
&uboOffset, &uboDescriptorSet);
|
||||
memcpy(vertData, ubo, uboSize);
|
||||
|
||||
QVk_BindPipeline(&vk_drawColorQuadPipeline[rpType]);
|
||||
VkDeviceSize offsets = 0;
|
||||
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawColorQuadPipeline[rpType].layout, 0, 1, &uboDescriptorSet, 1, &uboOffset);
|
||||
vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1, &vk_colorRectVbo.resource.buffer, &offsets);
|
||||
vkCmdBindIndexBuffer(vk_activeCmdbuffer, vk_rectIbo.resource.buffer, 0, VK_INDEX_TYPE_UINT32);
|
||||
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
vk_drawColorQuadPipeline[rpType].layout, 0, 1, &uboDescriptorSet, 1, &uboOffset);
|
||||
vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1,
|
||||
&vk_colorRectVbo.resource.buffer, &offsets);
|
||||
vkCmdBindIndexBuffer(vk_activeCmdbuffer, vk_rectIbo.resource.buffer,
|
||||
0, VK_INDEX_TYPE_UINT32);
|
||||
vkCmdDrawIndexed(vk_activeCmdbuffer, 6, 1, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -2252,8 +2330,10 @@ void QVk_DrawTexRect(const float *ubo, VkDeviceSize uboSize, qvktexture_t *textu
|
|||
VkDeviceSize offsets = 0;
|
||||
VkDescriptorSet descriptorSets[] = { texture->descriptorSet, uboDescriptorSet };
|
||||
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawTexQuadPipeline.layout, 0, 2, descriptorSets, 1, &uboOffset);
|
||||
vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1, &vk_texRectVbo.resource.buffer, &offsets);
|
||||
vkCmdBindIndexBuffer(vk_activeCmdbuffer, vk_rectIbo.resource.buffer, 0, VK_INDEX_TYPE_UINT32);
|
||||
vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1,
|
||||
&vk_texRectVbo.resource.buffer, &offsets);
|
||||
vkCmdBindIndexBuffer(vk_activeCmdbuffer,
|
||||
vk_rectIbo.resource.buffer, 0, VK_INDEX_TYPE_UINT32);
|
||||
vkCmdDrawIndexed(vk_activeCmdbuffer, 6, 1, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ See the GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "header/local.h"
|
||||
|
@ -300,7 +299,8 @@ void QVk_DebugSetObjectName(uint64_t obj, VkObjectType objType, const char *objN
|
|||
#endif
|
||||
}
|
||||
|
||||
void QVk_DebugSetObjectTag(uint64_t obj, VkObjectType objType, uint64_t tagName, size_t tagSize, const void *tagData)
|
||||
void QVk_DebugSetObjectTag(uint64_t obj, VkObjectType objType, uint64_t tagName,
|
||||
size_t tagSize, const void *tagData)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
VkDebugUtilsObjectTagInfoEXT oTagInf = {
|
||||
|
|
|
@ -16,7 +16,6 @@ See the GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
// vk_draw.c
|
||||
|
@ -318,11 +317,16 @@ void Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data
|
|||
else
|
||||
{
|
||||
QVVKTEXTURE_CLEAR(vk_rawTexture);
|
||||
QVk_CreateTexture(&vk_rawTexture, (unsigned char*)&image32, 256, 256, vk_current_sampler);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.resource.image, VK_OBJECT_TYPE_IMAGE, "Image: raw texture");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.imageView, VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: raw texture");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET, "Descriptor Set: raw texture");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: raw texture");
|
||||
QVk_CreateTexture(&vk_rawTexture, (unsigned char*)&image32, 256, 256,
|
||||
vk_current_sampler);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.resource.image,
|
||||
VK_OBJECT_TYPE_IMAGE, "Image: raw texture");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.imageView,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: raw texture");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.descriptorSet,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET, "Descriptor Set: raw texture");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_rawTexture.resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: raw texture");
|
||||
}
|
||||
|
||||
float imgTransform[] = { (float)x / vid.width, (float)y / vid.height,
|
||||
|
|
|
@ -16,7 +16,6 @@ See the GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "header/local.h"
|
||||
|
@ -937,7 +936,7 @@ IMAGE FLOOD FILLING
|
|||
|
||||
/*
|
||||
=================
|
||||
FloodFillSkin
|
||||
Mod_FloodFillSkin
|
||||
|
||||
Fill background pixels so mipmapping doesn't have haloes
|
||||
=================
|
||||
|
@ -1079,7 +1078,8 @@ Vk_Upload32
|
|||
Returns number of mip levels
|
||||
===============
|
||||
*/
|
||||
static uint32_t Vk_Upload32 (byte *data, int width, int height, qboolean mipmap, byte **texBuffer, int *upload_width, int *upload_height)
|
||||
static uint32_t Vk_Upload32 (byte *data, int width, int height, qboolean mipmap,
|
||||
byte **texBuffer, int *upload_width, int *upload_height)
|
||||
{
|
||||
int scaled_width, scaled_height;
|
||||
|
||||
|
@ -1159,7 +1159,8 @@ Returns number of mip levels
|
|||
===============
|
||||
*/
|
||||
|
||||
static uint32_t Vk_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean is_sky, byte **texBuffer, int *upload_width, int *upload_height)
|
||||
static uint32_t Vk_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean is_sky,
|
||||
byte **texBuffer, int *upload_width, int *upload_height)
|
||||
{
|
||||
unsigned *trans;
|
||||
int i, s;
|
||||
|
@ -1212,7 +1213,9 @@ This is also used as an entry point for the generated r_notexture
|
|||
================
|
||||
*/
|
||||
image_t *
|
||||
Vk_LoadPic(char *name, byte *pic, int width, int realwidth, int height, int realheight, imagetype_t type, int bits, qvksampler_t *samplerType)
|
||||
Vk_LoadPic(char *name, byte *pic, int width, int realwidth,
|
||||
int height, int realheight, imagetype_t type,
|
||||
int bits, qvksampler_t *samplerType)
|
||||
{
|
||||
image_t *image;
|
||||
int i;
|
||||
|
@ -1282,11 +1285,17 @@ Vk_LoadPic(char *name, byte *pic, int width, int realwidth, int height, int real
|
|||
else
|
||||
{
|
||||
QVVKTEXTURE_CLEAR(vk_scrapTextures[texnum]);
|
||||
QVk_CreateTexture(&vk_scrapTextures[texnum], texBuffer, image->upload_width, image->upload_height, samplerType ? *samplerType : vk_current_sampler);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].resource.image, VK_OBJECT_TYPE_IMAGE, va("Image: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].imageView, VK_OBJECT_TYPE_IMAGE_VIEW, va("Image View: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Descriptor Set: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: scrap texture");
|
||||
QVk_CreateTexture(&vk_scrapTextures[texnum], texBuffer,
|
||||
image->upload_width, image->upload_height,
|
||||
samplerType ? *samplerType : vk_current_sampler);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].resource.image,
|
||||
VK_OBJECT_TYPE_IMAGE, va("Image: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].imageView,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW, va("Image View: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].descriptorSet,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Descriptor Set: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_scrapTextures[texnum].resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: scrap texture");
|
||||
}
|
||||
|
||||
image->vk_texture = vk_scrapTextures[texnum];
|
||||
|
@ -1307,11 +1316,17 @@ Vk_LoadPic(char *name, byte *pic, int width, int realwidth, int height, int real
|
|||
image->tl = 0;
|
||||
image->th = 1;
|
||||
|
||||
QVk_CreateTexture(&image->vk_texture, (unsigned char*)texBuffer, image->upload_width, image->upload_height, samplerType ? *samplerType : vk_current_sampler);
|
||||
QVk_DebugSetObjectName((uint64_t)image->vk_texture.resource.image, VK_OBJECT_TYPE_IMAGE, va("Image: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)image->vk_texture.imageView, VK_OBJECT_TYPE_IMAGE_VIEW, va("Image View: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)image->vk_texture.descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Descriptor Set: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)image->vk_texture.resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: game textures");
|
||||
QVk_CreateTexture(&image->vk_texture, (unsigned char*)texBuffer,
|
||||
image->upload_width, image->upload_height,
|
||||
samplerType ? *samplerType : vk_current_sampler);
|
||||
QVk_DebugSetObjectName((uint64_t)image->vk_texture.resource.image,
|
||||
VK_OBJECT_TYPE_IMAGE, va("Image: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)image->vk_texture.imageView,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW, va("Image View: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)image->vk_texture.descriptorSet,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Descriptor Set: %s", name));
|
||||
QVk_DebugSetObjectName((uint64_t)image->vk_texture.resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: game textures");
|
||||
}
|
||||
if (texBuffer)
|
||||
{
|
||||
|
@ -1343,7 +1358,10 @@ static image_t *Vk_LoadWal (char *name)
|
|||
height = LittleLong (mt->height);
|
||||
ofs = LittleLong (mt->offsets[0]);
|
||||
|
||||
image = Vk_LoadPic (name, (byte *)mt + ofs, width, width, height, height, it_wall, 8, NULL);
|
||||
image = Vk_LoadPic(name, (byte *)mt + ofs,
|
||||
width, width,
|
||||
height, height,
|
||||
it_wall, 8, NULL);
|
||||
|
||||
ri.FS_FreeFile ((void *)mt);
|
||||
|
||||
|
@ -1382,7 +1400,10 @@ Vk_LoadHiColorImage(char *name, const char* namewe, const char *ext, imagetype_t
|
|||
realwidth = width;
|
||||
}
|
||||
|
||||
image = Vk_LoadPic (name, pic, width, realwidth, height, realheight, type, 32, samplerType);
|
||||
image = Vk_LoadPic(name, pic,
|
||||
width, realwidth,
|
||||
height, realheight,
|
||||
type, 32, samplerType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1422,7 +1443,10 @@ Vk_LoadImage(char *name, const char* namewe, const char *ext, imagetype_t type,
|
|||
LoadPCX (name, &pic, &palette, &width, &height);
|
||||
if (!pic)
|
||||
return NULL;
|
||||
image = Vk_LoadPic (name, pic, width, width, height, height, type, 8, samplerType);
|
||||
image = Vk_LoadPic(name, pic,
|
||||
width, width,
|
||||
height, height,
|
||||
type, 8, samplerType);
|
||||
|
||||
if (palette)
|
||||
free(palette);
|
||||
|
@ -1436,7 +1460,10 @@ Vk_LoadImage(char *name, const char* namewe, const char *ext, imagetype_t type,
|
|||
LoadTGA (name, &pic, &width, &height);
|
||||
if (!pic)
|
||||
return NULL;
|
||||
image = Vk_LoadPic(name, pic, width, width, height, height, type, 32, samplerType);
|
||||
image = Vk_LoadPic(name, pic,
|
||||
width, width,
|
||||
height, height,
|
||||
type, 32, samplerType);
|
||||
}
|
||||
|
||||
if (pic)
|
||||
|
|
|
@ -16,8 +16,8 @@ See the GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
// vk_misc.c
|
||||
|
||||
#include "header/local.h"
|
||||
|
@ -57,7 +57,8 @@ void R_InitParticleTexture (void)
|
|||
data[y][x][3] = dottexture[x][y]*255;
|
||||
}
|
||||
}
|
||||
r_particletexture = Vk_LoadPic ("***particle***", (byte *)data, 8, 8, 8, 8, it_sprite, 32, NULL);
|
||||
r_particletexture = Vk_LoadPic("***particle***", (byte *)data,
|
||||
8, 8, 8, 8, it_sprite, 32, NULL);
|
||||
|
||||
//
|
||||
// also use this for bad textures, but without alpha
|
||||
|
@ -72,7 +73,8 @@ void R_InitParticleTexture (void)
|
|||
data[y][x][3] = 255;
|
||||
}
|
||||
}
|
||||
r_notexture = Vk_LoadPic ("***r_notexture***", (byte *)data, 8, 8, 8, 8, it_wall, 32, NULL);
|
||||
r_notexture = Vk_LoadPic("***r_notexture***", (byte *)data,
|
||||
8, 8, 8, 8, it_wall, 32, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,7 +102,8 @@ void Vk_ScreenShot_f (void)
|
|||
QVk_ReadPixels(buffer, vid.width, vid.height);
|
||||
|
||||
// swap rgb to bgr
|
||||
if (vk_swapchain.format == VK_FORMAT_R8G8B8A8_UNORM || vk_swapchain.format == VK_FORMAT_R8G8B8A8_SRGB)
|
||||
if (vk_swapchain.format == VK_FORMAT_R8G8B8A8_UNORM ||
|
||||
vk_swapchain.format == VK_FORMAT_R8G8B8A8_SRGB)
|
||||
{
|
||||
for (i = 0; i < buffSize; i += 4)
|
||||
{
|
||||
|
@ -156,44 +159,69 @@ void Vk_Strings_f(void)
|
|||
VK_VERIFY(vkEnumeratePhysicalDevices(vk_instance, &numDevices, NULL));
|
||||
VK_VERIFY(vkEnumeratePhysicalDevices(vk_instance, &numDevices, physicalDevices));
|
||||
|
||||
if (preferredDevice >= numDevices) preferredDevice = -1;
|
||||
if (preferredDevice >= numDevices)
|
||||
{
|
||||
preferredDevice = -1;
|
||||
}
|
||||
|
||||
R_Printf(PRINT_ALL, "------------------------------------\n");
|
||||
R_Printf(PRINT_ALL, "Vulkan API: %d.%d\n", VK_VERSION_MAJOR(vk_config.vk_version),
|
||||
VK_VERSION_MINOR(vk_config.vk_version));
|
||||
VK_VERSION_MINOR(vk_config.vk_version));
|
||||
R_Printf(PRINT_ALL, "Header version: %d\n", VK_HEADER_VERSION);
|
||||
R_Printf(PRINT_ALL, "Devices found:\n");
|
||||
for (i = 0; i < numDevices; ++i)
|
||||
{
|
||||
vkGetPhysicalDeviceProperties(physicalDevices[i], &deviceProperties);
|
||||
isPreferred = (preferredDevice == i) || (preferredDevice < 0 && deviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU);
|
||||
if (isPreferred) usedDevice = i;
|
||||
R_Printf(PRINT_ALL, "%s#%d: %s\n", isPreferred && numDevices > 1 ? "* " : " ", i, deviceProperties.deviceName);
|
||||
isPreferred = (preferredDevice == i) || (
|
||||
preferredDevice < 0 &&
|
||||
deviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
|
||||
);
|
||||
if (isPreferred) {
|
||||
usedDevice = i;
|
||||
}
|
||||
R_Printf(PRINT_ALL, "%s#%d: %s\n",
|
||||
isPreferred && numDevices > 1 ? "* " : " ",
|
||||
i, deviceProperties.deviceName);
|
||||
}
|
||||
R_Printf(PRINT_ALL, "Using device #%d:\n", usedDevice);
|
||||
R_Printf(PRINT_ALL, " deviceName: %s\n", vk_device.properties.deviceName);
|
||||
R_Printf(PRINT_ALL, " resolution: %dx%d", vid.width, vid.height);
|
||||
if (msaa > 0)
|
||||
{
|
||||
R_Printf(PRINT_ALL, " (MSAAx%d)\n", 2 << (msaa - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
R_Printf(PRINT_ALL, "\n");
|
||||
}
|
||||
#ifndef __linux__
|
||||
// Intel on Windows and MacOS (Linux uses semver for Mesa drivers)
|
||||
if (vk_device.properties.vendorID == 0x8086)
|
||||
R_Printf(PRINT_ALL, " driverVersion: %d (0x%X)\n", vk_device.properties.driverVersion, vk_device.properties.driverVersion);
|
||||
{
|
||||
R_Printf(PRINT_ALL, " driverVersion: %d (0x%X)\n",
|
||||
vk_device.properties.driverVersion,
|
||||
vk_device.properties.driverVersion);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
R_Printf(PRINT_ALL, " driverVersion: %d.%d.%d (0x%X)\n", driverMajor, driverMinor, driverPatch, vk_device.properties.driverVersion);
|
||||
{
|
||||
R_Printf(PRINT_ALL, " driverVersion: %d.%d.%d (0x%X)\n",
|
||||
driverMajor, driverMinor, driverPatch,
|
||||
vk_device.properties.driverVersion);
|
||||
}
|
||||
|
||||
R_Printf(PRINT_ALL, " apiVersion: %d.%d.%d\n", VK_VERSION_MAJOR(vk_device.properties.apiVersion),
|
||||
VK_VERSION_MINOR(vk_device.properties.apiVersion),
|
||||
VK_VERSION_PATCH(vk_device.properties.apiVersion));
|
||||
R_Printf(PRINT_ALL, " apiVersion: %d.%d.%d\n",
|
||||
VK_VERSION_MAJOR(vk_device.properties.apiVersion),
|
||||
VK_VERSION_MINOR(vk_device.properties.apiVersion),
|
||||
VK_VERSION_PATCH(vk_device.properties.apiVersion));
|
||||
R_Printf(PRINT_ALL, " deviceID: %d\n", vk_device.properties.deviceID);
|
||||
R_Printf(PRINT_ALL, " vendorID: 0x%X (%s)\n", vk_device.properties.vendorID, vk_config.vendor_name);
|
||||
R_Printf(PRINT_ALL, " vendorID: 0x%X (%s)\n",
|
||||
vk_device.properties.vendorID, vk_config.vendor_name);
|
||||
R_Printf(PRINT_ALL, " deviceType: %s\n", vk_config.device_type);
|
||||
R_Printf(PRINT_ALL, " gfx/present/transfer: %d/%d/%d\n", vk_device.gfxFamilyIndex,
|
||||
vk_device.presentFamilyIndex,
|
||||
vk_device.transferFamilyIndex);
|
||||
R_Printf(PRINT_ALL, " gfx/present/transfer: %d/%d/%d\n",
|
||||
vk_device.gfxFamilyIndex,
|
||||
vk_device.presentFamilyIndex,
|
||||
vk_device.transferFamilyIndex);
|
||||
R_Printf(PRINT_ALL, "Present mode: %s\n", vk_config.present_mode);
|
||||
R_Printf(PRINT_ALL, "Swapchain image format: %d\n", vk_swapchain.format);
|
||||
R_Printf(PRINT_ALL, "Supported present modes: ");
|
||||
|
@ -226,20 +254,25 @@ void Vk_Strings_f(void)
|
|||
void Vk_Mem_f(void)
|
||||
{
|
||||
R_Printf(PRINT_ALL, "\nDynamic buffer stats: \n");
|
||||
R_Printf(PRINT_ALL, "Vertex : %u/%ukB (%.1f%% max: %ukB)\n", vk_config.vertex_buffer_usage / 1024,
|
||||
vk_config.vertex_buffer_size / 1024,
|
||||
100.f * vk_config.vertex_buffer_usage / vk_config.vertex_buffer_size,
|
||||
vk_config.vertex_buffer_max_usage / 1024);
|
||||
R_Printf(PRINT_ALL, "Index : %u/%uB (%.1f%% max: %uB)\n", vk_config.index_buffer_usage,
|
||||
vk_config.index_buffer_size,
|
||||
100.f * vk_config.index_buffer_usage / vk_config.index_buffer_size,
|
||||
vk_config.index_buffer_max_usage);
|
||||
R_Printf(PRINT_ALL, "Uniform: %u/%ukB (%.1f%% max: %ukB)\n", vk_config.uniform_buffer_usage / 1024,
|
||||
vk_config.uniform_buffer_size / 1024,
|
||||
100.f * vk_config.uniform_buffer_usage / vk_config.uniform_buffer_size,
|
||||
vk_config.uniform_buffer_max_usage / 1024);
|
||||
R_Printf(PRINT_ALL, "Tri fan: %u/%u (%.1f%% max: %u)\n", vk_config.triangle_fan_index_usage,
|
||||
vk_config.triangle_fan_index_count,
|
||||
100.f * vk_config.triangle_fan_index_usage / vk_config.triangle_fan_index_count,
|
||||
vk_config.triangle_fan_index_max_usage);
|
||||
R_Printf(PRINT_ALL, "Vertex : %u/%ukB (%.1f%% max: %ukB)\n",
|
||||
vk_config.vertex_buffer_usage / 1024,
|
||||
vk_config.vertex_buffer_size / 1024,
|
||||
100.f * vk_config.vertex_buffer_usage / vk_config.vertex_buffer_size,
|
||||
vk_config.vertex_buffer_max_usage / 1024);
|
||||
|
||||
R_Printf(PRINT_ALL, "Index : %u/%uB (%.1f%% max: %uB)\n",
|
||||
vk_config.index_buffer_usage,
|
||||
vk_config.index_buffer_size,
|
||||
100.f * vk_config.index_buffer_usage / vk_config.index_buffer_size,
|
||||
vk_config.index_buffer_max_usage);
|
||||
R_Printf(PRINT_ALL, "Uniform: %u/%ukB (%.1f%% max: %ukB)\n",
|
||||
vk_config.uniform_buffer_usage / 1024,
|
||||
vk_config.uniform_buffer_size / 1024,
|
||||
100.f * vk_config.uniform_buffer_usage / vk_config.uniform_buffer_size,
|
||||
vk_config.uniform_buffer_max_usage / 1024);
|
||||
R_Printf(PRINT_ALL, "Tri fan: %u/%u (%.1f%% max: %u)\n",
|
||||
vk_config.triangle_fan_index_usage,
|
||||
vk_config.triangle_fan_index_count,
|
||||
100.f * vk_config.triangle_fan_index_usage / vk_config.triangle_fan_index_count,
|
||||
vk_config.triangle_fan_index_max_usage);
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ See the GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
// vk_rsurf.c: surface-related refresh code
|
||||
#include <assert.h>
|
||||
|
||||
|
@ -1081,11 +1081,16 @@ static void LM_UploadBlock( qboolean dynamic )
|
|||
else
|
||||
{
|
||||
QVVKTEXTURE_CLEAR(vk_state.lightmap_textures[texture]);
|
||||
QVk_CreateTexture(&vk_state.lightmap_textures[texture], vk_lms.lightmap_buffer, BLOCK_WIDTH, BLOCK_HEIGHT, vk_current_lmap_sampler);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[texture].resource.image, VK_OBJECT_TYPE_IMAGE, va("Image: dynamic lightmap #%d", texture));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[texture].imageView, VK_OBJECT_TYPE_IMAGE_VIEW, va("Image View: dynamic lightmap #%d", texture));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[texture].descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Descriptor Set: dynamic lightmap #%d", texture));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[texture].resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: dynamic lightmap #%d", texture));
|
||||
QVk_CreateTexture(&vk_state.lightmap_textures[texture], vk_lms.lightmap_buffer,
|
||||
BLOCK_WIDTH, BLOCK_HEIGHT, vk_current_lmap_sampler);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[texture].resource.image,
|
||||
VK_OBJECT_TYPE_IMAGE, va("Image: dynamic lightmap #%d", texture));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[texture].imageView,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW, va("Image View: dynamic lightmap #%d", texture));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[texture].descriptorSet,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Descriptor Set: dynamic lightmap #%d", texture));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[texture].resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: dynamic lightmap #%d", texture));
|
||||
}
|
||||
if ( ++vk_lms.current_lightmap_texture == MAX_LIGHTMAPS )
|
||||
ri.Sys_Error( ERR_DROP, "%s() - MAX_LIGHTMAPS exceeded\n", __func__);
|
||||
|
@ -1278,11 +1283,16 @@ void Vk_BeginBuildingLightmaps (model_t *m)
|
|||
for (i = DYNLIGHTMAP_OFFSET; i < MAX_LIGHTMAPS*2; i++)
|
||||
{
|
||||
QVVKTEXTURE_CLEAR(vk_state.lightmap_textures[i]);
|
||||
QVk_CreateTexture(&vk_state.lightmap_textures[i], (unsigned char*)dummy, BLOCK_WIDTH, BLOCK_HEIGHT, vk_current_lmap_sampler);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[i].resource.image, VK_OBJECT_TYPE_IMAGE, va("Image: dynamic lightmap #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[i].imageView, VK_OBJECT_TYPE_IMAGE_VIEW, va("Image View: dynamic lightmap #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[i].descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Descriptor Set: dynamic lightmap #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[i].resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: dynamic lightmap #%d", i));
|
||||
QVk_CreateTexture(&vk_state.lightmap_textures[i], (unsigned char*)dummy,
|
||||
BLOCK_WIDTH, BLOCK_HEIGHT, vk_current_lmap_sampler);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[i].resource.image,
|
||||
VK_OBJECT_TYPE_IMAGE, va("Image: dynamic lightmap #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[i].imageView,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW, va("Image View: dynamic lightmap #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[i].descriptorSet,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET, va("Descriptor Set: dynamic lightmap #%d", i));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_state.lightmap_textures[i].resource.memory,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY, va("Memory: dynamic lightmap #%d", i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue