diff --git a/Quake/common.make b/Quake/common.make index 6598a2fb5..06e333fc1 100644 --- a/Quake/common.make +++ b/Quake/common.make @@ -131,11 +131,7 @@ SHADER_OBJS = \ md5_vert.o \ basic_alphatest_frag.o \ screen_effects_8bit_comp.o \ - screen_effects_8bit_scale_comp.o \ - screen_effects_8bit_scale_sops_comp.o \ screen_effects_10bit_comp.o \ - screen_effects_10bit_scale_comp.o \ - screen_effects_10bit_scale_sops_comp.o \ cs_tex_warp_comp.o \ indirect_comp.o \ indirect_clear_comp.o \ diff --git a/Quake/draw.h b/Quake/draw.h index 9366b93c6..8b4872cd5 100644 --- a/Quake/draw.h +++ b/Quake/draw.h @@ -48,6 +48,7 @@ qpic_t *Draw_TryCachePic (const char *path, unsigned int texflags); void Draw_NewGame (void); void GL_Viewport (cb_context_t *cbx, float x, float y, float width, float height, float min_depth, float max_depth); +void GL_Viewport_Scale (cb_context_t *cbx, float x, float y, float width, float height, float min_depth, float max_depth, int scale); void GL_SetCanvas (cb_context_t *cbx, canvastype newcanvas); // johnfitz #endif /* _QUAKE_DRAW_H */ diff --git a/Quake/gl_draw.c b/Quake/gl_draw.c index fbcd3300c..50f4e19e3 100644 --- a/Quake/gl_draw.c +++ b/Quake/gl_draw.c @@ -952,12 +952,23 @@ GL_Viewport ================ */ void GL_Viewport (cb_context_t *cbx, float x, float y, float width, float height, float min_depth, float max_depth) +{ + GL_Viewport_Scale (cbx, x, y, width, height, min_depth, max_depth, 1); +} + +/* +================ +GL_Viewport_Scale +================ +*/ +void GL_Viewport_Scale (cb_context_t *cbx, float x, float y, float width, float height, float min_depth, float max_depth, int scale) { VkViewport viewport; - viewport.x = x; - viewport.y = vid.height - (y + height); - viewport.width = width; - viewport.height = height; + // when using scale, always put the viewport flush against the corner (even when viewsize < 100) for simplicity + viewport.x = scale == 1 ? x : 0; + viewport.y = scale == 1 ? vid.height - (y + height) : 0; + viewport.width = (width + scale - 1) / scale; + viewport.height = (height + scale - 1) / scale; viewport.minDepth = min_depth; viewport.maxDepth = max_depth; diff --git a/Quake/gl_rmain.c b/Quake/gl_rmain.c index 48d996ce5..63a37081e 100644 --- a/Quake/gl_rmain.c +++ b/Quake/gl_rmain.c @@ -31,7 +31,7 @@ int r_framecount; // used for dlight push checking mplane_t frustum[4]; qboolean render_warp; -int render_scale; +int render_scale = 1; // when > 1, adjust the viewport size and upsacale after screen effects // johnfitz -- rendering statistics atomic_uint32_t rs_brushpolys, rs_aliaspolys, rs_skypolys, rs_particles, rs_fogpolys; @@ -352,7 +352,8 @@ R_SetupContext */ static void R_SetupContext (cb_context_t *cbx) { - GL_Viewport (cbx, r_refdef.vrect.x, glheight - r_refdef.vrect.y - r_refdef.vrect.height, r_refdef.vrect.width, r_refdef.vrect.height, 0.0f, 1.0f); + GL_Viewport_Scale ( + cbx, r_refdef.vrect.x, glheight - r_refdef.vrect.y - r_refdef.vrect.height, r_refdef.vrect.width, r_refdef.vrect.height, 0.0f, 1.0f, render_scale); R_BindPipeline (cbx, VK_PIPELINE_BIND_POINT_GRAPHICS, vulkan_globals.basic_blend_pipeline[cbx->render_pass_index]); R_PushConstants (cbx, VK_SHADER_STAGE_ALL_GRAPHICS, 0, 16 * sizeof (float), vulkan_globals.view_projection_matrix); } @@ -384,7 +385,6 @@ static void R_SetupViewBeforeMark (void *unused) r_fovx = r_refdef.fov_x; r_fovy = r_refdef.fov_y; render_warp = false; - render_scale = (int)r_scale.value; if (r_waterwarp.value) { @@ -554,14 +554,16 @@ void R_DrawViewModel (cb_context_t *cbx) R_BeginDebugUtilsLabel (cbx, "View Model"); // hack the depth range to prevent view model from poking into walls - GL_Viewport (cbx, r_refdef.vrect.x, glheight - r_refdef.vrect.y - r_refdef.vrect.height, r_refdef.vrect.width, r_refdef.vrect.height, 0.7f, 1.0f); + GL_Viewport_Scale ( + cbx, r_refdef.vrect.x, glheight - r_refdef.vrect.y - r_refdef.vrect.height, r_refdef.vrect.width, r_refdef.vrect.height, 0.7f, 1.0f, render_scale); int aliaspolys = 0; R_DrawAliasModel (cbx, currententity, &aliaspolys); Atomic_AddUInt32 (&rs_aliaspolys, aliaspolys); Atomic_IncrementUInt32 (&rs_aliaspasses); - GL_Viewport (cbx, r_refdef.vrect.x, glheight - r_refdef.vrect.y - r_refdef.vrect.height, r_refdef.vrect.width, r_refdef.vrect.height, 0.0f, 1.0f); + GL_Viewport_Scale ( + cbx, r_refdef.vrect.x, glheight - r_refdef.vrect.y - r_refdef.vrect.height, r_refdef.vrect.width, r_refdef.vrect.height, 0.0f, 1.0f, render_scale); R_EndDebugUtilsLabel (cbx); } diff --git a/Quake/gl_rmisc.c b/Quake/gl_rmisc.c index ffceb8422..450eb4254 100644 --- a/Quake/gl_rmisc.c +++ b/Quake/gl_rmisc.c @@ -57,7 +57,6 @@ extern cvar_t r_rtshadows; extern cvar_t r_indirect; extern cvar_t r_tasks; extern cvar_t r_parallelmark; -extern cvar_t r_usesops; #if defined(USE_SIMD) extern cvar_t r_simd; @@ -1701,7 +1700,7 @@ void R_CreatePipelineLayouts () ZEROED_STRUCT (VkPushConstantRange, push_constant_range); push_constant_range.offset = 0; - push_constant_range.size = 3 * sizeof (uint32_t) + 8 * sizeof (float); + push_constant_range.size = 3 * sizeof (uint32_t) + 10 * sizeof (float); push_constant_range.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT; ZEROED_STRUCT (VkPipelineLayoutCreateInfo, pipeline_layout_create_info); @@ -1716,10 +1715,6 @@ void R_CreatePipelineLayouts () Sys_Error ("vkCreatePipelineLayout failed"); GL_SetObjectName ((uint64_t)vulkan_globals.screen_effects_pipeline.layout.handle, VK_OBJECT_TYPE_PIPELINE_LAYOUT, "screen_effects_pipeline_layout"); vulkan_globals.screen_effects_pipeline.layout.push_constant_range = push_constant_range; - vulkan_globals.screen_effects_scale_pipeline.layout.handle = vulkan_globals.screen_effects_pipeline.layout.handle; - vulkan_globals.screen_effects_scale_pipeline.layout.push_constant_range = push_constant_range; - vulkan_globals.screen_effects_scale_sops_pipeline.layout.handle = vulkan_globals.screen_effects_pipeline.layout.handle; - vulkan_globals.screen_effects_scale_sops_pipeline.layout.push_constant_range = push_constant_range; } { @@ -1970,13 +1965,6 @@ void R_InitSamplers () break; } } - - if (r_scale.value >= 8) - lod_bias += 3.0f; - else if (r_scale.value >= 4) - lod_bias += 2.0f; - else if (r_scale.value >= 2) - lod_bias += 1.0f; } lod_bias += gl_lodbias.value; @@ -2120,11 +2108,7 @@ DECLARE_SHADER_MODULE (sky_cube_frag); DECLARE_SHADER_MODULE (postprocess_vert); DECLARE_SHADER_MODULE (postprocess_frag); DECLARE_SHADER_MODULE (screen_effects_8bit_comp); -DECLARE_SHADER_MODULE (screen_effects_8bit_scale_comp); -DECLARE_SHADER_MODULE (screen_effects_8bit_scale_sops_comp); DECLARE_SHADER_MODULE (screen_effects_10bit_comp); -DECLARE_SHADER_MODULE (screen_effects_10bit_scale_comp); -DECLARE_SHADER_MODULE (screen_effects_10bit_scale_sops_comp); DECLARE_SHADER_MODULE (cs_tex_warp_comp); DECLARE_SHADER_MODULE (indirect_comp); DECLARE_SHADER_MODULE (indirect_clear_comp); @@ -3202,32 +3186,6 @@ static void R_CreateScreenEffectsPipelines () if (err != VK_SUCCESS) Sys_Error ("vkCreateComputePipelines failed (screen_effects_pipeline)"); GL_SetObjectName ((uint64_t)vulkan_globals.screen_effects_pipeline.handle, VK_OBJECT_TYPE_PIPELINE, "screen_effects"); - - compute_shader_stage.module = - (vulkan_globals.color_format == VK_FORMAT_A2B10G10R10_UNORM_PACK32) ? screen_effects_10bit_scale_comp_module : screen_effects_8bit_scale_comp_module; - infos.compute_pipeline.stage = compute_shader_stage; - assert (vulkan_globals.screen_effects_scale_pipeline.handle == VK_NULL_HANDLE); - err = vkCreateComputePipelines ( - vulkan_globals.device, VK_NULL_HANDLE, 1, &infos.compute_pipeline, NULL, &vulkan_globals.screen_effects_scale_pipeline.handle); - if (err != VK_SUCCESS) - Sys_Error ("vkCreateComputePipelines failed (screen_effects_scale_pipeline)"); - GL_SetObjectName ((uint64_t)vulkan_globals.screen_effects_scale_pipeline.handle, VK_OBJECT_TYPE_PIPELINE, "screen_effects_scale"); - - if (vulkan_globals.screen_effects_sops) - { - compute_shader_stage.module = (vulkan_globals.color_format == VK_FORMAT_A2B10G10R10_UNORM_PACK32) ? screen_effects_10bit_scale_sops_comp_module - : screen_effects_8bit_scale_sops_comp_module; - compute_shader_stage.flags = - VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT | VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT; - infos.compute_pipeline.stage = compute_shader_stage; - assert (vulkan_globals.screen_effects_scale_sops_pipeline.handle == VK_NULL_HANDLE); - err = vkCreateComputePipelines ( - vulkan_globals.device, VK_NULL_HANDLE, 1, &infos.compute_pipeline, NULL, &vulkan_globals.screen_effects_scale_sops_pipeline.handle); - if (err != VK_SUCCESS) - Sys_Error ("vkCreateComputePipelines failed (screen_effects_scale_sops_pipeline)"); - GL_SetObjectName ((uint64_t)vulkan_globals.screen_effects_scale_sops_pipeline.handle, VK_OBJECT_TYPE_PIPELINE, "screen_effects_scale_sops"); - compute_shader_stage.flags = 0; - } } /* @@ -3347,11 +3305,7 @@ static void R_CreateShaderModules () CREATE_SHADER_MODULE (postprocess_vert); CREATE_SHADER_MODULE (postprocess_frag); CREATE_SHADER_MODULE (screen_effects_8bit_comp); - CREATE_SHADER_MODULE (screen_effects_8bit_scale_comp); - CREATE_SHADER_MODULE_COND (screen_effects_8bit_scale_sops_comp, vulkan_globals.screen_effects_sops); CREATE_SHADER_MODULE (screen_effects_10bit_comp); - CREATE_SHADER_MODULE (screen_effects_10bit_scale_comp); - CREATE_SHADER_MODULE_COND (screen_effects_10bit_scale_sops_comp, vulkan_globals.screen_effects_sops); CREATE_SHADER_MODULE (cs_tex_warp_comp); CREATE_SHADER_MODULE (indirect_comp); CREATE_SHADER_MODULE (indirect_clear_comp); @@ -3389,11 +3343,7 @@ static void R_DestroyShaderModules () DESTROY_SHADER_MODULE (postprocess_vert); DESTROY_SHADER_MODULE (postprocess_frag); DESTROY_SHADER_MODULE (screen_effects_8bit_comp); - DESTROY_SHADER_MODULE (screen_effects_8bit_scale_comp); - DESTROY_SHADER_MODULE (screen_effects_8bit_scale_sops_comp); DESTROY_SHADER_MODULE (screen_effects_10bit_comp); - DESTROY_SHADER_MODULE (screen_effects_10bit_scale_comp); - DESTROY_SHADER_MODULE (screen_effects_10bit_scale_sops_comp); DESTROY_SHADER_MODULE (cs_tex_warp_comp); DESTROY_SHADER_MODULE (indirect_comp); DESTROY_SHADER_MODULE (indirect_clear_comp); @@ -3506,13 +3456,6 @@ void R_DestroyPipelines (void) vulkan_globals.postprocess_pipeline.handle = VK_NULL_HANDLE; vkDestroyPipeline (vulkan_globals.device, vulkan_globals.screen_effects_pipeline.handle, NULL); vulkan_globals.screen_effects_pipeline.handle = VK_NULL_HANDLE; - vkDestroyPipeline (vulkan_globals.device, vulkan_globals.screen_effects_scale_pipeline.handle, NULL); - vulkan_globals.screen_effects_scale_pipeline.handle = VK_NULL_HANDLE; - if (vulkan_globals.screen_effects_scale_sops_pipeline.handle != VK_NULL_HANDLE) - { - vkDestroyPipeline (vulkan_globals.device, vulkan_globals.screen_effects_scale_sops_pipeline.handle, NULL); - vulkan_globals.screen_effects_scale_sops_pipeline.handle = VK_NULL_HANDLE; - } vkDestroyPipeline (vulkan_globals.device, vulkan_globals.cs_tex_warp_pipeline.handle, NULL); vulkan_globals.cs_tex_warp_pipeline.handle = VK_NULL_HANDLE; if (vulkan_globals.showtris_pipeline.handle != VK_NULL_HANDLE) @@ -3619,7 +3562,6 @@ void R_Init (void) Cvar_RegisterVariable (&r_scale); Cvar_RegisterVariable (&r_lodbias); Cvar_RegisterVariable (&gl_lodbias); - Cvar_SetCallback (&r_scale, R_ScaleChanged_f); Cvar_SetCallback (&r_lodbias, R_ScaleChanged_f); Cvar_SetCallback (&gl_lodbias, R_ScaleChanged_f); Cvar_SetCallback (&r_lavaalpha, R_SetLavaalpha_f); @@ -3632,7 +3574,6 @@ void R_Init (void) Cvar_RegisterVariable (&r_indirect); Cvar_RegisterVariable (&r_tasks); Cvar_RegisterVariable (&r_parallelmark); - Cvar_RegisterVariable (&r_usesops); R_InitParticles (); SetClearColor (); // johnfitz diff --git a/Quake/gl_screen.c b/Quake/gl_screen.c index a8499d297..8ca3a37b4 100644 --- a/Quake/gl_screen.c +++ b/Quake/gl_screen.c @@ -1219,9 +1219,6 @@ void SCR_UpdateScreen (qboolean use_tasks) } } - if (vid.recalc_refdef) - SCR_CalcRefdef (); - // decide on the height of the console con_forcedup = !cl.worldmodel || cls.signon != SIGNONS; @@ -1232,6 +1229,9 @@ void SCR_UpdateScreen (qboolean use_tasks) return; } + if (vid.recalc_refdef) + SCR_CalcRefdef (); + if (use_tasks) { if (prev_end_rendering_task != INVALID_TASK_HANDLE) diff --git a/Quake/gl_vidsdl.c b/Quake/gl_vidsdl.c index caa66e99d..67ecbdd20 100644 --- a/Quake/gl_vidsdl.c +++ b/Quake/gl_vidsdl.c @@ -104,7 +104,6 @@ cvar_t vid_fsaa = {"vid_fsaa", "0", CVAR_ARCHIVE}; cvar_t vid_fsaamode = {"vid_fsaamode", "0", CVAR_ARCHIVE}; cvar_t vid_gamma = {"gamma", "0.9", CVAR_ARCHIVE}; // johnfitz -- moved here from view.c cvar_t vid_contrast = {"contrast", "1.4", CVAR_ARCHIVE}; // QuakeSpasm, MarkV -cvar_t r_usesops = {"r_usesops", "1", CVAR_ARCHIVE}; // johnfitz #if defined(_DEBUG) static cvar_t r_raydebug = {"r_raydebug", "0", 0}; #endif @@ -890,7 +889,6 @@ static void GL_InitDevice (void) vulkan_globals.dedicated_allocation = false; vulkan_globals.full_screen_exclusive = false; vulkan_globals.swap_chain_full_screen_acquired = false; - vulkan_globals.screen_effects_sops = false; vulkan_globals.ray_query = false; vkGetPhysicalDeviceMemoryProperties (vulkan_physical_device, &vulkan_globals.memory_properties); @@ -1053,16 +1051,6 @@ static void GL_InitDevice (void) vulkan_globals.device_features.sampleRateShading = false; #endif - vulkan_globals.screen_effects_sops = - vulkan_globals.vulkan_1_1_available && subgroup_size_control && subgroup_size_control_features.subgroupSizeControl && - subgroup_size_control_features.computeFullSubgroups && ((physical_device_subgroup_properties.supportedStages & VK_SHADER_STAGE_COMPUTE_BIT) != 0) && - ((physical_device_subgroup_properties.supportedOperations & VK_SUBGROUP_FEATURE_SHUFFLE_BIT) != 0) - // Shader only supports subgroup sizes from 4 to 64. 128 can't be supported because Vulkan spec states that workgroup size - // in x dimension must be a multiple of the subgroup size for VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT. - && (physical_device_subgroup_size_control_properties.minSubgroupSize >= 4) && (physical_device_subgroup_size_control_properties.maxSubgroupSize <= 64); - if (vulkan_globals.screen_effects_sops) - Con_Printf ("Using subgroup operations\n"); - vulkan_globals.ray_query = vulkan_globals.ray_query && acceleration_structure_features.accelerationStructure && ray_query_features.rayQuery && buffer_device_address_features.bufferDeviceAddress; if (vulkan_globals.ray_query) @@ -1075,8 +1063,6 @@ static void GL_InitDevice (void) device_extensions[numEnabledExtensions++] = VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME; device_extensions[numEnabledExtensions++] = VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME; } - if (vulkan_globals.screen_effects_sops) - device_extensions[numEnabledExtensions++] = VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME; #if defined(VK_EXT_full_screen_exclusive) if (vulkan_globals.full_screen_exclusive) device_extensions[numEnabledExtensions++] = VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME; @@ -1109,8 +1095,6 @@ static void GL_InitDevice (void) ZEROED_STRUCT (VkDeviceCreateInfo, device_create_info); device_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; void **device_create_info_next = (void **)&device_create_info.pNext; - if (vulkan_globals.screen_effects_sops) - CHAIN_PNEXT (device_create_info_next, subgroup_size_control_features); if (vulkan_globals.ray_query) { CHAIN_PNEXT (device_create_info_next, buffer_device_address_features); @@ -1625,11 +1609,17 @@ static void GL_CreateColorBuffer (void) image_create_info.arrayLayers = 1; image_create_info.samples = VK_SAMPLE_COUNT_1_BIT; image_create_info.tiling = VK_IMAGE_TILING_OPTIMAL; - image_create_info.usage = - VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT; + image_create_info.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | + VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; for (i = 0; i < NUM_COLOR_BUFFERS; ++i) { + if (i == 1) + { + image_create_info.usage &= ~VK_IMAGE_USAGE_TRANSFER_DST_BIT; + image_create_info.usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; + } + assert (vulkan_globals.color_buffers[i] == VK_NULL_HANDLE); err = vkCreateImage (vulkan_globals.device, &image_create_info, NULL, &vulkan_globals.color_buffers[i]); if (err != VK_SUCCESS) @@ -1809,18 +1799,13 @@ void GL_UpdateDescriptorSets (void) input_attachment_write.pImageInfo = &image_info; vkUpdateDescriptorSets (vulkan_globals.device, 1, &input_attachment_write, 0, NULL); - if (vulkan_globals.screen_effects_desc_set != VK_NULL_HANDLE) - R_FreeDescriptorSet (vulkan_globals.screen_effects_desc_set, &vulkan_globals.input_attachment_set_layout); - vulkan_globals.screen_effects_desc_set = R_AllocateDescriptorSet (&vulkan_globals.screen_effects_set_layout); - - ZEROED_STRUCT (VkDescriptorImageInfo, input_image_info); - input_image_info.imageView = color_buffers_view[1]; - input_image_info.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - input_image_info.sampler = vulkan_globals.linear_sampler; - - ZEROED_STRUCT (VkDescriptorImageInfo, output_image_info); - output_image_info.imageView = color_buffers_view[0]; - output_image_info.imageLayout = VK_IMAGE_LAYOUT_GENERAL; + if (vulkan_globals.screen_effects_desc_set[0] != VK_NULL_HANDLE) + { + R_FreeDescriptorSet (vulkan_globals.screen_effects_desc_set[0], &vulkan_globals.input_attachment_set_layout); + R_FreeDescriptorSet (vulkan_globals.screen_effects_desc_set[1], &vulkan_globals.input_attachment_set_layout); + } + vulkan_globals.screen_effects_desc_set[0] = R_AllocateDescriptorSet (&vulkan_globals.screen_effects_set_layout); + vulkan_globals.screen_effects_desc_set[1] = R_AllocateDescriptorSet (&vulkan_globals.screen_effects_set_layout); ZEROED_STRUCT (VkDescriptorBufferInfo, palette_octree_info); palette_octree_info.buffer = palette_octree_buffer; @@ -1832,48 +1817,60 @@ void GL_UpdateDescriptorSets (void) blue_noise_image_info.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; blue_noise_image_info.sampler = vulkan_globals.linear_sampler; - ZEROED_STRUCT_ARRAY (VkWriteDescriptorSet, screen_effects_writes, 5); - screen_effects_writes[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - screen_effects_writes[0].dstBinding = 0; - screen_effects_writes[0].dstArrayElement = 0; - screen_effects_writes[0].descriptorCount = 1; - screen_effects_writes[0].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; - screen_effects_writes[0].dstSet = vulkan_globals.screen_effects_desc_set; - screen_effects_writes[0].pImageInfo = &input_image_info; - - screen_effects_writes[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - screen_effects_writes[1].dstBinding = 1; - screen_effects_writes[1].dstArrayElement = 0; - screen_effects_writes[1].descriptorCount = 1; - screen_effects_writes[1].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; - screen_effects_writes[1].dstSet = vulkan_globals.screen_effects_desc_set; - screen_effects_writes[1].pImageInfo = &blue_noise_image_info; - - screen_effects_writes[2].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - screen_effects_writes[2].dstBinding = 2; - screen_effects_writes[2].dstArrayElement = 0; - screen_effects_writes[2].descriptorCount = 1; - screen_effects_writes[2].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; - screen_effects_writes[2].dstSet = vulkan_globals.screen_effects_desc_set; - screen_effects_writes[2].pImageInfo = &output_image_info; - - screen_effects_writes[3].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - screen_effects_writes[3].dstBinding = 3; - screen_effects_writes[3].dstArrayElement = 0; - screen_effects_writes[3].descriptorCount = 1; - screen_effects_writes[3].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER; - screen_effects_writes[3].dstSet = vulkan_globals.screen_effects_desc_set; - screen_effects_writes[3].pTexelBufferView = &palette_buffer_view; - - screen_effects_writes[4].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - screen_effects_writes[4].dstBinding = 4; - screen_effects_writes[4].dstArrayElement = 0; - screen_effects_writes[4].descriptorCount = 1; - screen_effects_writes[4].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; - screen_effects_writes[4].dstSet = vulkan_globals.screen_effects_desc_set; - screen_effects_writes[4].pBufferInfo = &palette_octree_info; - - vkUpdateDescriptorSets (vulkan_globals.device, countof (screen_effects_writes), screen_effects_writes, 0, NULL); + for (int i = 0; i < 2; i++) + { + ZEROED_STRUCT (VkDescriptorImageInfo, input_image_info); + input_image_info.imageView = color_buffers_view[1 - i]; + input_image_info.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + input_image_info.sampler = vulkan_globals.linear_sampler; + + ZEROED_STRUCT (VkDescriptorImageInfo, output_image_info); + output_image_info.imageView = color_buffers_view[i]; + output_image_info.imageLayout = VK_IMAGE_LAYOUT_GENERAL; + + ZEROED_STRUCT_ARRAY (VkWriteDescriptorSet, screen_effects_writes, 5); + screen_effects_writes[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + screen_effects_writes[0].dstBinding = 0; + screen_effects_writes[0].dstArrayElement = 0; + screen_effects_writes[0].descriptorCount = 1; + screen_effects_writes[0].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; + screen_effects_writes[0].dstSet = vulkan_globals.screen_effects_desc_set[i]; + screen_effects_writes[0].pImageInfo = &input_image_info; + + screen_effects_writes[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + screen_effects_writes[1].dstBinding = 1; + screen_effects_writes[1].dstArrayElement = 0; + screen_effects_writes[1].descriptorCount = 1; + screen_effects_writes[1].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; + screen_effects_writes[1].dstSet = vulkan_globals.screen_effects_desc_set[i]; + screen_effects_writes[1].pImageInfo = &blue_noise_image_info; + + screen_effects_writes[2].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + screen_effects_writes[2].dstBinding = 2; + screen_effects_writes[2].dstArrayElement = 0; + screen_effects_writes[2].descriptorCount = 1; + screen_effects_writes[2].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + screen_effects_writes[2].dstSet = vulkan_globals.screen_effects_desc_set[i]; + screen_effects_writes[2].pImageInfo = &output_image_info; + + screen_effects_writes[3].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + screen_effects_writes[3].dstBinding = 3; + screen_effects_writes[3].dstArrayElement = 0; + screen_effects_writes[3].descriptorCount = 1; + screen_effects_writes[3].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER; + screen_effects_writes[3].dstSet = vulkan_globals.screen_effects_desc_set[i]; + screen_effects_writes[3].pTexelBufferView = &palette_buffer_view; + + screen_effects_writes[4].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + screen_effects_writes[4].dstBinding = 4; + screen_effects_writes[4].dstArrayElement = 0; + screen_effects_writes[4].descriptorCount = 1; + screen_effects_writes[4].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; + screen_effects_writes[4].dstSet = vulkan_globals.screen_effects_desc_set[i]; + screen_effects_writes[4].pBufferInfo = &palette_octree_info; + + vkUpdateDescriptorSets (vulkan_globals.device, countof (screen_effects_writes), screen_effects_writes, 0, NULL); + } #if defined(_DEBUG) if (vulkan_globals.ray_query) @@ -1882,6 +1879,10 @@ void GL_UpdateDescriptorSets (void) R_FreeDescriptorSet (vulkan_globals.ray_debug_desc_set, &vulkan_globals.ray_debug_set_layout); vulkan_globals.ray_debug_desc_set = R_AllocateDescriptorSet (&vulkan_globals.ray_debug_set_layout); + ZEROED_STRUCT (VkDescriptorImageInfo, output_image_info); + output_image_info.imageView = color_buffers_view[0]; + output_image_info.imageLayout = VK_IMAGE_LAYOUT_GENERAL; + ZEROED_STRUCT_ARRAY (VkWriteDescriptorSet, ray_debug_writes, 2); ray_debug_writes[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; @@ -2264,8 +2265,10 @@ static void GL_DestroyRenderResources (void) R_FreeDescriptorSet (postprocess_descriptor_set, &vulkan_globals.input_attachment_set_layout); postprocess_descriptor_set = VK_NULL_HANDLE; - R_FreeDescriptorSet (vulkan_globals.screen_effects_desc_set, &vulkan_globals.screen_effects_set_layout); - vulkan_globals.screen_effects_desc_set = VK_NULL_HANDLE; + R_FreeDescriptorSet (vulkan_globals.screen_effects_desc_set[0], &vulkan_globals.screen_effects_set_layout); + R_FreeDescriptorSet (vulkan_globals.screen_effects_desc_set[1], &vulkan_globals.screen_effects_set_layout); + vulkan_globals.screen_effects_desc_set[0] = VK_NULL_HANDLE; + vulkan_globals.screen_effects_desc_set[1] = VK_NULL_HANDLE; if (msaa_color_buffer) { @@ -2478,6 +2481,8 @@ qboolean GL_BeginRendering (qboolean use_tasks, task_handle_t *begin_rendering_t else GL_BeginRenderingTask (NULL); + render_scale = CLAMP (1, (int)r_scale.value, 32); + return true; } @@ -2543,6 +2548,8 @@ typedef struct screen_effect_constants_s uint32_t clamp_size_y; float screen_size_rcp_x; float screen_size_rcp_y; + float scale_rcp_x; + float scale_rcp_y; float aspect_ratio; float time; uint32_t flags; @@ -2578,9 +2585,10 @@ typedef struct end_rendering_parms_s qboolean render_warp : 1; qboolean vid_palettize : 1; qboolean menu : 1; - qboolean ray_debug : 1; - uint32_t render_scale : 4; uint32_t vid_height : 20; + uint32_t render_scale : 6; + qboolean ray_debug : 1; + glRect_t bounds; float time; float viewent_alpha; uint8_t v_blend[4]; @@ -2590,20 +2598,102 @@ typedef struct end_rendering_parms_s vec3_t down; } end_rendering_parms_t; -#define SCREEN_EFFECT_FLAG_SCALE_MASK 0x3 -#define SCREEN_EFFECT_FLAG_SCALE_2X 0x1 -#define SCREEN_EFFECT_FLAG_SCALE_4X 0x2 -#define SCREEN_EFFECT_FLAG_SCALE_8X 0x3 #define SCREEN_EFFECT_FLAG_WATER_WARP 0x4 #define SCREEN_EFFECT_FLAG_PALETTIZE 0x8 #define SCREEN_EFFECT_FLAG_MENU 0x10 +/* +=============== +GL_RenderScale +=============== +*/ +static void GL_RenderScale (cb_context_t *cbx, end_rendering_parms_t *parms, qboolean effects) +{ + VkImageMemoryBarrier image_barriers[2]; + image_barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + image_barriers[0].pNext = NULL; + image_barriers[0].srcAccessMask = VK_ACCESS_SHADER_READ_BIT; + image_barriers[0].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + image_barriers[0].oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + image_barriers[0].newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + image_barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + image_barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + image_barriers[0].image = vulkan_globals.color_buffers[0]; + image_barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + image_barriers[0].subresourceRange.baseMipLevel = 0; + image_barriers[0].subresourceRange.levelCount = 1; + image_barriers[0].subresourceRange.baseArrayLayer = 0; + image_barriers[0].subresourceRange.layerCount = 1; + + image_barriers[1].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + image_barriers[1].pNext = NULL; + image_barriers[1].srcAccessMask = effects ? VK_ACCESS_SHADER_WRITE_BIT : VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; + image_barriers[1].dstAccessMask = effects ? VK_ACCESS_TRANSFER_READ_BIT : VK_ACCESS_TRANSFER_WRITE_BIT; + image_barriers[1].oldLayout = effects ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; + image_barriers[1].newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; + image_barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + image_barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + image_barriers[1].image = vulkan_globals.color_buffers[1]; + image_barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + image_barriers[1].subresourceRange.baseMipLevel = 0; + image_barriers[1].subresourceRange.levelCount = 1; + image_barriers[1].subresourceRange.baseArrayLayer = 0; + image_barriers[1].subresourceRange.layerCount = 1; + + VkMemoryBarrier memory_barrier; + memory_barrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER; + memory_barrier.pNext = NULL; + memory_barrier.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; + memory_barrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT; + + vkCmdPipelineBarrier ( + cbx->cb, (!effects ? VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT : 0) | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, + !effects ? 1 : 0, &memory_barrier, 0, NULL, 2, image_barriers); + + ZEROED_STRUCT (VkImageBlit, region); + region.srcOffsets[1].x = (parms->bounds.w + parms->render_scale - 1) / parms->render_scale; + region.srcOffsets[1].y = (parms->bounds.h + parms->render_scale - 1) / parms->render_scale; + region.srcOffsets[1].z = 1; + region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + region.srcSubresource.layerCount = 1; + region.srcSubresource.mipLevel = 0; + region.dstOffsets[0].x = parms->bounds.l; + region.dstOffsets[0].y = parms->bounds.t; + region.dstOffsets[1].x = parms->bounds.l + parms->bounds.w; + region.dstOffsets[1].y = parms->bounds.t + parms->bounds.h; + region.dstOffsets[1].z = 1; + region.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + region.dstSubresource.layerCount = 1; + region.dstSubresource.mipLevel = 0; + + vkCmdBlitImage ( + cbx->cb, vulkan_globals.color_buffers[1], VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, vulkan_globals.color_buffers[0], VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + 1, ®ion, VK_FILTER_NEAREST); + + image_barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + image_barriers[0].pNext = NULL; + image_barriers[0].srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + image_barriers[0].dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; + image_barriers[0].oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + image_barriers[0].newLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; + image_barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + image_barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + image_barriers[0].image = vulkan_globals.color_buffers[0]; + image_barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + image_barriers[0].subresourceRange.baseMipLevel = 0; + image_barriers[0].subresourceRange.levelCount = 1; + image_barriers[0].subresourceRange.baseArrayLayer = 0; + image_barriers[0].subresourceRange.layerCount = 1; + + vkCmdPipelineBarrier (cbx->cb, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, 0, NULL, 0, NULL, 1, image_barriers); +} + /* =============== GL_ScreenEffects =============== */ -static void GL_ScreenEffects (cb_context_t *cbx, qboolean enabled, end_rendering_parms_t *parms) +static void GL_ScreenEffects (cb_context_t *cbx, qboolean enabled, qboolean source_buffer, end_rendering_parms_t *parms) { if (enabled) { @@ -2618,7 +2708,7 @@ static void GL_ScreenEffects (cb_context_t *cbx, qboolean enabled, end_rendering image_barriers[0].newLayout = VK_IMAGE_LAYOUT_GENERAL; image_barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; image_barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - image_barriers[0].image = vulkan_globals.color_buffers[0]; + image_barriers[0].image = vulkan_globals.color_buffers[source_buffer ? 0 : 1]; image_barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; image_barriers[0].subresourceRange.baseMipLevel = 0; image_barriers[0].subresourceRange.levelCount = 1; @@ -2633,7 +2723,7 @@ static void GL_ScreenEffects (cb_context_t *cbx, qboolean enabled, end_rendering image_barriers[1].newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; image_barriers[1].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; image_barriers[1].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - image_barriers[1].image = vulkan_globals.color_buffers[1]; + image_barriers[1].image = vulkan_globals.color_buffers[source_buffer]; image_barriers[1].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; image_barriers[1].subresourceRange.baseMipLevel = 0; image_barriers[1].subresourceRange.levelCount = 1; @@ -2653,44 +2743,37 @@ static void GL_ScreenEffects (cb_context_t *cbx, qboolean enabled, end_rendering } else #endif - if (parms->render_scale >= 2) - { - if (vulkan_globals.screen_effects_sops && r_usesops.value) - pipeline = &vulkan_globals.screen_effects_scale_sops_pipeline; - else - pipeline = &vulkan_globals.screen_effects_scale_pipeline; - } - else pipeline = &vulkan_globals.screen_effects_pipeline; R_BindPipeline (cbx, VK_PIPELINE_BIND_POINT_COMPUTE, *pipeline); + uint32_t width = parms->render_scale > 1 && !parms->ray_debug ? (parms->bounds.w + parms->render_scale - 1) / parms->render_scale : parms->vid_width; + uint32_t height = parms->render_scale > 1 && !parms->ray_debug ? (parms->bounds.h + parms->render_scale - 1) / parms->render_scale : parms->vid_height; + #if defined(_DEBUG) if (!parms->ray_debug || !bmodel_tlas) #endif { - vkCmdBindDescriptorSets (cbx->cb, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline->layout.handle, 0, 1, &vulkan_globals.screen_effects_desc_set, 0, NULL); + vkCmdBindDescriptorSets ( + cbx->cb, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline->layout.handle, 0, 1, &vulkan_globals.screen_effects_desc_set[source_buffer ? 0 : 1], 0, + NULL); uint32_t screen_effect_flags = 0; if (parms->render_warp) screen_effect_flags |= SCREEN_EFFECT_FLAG_WATER_WARP; - if (parms->render_scale >= 8) - screen_effect_flags |= SCREEN_EFFECT_FLAG_SCALE_8X; - else if (parms->render_scale >= 4) - screen_effect_flags |= SCREEN_EFFECT_FLAG_SCALE_4X; - else if (parms->render_scale >= 2) - screen_effect_flags |= SCREEN_EFFECT_FLAG_SCALE_2X; if (parms->vid_palettize) screen_effect_flags |= SCREEN_EFFECT_FLAG_PALETTIZE; if (parms->menu) screen_effect_flags |= SCREEN_EFFECT_FLAG_MENU; const screen_effect_constants_t push_constants = { - parms->vid_width - 1, - parms->vid_height - 1, - 1.0f / (float)parms->vid_width, - 1.0f / (float)parms->vid_height, - (float)parms->vid_width / (float)parms->vid_height, + width - 1, + height - 1, + 1.0f / (float)width, + 1.0f / (float)height, + (float)width / (float)parms->vid_width, + (float)height / (float)parms->vid_height, + (float)width / (float)height, parms->time, screen_effect_flags, (float)parms->v_blend[0] / 255.0f, @@ -2706,49 +2789,44 @@ static void GL_ScreenEffects (cb_context_t *cbx, qboolean enabled, end_rendering vkCmdBindDescriptorSets (cbx->cb, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline->layout.handle, 0, 1, &vulkan_globals.ray_debug_desc_set, 0, NULL); const ray_debug_constants_t push_constants = { - 1.0f / (float)parms->vid_width, - 1.0f / (float)parms->vid_height, - (float)parms->vid_width / (float)parms->vid_height, - parms->origin[0], - parms->origin[1], - parms->origin[2], - parms->forward[0], - parms->forward[1], - parms->forward[2], - parms->right[0], - parms->right[1], - parms->right[2], - parms->down[0], - parms->down[1], - parms->down[2], + 1.0f / (float)width, 1.0f / (float)height, (float)width / (float)height, + parms->origin[0], parms->origin[1], parms->origin[2], + parms->forward[0], parms->forward[1], parms->forward[2], + parms->right[0], parms->right[1], parms->right[2], + parms->down[0], parms->down[1], parms->down[2], }; R_PushConstants (cbx, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof (push_constants), &push_constants); } #endif - vkCmdDispatch (cbx->cb, (parms->vid_width + 7) / 8, (parms->vid_height + 7) / 8, 1); + vkCmdDispatch (cbx->cb, (width + 7) / 8, (height + 7) / 8, 1); - image_barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; - image_barriers[0].pNext = NULL; - image_barriers[0].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; - image_barriers[0].dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; - image_barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; - image_barriers[0].newLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; - image_barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - image_barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - image_barriers[0].image = vulkan_globals.color_buffers[0]; - image_barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - image_barriers[0].subresourceRange.baseMipLevel = 0; - image_barriers[0].subresourceRange.levelCount = 1; - image_barriers[0].subresourceRange.baseArrayLayer = 0; - image_barriers[0].subresourceRange.layerCount = 1; - - vkCmdPipelineBarrier ( - cbx->cb, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, 0, NULL, 0, NULL, 1, image_barriers); + if (source_buffer) + { + image_barriers[0].sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + image_barriers[0].pNext = NULL; + image_barriers[0].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; + image_barriers[0].dstAccessMask = + source_buffer == 0 ? VK_ACCESS_TRANSFER_READ_BIT : VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; + image_barriers[0].oldLayout = VK_IMAGE_LAYOUT_GENERAL; + image_barriers[0].newLayout = source_buffer == 0 ? VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL : VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; + image_barriers[0].srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + image_barriers[0].dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + image_barriers[0].image = vulkan_globals.color_buffers[source_buffer ? 0 : 1]; + image_barriers[0].subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + image_barriers[0].subresourceRange.baseMipLevel = 0; + image_barriers[0].subresourceRange.levelCount = 1; + image_barriers[0].subresourceRange.baseArrayLayer = 0; + image_barriers[0].subresourceRange.layerCount = 1; + + vkCmdPipelineBarrier ( + cbx->cb, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, + source_buffer == 0 ? VK_PIPELINE_STAGE_TRANSFER_BIT : VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, 0, NULL, 0, NULL, 1, image_barriers); + } R_EndDebugUtilsLabel (cbx); } - else + else if (source_buffer == 0) { VkMemoryBarrier memory_barrier; memory_barrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER; @@ -2807,8 +2885,8 @@ static void GL_EndRenderingTask (end_rendering_parms_t *parms) VkRect2D render_area; render_area.offset.x = 0; render_area.offset.y = 0; - render_area.extent.width = parms->vid_width; - render_area.extent.height = parms->vid_height; + render_area.extent.width = parms->render_scale > 1 ? (parms->bounds.w + parms->render_scale - 1) / parms->render_scale : parms->vid_width; + render_area.extent.height = parms->render_scale > 1 ? (parms->bounds.h + parms->render_scale - 1) / parms->render_scale : parms->vid_height; VkClearValue depth_clear_value; depth_clear_value.depthStencil.depth = 0.0f; @@ -2819,14 +2897,14 @@ static void GL_EndRenderingTask (end_rendering_parms_t *parms) clear_values[1] = depth_clear_value; clear_values[2] = vulkan_globals.color_clear_value; - const qboolean screen_effects = parms->render_warp || (parms->render_scale >= 2) || parms->vid_palettize || (gl_polyblend.value && parms->v_blend[3]) || - parms->menu || parms->ray_debug; + const qboolean screen_effects = parms->render_warp || parms->vid_palettize || (gl_polyblend.value && parms->v_blend[3]) || parms->menu || parms->ray_debug; + const qboolean source_buffer = parms->ray_debug || screen_effects != (parms->render_scale > 1); { const qboolean resolve = (vulkan_globals.sample_count != VK_SAMPLE_COUNT_1_BIT); ZEROED_STRUCT (VkRenderPassBeginInfo, render_pass_begin_info); render_pass_begin_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; render_pass_begin_info.renderPass = vulkan_globals.secondary_cb_contexts[SCBX_WORLD][0].render_pass; - render_pass_begin_info.framebuffer = main_framebuffers[screen_effects ? 1 : 0]; + render_pass_begin_info.framebuffer = main_framebuffers[source_buffer ? 1 : 0]; render_pass_begin_info.renderArea = render_area; render_pass_begin_info.clearValueCount = resolve ? 3 : 2; render_pass_begin_info.pClearValues = clear_values; @@ -2840,8 +2918,15 @@ static void GL_EndRenderingTask (end_rendering_parms_t *parms) vkCmdEndRenderPass (render_passes_cb); } - GL_ScreenEffects (&vulkan_globals.primary_cb_contexts[PCBX_RENDER_PASSES], screen_effects, parms); + GL_ScreenEffects (&vulkan_globals.primary_cb_contexts[PCBX_RENDER_PASSES], screen_effects, source_buffer, parms); + if (parms->render_scale > 1 && !parms->ray_debug) + GL_RenderScale (&vulkan_globals.primary_cb_contexts[PCBX_RENDER_PASSES], parms, screen_effects); + + render_area.offset.x = 0; + render_area.offset.y = 0; + render_area.extent.width = parms->vid_width; + render_area.extent.height = parms->vid_height; { ZEROED_STRUCT (VkRenderPassBeginInfo, render_pass_begin_info); render_pass_begin_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; @@ -2926,12 +3011,13 @@ task_handle_t GL_EndRendering (qboolean use_tasks, qboolean swapchain) .render_warp = render_warp, .vid_palettize = vid_palettize.value != 0, .menu = key_dest == key_menu, + .vid_width = vid.width, + .vid_height = vid.height, + .render_scale = render_scale, #if defined(_DEBUG) .ray_debug = r_raydebug.value && (bmodel_tlas != VK_NULL_HANDLE), #endif - .render_scale = CLAMP (0, render_scale, 8), - .vid_width = vid.width, - .vid_height = vid.height, + .bounds = {r_refdef.vrect.x, r_refdef.vrect.y, r_refdef.vrect.width, r_refdef.vrect.height}, .time = fmod (cl.time, 2.0 * M_PI), .viewent_alpha = ENTALPHA_DECODE (cl.viewent.alpha), .v_blend[0] = v_blend[0], diff --git a/Quake/glquake.h b/Quake/glquake.h index a6f6e7752..a611c7c5a 100644 --- a/Quake/glquake.h +++ b/Quake/glquake.h @@ -254,7 +254,6 @@ typedef struct qboolean supersampling; qboolean non_solid_fill; qboolean multi_draw_indirect; - qboolean screen_effects_sops; // Instance extensions qboolean get_surface_capabilities_2; @@ -298,8 +297,6 @@ typedef struct vulkan_pipeline_t md5_pipelines[MODEL_PIPELINE_COUNT]; vulkan_pipeline_t postprocess_pipeline; vulkan_pipeline_t screen_effects_pipeline; - vulkan_pipeline_t screen_effects_scale_pipeline; - vulkan_pipeline_t screen_effects_scale_sops_pipeline; vulkan_pipeline_t cs_tex_warp_pipeline; vulkan_pipeline_t showtris_pipeline; vulkan_pipeline_t showtris_indirect_pipeline; @@ -320,7 +317,7 @@ typedef struct vulkan_desc_set_layout_t ubo_set_layout; vulkan_desc_set_layout_t single_texture_set_layout; vulkan_desc_set_layout_t input_attachment_set_layout; - VkDescriptorSet screen_effects_desc_set; + VkDescriptorSet screen_effects_desc_set[2]; vulkan_desc_set_layout_t screen_effects_set_layout; vulkan_desc_set_layout_t single_texture_cs_write_set_layout; vulkan_desc_set_layout_t lightmap_compute_set_layout; diff --git a/Quake/menu.c b/Quake/menu.c index c14459964..828eb017a 100644 --- a/Quake/menu.c +++ b/Quake/menu.c @@ -1676,32 +1676,21 @@ static void M_GraphicsOptions_ChooseNextAASamples (int dir) static void M_GraphicsOptions_ChooseNextRenderScale (int dir) { - int value = r_scale.value; + int value = CLAMP (1, r_scale.value, 32); - if (dir > 0) - { - if (value >= 8) - value = 0; - else if (value >= 4) - value = 8; - else if (value >= 2) - value = 4; - else - value = 2; - } - else - { - if (value <= 0) - value = 8; - else if (value <= 2) - value = 0; - else if (value <= 4) - value = 2; - else if (value <= 8) - value = 4; - else - value = 8; - } + value += dir; + + if (value > 8 && value & 1) + value += dir; + + if (value > 16 && value & 3) + value += dir * 2; + + if (value > 32) + value = 1; + + if (value < 1) + value = 32; Cvar_SetValueQuick (&r_scale, (float)value); } diff --git a/Quake/view.c b/Quake/view.c index 2435d1a6c..7f2cbc8ea 100644 --- a/Quake/view.c +++ b/Quake/view.c @@ -881,7 +881,6 @@ void V_RenderView (qboolean use_tasks, task_handle_t begin_rendering_task, task_ if (con_forcedup) { render_warp = false; - render_scale = 1; return; } diff --git a/Shaders/screen_effects.inc b/Shaders/screen_effects.inc index b987853cb..6868a26c4 100644 --- a/Shaders/screen_effects.inc +++ b/Shaders/screen_effects.inc @@ -20,6 +20,7 @@ layout (push_constant) uniform PushConsts { uvec2 clamp_size; vec2 screen_size_rcp; + vec2 scale_rcp; float aspect_ratio; float time; uint flags; @@ -30,102 +31,26 @@ layout (push_constant) uniform PushConsts } push_constants; -#if defined(USE_SUBGROUP_OPS) -uint Compact1By1 (uint x) -{ - x &= 0x55555555; - if (gl_SubgroupSize > 4) - x = (x ^ (x >> 1)) & 0x33333333; - if (gl_SubgroupSize > 16) - x = (x ^ (x >> 2)) & 0x0f0f0f0f; - return x; -} - -uint DecodeMorton2X (uint code) -{ - return Compact1By1 (code >> 0); -} - -uint DecodeMorton2Y (uint code) -{ - return Compact1By1 (code >> 1); -} -#endif - float blue_noise (ivec2 u) { return texelFetch (blue_noise_tex, ivec2 (uint (u.x) % 64, uint (u.y) % 64), 0).r; } -#define SCREEN_EFFECT_FLAG_SCALE_MASK 0x3 -#define SCREEN_EFFECT_FLAG_SCALE_2X 0x1 -#define SCREEN_EFFECT_FLAG_SCALE_4X 0x2 -#define SCREEN_EFFECT_FLAG_SCALE_8X 0x3 #define SCREEN_EFFECT_FLAG_WATER_WARP 0x4 #define SCREEN_EFFECT_FLAG_PALETTIZE 0x8 #define SCREEN_EFFECT_FLAG_MENU 0x10 -#if defined(SCALING) -// Vulkan guarantees 16384 bytes of shared memory, so host doesn't need to check -shared uint group_red[16]; -shared uint group_green[16]; -shared uint group_blue[16]; -#endif - -#if defined(SCALING) && defined(USE_SUBGROUP_OPS) -// Vulkan spec states that workgroup size in x dimension must be a multiple of the -// subgroup size for VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT -layout (local_size_x = 64, local_size_y = 1) in; -#else layout (local_size_x = 8, local_size_y = 8) in; -#endif + void main () { const uint tile_size_x = 8; const uint tile_size_y = 8; -#if defined(SCALING) && defined(USE_SUBGROUP_OPS) - // gl_SubgroupSize >= 4 && gl_SubgroupSize <= 64 otherwise the host code chooses the shared mem only shader - // Vulkan guarantees subgroup size must be power of two and between 1 and 128 - uint subgroup_width = 0; - uint subgroup_height = 0; - switch (gl_SubgroupSize) - { - case 4: - subgroup_width = 2; - subgroup_height = 2; - break; - case 8: - subgroup_width = 4; - subgroup_height = 2; - break; - case 16: - subgroup_width = 4; - subgroup_height = 4; - break; - case 32: - subgroup_width = 8; - subgroup_height = 4; - break; - case 64: - subgroup_width = 8; - subgroup_height = 8; - break; - } - // Morton order for subgroupShuffleXor - const uint subgroup_x = DecodeMorton2X (gl_SubgroupInvocationID); - const uint subgroup_y = DecodeMorton2Y (gl_SubgroupInvocationID); - const uint num_subgroups_x = (tile_size_x + subgroup_width - 1) / subgroup_width; - const uint local_x = ((gl_SubgroupID % num_subgroups_x) * subgroup_width) + subgroup_x; - const uint local_y = ((gl_SubgroupID / num_subgroups_x) * subgroup_height) + subgroup_y; - const uint pos_x = (gl_WorkGroupID.x * tile_size_x) + local_x; - const uint pos_y = (gl_WorkGroupID.y * tile_size_y) + local_y; -#else const uint local_x = gl_LocalInvocationID.x; const uint local_y = gl_LocalInvocationID.y; const uint pos_x = gl_GlobalInvocationID.x; const uint pos_y = gl_GlobalInvocationID.y; -#endif vec4 color = vec4 (0.0f, 0.0f, 0.0f, 0.0f); @@ -142,7 +67,7 @@ void main () const float tex_x = (pos_x_norm + (sin (pos_y_norm * cycle_x + push_constants.time) * amp_x)) * (1.0f - amp_x * 2.0f) + amp_x; const float tex_y = (pos_y_norm + (sin (pos_x_norm * cycle_y + push_constants.time) * amp_y)) * (1.0f - amp_y * 2.0f) + amp_y; - color = texture (input_tex, vec2 (tex_x, tex_y)); + color = texture (input_tex, vec2 (tex_x, tex_y) * push_constants.scale_rcp); } else color = texelFetch (input_tex, ivec2 (min (push_constants.clamp_size.x, pos_x), min (push_constants.clamp_size.y, pos_y)), 0); @@ -209,109 +134,17 @@ void main () (s[0] * luma[0][0]) - (s[0] * luma[0][2]) + (s[1] * luma[1][0]) - (s[1] * luma[1][2]) + (s[0] * luma[2][0]) - (s[0] * luma[2][2])); float sobel = dot (sobel_xy, sobel_xy); - float p = clamp ((5.0f - (sobel * 1e4f)), 1.0f, 5.0f); - float a = pow (best_dist_sq, p); - float b = pow (second_best_dist_sq, p); - float ratio = a / (a + b); -#if defined(SCALING) - uint noise_shift = push_constants.flags & SCREEN_EFFECT_FLAG_SCALE_MASK; -#else - uint noise_shift = 0; -#endif - const float noise = blue_noise (ivec2 (pos_x >> noise_shift, pos_y >> noise_shift)); + float p = clamp ((5.0f - (sobel * 1e4f)), 1.0f, 5.0f); + float a = pow (best_dist_sq, p); + float b = pow (second_best_dist_sq, p); + float ratio = a / (a + b); + const float noise = blue_noise (ivec2 (pos_x, pos_y)); color.rgb = (ratio < noise) ? best_color : second_best_color; break; } } } -#if defined(SCALING) - [[branch]] if ((push_constants.flags & SCREEN_EFFECT_FLAG_SCALE_MASK) == SCREEN_EFFECT_FLAG_SCALE_2X) - { -#if defined(USE_SUBGROUP_OPS) - if (gl_SubgroupSize >= 4) - { - color.r = uintBitsToFloat (subgroupShuffle (floatBitsToUint (color.r), gl_SubgroupInvocationID & ~0x3)); - color.g = uintBitsToFloat (subgroupShuffle (floatBitsToUint (color.g), gl_SubgroupInvocationID & ~0x3)); - color.b = uintBitsToFloat (subgroupShuffle (floatBitsToUint (color.b), gl_SubgroupInvocationID & ~0x3)); - } - else - { -#endif - const uint local_idx = local_x + (local_y * tile_size_x); - const uint shared_mem_idx = (local_x / 2) + ((local_y / 2) * (tile_size_x / 2)); - if (((local_x % 2) == 0) && ((local_y % 2) == 0)) - { - group_red[shared_mem_idx] = floatBitsToUint (color.r); - group_green[shared_mem_idx] = floatBitsToUint (color.g); - group_blue[shared_mem_idx] = floatBitsToUint (color.b); - } - barrier (); - color.r = uintBitsToFloat (group_red[shared_mem_idx]); - color.g = uintBitsToFloat (group_green[shared_mem_idx]); - color.b = uintBitsToFloat (group_blue[shared_mem_idx]); -#if defined(USE_SUBGROUP_OPS) - } -#endif - } - else if ((push_constants.flags & SCREEN_EFFECT_FLAG_SCALE_MASK) == SCREEN_EFFECT_FLAG_SCALE_4X) - { -#if defined(USE_SUBGROUP_OPS) - if (gl_SubgroupSize >= 16) - { - color.r = uintBitsToFloat (subgroupShuffle (floatBitsToUint (color.r), gl_SubgroupInvocationID & ~0xF)); - color.g = uintBitsToFloat (subgroupShuffle (floatBitsToUint (color.g), gl_SubgroupInvocationID & ~0xF)); - color.b = uintBitsToFloat (subgroupShuffle (floatBitsToUint (color.b), gl_SubgroupInvocationID & ~0xF)); - } - else - { -#endif - const uint local_idx = local_x + (local_y * tile_size_x); - const uint shared_mem_idx = (local_x / 4) + ((local_y / 4) * (tile_size_x / 4)); - if (((local_x % 4) == 0) && ((local_y % 4) == 0)) - { - group_red[shared_mem_idx] = floatBitsToUint (color.r); - group_green[shared_mem_idx] = floatBitsToUint (color.g); - group_blue[shared_mem_idx] = floatBitsToUint (color.b); - } - barrier (); - color.r = uintBitsToFloat (group_red[shared_mem_idx]); - color.g = uintBitsToFloat (group_green[shared_mem_idx]); - color.b = uintBitsToFloat (group_blue[shared_mem_idx]); -#if defined(USE_SUBGROUP_OPS) - } -#endif - } - else if ((push_constants.flags & SCREEN_EFFECT_FLAG_SCALE_MASK) == SCREEN_EFFECT_FLAG_SCALE_8X) - { -#if defined(USE_SUBGROUP_OPS) - if (gl_SubgroupSize >= 64) - { - color.r = uintBitsToFloat (subgroupShuffle (floatBitsToUint (color.r), gl_SubgroupInvocationID & ~0x3F)); - color.g = uintBitsToFloat (subgroupShuffle (floatBitsToUint (color.g), gl_SubgroupInvocationID & ~0x3F)); - color.b = uintBitsToFloat (subgroupShuffle (floatBitsToUint (color.b), gl_SubgroupInvocationID & ~0x3F)); - } - else - { -#endif - const uint local_idx = local_x + (local_y * tile_size_x); - const uint shared_mem_idx = (local_x / 8) + ((local_y / 8) * (tile_size_x / 8)); - if (((local_x % 8) == 0) && ((local_y % 8) == 0)) - { - group_red[shared_mem_idx] = floatBitsToUint (color.r); - group_green[shared_mem_idx] = floatBitsToUint (color.g); - group_blue[shared_mem_idx] = floatBitsToUint (color.b); - } - barrier (); - color.r = uintBitsToFloat (group_red[shared_mem_idx]); - color.g = uintBitsToFloat (group_green[shared_mem_idx]); - color.b = uintBitsToFloat (group_blue[shared_mem_idx]); -#if defined(USE_SUBGROUP_OPS) - } -#endif - } -#endif - color.rgb = mix (color.rgb, vec3 (push_constants.poly_blend_r, push_constants.poly_blend_g, push_constants.poly_blend_b), push_constants.poly_blend_a); [[branch]] if ((push_constants.flags & SCREEN_EFFECT_FLAG_MENU) != 0) color.rgb = mix (color.rgb, vec3 (color.r * 0.3f + color.g * 0.59f + color.b * 0.11f), 0.5f) * 0.6f; diff --git a/Shaders/screen_effects_10bit_scale.comp b/Shaders/screen_effects_10bit_scale.comp deleted file mode 100644 index 8c87fbf03..000000000 --- a/Shaders/screen_effects_10bit_scale.comp +++ /dev/null @@ -1,9 +0,0 @@ -#version 460 -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable -#extension GL_GOOGLE_include_directive : enable - -layout (set = 0, binding = 2, rgb10_a2) uniform writeonly image2D output_image; - -#define SCALING -#include "screen_effects.inc" diff --git a/Shaders/screen_effects_10bit_scale_sops.comp b/Shaders/screen_effects_10bit_scale_sops.comp deleted file mode 100644 index e1b548e04..000000000 --- a/Shaders/screen_effects_10bit_scale_sops.comp +++ /dev/null @@ -1,11 +0,0 @@ -#version 460 -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable -#extension GL_GOOGLE_include_directive : enable -#extension GL_KHR_shader_subgroup_shuffle : enable - -layout (set = 0, binding = 2, rgb10_a2) uniform writeonly image2D output_image; - -#define SCALING -#define USE_SUBGROUP_OPS -#include "screen_effects.inc" diff --git a/Shaders/screen_effects_8bit_scale.comp b/Shaders/screen_effects_8bit_scale.comp deleted file mode 100644 index 304d79044..000000000 --- a/Shaders/screen_effects_8bit_scale.comp +++ /dev/null @@ -1,9 +0,0 @@ -#version 460 -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable -#extension GL_GOOGLE_include_directive : enable - -layout (set = 0, binding = 2, rgba8) uniform writeonly image2D output_image; - -#define SCALING -#include "screen_effects.inc" diff --git a/Shaders/screen_effects_8bit_scale_sops.comp b/Shaders/screen_effects_8bit_scale_sops.comp deleted file mode 100644 index f5febc658..000000000 --- a/Shaders/screen_effects_8bit_scale_sops.comp +++ /dev/null @@ -1,11 +0,0 @@ -#version 460 -#extension GL_ARB_separate_shader_objects : enable -#extension GL_ARB_shading_language_420pack : enable -#extension GL_GOOGLE_include_directive : enable -#extension GL_KHR_shader_subgroup_shuffle : enable - -layout (set = 0, binding = 2, rgba8) uniform writeonly image2D output_image; - -#define SCALING -#define USE_SUBGROUP_OPS -#include "screen_effects.inc" diff --git a/Shaders/shaders.h b/Shaders/shaders.h index e9b874499..d6eda8669 100644 --- a/Shaders/shaders.h +++ b/Shaders/shaders.h @@ -43,11 +43,7 @@ DECLARE_SHADER_SPV (sky_cube_frag); DECLARE_SHADER_SPV (postprocess_vert); DECLARE_SHADER_SPV (postprocess_frag); DECLARE_SHADER_SPV (screen_effects_8bit_comp); -DECLARE_SHADER_SPV (screen_effects_8bit_scale_comp); -DECLARE_SHADER_SPV (screen_effects_8bit_scale_sops_comp); DECLARE_SHADER_SPV (screen_effects_10bit_comp); -DECLARE_SHADER_SPV (screen_effects_10bit_scale_comp); -DECLARE_SHADER_SPV (screen_effects_10bit_scale_sops_comp); DECLARE_SHADER_SPV (cs_tex_warp_comp); DECLARE_SHADER_SPV (indirect_comp); DECLARE_SHADER_SPV (indirect_clear_comp); diff --git a/Windows/VisualStudio/embedded.vcxproj b/Windows/VisualStudio/embedded.vcxproj index 705576379..f9d0bc761 100644 --- a/Windows/VisualStudio/embedded.vcxproj +++ b/Windows/VisualStudio/embedded.vcxproj @@ -62,32 +62,6 @@ $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - - Document - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - - - Document - $(SolutionDir)..\..\Shaders\screen_effects.inc - $(SolutionDir)..\..\Shaders\screen_effects.inc - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - $(VULKAN_SDK)\bin\glslangValidator.exe --target-env vulkan1.1 -g -V "%(FullPath)" -o "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).spv" -"$(SolutionDir)\Build-bintoc\$(PlatformShortName)\$(Configuration)\bintoc.exe" "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).spv" %(Filename)%(Extension)_spv "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).c" - $(VULKAN_SDK)\bin\glslangValidator.exe --target-env vulkan1.1 -g -V "%(FullPath)" -o "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).spv" -"$(SolutionDir)\Build-bintoc\$(PlatformShortName)\$(Configuration)\bintoc.exe" "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).spv" %(Filename)%(Extension)_spv "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).c" - $(VULKAN_SDK)\bin\glslangValidator.exe --target-env vulkan1.1 -V "%(FullPath)" -o "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -$(VULKAN_SDK)\bin\spirv-opt.exe -Os "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -o "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -$(VULKAN_SDK)\bin\spirv-remap.exe -s -i "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -o "$(SolutionDir)..\..\Shaders\Compiled\Release" -"$(SolutionDir)\Build-bintoc\$(PlatformShortName)\$(Configuration)\bintoc.exe" "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" %(Filename)%(Extension)_spv "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).c" - $(VULKAN_SDK)\bin\glslangValidator.exe --target-env vulkan1.1 -V "%(FullPath)" -o "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -$(VULKAN_SDK)\bin\spirv-opt.exe -Os "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -o "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -$(VULKAN_SDK)\bin\spirv-remap.exe -s -i "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -o "$(SolutionDir)..\..\Shaders\Compiled\Release" -"$(SolutionDir)\Build-bintoc\$(PlatformShortName)\$(Configuration)\bintoc.exe" "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" %(Filename)%(Extension)_spv "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).c" - Document $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) @@ -95,32 +69,6 @@ $(VULKAN_SDK)\bin\spirv-remap.exe -s -i "$(SolutionDir)..\..\Shaders\Compiled\Re $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - - Document - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - - - Document - $(SolutionDir)..\..\Shaders\screen_effects.inc - $(SolutionDir)..\..\Shaders\screen_effects.inc - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - $(SolutionDir)..\..\Shaders\screen_effects.inc;%(AdditionalInputs) - $(VULKAN_SDK)\bin\glslangValidator.exe --target-env vulkan1.1 -g -V "%(FullPath)" -o "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).spv" -"$(SolutionDir)\Build-bintoc\$(PlatformShortName)\$(Configuration)\bintoc.exe" "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).spv" %(Filename)%(Extension)_spv "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).c" - $(VULKAN_SDK)\bin\glslangValidator.exe --target-env vulkan1.1 -g -V "%(FullPath)" -o "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).spv" -"$(SolutionDir)\Build-bintoc\$(PlatformShortName)\$(Configuration)\bintoc.exe" "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).spv" %(Filename)%(Extension)_spv "$(SolutionDir)..\..\Shaders\Compiled\Debug\%(Filename)%(Extension).c" - $(VULKAN_SDK)\bin\glslangValidator.exe --target-env vulkan1.1 -V "%(FullPath)" -o "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -$(VULKAN_SDK)\bin\spirv-opt.exe -Os "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -o "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -$(VULKAN_SDK)\bin\spirv-remap.exe -s -i "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -o "$(SolutionDir)..\..\Shaders\Compiled\Release" -"$(SolutionDir)\Build-bintoc\$(PlatformShortName)\$(Configuration)\bintoc.exe" "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" %(Filename)%(Extension)_spv "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).c" - $(VULKAN_SDK)\bin\glslangValidator.exe --target-env vulkan1.1 -V "%(FullPath)" -o "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -$(VULKAN_SDK)\bin\spirv-opt.exe -Os "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -o "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -$(VULKAN_SDK)\bin\spirv-remap.exe -s -i "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" -o "$(SolutionDir)..\..\Shaders\Compiled\Release" -"$(SolutionDir)\Build-bintoc\$(PlatformShortName)\$(Configuration)\bintoc.exe" "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).spv" %(Filename)%(Extension)_spv "$(SolutionDir)..\..\Shaders\Compiled\Release\%(Filename)%(Extension).c" - Document diff --git a/Windows/VisualStudio/embedded.vcxproj.filters b/Windows/VisualStudio/embedded.vcxproj.filters index 3e6a443b4..06eb5e447 100644 --- a/Windows/VisualStudio/embedded.vcxproj.filters +++ b/Windows/VisualStudio/embedded.vcxproj.filters @@ -40,21 +40,9 @@ Shaders - - Shaders - - - Shaders - Shaders - - Shaders - - - Shaders - Shaders diff --git a/Windows/VisualStudio/vkquake.vcxproj b/Windows/VisualStudio/vkquake.vcxproj index 8f3402b82..c9ad2ccfc 100644 --- a/Windows/VisualStudio/vkquake.vcxproj +++ b/Windows/VisualStudio/vkquake.vcxproj @@ -489,22 +489,6 @@ copy "$(SolutionDir)\..\SDL2\lib64\*.dll" "$(TargetDir)" NotUsing NotUsing - - true - true - NotUsing - NotUsing - NotUsing - NotUsing - - - true - true - NotUsing - NotUsing - NotUsing - NotUsing - true true @@ -513,22 +497,6 @@ copy "$(SolutionDir)\..\SDL2\lib64\*.dll" "$(TargetDir)" NotUsing NotUsing - - true - true - NotUsing - NotUsing - NotUsing - NotUsing - - - true - true - NotUsing - NotUsing - NotUsing - NotUsing - true true @@ -737,22 +705,6 @@ copy "$(SolutionDir)\..\SDL2\lib64\*.dll" "$(TargetDir)" NotUsing NotUsing - - true - true - NotUsing - NotUsing - NotUsing - NotUsing - - - true - true - NotUsing - NotUsing - NotUsing - NotUsing - true true @@ -761,22 +713,6 @@ copy "$(SolutionDir)\..\SDL2\lib64\*.dll" "$(TargetDir)" NotUsing NotUsing - - true - true - NotUsing - NotUsing - NotUsing - NotUsing - - - true - true - NotUsing - NotUsing - NotUsing - NotUsing - true true diff --git a/Windows/VisualStudio/vkquake.vcxproj.filters b/Windows/VisualStudio/vkquake.vcxproj.filters index 5781042b0..ca0a9bb99 100644 --- a/Windows/VisualStudio/vkquake.vcxproj.filters +++ b/Windows/VisualStudio/vkquake.vcxproj.filters @@ -319,21 +319,9 @@ Shaders\Debug - - Shaders\Debug - - - Shaders\Debug - Shaders\Debug - - Shaders\Debug - - - Shaders\Debug - Shaders\Debug @@ -400,21 +388,9 @@ Shaders\Release - - Shaders\Release - - - Shaders\Release - Shaders\Release - - Shaders\Release - - - Shaders\Release - Shaders\Release diff --git a/meson.build b/meson.build index ea58d42cb..ab550a63a 100644 --- a/meson.build +++ b/meson.build @@ -15,11 +15,7 @@ shaders = [ 'Shaders/postprocess.frag', 'Shaders/postprocess.vert', 'Shaders/screen_effects_10bit.comp', - 'Shaders/screen_effects_10bit_scale.comp', - 'Shaders/screen_effects_10bit_scale_sops.comp', 'Shaders/screen_effects_8bit.comp', - 'Shaders/screen_effects_8bit_scale.comp', - 'Shaders/screen_effects_8bit_scale_sops.comp', 'Shaders/showtris.frag', 'Shaders/showtris.vert', 'Shaders/sky_box.frag',