[Vulkan] Update glslang to 16.0.0 and introduce compat layer
This commit is contained in:
@@ -17,6 +17,7 @@ project("xenia-gpu-vulkan")
|
||||
})
|
||||
includedirs({
|
||||
project_root.."/third_party/Vulkan-Headers/include",
|
||||
project_root.."/third_party/glslang", -- For glslang SPIRV headers
|
||||
})
|
||||
local_platform_files()
|
||||
files({
|
||||
@@ -60,6 +61,7 @@ if enableMiscSubprojects then
|
||||
})
|
||||
includedirs({
|
||||
project_root.."/third_party/Vulkan-Headers/include",
|
||||
project_root.."/third_party/glslang", -- For glslang SPIRV headers
|
||||
})
|
||||
files({
|
||||
"vulkan_trace_viewer_main.cc",
|
||||
@@ -125,6 +127,7 @@ if enableMiscSubprojects then
|
||||
})
|
||||
includedirs({
|
||||
project_root.."/third_party/Vulkan-Headers/include",
|
||||
project_root.."/third_party/glslang", -- For glslang SPIRV headers
|
||||
})
|
||||
files({
|
||||
"vulkan_trace_dump_main.cc",
|
||||
@@ -153,4 +156,4 @@ if enableMiscSubprojects then
|
||||
"1>scratch/stdout-trace-dump.txt",
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "xenia/gpu/register_file.h"
|
||||
#include "xenia/gpu/registers.h"
|
||||
#include "xenia/gpu/spirv_builder.h"
|
||||
#include "xenia/gpu/spirv_compatibility.h"
|
||||
#include "xenia/gpu/spirv_shader_translator.h"
|
||||
#include "xenia/gpu/vulkan/vulkan_command_processor.h"
|
||||
#include "xenia/gpu/vulkan/vulkan_shader.h"
|
||||
@@ -837,7 +838,7 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
|
||||
(key.user_clip_plane_cull ? key.user_clip_plane_count : 0) +
|
||||
key.has_vertex_kill_and;
|
||||
|
||||
SpirvBuilder builder(spv::Spv_1_0,
|
||||
SpirvBuilder builder(spv::Spv_1_5,
|
||||
(SpirvShaderTranslator::kSpirvMagicToolId << 16) | 1,
|
||||
nullptr);
|
||||
spv::Id ext_inst_glsl_std_450 = builder.import("GLSL.std.450");
|
||||
@@ -955,16 +956,16 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
|
||||
builder.makeStructType(id_vector_temp, "gl_PerVertex");
|
||||
builder.addMemberName(type_struct_in_gl_per_vertex,
|
||||
member_in_gl_per_vertex_position, "gl_Position");
|
||||
builder.addMemberDecoration(type_struct_in_gl_per_vertex,
|
||||
member_in_gl_per_vertex_position,
|
||||
spv::DecorationBuiltIn, spv::BuiltInPosition);
|
||||
builder.addMemberDecoration(
|
||||
type_struct_in_gl_per_vertex, member_in_gl_per_vertex_position,
|
||||
spv::DecorationBuiltIn, static_cast<int>(spv::BuiltIn::Position));
|
||||
if (clip_distance_count) {
|
||||
builder.addMemberName(type_struct_in_gl_per_vertex,
|
||||
member_in_gl_per_vertex_clip_distance,
|
||||
"gl_ClipDistance");
|
||||
builder.addMemberDecoration(
|
||||
type_struct_in_gl_per_vertex, member_in_gl_per_vertex_clip_distance,
|
||||
spv::DecorationBuiltIn, spv::BuiltInClipDistance);
|
||||
spv::DecorationBuiltIn, static_cast<int>(spv::BuiltIn::ClipDistance));
|
||||
}
|
||||
if (cull_distance_count) {
|
||||
builder.addMemberName(type_struct_in_gl_per_vertex,
|
||||
@@ -972,7 +973,7 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
|
||||
"gl_CullDistance");
|
||||
builder.addMemberDecoration(
|
||||
type_struct_in_gl_per_vertex, member_in_gl_per_vertex_cull_distance,
|
||||
spv::DecorationBuiltIn, spv::BuiltInCullDistance);
|
||||
spv::DecorationBuiltIn, static_cast<int>(spv::BuiltIn::CullDistance));
|
||||
}
|
||||
builder.addDecoration(type_struct_in_gl_per_vertex, spv::DecorationBlock);
|
||||
spv::Id type_array_in_gl_per_vertex = builder.makeArrayType(
|
||||
@@ -1063,16 +1064,16 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
|
||||
builder.makeStructType(id_vector_temp, "gl_PerVertex");
|
||||
builder.addMemberName(type_struct_out_gl_per_vertex,
|
||||
member_out_gl_per_vertex_position, "gl_Position");
|
||||
builder.addMemberDecoration(type_struct_out_gl_per_vertex,
|
||||
member_out_gl_per_vertex_position,
|
||||
spv::DecorationBuiltIn, spv::BuiltInPosition);
|
||||
builder.addMemberDecoration(
|
||||
type_struct_out_gl_per_vertex, member_out_gl_per_vertex_position,
|
||||
spv::DecorationBuiltIn, static_cast<int>(spv::BuiltIn::Position));
|
||||
if (clip_distance_count) {
|
||||
builder.addMemberName(type_struct_out_gl_per_vertex,
|
||||
member_out_gl_per_vertex_clip_distance,
|
||||
"gl_ClipDistance");
|
||||
builder.addMemberDecoration(
|
||||
type_struct_out_gl_per_vertex, member_out_gl_per_vertex_clip_distance,
|
||||
spv::DecorationBuiltIn, spv::BuiltInClipDistance);
|
||||
spv::DecorationBuiltIn, static_cast<int>(spv::BuiltIn::ClipDistance));
|
||||
}
|
||||
builder.addDecoration(type_struct_out_gl_per_vertex, spv::DecorationBlock);
|
||||
spv::Id out_gl_per_vertex =
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "xenia/gpu/draw_util.h"
|
||||
#include "xenia/gpu/registers.h"
|
||||
#include "xenia/gpu/spirv_builder.h"
|
||||
#include "xenia/gpu/spirv_compatibility.h"
|
||||
#include "xenia/gpu/spirv_shader_translator.h"
|
||||
#include "xenia/gpu/texture_cache.h"
|
||||
#include "xenia/gpu/vulkan/deferred_command_buffer.h"
|
||||
@@ -2288,8 +2289,7 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
|
||||
|
||||
std::vector<spv::Id> id_vector_temp;
|
||||
std::vector<unsigned int> uint_vector_temp;
|
||||
|
||||
SpirvBuilder builder(spv::Spv_1_0,
|
||||
SpirvBuilder builder(spv::Spv_1_5,
|
||||
(SpirvShaderTranslator::kSpirvMagicToolId << 16) | 1,
|
||||
nullptr);
|
||||
spv::Id ext_inst_glsl_std_450 = builder.import("GLSL.std.450");
|
||||
@@ -2405,7 +2405,7 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
|
||||
builder.createVariable(spv::NoPrecision, spv::StorageClassOutput,
|
||||
type_float, "gl_FragDepth");
|
||||
builder.addDecoration(output_fragment_depth, spv::DecorationBuiltIn,
|
||||
spv::BuiltInFragDepth);
|
||||
static_cast<int>(spv::BuiltIn::FragDepth));
|
||||
main_interface.push_back(output_fragment_depth);
|
||||
if (shader_uses_stencil_reference_output) {
|
||||
builder.addExtension("SPV_EXT_shader_stencil_export");
|
||||
@@ -2413,9 +2413,9 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
|
||||
output_fragment_stencil_ref =
|
||||
builder.createVariable(spv::NoPrecision, spv::StorageClassOutput,
|
||||
type_int, "gl_FragStencilRefARB");
|
||||
builder.addDecoration(output_fragment_stencil_ref,
|
||||
spv::DecorationBuiltIn,
|
||||
spv::BuiltInFragStencilRefEXT);
|
||||
builder.addDecoration(
|
||||
output_fragment_stencil_ref, spv::DecorationBuiltIn,
|
||||
static_cast<int>(spv::BuiltIn::FragStencilRefEXT));
|
||||
main_interface.push_back(output_fragment_stencil_ref);
|
||||
}
|
||||
break;
|
||||
@@ -2603,7 +2603,7 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
|
||||
spv::Id input_fragment_coord = builder.createVariable(
|
||||
spv::NoPrecision, spv::StorageClassInput, type_float4, "gl_FragCoord");
|
||||
builder.addDecoration(input_fragment_coord, spv::DecorationBuiltIn,
|
||||
spv::BuiltInFragCoord);
|
||||
static_cast<int>(spv::BuiltIn::FragCoord));
|
||||
main_interface.push_back(input_fragment_coord);
|
||||
spv::Id input_sample_id = spv::NoResult;
|
||||
spv::Id spec_const_sample_id = spv::NoResult;
|
||||
@@ -2615,7 +2615,7 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
|
||||
spv::NoPrecision, spv::StorageClassInput, type_int, "gl_SampleID");
|
||||
builder.addDecoration(input_sample_id, spv::DecorationFlat);
|
||||
builder.addDecoration(input_sample_id, spv::DecorationBuiltIn,
|
||||
spv::BuiltInSampleId);
|
||||
static_cast<int>(spv::BuiltIn::SampleId));
|
||||
main_interface.push_back(input_sample_id);
|
||||
} else {
|
||||
// One sample per draw, with different sample masks.
|
||||
@@ -5550,7 +5550,7 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
|
||||
|
||||
std::vector<spv::Id> id_vector_temp;
|
||||
|
||||
SpirvBuilder builder(spv::Spv_1_0,
|
||||
SpirvBuilder builder(spv::Spv_1_5,
|
||||
(SpirvShaderTranslator::kSpirvMagicToolId << 16) | 1,
|
||||
nullptr);
|
||||
spv::Id ext_inst_glsl_std_450 = builder.import("GLSL.std.450");
|
||||
@@ -5649,7 +5649,7 @@ VkPipeline VulkanRenderTargetCache::GetDumpPipeline(DumpPipelineKey key) {
|
||||
builder.createVariable(spv::NoPrecision, spv::StorageClassInput,
|
||||
type_uint3, "gl_GlobalInvocationID");
|
||||
builder.addDecoration(input_global_invocation_id, spv::DecorationBuiltIn,
|
||||
spv::BuiltInGlobalInvocationId);
|
||||
static_cast<int>(spv::BuiltIn::GlobalInvocationId));
|
||||
|
||||
// Begin the main function.
|
||||
std::vector<spv::Id> main_param_types;
|
||||
|
||||
Reference in New Issue
Block a user