commit
d713944681
|
@ -230,7 +230,7 @@ extern VkRect2D vk_scissor;
|
|||
extern VkDescriptorSetLayout vk_samplerDescSetLayout;
|
||||
|
||||
// *** pipelines ***
|
||||
extern qvkpipeline_t vk_drawTexQuadPipeline;
|
||||
extern qvkpipeline_t vk_drawTexQuadPipeline[RP_COUNT];
|
||||
extern qvkpipeline_t vk_drawColorQuadPipeline[RP_COUNT];
|
||||
extern qvkpipeline_t vk_drawModelPipelineStrip[RP_COUNT];
|
||||
extern qvkpipeline_t vk_drawModelPipelineFan[RP_COUNT];
|
||||
|
@ -312,6 +312,7 @@ void QVk_DrawColorRect(float *ubo, VkDeviceSize uboSize, qvkrenderpasstype_t rp
|
|||
void QVk_DrawTexRect(const float *ubo, VkDeviceSize uboSize, qvktexture_t *texture);
|
||||
void QVk_BindPipeline(qvkpipeline_t *pipeline);
|
||||
void QVk_SubmitStagingBuffers(void);
|
||||
void Qvk_MemoryBarrier(VkCommandBuffer cmdBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask);
|
||||
|
||||
// debug label related functions
|
||||
void QVk_DebugSetObjectName(uint64_t obj, VkObjectType objType, const char *objName);
|
||||
|
|
|
@ -48,17 +48,17 @@ const uint32_t postprocess_frag_spv[] = {
|
|||
0x00000012,0x00000023,0x0000000f,0x00000022,0x0004003d,0x00000006,0x00000024,0x00000023,
|
||||
0x000500ba,0x00000026,0x00000027,0x00000024,0x00000025,0x000300f7,0x00000029,0x00000000,
|
||||
0x000400fa,0x00000027,0x00000028,0x00000042,0x000200f8,0x00000028,0x0004003d,0x0000002e,
|
||||
0x00000031,0x00000030,0x0004003d,0x00000007,0x00000032,0x00000009,0x00050057,0x0000002a,
|
||||
0x00000033,0x00000031,0x00000032,0x0008004f,0x00000034,0x00000035,0x00000033,0x00000033,
|
||||
0x00000000,0x00000001,0x00000002,0x0005008e,0x00000034,0x00000037,0x00000035,0x00000036,
|
||||
0x00050041,0x00000012,0x00000039,0x0000000f,0x00000038,0x0004003d,0x00000006,0x0000003a,
|
||||
0x00000039,0x00060050,0x00000034,0x0000003b,0x0000003a,0x0000003a,0x0000003a,0x0007000c,
|
||||
0x00000034,0x0000003c,0x00000001,0x0000001a,0x00000037,0x0000003b,0x00050051,0x00000006,
|
||||
0x0000003e,0x0000003c,0x00000000,0x00050051,0x00000006,0x0000003f,0x0000003c,0x00000001,
|
||||
0x00050051,0x00000006,0x00000040,0x0000003c,0x00000002,0x00070050,0x0000002a,0x00000041,
|
||||
0x0000003e,0x0000003f,0x00000040,0x0000003d,0x0003003e,0x0000002c,0x00000041,0x000200f9,
|
||||
0x00000029,0x000200f8,0x00000042,0x0004003d,0x0000002e,0x00000043,0x00000030,0x0004003d,
|
||||
0x00000007,0x00000044,0x00000009,0x00050057,0x0000002a,0x00000045,0x00000043,0x00000044,
|
||||
0x0003003e,0x0000002c,0x00000045,0x000200f9,0x00000029,0x000200f8,0x00000029,0x000100fd,
|
||||
0x00010038
|
||||
0x00000031,0x00000030,0x0004003d,0x00000007,0x00000032,0x00000009,0x00070058,0x0000002a,
|
||||
0x00000033,0x00000031,0x00000032,0x00000002,0x00000025,0x0008004f,0x00000034,0x00000035,
|
||||
0x00000033,0x00000033,0x00000000,0x00000001,0x00000002,0x0005008e,0x00000034,0x00000037,
|
||||
0x00000035,0x00000036,0x00050041,0x00000012,0x00000039,0x0000000f,0x00000038,0x0004003d,
|
||||
0x00000006,0x0000003a,0x00000039,0x00060050,0x00000034,0x0000003b,0x0000003a,0x0000003a,
|
||||
0x0000003a,0x0007000c,0x00000034,0x0000003c,0x00000001,0x0000001a,0x00000037,0x0000003b,
|
||||
0x00050051,0x00000006,0x0000003e,0x0000003c,0x00000000,0x00050051,0x00000006,0x0000003f,
|
||||
0x0000003c,0x00000001,0x00050051,0x00000006,0x00000040,0x0000003c,0x00000002,0x00070050,
|
||||
0x0000002a,0x00000041,0x0000003e,0x0000003f,0x00000040,0x0000003d,0x0003003e,0x0000002c,
|
||||
0x00000041,0x000200f9,0x00000029,0x000200f8,0x00000042,0x0004003d,0x0000002e,0x00000043,
|
||||
0x00000030,0x0004003d,0x00000007,0x00000044,0x00000009,0x00070058,0x0000002a,0x00000045,
|
||||
0x00000043,0x00000044,0x00000002,0x00000025,0x0003003e,0x0000002c,0x00000045,0x000200f9,
|
||||
0x00000029,0x000200f8,0x00000029,0x000100fd,0x00010038
|
||||
};
|
|
@ -148,6 +148,7 @@ const uint32_t world_warp_frag_spv[] = {
|
|||
0x000000b0,0x0004003d,0x00000007,0x000000b3,0x00000009,0x00050083,0x00000007,0x000000b6,
|
||||
0x000000b3,0x000000b5,0x0008000c,0x00000007,0x000000b7,0x00000001,0x0000002b,0x000000b1,
|
||||
0x000000b2,0x000000b6,0x0003003e,0x00000024,0x000000b7,0x0004003d,0x000000bb,0x000000be,
|
||||
0x000000bd,0x0004003d,0x00000007,0x000000bf,0x00000024,0x00050057,0x00000017,0x000000c0,
|
||||
0x000000be,0x000000bf,0x0003003e,0x000000b9,0x000000c0,0x000100fd,0x00010038
|
||||
0x000000bd,0x0004003d,0x00000007,0x000000bf,0x00000024,0x00070058,0x00000017,0x000000c0,
|
||||
0x000000be,0x000000bf,0x00000002,0x00000043,0x0003003e,0x000000b9,0x000000c0,0x000100fd,
|
||||
0x00010038
|
||||
};
|
|
@ -63,7 +63,7 @@ qvkrenderpass_t vk_renderpasses[RP_COUNT] = {
|
|||
// RP_WORLD
|
||||
{
|
||||
.rp = VK_NULL_HANDLE,
|
||||
.colorLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
|
||||
.colorLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||
.sampleCount = VK_SAMPLE_COUNT_1_BIT
|
||||
},
|
||||
// RP_UI
|
||||
|
@ -123,7 +123,8 @@ static int vk_activeStagingBuffer = 0;
|
|||
qboolean vk_frameStarted = false;
|
||||
|
||||
// render pipelines
|
||||
qvkpipeline_t vk_drawTexQuadPipeline = QVKPIPELINE_INIT;
|
||||
qvkpipeline_t vk_drawTexQuadPipeline[RP_COUNT] = {
|
||||
QVKPIPELINE_INIT, QVKPIPELINE_INIT, QVKPIPELINE_INIT };
|
||||
qvkpipeline_t vk_drawColorQuadPipeline[RP_COUNT] = {
|
||||
QVKPIPELINE_INIT, QVKPIPELINE_INIT, QVKPIPELINE_INIT };
|
||||
qvkpipeline_t vk_drawModelPipelineStrip[RP_COUNT] = {
|
||||
|
@ -443,16 +444,16 @@ static VkResult CreateRenderpasses()
|
|||
/*
|
||||
* world view setup
|
||||
*/
|
||||
// The color attachment is loaded from the previous frame and stored
|
||||
// after the frame is drawn to mask geometry errors in the skybox
|
||||
// that may leave some pixels without coverage.
|
||||
VkAttachmentDescription worldAttachments[] = {
|
||||
// color attachment
|
||||
// Single-sample color attachment.
|
||||
{
|
||||
.flags = 0,
|
||||
.format = vk_swapchain.format,
|
||||
.samples = VK_SAMPLE_COUNT_1_BIT,
|
||||
// The color attachment is loaded from the previous frame and stored
|
||||
// after the frame is drawn to mask geometry errors in the skybox
|
||||
// that may leave some pixels without coverage.
|
||||
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||
.loadOp = (msaaEnabled ? VK_ATTACHMENT_LOAD_OP_DONT_CARE : VK_ATTACHMENT_LOAD_OP_LOAD),
|
||||
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
||||
.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
|
||||
.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE,
|
||||
|
@ -471,16 +472,16 @@ static VkResult CreateRenderpasses()
|
|||
.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
|
||||
},
|
||||
// MSAA resolve attachment
|
||||
// MSAA attachment
|
||||
{
|
||||
.flags = 0,
|
||||
.format = vk_swapchain.format,
|
||||
.samples = vk_renderpasses[RP_WORLD].sampleCount,
|
||||
.loadOp = msaaEnabled ? vk_renderpasses[RP_WORLD].colorLoadOp : VK_ATTACHMENT_LOAD_OP_DONT_CARE,
|
||||
.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE,
|
||||
.loadOp = (msaaEnabled ? VK_ATTACHMENT_LOAD_OP_LOAD : VK_ATTACHMENT_LOAD_OP_DONT_CARE),
|
||||
.storeOp = (msaaEnabled ? VK_ATTACHMENT_STORE_OP_STORE : VK_ATTACHMENT_STORE_OP_DONT_CARE),
|
||||
.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
|
||||
.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE,
|
||||
.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
.initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
.finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL
|
||||
}
|
||||
};
|
||||
|
@ -647,7 +648,7 @@ static VkResult CreateRenderpasses()
|
|||
.srcStageMask = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
|
||||
.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||
.srcAccessMask = VK_ACCESS_SHADER_READ_BIT,
|
||||
.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
|
||||
.dstAccessMask = (VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT),
|
||||
.dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT
|
||||
},
|
||||
{
|
||||
|
@ -1157,6 +1158,18 @@ static void CreateStagingBuffers()
|
|||
}
|
||||
}
|
||||
|
||||
// Records a memory barrier in the given command buffer.
|
||||
void Qvk_MemoryBarrier(VkCommandBuffer cmdBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask)
|
||||
{
|
||||
const VkMemoryBarrier memBarrier = {
|
||||
.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
|
||||
.pNext = NULL,
|
||||
.srcAccessMask = srcAccessMask,
|
||||
.dstAccessMask = dstAccessMask,
|
||||
};
|
||||
vkCmdPipelineBarrier(cmdBuffer, srcStageMask, dstStageMask, 0u, 1u, &memBarrier, 0u, NULL, 0u, NULL);
|
||||
}
|
||||
|
||||
// internal helper
|
||||
static void SubmitStagingBuffer(int index)
|
||||
{
|
||||
|
@ -1166,14 +1179,12 @@ static void SubmitStagingBuffer(int index)
|
|||
return;
|
||||
}
|
||||
|
||||
VkMemoryBarrier memBarrier = {
|
||||
.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER,
|
||||
.pNext = NULL,
|
||||
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
.dstAccessMask = VK_ACCESS_INDEX_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT
|
||||
};
|
||||
Qvk_MemoryBarrier(vk_stagingBuffers[index].cmdBuffer,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
(VK_ACCESS_INDEX_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT));
|
||||
|
||||
vkCmdPipelineBarrier(vk_stagingBuffers[index].cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, 0, 1, &memBarrier, 0, NULL, 0, NULL);
|
||||
VK_VERIFY(vkEndCommandBuffer(vk_stagingBuffers[index].cmdBuffer));
|
||||
|
||||
VkSubmitInfo submitInfo = {
|
||||
|
@ -1268,10 +1279,15 @@ static void CreatePipelines()
|
|||
|
||||
// textured quad pipeline
|
||||
VK_LOAD_VERTFRAG_SHADERS(shaders, basic, basic);
|
||||
vk_drawTexQuadPipeline.depthTestEnable = VK_FALSE;
|
||||
QVk_CreatePipeline(samplerUboDsLayouts, 2, &vertInfoRG_RG, &vk_drawTexQuadPipeline, &vk_renderpasses[RP_UI], shaders, 2);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_drawTexQuadPipeline.layout, VK_OBJECT_TYPE_PIPELINE_LAYOUT, "Pipeline Layout: textured quad");
|
||||
QVk_DebugSetObjectName((uint64_t)vk_drawTexQuadPipeline.pl, VK_OBJECT_TYPE_PIPELINE, "Pipeline: textured quad");
|
||||
for (int i = 0; i < RP_COUNT; ++i)
|
||||
{
|
||||
vk_drawTexQuadPipeline[i].depthTestEnable = VK_FALSE;
|
||||
QVk_CreatePipeline(samplerUboDsLayouts, 2, &vertInfoRG_RG, &vk_drawTexQuadPipeline[i], &vk_renderpasses[i], shaders, 2);
|
||||
QVk_DebugSetObjectName((uint64_t)vk_drawTexQuadPipeline[i].layout, VK_OBJECT_TYPE_PIPELINE_LAYOUT,
|
||||
va("Pipeline Layout: textured quad (%s)", renderpassObjectNames[i]));
|
||||
QVk_DebugSetObjectName((uint64_t)vk_drawTexQuadPipeline[i].pl, VK_OBJECT_TYPE_PIPELINE,
|
||||
va("Pipeline: textured quad (%s)", renderpassObjectNames[i]));
|
||||
}
|
||||
|
||||
// draw particles pipeline (using a texture)
|
||||
VK_LOAD_VERTFRAG_SHADERS(shaders, particle, basic);
|
||||
|
@ -1499,8 +1515,8 @@ void QVk_Shutdown( void )
|
|||
QVk_DestroyPipeline(&vk_drawColorQuadPipeline[i]);
|
||||
QVk_DestroyPipeline(&vk_drawModelPipelineStrip[i]);
|
||||
QVk_DestroyPipeline(&vk_drawModelPipelineFan[i]);
|
||||
QVk_DestroyPipeline(&vk_drawTexQuadPipeline[i]);
|
||||
}
|
||||
QVk_DestroyPipeline(&vk_drawTexQuadPipeline);
|
||||
QVk_DestroyPipeline(&vk_drawNullModelPipeline);
|
||||
QVk_DestroyPipeline(&vk_drawNoDepthModelPipelineStrip);
|
||||
QVk_DestroyPipeline(&vk_drawNoDepthModelPipelineFan);
|
||||
|
@ -1808,12 +1824,21 @@ qboolean QVk_Init(SDL_Window *window)
|
|||
R_Printf(PRINT_ALL, "...created Vulkan swapchain\n");
|
||||
|
||||
// set viewport and scissor
|
||||
vk_viewport.x = (float)(vk_swapchain.extent.width - (uint32_t)(vid.width)) / 2.0f;
|
||||
vk_viewport.y = (float)(vk_swapchain.extent.height - (uint32_t)(vid.height)) / 2.0f;
|
||||
if (vid_fullscreen->value == 1)
|
||||
{
|
||||
// Center viewport in "keep resolution mode".
|
||||
vk_viewport.x = max(0.f, (float)(vk_swapchain.extent.width - (uint32_t)(vid.width)) / 2.0f);
|
||||
vk_viewport.y = max(0.f, (float)(vk_swapchain.extent.height - (uint32_t)(vid.height)) / 2.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
vk_viewport.x = 0.f;
|
||||
vk_viewport.y = 0.f;
|
||||
}
|
||||
vk_viewport.minDepth = 0.f;
|
||||
vk_viewport.maxDepth = 1.f;
|
||||
vk_viewport.width = (float)vid.width;
|
||||
vk_viewport.height = (float)vid.height;
|
||||
vk_viewport.width = min((float)vid.width, (float)(vk_swapchain.extent.width) - vk_viewport.x);
|
||||
vk_viewport.height = min((float)vid.height, (float)(vk_swapchain.extent.height) - vk_viewport.y);
|
||||
vk_scissor.offset.x = 0;
|
||||
vk_scissor.offset.y = 0;
|
||||
vk_scissor.extent = vk_swapchain.extent;
|
||||
|
@ -2469,16 +2494,16 @@ void QVk_DrawTexRect(const float *ubo, VkDeviceSize uboSize, qvktexture_t *textu
|
|||
uint8_t *uboData = QVk_GetUniformBuffer(uboSize, &uboOffset, &uboDescriptorSet);
|
||||
memcpy(uboData, ubo, uboSize);
|
||||
|
||||
QVk_BindPipeline(&vk_drawTexQuadPipeline);
|
||||
QVk_BindPipeline(&vk_drawTexQuadPipeline[vk_state.current_renderpass]);
|
||||
VkDeviceSize offsets = 0;
|
||||
VkDescriptorSet descriptorSets[] = { texture->descriptorSet, uboDescriptorSet };
|
||||
|
||||
float gamma = 2.1F - vid_gamma->value;
|
||||
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout,
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout,
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, 17 * sizeof(float), sizeof(gamma), &gamma);
|
||||
|
||||
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawTexQuadPipeline.layout, 0, 2, descriptorSets, 1, &uboOffset);
|
||||
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout, 0, 2, descriptorSets, 1, &uboOffset);
|
||||
vkCmdBindVertexBuffers(vk_activeCmdbuffer, 0, 1,
|
||||
&vk_texRectVbo.resource.buffer, &offsets);
|
||||
vkCmdBindIndexBuffer(vk_activeCmdbuffer,
|
||||
|
|
|
@ -397,7 +397,14 @@ void QVk_CreateColorBuffer(VkSampleCountFlagBits sampleCount, qvktexture_t *colo
|
|||
VK_VERIFY(QVk_CreateImage(vk_swapchain.extent.width, vk_swapchain.extent.height, colorBuffer->format, VK_IMAGE_TILING_OPTIMAL, extraFlags | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, colorBuffer));
|
||||
VK_VERIFY(QVk_CreateImageView(&colorBuffer->resource.image, VK_IMAGE_ASPECT_COLOR_BIT, &colorBuffer->imageView, colorBuffer->format, colorBuffer->mipLevels));
|
||||
|
||||
ChangeColorBufferLayout(colorBuffer->resource.image, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||
// The single-sample color attachment ends every frame as
|
||||
// SHADER_READ_ONLY_OPTIMAL as used in the post-processing stage, so its
|
||||
// initial image layout is specified as such.
|
||||
//
|
||||
// The multi-sample color attachment is always COLOR_ATTACHMENT_OPTIMAL.
|
||||
//
|
||||
const VkImageLayout newLayout = ((sampleCount == VK_SAMPLE_COUNT_1_BIT) ? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
|
||||
ChangeColorBufferLayout(colorBuffer->resource.image, VK_IMAGE_LAYOUT_UNDEFINED, newLayout);
|
||||
}
|
||||
|
||||
void QVk_CreateTexture(qvktexture_t *texture, const unsigned char *data, uint32_t width, uint32_t height, qvksampler_t samplerType, qboolean clampToEdge)
|
||||
|
|
|
@ -704,13 +704,13 @@ void R_DrawAliasModel (entity_t *currententity, model_t *currentmodel)
|
|||
Mat_Perspective(r_projection_matrix, r_vulkan_correction_dh, r_gunfov->value, r_proj_aspect, 4, dist);
|
||||
}
|
||||
Mat_Mul(r_view_matrix, r_projection_matrix, r_viewproj_matrix);
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(r_viewproj_matrix), r_viewproj_matrix);
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(r_viewproj_matrix), r_viewproj_matrix);
|
||||
}
|
||||
|
||||
if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
|
||||
{
|
||||
Mat_Scale(r_viewproj_matrix, -1.f, 1.f, 1.f);
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(r_viewproj_matrix), r_viewproj_matrix);
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(r_viewproj_matrix), r_viewproj_matrix);
|
||||
leftHandOffset = 2;
|
||||
}
|
||||
|
||||
|
@ -767,13 +767,13 @@ void R_DrawAliasModel (entity_t *currententity, model_t *currentmodel)
|
|||
if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
|
||||
{
|
||||
Mat_Scale(r_viewproj_matrix, -1.f, 1.f, 1.f);
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(r_viewproj_matrix), r_viewproj_matrix);
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(r_viewproj_matrix), r_viewproj_matrix);
|
||||
}
|
||||
|
||||
if (currententity->flags & RF_DEPTHHACK || r_newrefdef.rdflags & RDF_NOWORLDMODEL)
|
||||
{
|
||||
memcpy(r_viewproj_matrix, prev_viewproj, sizeof(prev_viewproj));
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(r_viewproj_matrix), r_viewproj_matrix);
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(r_viewproj_matrix), r_viewproj_matrix);
|
||||
}
|
||||
|
||||
if (vk_shadows->value && !(currententity->flags & (RF_TRANSLUCENT | RF_WEAPONMODEL)))
|
||||
|
|
|
@ -232,7 +232,7 @@ void R_DrawSpriteModel (entity_t *currententity, model_t *currentmodel)
|
|||
|
||||
float gamma = 2.1F - vid_gamma->value;
|
||||
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout,
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout,
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, 17 * sizeof(float), sizeof(gamma), &gamma);
|
||||
|
||||
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawSpritePipeline.layout, 0, 1, ¤tmodel->skins[currententity->frame]->vk_texture.descriptorSet, 0, NULL);
|
||||
|
@ -496,7 +496,7 @@ void Vk_DrawParticles(int num_particles, const particle_t particles[], const uns
|
|||
|
||||
float gamma = 2.1F - vid_gamma->value;
|
||||
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout,
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout,
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, 17 * sizeof(float), sizeof(gamma), &gamma);
|
||||
|
||||
if (vk_custom_particles->value == 2)
|
||||
|
@ -912,7 +912,7 @@ R_SetupVulkan (void)
|
|||
// precalculate view-projection matrix
|
||||
Mat_Mul(r_view_matrix, r_projection_matrix, r_viewproj_matrix);
|
||||
// view-projection matrix will always be stored as the first push constant item, so set no offset
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(r_viewproj_matrix), r_viewproj_matrix);
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(r_viewproj_matrix), r_viewproj_matrix);
|
||||
}
|
||||
|
||||
static void R_Flash( void )
|
||||
|
|
|
@ -135,7 +135,7 @@ static void DrawVkPoly (vkpoly_t *p, image_t *texture, float *color)
|
|||
|
||||
float gamma = 2.1F - vid_gamma->value;
|
||||
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout,
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout,
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, 17 * sizeof(float), sizeof(gamma), &gamma);
|
||||
|
||||
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawPolyPipeline.layout, 0, 2, descriptorSets, 1, &uboOffset);
|
||||
|
@ -196,7 +196,7 @@ static void DrawVkFlowingPoly (msurface_t *fa, image_t *texture, float *color)
|
|||
|
||||
float gamma = 2.1F - vid_gamma->value;
|
||||
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout,
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout,
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, 17 * sizeof(float), sizeof(gamma), &gamma);
|
||||
|
||||
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawPolyPipeline.layout, 0, 2, descriptorSets, 1, &uboOffset);
|
||||
|
|
|
@ -252,7 +252,7 @@ void EmitWaterPolys (msurface_t *fa, image_t *texture, float *modelMatrix, float
|
|||
|
||||
float gamma = 2.1F - vid_gamma->value;
|
||||
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout,
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout,
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, 17 * sizeof(float), sizeof(gamma), &gamma);
|
||||
|
||||
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vk_drawPolyWarpPipeline.layout, 0, 2, descriptorSets, 1, &uboOffset);
|
||||
|
@ -649,7 +649,7 @@ void R_DrawSkyBox (void)
|
|||
|
||||
float gamma = 2.1F - vid_gamma->value;
|
||||
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline.layout,
|
||||
vkCmdPushConstants(vk_activeCmdbuffer, vk_drawTexQuadPipeline[vk_state.current_renderpass].layout,
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT, 17 * sizeof(float), sizeof(gamma), &gamma);
|
||||
|
||||
vkCmdBindDescriptorSets(vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
|
|
|
@ -24,10 +24,10 @@ void main()
|
|||
if (pc.postprocess > 0.0)
|
||||
{
|
||||
//gamma + color intensity bump
|
||||
fragmentColor = vec4(pow(texture(sTexture, unnormTexCoord).rgb * 1.5, vec3(pc.gamma)), 1.0);
|
||||
fragmentColor = vec4(pow(textureLod(sTexture, unnormTexCoord, 0.0).rgb * 1.5, vec3(pc.gamma)), 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
fragmentColor = texture(sTexture, unnormTexCoord);
|
||||
fragmentColor = textureLod(sTexture, unnormTexCoord, 0.0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,5 +51,5 @@ void main()
|
|||
|
||||
uv = clamp(uv * scrSize, vec2(0.0, 0.0), scrSize - vec2(0.5, 0.5));
|
||||
|
||||
fragmentColor = texture(sTexture, uv);
|
||||
fragmentColor = textureLod(sTexture, uv, 0.0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue