From b478408dfbe2460af247d25d8589410137345e9c Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Sun, 24 Jul 2016 15:36:41 -0500 Subject: [PATCH] PipelineCache: Better stencil support, and allow null pixel shaders. --- src/xenia/gpu/vulkan/pipeline_cache.cc | 101 +++++++----- src/xenia/gpu/vulkan/pipeline_cache.h | 8 +- src/xenia/gpu/vulkan/shaders/bin/dummy_frag.h | 152 ++++++++++++++++++ .../gpu/vulkan/shaders/bin/dummy_frag.txt | 105 ++++++++++++ src/xenia/gpu/vulkan/shaders/dummy.frag | 31 ++++ 5 files changed, 355 insertions(+), 42 deletions(-) create mode 100644 src/xenia/gpu/vulkan/shaders/bin/dummy_frag.h create mode 100644 src/xenia/gpu/vulkan/shaders/bin/dummy_frag.txt create mode 100644 src/xenia/gpu/vulkan/shaders/dummy.frag diff --git a/src/xenia/gpu/vulkan/pipeline_cache.cc b/src/xenia/gpu/vulkan/pipeline_cache.cc index cce9e0d7f..31831b408 100644 --- a/src/xenia/gpu/vulkan/pipeline_cache.cc +++ b/src/xenia/gpu/vulkan/pipeline_cache.cc @@ -27,6 +27,7 @@ namespace vulkan { using xe::ui::vulkan::CheckResult; // Generated with `xenia-build genspirv`. +#include "xenia/gpu/vulkan/shaders/bin/dummy_frag.h" #include "xenia/gpu/vulkan/shaders/bin/line_quad_list_geom.h" #include "xenia/gpu/vulkan/shaders/bin/point_list_geom.h" #include "xenia/gpu/vulkan/shaders/bin/quad_list_geom.h" @@ -113,6 +114,13 @@ PipelineCache::PipelineCache( err = vkCreateShaderModule(device_, &shader_module_info, nullptr, &geometry_shaders_.rect_list); CheckResult(err, "vkCreateShaderModule"); + shader_module_info.codeSize = static_cast(sizeof(dummy_frag)); + shader_module_info.pCode = reinterpret_cast(dummy_frag); + err = vkCreateShaderModule(device_, &shader_module_info, nullptr, + &dummy_pixel_shader_); + + // We can also use the GLSL translator with a Vulkan dialect. + shader_translator_.reset(new SpirvShaderTranslator()); } PipelineCache::~PipelineCache() { @@ -127,6 +135,7 @@ PipelineCache::~PipelineCache() { vkDestroyShaderModule(device_, geometry_shaders_.point_list, nullptr); vkDestroyShaderModule(device_, geometry_shaders_.quad_list, nullptr); vkDestroyShaderModule(device_, geometry_shaders_.rect_list, nullptr); + vkDestroyShaderModule(device_, dummy_pixel_shader_, nullptr); vkDestroyPipelineLayout(device_, pipeline_layout_, nullptr); vkDestroyPipelineCache(device_, pipeline_cache_, nullptr); @@ -261,9 +270,12 @@ VkPipeline PipelineCache::GetPipeline(const RenderState* render_state, pipeline_info.basePipelineHandle = nullptr; pipeline_info.basePipelineIndex = -1; VkPipeline pipeline = nullptr; - auto err = vkCreateGraphicsPipelines(device_, pipeline_cache_, 1, - &pipeline_info, nullptr, &pipeline); - CheckResult(err, "vkCreateGraphicsPipelines"); + auto result = vkCreateGraphicsPipelines(device_, pipeline_cache_, 1, + &pipeline_info, nullptr, &pipeline); + if (result != VK_SUCCESS) { + XELOGE("vkCreateGraphicsPipelines failed with code %d", result); + return nullptr; + } // Dump shader disassembly. if (FLAGS_vulkan_dump_disasm) { @@ -280,7 +292,7 @@ bool PipelineCache::TranslateShader(VulkanShader* shader, xenos::xe_gpu_program_cntl_t cntl) { // Perform translation. // If this fails the shader will be marked as invalid and ignored later. - if (!shader_translator_.Translate(shader, cntl)) { + if (!shader_translator_->Translate(shader, cntl)) { XELOGE("Shader translation failed; marking shader as ignored"); return false; } @@ -392,6 +404,7 @@ void PipelineCache::DumpShaderDisasmNV( disasm_fp.c_str()); } + vkDestroyPipeline(device_, dummy_pipeline, nullptr); vkDestroyPipelineCache(device_, dummy_pipeline_cache, nullptr); } @@ -529,9 +542,6 @@ bool PipelineCache::SetDynamicState(VkCommandBuffer command_buffer, VkViewport viewport_rect; std::memset(&viewport_rect, 0, sizeof(VkViewport)); - viewport_rect.minDepth = 0; - viewport_rect.maxDepth = 1; - if (vport_xscale_enable) { float texel_offset_x = 0.0f; float texel_offset_y = 0.0f; @@ -549,10 +559,6 @@ bool PipelineCache::SetDynamicState(VkCommandBuffer command_buffer, viewport_rect.y = vpy + texel_offset_y; viewport_rect.width = vpw; viewport_rect.height = vph; - - // TODO(benvanik): depth range adjustment? - // float voz = vport_zoffset_enable ? regs.pa_cl_vport_zoffset : 0; - // float vsz = vport_zscale_enable ? regs.pa_cl_vport_zscale : 1; } else { float texel_offset_x = 0.0f; float texel_offset_y = 0.0f; @@ -569,6 +575,8 @@ bool PipelineCache::SetDynamicState(VkCommandBuffer command_buffer, float vsz = vport_zscale_enable ? regs.pa_cl_vport_zscale : 1; viewport_rect.minDepth = voz; viewport_rect.maxDepth = voz + vsz; + assert_true(viewport_rect.minDepth >= 0 && viewport_rect.minDepth <= 1); + assert_true(viewport_rect.maxDepth >= -1 && viewport_rect.maxDepth <= 1); vkCmdSetViewport(command_buffer, 0, 1, &viewport_rect); } @@ -587,24 +595,25 @@ bool PipelineCache::SetDynamicState(VkCommandBuffer command_buffer, vkCmdSetBlendConstants(command_buffer, regs.rb_blend_rgba); } - if (full_update) { - // VK_DYNAMIC_STATE_LINE_WIDTH - vkCmdSetLineWidth(command_buffer, 1.0f); - - // VK_DYNAMIC_STATE_DEPTH_BIAS - vkCmdSetDepthBias(command_buffer, 0.0f, 0.0f, 0.0f); - - // VK_DYNAMIC_STATE_DEPTH_BOUNDS - vkCmdSetDepthBounds(command_buffer, 0.0f, 1.0f); - - // VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK - vkCmdSetStencilCompareMask(command_buffer, VK_STENCIL_FRONT_AND_BACK, 0); + bool stencil_state_dirty = full_update; + stencil_state_dirty |= + SetShadowRegister(®s.rb_stencilrefmask, XE_GPU_REG_RB_STENCILREFMASK); + if (stencil_state_dirty) { + uint32_t stencil_ref = (regs.rb_stencilrefmask & 0xFF); + uint32_t stencil_read_mask = (regs.rb_stencilrefmask >> 8) & 0xFF; + uint32_t stencil_write_mask = (regs.rb_stencilrefmask >> 16) & 0xFF; // VK_DYNAMIC_STATE_STENCIL_REFERENCE - vkCmdSetStencilReference(command_buffer, VK_STENCIL_FRONT_AND_BACK, 0); + vkCmdSetStencilReference(command_buffer, VK_STENCIL_FRONT_AND_BACK, + stencil_ref); + + // VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK + vkCmdSetStencilCompareMask(command_buffer, VK_STENCIL_FRONT_AND_BACK, + stencil_read_mask); // VK_DYNAMIC_STATE_STENCIL_WRITE_MASK - vkCmdSetStencilWriteMask(command_buffer, VK_STENCIL_FRONT_AND_BACK, 0); + vkCmdSetStencilWriteMask(command_buffer, VK_STENCIL_FRONT_AND_BACK, + stencil_write_mask); } bool push_constants_dirty = full_update || viewport_state_dirty; @@ -676,6 +685,17 @@ bool PipelineCache::SetDynamicState(VkCommandBuffer command_buffer, kSpirvPushConstantsSize, &push_constants); } + if (full_update) { + // VK_DYNAMIC_STATE_LINE_WIDTH + vkCmdSetLineWidth(command_buffer, 1.0f); + + // VK_DYNAMIC_STATE_DEPTH_BIAS + vkCmdSetDepthBias(command_buffer, 0.0f, 0.0f, 0.0f); + + // VK_DYNAMIC_STATE_DEPTH_BOUNDS + vkCmdSetDepthBounds(command_buffer, 0.0f, 1.0f); + } + return true; } @@ -775,7 +795,7 @@ PipelineCache::UpdateStatus PipelineCache::UpdateShaderStages( return UpdateStatus::kError; } - if (!pixel_shader->is_translated() && + if (pixel_shader && !pixel_shader->is_translated() && !TranslateShader(pixel_shader, sq_program_cntl)) { XELOGE("Failed to translate the pixel shader!"); return UpdateStatus::kError; @@ -822,7 +842,8 @@ PipelineCache::UpdateStatus PipelineCache::UpdateShaderStages( pixel_pipeline_stage.pNext = nullptr; pixel_pipeline_stage.flags = 0; pixel_pipeline_stage.stage = VK_SHADER_STAGE_FRAGMENT_BIT; - pixel_pipeline_stage.module = pixel_shader->shader_module(); + pixel_pipeline_stage.module = + pixel_shader ? pixel_shader->shader_module() : dummy_pixel_shader_; pixel_pipeline_stage.pName = "main"; pixel_pipeline_stage.pSpecializationInfo = nullptr; @@ -1051,6 +1072,7 @@ PipelineCache::UpdateStatus PipelineCache::UpdateRasterizationState( bool dirty = false; dirty |= regs.primitive_type != primitive_type; + dirty |= SetShadowRegister(®s.pa_cl_clip_cntl, XE_GPU_REG_PA_CL_CLIP_CNTL); dirty |= SetShadowRegister(®s.pa_su_sc_mode_cntl, XE_GPU_REG_PA_SU_SC_MODE_CNTL); dirty |= SetShadowRegister(®s.pa_sc_screen_scissor_tl, @@ -1070,14 +1092,14 @@ PipelineCache::UpdateStatus PipelineCache::UpdateRasterizationState( state_info.pNext = nullptr; state_info.flags = 0; - // TODO(benvanik): right setting? - state_info.depthClampEnable = VK_FALSE; - state_info.rasterizerDiscardEnable = VK_FALSE; + // ZCLIP_NEAR_DISABLE + // state_info.depthClampEnable = !(regs.pa_cl_clip_cntl & (1 << 26)); + // RASTERIZER_DISABLE + // state_info.rasterizerDiscardEnable = !!(regs.pa_cl_clip_cntl & (1 << 22)); - // KILL_PIX_POST_EARLY_Z - if (regs.pa_sc_viz_query & 0x80) { - state_info.rasterizerDiscardEnable = VK_TRUE; - } + // CLIP_DISABLE + state_info.depthClampEnable = !!(regs.pa_cl_clip_cntl & (1 << 16)); + state_info.rasterizerDiscardEnable = VK_FALSE; bool poly_mode = ((regs.pa_su_sc_mode_cntl >> 3) & 0x3) != 0; if (poly_mode) { @@ -1213,11 +1235,11 @@ PipelineCache::UpdateStatus PipelineCache::UpdateDepthStencilState() { /* 0 */ VK_STENCIL_OP_KEEP, /* 1 */ VK_STENCIL_OP_ZERO, /* 2 */ VK_STENCIL_OP_REPLACE, - /* 3 */ VK_STENCIL_OP_INCREMENT_AND_WRAP, - /* 4 */ VK_STENCIL_OP_DECREMENT_AND_WRAP, + /* 3 */ VK_STENCIL_OP_INCREMENT_AND_CLAMP, + /* 4 */ VK_STENCIL_OP_DECREMENT_AND_CLAMP, /* 5 */ VK_STENCIL_OP_INVERT, - /* 6 */ VK_STENCIL_OP_INCREMENT_AND_CLAMP, - /* 7 */ VK_STENCIL_OP_DECREMENT_AND_CLAMP, + /* 6 */ VK_STENCIL_OP_INCREMENT_AND_WRAP, + /* 7 */ VK_STENCIL_OP_DECREMENT_AND_WRAP, }; // Depth state @@ -1230,9 +1252,6 @@ PipelineCache::UpdateStatus PipelineCache::UpdateDepthStencilState() { compare_func_map[(regs.rb_depthcontrol >> 4) & 0x7]; state_info.depthBoundsTestEnable = VK_FALSE; - uint32_t stencil_ref = (regs.rb_stencilrefmask & 0x000000FF); - uint32_t stencil_read_mask = (regs.rb_stencilrefmask & 0x0000FF00) >> 8; - // Stencil state state_info.front.compareOp = compare_func_map[(regs.rb_depthcontrol >> 8) & 0x7]; diff --git a/src/xenia/gpu/vulkan/pipeline_cache.h b/src/xenia/gpu/vulkan/pipeline_cache.h index 49144f50f..d359dd0cc 100644 --- a/src/xenia/gpu/vulkan/pipeline_cache.h +++ b/src/xenia/gpu/vulkan/pipeline_cache.h @@ -14,6 +14,7 @@ #include "third_party/xxhash/xxhash.h" +#include "xenia/gpu/glsl_shader_translator.h" #include "xenia/gpu/register_file.h" #include "xenia/gpu/spirv_shader_translator.h" #include "xenia/gpu/vulkan/render_cache.h" @@ -87,7 +88,7 @@ class PipelineCache { VkDevice device_ = nullptr; // Reusable shader translator. - SpirvShaderTranslator shader_translator_; + std::unique_ptr shader_translator_ = nullptr; // Disassembler used to get the SPIRV disasm. Only used in debug. xe::ui::spirv::SpirvDisassembler disassembler_; // All loaded shaders mapped by their guest hash key. @@ -108,6 +109,9 @@ class PipelineCache { VkShaderModule rect_list; } geometry_shaders_; + // Shared dummy pixel shader. + VkShaderModule dummy_pixel_shader_; + // Hash state used to incrementally produce pipeline hashes during update. // By the time the full update pass has run the hash will represent the // current state in a way that can uniquely identify the produced VkPipeline. @@ -211,6 +215,7 @@ class PipelineCache { struct UpdateRasterizationStateRegisters { PrimitiveType primitive_type; + uint32_t pa_cl_clip_cntl; uint32_t pa_su_sc_mode_cntl; uint32_t pa_sc_screen_scissor_tl; uint32_t pa_sc_screen_scissor_br; @@ -270,6 +275,7 @@ class PipelineCache { float pa_cl_vport_zscale; float rb_blend_rgba[4]; + uint32_t rb_stencilrefmask; uint32_t sq_program_cntl; uint32_t sq_context_misc; diff --git a/src/xenia/gpu/vulkan/shaders/bin/dummy_frag.h b/src/xenia/gpu/vulkan/shaders/bin/dummy_frag.h new file mode 100644 index 000000000..4979148f4 --- /dev/null +++ b/src/xenia/gpu/vulkan/shaders/bin/dummy_frag.h @@ -0,0 +1,152 @@ +// generated from `xb genspirv` +// source: dummy.frag +const uint8_t dummy_frag[] = { + 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, + 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x2B, 0x00, 0x00, 0x00, + 0x0B, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4C, 0x53, 0x4C, + 0x2E, 0x73, 0x74, 0x64, 0x2E, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0F, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x6D, 0x61, 0x69, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x2F, 0x00, 0x00, 0x00, + 0x33, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, + 0xC2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x6D, 0x61, 0x69, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x73, 0x5F, 0x74, + 0x79, 0x70, 0x65, 0x00, 0x06, 0x00, 0x07, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x66, 0x6C, 0x6F, 0x61, 0x74, 0x5F, 0x63, 0x6F, + 0x6E, 0x73, 0x74, 0x73, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6C, 0x6F, 0x6F, 0x70, + 0x5F, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x73, 0x00, 0x06, 0x00, 0x06, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x62, 0x6F, 0x6F, 0x6C, + 0x5F, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x73, 0x00, 0x05, 0x00, 0x04, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x73, 0x00, 0x00, + 0x05, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x70, 0x75, 0x73, 0x68, + 0x5F, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x73, 0x5F, 0x74, 0x79, 0x70, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x77, 0x69, 0x6E, 0x64, 0x6F, 0x77, 0x5F, 0x73, + 0x63, 0x61, 0x6C, 0x65, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x74, 0x78, 0x5F, + 0x66, 0x6D, 0x74, 0x00, 0x06, 0x00, 0x06, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x5F, 0x74, 0x65, + 0x73, 0x74, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5F, 0x70, 0x61, 0x72, 0x61, 0x6D, + 0x5F, 0x67, 0x65, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, + 0x15, 0x00, 0x00, 0x00, 0x70, 0x75, 0x73, 0x68, 0x5F, 0x63, 0x6F, 0x6E, + 0x73, 0x74, 0x61, 0x6E, 0x74, 0x73, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, + 0x1A, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x73, + 0x31, 0x44, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x1F, 0x00, 0x00, 0x00, + 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x73, 0x32, 0x44, 0x00, 0x00, + 0x05, 0x00, 0x05, 0x00, 0x24, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x74, + 0x75, 0x72, 0x65, 0x73, 0x33, 0x44, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x73, + 0x34, 0x44, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x2F, 0x00, 0x00, 0x00, + 0x69, 0x6E, 0x5F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x70, 0x6F, 0x6C, 0x61, + 0x74, 0x6F, 0x72, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, + 0x33, 0x00, 0x00, 0x00, 0x6F, 0x43, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, + 0x0B, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x47, 0x00, 0x04, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x0F, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + 0x48, 0x00, 0x05, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x47, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x48, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x47, 0x00, 0x03, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x47, 0x00, 0x04, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1A, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, + 0x1F, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x47, 0x00, 0x04, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x47, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, + 0x2F, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x47, 0x00, 0x04, 0x00, 0x33, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x04, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x1C, 0x00, 0x04, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x0A, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x0C, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x04, 0x00, + 0x0D, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x2B, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x04, 0x00, 0x0F, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x05, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, + 0x0F, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x3B, 0x00, 0x04, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x1E, 0x00, 0x06, 0x00, 0x13, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x3B, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x15, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x03, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x04, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x04, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x3B, 0x00, 0x04, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, + 0x1B, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x03, 0x00, + 0x1C, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x04, 0x00, + 0x1D, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x04, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1D, 0x00, 0x00, 0x00, 0x3B, 0x00, 0x04, 0x00, 0x1E, 0x00, 0x00, 0x00, + 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x03, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x04, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x3B, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x03, 0x00, + 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x04, 0x00, + 0x27, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x27, 0x00, 0x00, 0x00, 0x3B, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x04, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x1C, 0x00, 0x04, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x2A, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x04, 0x00, + 0x2D, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x04, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x2D, 0x00, 0x00, 0x00, 0x3B, 0x00, 0x04, 0x00, 0x2E, 0x00, 0x00, 0x00, + 0x2F, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x04, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x1C, 0x00, 0x04, 0x00, 0x31, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x30, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x32, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x3B, 0x00, 0x04, 0x00, + 0x32, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x02, 0x00, + 0x05, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, +}; diff --git a/src/xenia/gpu/vulkan/shaders/bin/dummy_frag.txt b/src/xenia/gpu/vulkan/shaders/bin/dummy_frag.txt new file mode 100644 index 000000000..87e4a97e3 --- /dev/null +++ b/src/xenia/gpu/vulkan/shaders/bin/dummy_frag.txt @@ -0,0 +1,105 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 1 +; Bound: 52 +; Schema: 0 + OpCapability Shader + OpCapability Sampled1D + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %47 %51 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 450 + OpName %4 "main" + OpName %16 "consts_type" + OpMemberName %16 0 "float_consts" + OpMemberName %16 1 "loop_consts" + OpMemberName %16 2 "bool_consts" + OpName %18 "consts" + OpName %19 "push_consts_type" + OpMemberName %19 0 "window_scale" + OpMemberName %19 1 "vtx_fmt" + OpMemberName %19 2 "alpha_test" + OpMemberName %19 3 "ps_param_gen" + OpName %21 "push_constants" + OpName %26 "textures1D" + OpName %31 "textures2D" + OpName %36 "textures3D" + OpName %41 "textures4D" + OpName %47 "in_interpolators" + OpName %51 "oC" + OpDecorate %11 ArrayStride 16 + OpDecorate %13 ArrayStride 16 + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %16 0 Offset 0 + OpMemberDecorate %16 1 Offset 8192 + OpMemberDecorate %16 2 Offset 8704 + OpDecorate %16 Block + OpDecorate %18 DescriptorSet 0 + OpDecorate %18 Binding 1 + OpMemberDecorate %19 0 Offset 0 + OpMemberDecorate %19 1 Offset 16 + OpMemberDecorate %19 2 Offset 32 + OpMemberDecorate %19 3 Offset 48 + OpDecorate %19 Block + OpDecorate %26 DescriptorSet 1 + OpDecorate %26 Binding 0 + OpDecorate %31 DescriptorSet 1 + OpDecorate %31 Binding 1 + OpDecorate %36 DescriptorSet 1 + OpDecorate %36 Binding 2 + OpDecorate %41 DescriptorSet 1 + OpDecorate %41 Binding 3 + OpDecorate %47 Location 0 + OpDecorate %51 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %7 = OpTypeFloat 32 + %8 = OpTypeVector %7 4 + %9 = OpTypeInt 32 0 + %10 = OpConstant %9 512 + %11 = OpTypeArray %8 %10 + %12 = OpConstant %9 32 + %13 = OpTypeArray %9 %12 + %14 = OpConstant %9 8 + %15 = OpTypeArray %9 %14 + %16 = OpTypeStruct %11 %13 %15 + %17 = OpTypePointer Uniform %16 + %18 = OpVariable %17 Uniform + %19 = OpTypeStruct %8 %8 %8 %9 + %20 = OpTypePointer PushConstant %19 + %21 = OpVariable %20 PushConstant + %22 = OpTypeImage %7 1D 0 0 0 1 Unknown + %23 = OpTypeSampledImage %22 + %24 = OpTypeArray %23 %12 + %25 = OpTypePointer UniformConstant %24 + %26 = OpVariable %25 UniformConstant + %27 = OpTypeImage %7 2D 0 0 0 1 Unknown + %28 = OpTypeSampledImage %27 + %29 = OpTypeArray %28 %12 + %30 = OpTypePointer UniformConstant %29 + %31 = OpVariable %30 UniformConstant + %32 = OpTypeImage %7 3D 0 0 0 1 Unknown + %33 = OpTypeSampledImage %32 + %34 = OpTypeArray %33 %12 + %35 = OpTypePointer UniformConstant %34 + %36 = OpVariable %35 UniformConstant + %37 = OpTypeImage %7 Cube 0 0 0 1 Unknown + %38 = OpTypeSampledImage %37 + %39 = OpTypeArray %38 %12 + %40 = OpTypePointer UniformConstant %39 + %41 = OpVariable %40 UniformConstant + %42 = OpConstant %9 16 + %43 = OpTypeArray %8 %42 + %44 = OpConstant %9 1 + %45 = OpTypeArray %43 %44 + %46 = OpTypePointer Input %45 + %47 = OpVariable %46 Input + %48 = OpConstant %9 4 + %49 = OpTypeArray %8 %48 + %50 = OpTypePointer Output %49 + %51 = OpVariable %50 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd diff --git a/src/xenia/gpu/vulkan/shaders/dummy.frag b/src/xenia/gpu/vulkan/shaders/dummy.frag new file mode 100644 index 000000000..eeeef3804 --- /dev/null +++ b/src/xenia/gpu/vulkan/shaders/dummy.frag @@ -0,0 +1,31 @@ +// NOTE: This file is compiled and embedded into the exe. +// Use `xenia-build genspirv` and check in any changes under bin/. + +#version 450 core +#extension all : warn + +layout(set = 0, binding = 1) uniform consts_type { + vec4 float_consts[512]; + uint loop_consts[32]; + uint bool_consts[8]; +} consts; + +layout(push_constant) uniform push_consts_type { + vec4 window_scale; + vec4 vtx_fmt; + vec4 alpha_test; + uint ps_param_gen; +} push_constants; + +layout(set = 1, binding = 0) uniform sampler1D textures1D[32]; +layout(set = 1, binding = 1) uniform sampler2D textures2D[32]; +layout(set = 1, binding = 2) uniform sampler3D textures3D[32]; +layout(set = 1, binding = 3) uniform samplerCube textures4D[32]; + +layout(location = 0) in vec4 in_interpolators[][16]; +layout(location = 0) out vec4 oC[4]; + +void main() { + // This shader does absolutely nothing! + return; +} \ No newline at end of file