diff --git a/src/xenia/gpu/shaders/adaptive_quad.hs.glsl b/src/xenia/gpu/shaders/adaptive_quad.hs.glsl new file mode 100644 index 000000000..6cb5fb44d --- /dev/null +++ b/src/xenia/gpu/shaders/adaptive_quad.hs.glsl @@ -0,0 +1,68 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Tessellation control shader for adaptive quad tessellation. +// Edge factors come from the vertex shader (read from the index buffer). +// Uses fractional_even spacing for smooth tessellation. + +layout(vertices = 1) out; + +#include "xenos_draw.glsli" + +// Input from vertex shader - edge tessellation factor (already processed: +// 1.0 added and clamped to range in the vertex shader). +layout(location = 0) in float in_edge_factor[]; + +// Output to tessellation evaluation shader - patch index as float. +layout(location = 0) out float out_index[]; + +void main() { + // 1.0 added to the factors according to the images in + // https://www.slideshare.net/blackdevilvikas/next-generation-graphics-programming-on-xbox-360 + // (fractional_even also requires a factor of at least 2.0), to the min/max it + // has already been added on the CPU. + + // Vulkan/OpenGL (goes in a direction along the perimeter): + // [0] - between U0V1 and U0V0. + // [1] - between U0V0 and U1V0. + // [2] - between U1V0 and U1V1. + // [3] - between U1V1 and U0V1. + // + // Xbox 360 factors go along the perimeter too according to the example of + // edge factors in Next Generation Graphics Programming on Xbox 360. + // However, if v0->v1... that seems to be working for triangle patches applies + // here too, with the swizzle Xenia uses in domain shaders: + // [0] - between U0V0 and U1V0. + // [1] - between U1V0 and U1V1. + // [2] - between U1V1 and U0V1. + // [3] - between U0V1 and U0V0. + gl_TessLevelOuter[0] = in_edge_factor[3]; + gl_TessLevelOuter[1] = in_edge_factor[0]; + gl_TessLevelOuter[2] = in_edge_factor[1]; + gl_TessLevelOuter[3] = in_edge_factor[2]; + + // On the Xbox 360, according to the presentation, the inside factor is the + // minimum of the factors of the edges along the axis. + // Vulkan/OpenGL: + // [0] - along U. + // [1] - along V. + gl_TessLevelInner[0] = min(gl_TessLevelOuter[1], gl_TessLevelOuter[3]); + gl_TessLevelInner[1] = min(gl_TessLevelOuter[0], gl_TessLevelOuter[2]); + + // Output the patch index. + // Only the lower 24 bits of the vertex index are used (tested on an Adreno + // 200 phone). `((index & 0xFFFFFF) + offset) & 0xFFFFFF` is the same as + // `(index + offset) & 0xFFFFFF`. + out_index[gl_InvocationID] = + float(clamp((gl_PrimitiveID + xe_vertex_index_offset) & 0xFFFFFFu, + xe_vertex_index_min_max.x, xe_vertex_index_min_max.y)); +} diff --git a/src/xenia/gpu/shaders/adaptive_triangle.hs.glsl b/src/xenia/gpu/shaders/adaptive_triangle.hs.glsl new file mode 100644 index 000000000..9db4018e8 --- /dev/null +++ b/src/xenia/gpu/shaders/adaptive_triangle.hs.glsl @@ -0,0 +1,71 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Tessellation control shader for adaptive triangle tessellation. +// Edge factors come from the vertex shader (read from the index buffer). +// Uses fractional_even spacing for smooth tessellation. + +layout(vertices = 1) out; + +#include "xenos_draw.glsli" + +// Input from vertex shader - edge tessellation factor (already processed: +// 1.0 added and clamped to range in the vertex shader). +layout(location = 0) in float in_edge_factor[]; + +// Output to tessellation evaluation shader - patch index as float. +layout(location = 0) out float out_index[]; + +void main() { + // Factors for adaptive tessellation are taken from the index buffer. + // + // 1.0 added to the factors according to the images in + // https://www.slideshare.net/blackdevilvikas/next-generation-graphics-programming-on-xbox-360 + // (fractional_even also requires a factor of at least 2.0), to the min/max it + // has already been added on the CPU. + + // It appears that on the Xbox 360: + // - [0] is the factor for the v0->v1 edge. + // - [1] is the factor for the v1->v2 edge. + // - [2] is the factor for the v2->v0 edge. + // Where v0 is the U1V0W0 vertex, v1 is the U0V1W0 vertex, and v2 is the + // U0V0W1 vertex. + // The hint at the order was provided in the Code Listing 15 of: + // http://www.uraldev.ru/files/download/21/Real-Time_Tessellation_on_GPU.pdf + // + // In Vulkan/OpenGL: + // - gl_TessLevelOuter[0] is the factor for the U0 edge (v1->v2). + // - gl_TessLevelOuter[1] is the factor for the V0 edge (v2->v0). + // - gl_TessLevelOuter[2] is the factor for the W0 edge (v0->v1). + // + // In Xenia's domain shaders, the barycentric coordinates are handled as: + // 1) gl_TessCoord.xyz -> r0.zyx by Xenia. + // 2) r0.zyx -> r0.zyx by the guest (because r1.y is set to 0 by Xenia, which + // apparently means identity swizzle to games). + // 3) r0.z * v0 + r0.y * v1 + r0.x * v2 by the guest. + // With this order, there are no cracks in 4D5307E6 water. + gl_TessLevelOuter[0] = in_edge_factor[1]; // v1->v2 edge + gl_TessLevelOuter[1] = in_edge_factor[2]; // v2->v0 edge + gl_TessLevelOuter[2] = in_edge_factor[0]; // v0->v1 edge + + // Inside factor is the minimum of edge factors. + gl_TessLevelInner[0] = min(min(gl_TessLevelOuter[0], gl_TessLevelOuter[1]), + gl_TessLevelOuter[2]); + + // Output the patch index. + // Only the lower 24 bits of the vertex index are used (tested on an Adreno + // 200 phone). `((index & 0xFFFFFF) + offset) & 0xFFFFFF` is the same as + // `(index + offset) & 0xFFFFFF`. + out_index[gl_InvocationID] = + float(clamp((gl_PrimitiveID + xe_vertex_index_offset) & 0xFFFFFFu, + xe_vertex_index_min_max.x, xe_vertex_index_min_max.y)); +} diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/adaptive_quad_hs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/adaptive_quad_hs.h new file mode 100644 index 000000000..21c611c0c --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/adaptive_quad_hs.h @@ -0,0 +1,191 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 24500 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %5663 "main" %gl_TessLevelOuter %4243 %gl_TessLevelInner %3307 %gl_InvocationID %gl_PrimitiveID + OpExecutionMode %5663 OutputVertices 1 + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %4243 Location 0 + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelInner Patch + OpDecorate %3307 Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %gl_PrimitiveID BuiltIn PrimitiveId + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_32 = OpConstant %uint 32 +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %4243 = OpVariable %_ptr_Input__arr_float_uint_32 Input + %int_3 = OpConstant %int 3 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Output__arr_float_uint_1 = OpTypePointer Output %_arr_float_uint_1 + %3307 = OpVariable %_ptr_Output__arr_float_uint_1 Output +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%gl_PrimitiveID = OpVariable %_ptr_Input_int Input + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%uint_16777215 = OpConstant %uint 16777215 + %int_4 = OpConstant %int 4 + %uint_0 = OpConstant %uint 0 + %5663 = OpFunction %void None %1282 + %23915 = OpLabel + %7129 = OpAccessChain %_ptr_Input_float %4243 %int_3 + %15646 = OpLoad %float %7129 + %19981 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %19981 %15646 + %19905 = OpAccessChain %_ptr_Input_float %4243 %int_0 + %7391 = OpLoad %float %19905 + %19982 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %19982 %7391 + %19906 = OpAccessChain %_ptr_Input_float %4243 %int_1 + %7392 = OpLoad %float %19906 + %19983 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %19983 %7392 + %19907 = OpAccessChain %_ptr_Input_float %4243 %int_2 + %7393 = OpLoad %float %19907 + %19908 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %19908 %7393 + %13565 = OpLoad %float %19982 + %12692 = OpLoad %float %19908 + %7944 = OpExtInst %float %1 FMin %13565 %12692 + %14721 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %14721 %7944 + %13566 = OpLoad %float %19981 + %12693 = OpLoad %float %19983 + %7945 = OpExtInst %float %1 FMin %13566 %12693 + %14722 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %14722 %7945 + %15656 = OpLoad %int %gl_InvocationID + %23765 = OpLoad %int %gl_PrimitiveID + %9548 = OpBitcast %uint %23765 + %7395 = OpAccessChain %_ptr_Uniform_uint %4930 %int_3 + %22970 = OpLoad %uint %7395 + %7652 = OpIAdd %uint %9548 %22970 + %18847 = OpBitwiseAnd %uint %7652 %uint_16777215 + %10702 = OpAccessChain %_ptr_Uniform_uint %4930 %int_4 %uint_0 + %24236 = OpLoad %uint %10702 + %19191 = OpAccessChain %_ptr_Uniform_uint %4930 %int_4 %uint_1 + %22108 = OpLoad %uint %19191 + %23780 = OpExtInst %uint %1 UClamp %18847 %24236 %22108 + %24499 = OpConvertUToF %float %23780 + %12694 = OpAccessChain %_ptr_Output_float %3307 %15656 + OpStore %12694 %24499 + OpReturn + OpFunctionEnd +#endif + +const uint32_t adaptive_quad_hs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x00005FB4, 0x00000000, 0x00020011, + 0x00000003, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x000B000F, 0x00000001, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00001548, 0x00001093, 0x00000CDA, + 0x00000CEB, 0x000011E9, 0x000014CB, 0x00040010, 0x0000161F, 0x0000001A, + 0x00000001, 0x00040047, 0x00001548, 0x0000000B, 0x0000000B, 0x00030047, + 0x00001548, 0x0000000F, 0x00040047, 0x00001093, 0x0000001E, 0x00000000, + 0x00040047, 0x00000CDA, 0x0000000B, 0x0000000C, 0x00030047, 0x00000CDA, + 0x0000000F, 0x00040047, 0x00000CEB, 0x0000001E, 0x00000000, 0x00040047, + 0x000011E9, 0x0000000B, 0x00000008, 0x00040047, 0x000014CB, 0x0000000B, + 0x00000007, 0x00030047, 0x00000457, 0x00000002, 0x00050048, 0x00000457, + 0x00000000, 0x00000023, 0x00000000, 0x00050048, 0x00000457, 0x00000001, + 0x00000023, 0x00000008, 0x00050048, 0x00000457, 0x00000002, 0x00000023, + 0x00000010, 0x00050048, 0x00000457, 0x00000003, 0x00000023, 0x00000014, + 0x00050048, 0x00000457, 0x00000004, 0x00000023, 0x00000018, 0x00040047, + 0x00001342, 0x00000021, 0x00000006, 0x00040047, 0x00001342, 0x00000022, + 0x00000001, 0x00020013, 0x00000008, 0x00030021, 0x00000502, 0x00000008, + 0x00030016, 0x0000000D, 0x00000020, 0x00040015, 0x0000000B, 0x00000020, + 0x00000000, 0x0004002B, 0x0000000B, 0x00000A16, 0x00000004, 0x0004001C, + 0x00000225, 0x0000000D, 0x00000A16, 0x00040020, 0x000004A2, 0x00000003, + 0x00000225, 0x0004003B, 0x000004A2, 0x00001548, 0x00000003, 0x00040015, + 0x0000000C, 0x00000020, 0x00000001, 0x0004002B, 0x0000000C, 0x00000A0B, + 0x00000000, 0x0004002B, 0x0000000B, 0x00000A6A, 0x00000020, 0x0004001C, + 0x00000243, 0x0000000D, 0x00000A6A, 0x00040020, 0x000004C0, 0x00000001, + 0x00000243, 0x0004003B, 0x000004C0, 0x00001093, 0x00000001, 0x0004002B, + 0x0000000C, 0x00000A14, 0x00000003, 0x00040020, 0x0000028A, 0x00000001, + 0x0000000D, 0x00040020, 0x0000028B, 0x00000003, 0x0000000D, 0x0004002B, + 0x0000000C, 0x00000A0E, 0x00000001, 0x0004002B, 0x0000000C, 0x00000A11, + 0x00000002, 0x0004002B, 0x0000000B, 0x00000A10, 0x00000002, 0x0004001C, + 0x000002AC, 0x0000000D, 0x00000A10, 0x00040020, 0x00000529, 0x00000003, + 0x000002AC, 0x0004003B, 0x00000529, 0x00000CDA, 0x00000003, 0x0004002B, + 0x0000000B, 0x00000A0D, 0x00000001, 0x0004001C, 0x000002FC, 0x0000000D, + 0x00000A0D, 0x00040020, 0x00000579, 0x00000003, 0x000002FC, 0x0004003B, + 0x00000579, 0x00000CEB, 0x00000003, 0x00040020, 0x00000289, 0x00000001, + 0x0000000C, 0x0004003B, 0x00000289, 0x000011E9, 0x00000001, 0x0004003B, + 0x00000289, 0x000014CB, 0x00000001, 0x00040017, 0x00000013, 0x0000000D, + 0x00000002, 0x00040017, 0x00000011, 0x0000000B, 0x00000002, 0x0007001E, + 0x00000457, 0x00000013, 0x00000013, 0x0000000B, 0x0000000B, 0x00000011, + 0x00040020, 0x000006D4, 0x00000002, 0x00000457, 0x0004003B, 0x000006D4, + 0x00001342, 0x00000002, 0x00040020, 0x00000288, 0x00000002, 0x0000000B, + 0x0004002B, 0x0000000B, 0x00000923, 0x00FFFFFF, 0x0004002B, 0x0000000C, + 0x00000A17, 0x00000004, 0x0004002B, 0x0000000B, 0x00000A0A, 0x00000000, + 0x00050036, 0x00000008, 0x0000161F, 0x00000000, 0x00000502, 0x000200F8, + 0x00005D6B, 0x00050041, 0x0000028A, 0x00001BD9, 0x00001093, 0x00000A14, + 0x0004003D, 0x0000000D, 0x00003D1E, 0x00001BD9, 0x00050041, 0x0000028B, + 0x00004E0D, 0x00001548, 0x00000A0B, 0x0003003E, 0x00004E0D, 0x00003D1E, + 0x00050041, 0x0000028A, 0x00004DC1, 0x00001093, 0x00000A0B, 0x0004003D, + 0x0000000D, 0x00001CDF, 0x00004DC1, 0x00050041, 0x0000028B, 0x00004E0E, + 0x00001548, 0x00000A0E, 0x0003003E, 0x00004E0E, 0x00001CDF, 0x00050041, + 0x0000028A, 0x00004DC2, 0x00001093, 0x00000A0E, 0x0004003D, 0x0000000D, + 0x00001CE0, 0x00004DC2, 0x00050041, 0x0000028B, 0x00004E0F, 0x00001548, + 0x00000A11, 0x0003003E, 0x00004E0F, 0x00001CE0, 0x00050041, 0x0000028A, + 0x00004DC3, 0x00001093, 0x00000A11, 0x0004003D, 0x0000000D, 0x00001CE1, + 0x00004DC3, 0x00050041, 0x0000028B, 0x00004DC4, 0x00001548, 0x00000A14, + 0x0003003E, 0x00004DC4, 0x00001CE1, 0x0004003D, 0x0000000D, 0x000034FD, + 0x00004E0E, 0x0004003D, 0x0000000D, 0x00003194, 0x00004DC4, 0x0007000C, + 0x0000000D, 0x00001F08, 0x00000001, 0x00000025, 0x000034FD, 0x00003194, + 0x00050041, 0x0000028B, 0x00003981, 0x00000CDA, 0x00000A0B, 0x0003003E, + 0x00003981, 0x00001F08, 0x0004003D, 0x0000000D, 0x000034FE, 0x00004E0D, + 0x0004003D, 0x0000000D, 0x00003195, 0x00004E0F, 0x0007000C, 0x0000000D, + 0x00001F09, 0x00000001, 0x00000025, 0x000034FE, 0x00003195, 0x00050041, + 0x0000028B, 0x00003982, 0x00000CDA, 0x00000A0E, 0x0003003E, 0x00003982, + 0x00001F09, 0x0004003D, 0x0000000C, 0x00003D28, 0x000011E9, 0x0004003D, + 0x0000000C, 0x00005CD5, 0x000014CB, 0x0004007C, 0x0000000B, 0x0000254C, + 0x00005CD5, 0x00050041, 0x00000288, 0x00001CE3, 0x00001342, 0x00000A14, + 0x0004003D, 0x0000000B, 0x000059BA, 0x00001CE3, 0x00050080, 0x0000000B, + 0x00001DE4, 0x0000254C, 0x000059BA, 0x000500C7, 0x0000000B, 0x0000499F, + 0x00001DE4, 0x00000923, 0x00060041, 0x00000288, 0x000029CE, 0x00001342, + 0x00000A17, 0x00000A0A, 0x0004003D, 0x0000000B, 0x00005EAC, 0x000029CE, + 0x00060041, 0x00000288, 0x00004AF7, 0x00001342, 0x00000A17, 0x00000A0D, + 0x0004003D, 0x0000000B, 0x0000565C, 0x00004AF7, 0x0008000C, 0x0000000B, + 0x00005CE4, 0x00000001, 0x0000002C, 0x0000499F, 0x00005EAC, 0x0000565C, + 0x00040070, 0x0000000D, 0x00005FB3, 0x00005CE4, 0x00050041, 0x0000028B, + 0x00003196, 0x00000CEB, 0x00003D28, 0x0003003E, 0x00003196, 0x00005FB3, + 0x000100FD, 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/adaptive_triangle_hs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/adaptive_triangle_hs.h new file mode 100644 index 000000000..8ea48e285 --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/adaptive_triangle_hs.h @@ -0,0 +1,179 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 24500 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %5663 "main" %gl_TessLevelOuter %4243 %gl_TessLevelInner %3307 %gl_InvocationID %gl_PrimitiveID + OpExecutionMode %5663 OutputVertices 1 + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %4243 Location 0 + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelInner Patch + OpDecorate %3307 Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %gl_PrimitiveID BuiltIn PrimitiveId + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %uint_32 = OpConstant %uint 32 +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %4243 = OpVariable %_ptr_Input__arr_float_uint_32 Input + %int_1 = OpConstant %int 1 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float + %int_2 = OpConstant %int 2 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Output__arr_float_uint_1 = OpTypePointer Output %_arr_float_uint_1 + %3307 = OpVariable %_ptr_Output__arr_float_uint_1 Output +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input +%gl_PrimitiveID = OpVariable %_ptr_Input_int Input + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform + %int_3 = OpConstant %int 3 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%uint_16777215 = OpConstant %uint 16777215 + %int_4 = OpConstant %int 4 + %uint_0 = OpConstant %uint 0 + %5663 = OpFunction %void None %1282 + %23915 = OpLabel + %7129 = OpAccessChain %_ptr_Input_float %4243 %int_1 + %15646 = OpLoad %float %7129 + %19981 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %19981 %15646 + %19905 = OpAccessChain %_ptr_Input_float %4243 %int_2 + %7391 = OpLoad %float %19905 + %19982 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %19982 %7391 + %19906 = OpAccessChain %_ptr_Input_float %4243 %int_0 + %7392 = OpLoad %float %19906 + %19907 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %19907 %7392 + %13565 = OpLoad %float %19981 + %12616 = OpLoad %float %19982 + %7723 = OpExtInst %float %1 FMin %13565 %12616 + %6699 = OpLoad %float %19907 + %21028 = OpExtInst %float %1 FMin %7723 %6699 + %14721 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %14721 %21028 + %15656 = OpLoad %int %gl_InvocationID + %23765 = OpLoad %int %gl_PrimitiveID + %9548 = OpBitcast %uint %23765 + %7395 = OpAccessChain %_ptr_Uniform_uint %4930 %int_3 + %22970 = OpLoad %uint %7395 + %7652 = OpIAdd %uint %9548 %22970 + %18847 = OpBitwiseAnd %uint %7652 %uint_16777215 + %10702 = OpAccessChain %_ptr_Uniform_uint %4930 %int_4 %uint_0 + %24236 = OpLoad %uint %10702 + %19191 = OpAccessChain %_ptr_Uniform_uint %4930 %int_4 %uint_1 + %22108 = OpLoad %uint %19191 + %23780 = OpExtInst %uint %1 UClamp %18847 %24236 %22108 + %24499 = OpConvertUToF %float %23780 + %12692 = OpAccessChain %_ptr_Output_float %3307 %15656 + OpStore %12692 %24499 + OpReturn + OpFunctionEnd +#endif + +const uint32_t adaptive_triangle_hs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x00005FB4, 0x00000000, 0x00020011, + 0x00000003, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x000B000F, 0x00000001, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00001548, 0x00001093, 0x00000CDA, + 0x00000CEB, 0x000011E9, 0x000014CB, 0x00040010, 0x0000161F, 0x0000001A, + 0x00000001, 0x00040047, 0x00001548, 0x0000000B, 0x0000000B, 0x00030047, + 0x00001548, 0x0000000F, 0x00040047, 0x00001093, 0x0000001E, 0x00000000, + 0x00040047, 0x00000CDA, 0x0000000B, 0x0000000C, 0x00030047, 0x00000CDA, + 0x0000000F, 0x00040047, 0x00000CEB, 0x0000001E, 0x00000000, 0x00040047, + 0x000011E9, 0x0000000B, 0x00000008, 0x00040047, 0x000014CB, 0x0000000B, + 0x00000007, 0x00030047, 0x00000457, 0x00000002, 0x00050048, 0x00000457, + 0x00000000, 0x00000023, 0x00000000, 0x00050048, 0x00000457, 0x00000001, + 0x00000023, 0x00000008, 0x00050048, 0x00000457, 0x00000002, 0x00000023, + 0x00000010, 0x00050048, 0x00000457, 0x00000003, 0x00000023, 0x00000014, + 0x00050048, 0x00000457, 0x00000004, 0x00000023, 0x00000018, 0x00040047, + 0x00001342, 0x00000021, 0x00000006, 0x00040047, 0x00001342, 0x00000022, + 0x00000001, 0x00020013, 0x00000008, 0x00030021, 0x00000502, 0x00000008, + 0x00030016, 0x0000000D, 0x00000020, 0x00040015, 0x0000000B, 0x00000020, + 0x00000000, 0x0004002B, 0x0000000B, 0x00000A16, 0x00000004, 0x0004001C, + 0x00000225, 0x0000000D, 0x00000A16, 0x00040020, 0x000004A2, 0x00000003, + 0x00000225, 0x0004003B, 0x000004A2, 0x00001548, 0x00000003, 0x00040015, + 0x0000000C, 0x00000020, 0x00000001, 0x0004002B, 0x0000000C, 0x00000A0B, + 0x00000000, 0x0004002B, 0x0000000B, 0x00000A6A, 0x00000020, 0x0004001C, + 0x00000243, 0x0000000D, 0x00000A6A, 0x00040020, 0x000004C0, 0x00000001, + 0x00000243, 0x0004003B, 0x000004C0, 0x00001093, 0x00000001, 0x0004002B, + 0x0000000C, 0x00000A0E, 0x00000001, 0x00040020, 0x0000028A, 0x00000001, + 0x0000000D, 0x00040020, 0x0000028B, 0x00000003, 0x0000000D, 0x0004002B, + 0x0000000C, 0x00000A11, 0x00000002, 0x0004002B, 0x0000000B, 0x00000A10, + 0x00000002, 0x0004001C, 0x00000298, 0x0000000D, 0x00000A10, 0x00040020, + 0x00000515, 0x00000003, 0x00000298, 0x0004003B, 0x00000515, 0x00000CDA, + 0x00000003, 0x0004002B, 0x0000000B, 0x00000A0D, 0x00000001, 0x0004001C, + 0x000002D9, 0x0000000D, 0x00000A0D, 0x00040020, 0x00000556, 0x00000003, + 0x000002D9, 0x0004003B, 0x00000556, 0x00000CEB, 0x00000003, 0x00040020, + 0x00000289, 0x00000001, 0x0000000C, 0x0004003B, 0x00000289, 0x000011E9, + 0x00000001, 0x0004003B, 0x00000289, 0x000014CB, 0x00000001, 0x00040017, + 0x00000013, 0x0000000D, 0x00000002, 0x00040017, 0x00000011, 0x0000000B, + 0x00000002, 0x0007001E, 0x00000457, 0x00000013, 0x00000013, 0x0000000B, + 0x0000000B, 0x00000011, 0x00040020, 0x000006D4, 0x00000002, 0x00000457, + 0x0004003B, 0x000006D4, 0x00001342, 0x00000002, 0x0004002B, 0x0000000C, + 0x00000A14, 0x00000003, 0x00040020, 0x00000288, 0x00000002, 0x0000000B, + 0x0004002B, 0x0000000B, 0x00000923, 0x00FFFFFF, 0x0004002B, 0x0000000C, + 0x00000A17, 0x00000004, 0x0004002B, 0x0000000B, 0x00000A0A, 0x00000000, + 0x00050036, 0x00000008, 0x0000161F, 0x00000000, 0x00000502, 0x000200F8, + 0x00005D6B, 0x00050041, 0x0000028A, 0x00001BD9, 0x00001093, 0x00000A0E, + 0x0004003D, 0x0000000D, 0x00003D1E, 0x00001BD9, 0x00050041, 0x0000028B, + 0x00004E0D, 0x00001548, 0x00000A0B, 0x0003003E, 0x00004E0D, 0x00003D1E, + 0x00050041, 0x0000028A, 0x00004DC1, 0x00001093, 0x00000A11, 0x0004003D, + 0x0000000D, 0x00001CDF, 0x00004DC1, 0x00050041, 0x0000028B, 0x00004E0E, + 0x00001548, 0x00000A0E, 0x0003003E, 0x00004E0E, 0x00001CDF, 0x00050041, + 0x0000028A, 0x00004DC2, 0x00001093, 0x00000A0B, 0x0004003D, 0x0000000D, + 0x00001CE0, 0x00004DC2, 0x00050041, 0x0000028B, 0x00004DC3, 0x00001548, + 0x00000A11, 0x0003003E, 0x00004DC3, 0x00001CE0, 0x0004003D, 0x0000000D, + 0x000034FD, 0x00004E0D, 0x0004003D, 0x0000000D, 0x00003148, 0x00004E0E, + 0x0007000C, 0x0000000D, 0x00001E2B, 0x00000001, 0x00000025, 0x000034FD, + 0x00003148, 0x0004003D, 0x0000000D, 0x00001A2B, 0x00004DC3, 0x0007000C, + 0x0000000D, 0x00005224, 0x00000001, 0x00000025, 0x00001E2B, 0x00001A2B, + 0x00050041, 0x0000028B, 0x00003981, 0x00000CDA, 0x00000A0B, 0x0003003E, + 0x00003981, 0x00005224, 0x0004003D, 0x0000000C, 0x00003D28, 0x000011E9, + 0x0004003D, 0x0000000C, 0x00005CD5, 0x000014CB, 0x0004007C, 0x0000000B, + 0x0000254C, 0x00005CD5, 0x00050041, 0x00000288, 0x00001CE3, 0x00001342, + 0x00000A14, 0x0004003D, 0x0000000B, 0x000059BA, 0x00001CE3, 0x00050080, + 0x0000000B, 0x00001DE4, 0x0000254C, 0x000059BA, 0x000500C7, 0x0000000B, + 0x0000499F, 0x00001DE4, 0x00000923, 0x00060041, 0x00000288, 0x000029CE, + 0x00001342, 0x00000A17, 0x00000A0A, 0x0004003D, 0x0000000B, 0x00005EAC, + 0x000029CE, 0x00060041, 0x00000288, 0x00004AF7, 0x00001342, 0x00000A17, + 0x00000A0D, 0x0004003D, 0x0000000B, 0x0000565C, 0x00004AF7, 0x0008000C, + 0x0000000B, 0x00005CE4, 0x00000001, 0x0000002C, 0x0000499F, 0x00005EAC, + 0x0000565C, 0x00040070, 0x0000000D, 0x00005FB3, 0x00005CE4, 0x00050041, + 0x0000028B, 0x00003194, 0x00000CEB, 0x00003D28, 0x0003003E, 0x00003194, + 0x00005FB3, 0x000100FD, 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_quad_1cp_hs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_quad_1cp_hs.h new file mode 100644 index 000000000..d61c328b7 --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_quad_1cp_hs.h @@ -0,0 +1,143 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 24684 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %5663 "main" %3307 %gl_InvocationID %3884 %gl_TessLevelOuter %gl_TessLevelInner + OpExecutionMode %5663 OutputVertices 1 + OpDecorate %3307 Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %3884 Location 0 + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelInner Patch + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Output__arr_float_uint_1 = OpTypePointer Output %_arr_float_uint_1 + %3307 = OpVariable %_ptr_Output__arr_float_uint_1 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %uint_32 = OpConstant %uint 32 +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %3884 = OpVariable %_ptr_Input__arr_float_uint_32 Input +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %5663 = OpFunction %void None %1282 + %24683 = OpLabel + %20062 = OpLoad %int %gl_InvocationID + %10147 = OpAccessChain %_ptr_Input_float %3884 %20062 + %22427 = OpLoad %float %10147 + %19981 = OpAccessChain %_ptr_Output_float %3307 %20062 + OpStore %19981 %22427 + %19905 = OpAccessChain %_ptr_Uniform_float %4930 %int_0 %uint_1 + %7391 = OpLoad %float %19905 + %19982 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %19982 %7391 + %19732 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %19732 %7391 + %19733 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %19733 %7391 + %19734 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %19734 %7391 + %19735 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %19735 %7391 + %23304 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %23304 %7391 + OpReturn + OpFunctionEnd +#endif + +const uint32_t continuous_quad_1cp_hs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x0000606C, 0x00000000, 0x00020011, + 0x00000003, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x000A000F, 0x00000001, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00000CEB, 0x000011E9, 0x00000F2C, + 0x00001548, 0x00000CDA, 0x00040010, 0x0000161F, 0x0000001A, 0x00000001, + 0x00040047, 0x00000CEB, 0x0000001E, 0x00000000, 0x00040047, 0x000011E9, + 0x0000000B, 0x00000008, 0x00040047, 0x00000F2C, 0x0000001E, 0x00000000, + 0x00030047, 0x00000457, 0x00000002, 0x00050048, 0x00000457, 0x00000000, + 0x00000023, 0x00000000, 0x00050048, 0x00000457, 0x00000001, 0x00000023, + 0x00000008, 0x00050048, 0x00000457, 0x00000002, 0x00000023, 0x00000010, + 0x00050048, 0x00000457, 0x00000003, 0x00000023, 0x00000014, 0x00050048, + 0x00000457, 0x00000004, 0x00000023, 0x00000018, 0x00040047, 0x00001342, + 0x00000021, 0x00000006, 0x00040047, 0x00001342, 0x00000022, 0x00000001, + 0x00040047, 0x00001548, 0x0000000B, 0x0000000B, 0x00030047, 0x00001548, + 0x0000000F, 0x00040047, 0x00000CDA, 0x0000000B, 0x0000000C, 0x00030047, + 0x00000CDA, 0x0000000F, 0x00020013, 0x00000008, 0x00030021, 0x00000502, + 0x00000008, 0x00030016, 0x0000000D, 0x00000020, 0x00040015, 0x0000000B, + 0x00000020, 0x00000000, 0x0004002B, 0x0000000B, 0x00000A0D, 0x00000001, + 0x0004001C, 0x00000225, 0x0000000D, 0x00000A0D, 0x00040020, 0x000004A2, + 0x00000003, 0x00000225, 0x0004003B, 0x000004A2, 0x00000CEB, 0x00000003, + 0x00040015, 0x0000000C, 0x00000020, 0x00000001, 0x00040020, 0x00000289, + 0x00000001, 0x0000000C, 0x0004003B, 0x00000289, 0x000011E9, 0x00000001, + 0x0004002B, 0x0000000B, 0x00000A6A, 0x00000020, 0x0004001C, 0x0000024D, + 0x0000000D, 0x00000A6A, 0x00040020, 0x000004CA, 0x00000001, 0x0000024D, + 0x0004003B, 0x000004CA, 0x00000F2C, 0x00000001, 0x00040020, 0x0000028A, + 0x00000001, 0x0000000D, 0x00040020, 0x0000028B, 0x00000003, 0x0000000D, + 0x00040017, 0x00000013, 0x0000000D, 0x00000002, 0x00040017, 0x00000011, + 0x0000000B, 0x00000002, 0x0007001E, 0x00000457, 0x00000013, 0x00000013, + 0x0000000B, 0x0000000B, 0x00000011, 0x00040020, 0x000006D4, 0x00000002, + 0x00000457, 0x0004003B, 0x000006D4, 0x00001342, 0x00000002, 0x0004002B, + 0x0000000C, 0x00000A0B, 0x00000000, 0x00040020, 0x0000028C, 0x00000002, + 0x0000000D, 0x0004002B, 0x0000000B, 0x00000A16, 0x00000004, 0x0004001C, + 0x000002B6, 0x0000000D, 0x00000A16, 0x00040020, 0x00000533, 0x00000003, + 0x000002B6, 0x0004003B, 0x00000533, 0x00001548, 0x00000003, 0x0004002B, + 0x0000000C, 0x00000A0E, 0x00000001, 0x0004002B, 0x0000000C, 0x00000A11, + 0x00000002, 0x0004002B, 0x0000000C, 0x00000A14, 0x00000003, 0x0004002B, + 0x0000000B, 0x00000A10, 0x00000002, 0x0004001C, 0x00000301, 0x0000000D, + 0x00000A10, 0x00040020, 0x0000057E, 0x00000003, 0x00000301, 0x0004003B, + 0x0000057E, 0x00000CDA, 0x00000003, 0x00050036, 0x00000008, 0x0000161F, + 0x00000000, 0x00000502, 0x000200F8, 0x0000606B, 0x0004003D, 0x0000000C, + 0x00004E5E, 0x000011E9, 0x00050041, 0x0000028A, 0x000027A3, 0x00000F2C, + 0x00004E5E, 0x0004003D, 0x0000000D, 0x0000579B, 0x000027A3, 0x00050041, + 0x0000028B, 0x00004E0D, 0x00000CEB, 0x00004E5E, 0x0003003E, 0x00004E0D, + 0x0000579B, 0x00060041, 0x0000028C, 0x00004DC1, 0x00001342, 0x00000A0B, + 0x00000A0D, 0x0004003D, 0x0000000D, 0x00001CDF, 0x00004DC1, 0x00050041, + 0x0000028B, 0x00004E0E, 0x00001548, 0x00000A0B, 0x0003003E, 0x00004E0E, + 0x00001CDF, 0x00050041, 0x0000028B, 0x00004D14, 0x00001548, 0x00000A0E, + 0x0003003E, 0x00004D14, 0x00001CDF, 0x00050041, 0x0000028B, 0x00004D15, + 0x00001548, 0x00000A11, 0x0003003E, 0x00004D15, 0x00001CDF, 0x00050041, + 0x0000028B, 0x00004D16, 0x00001548, 0x00000A14, 0x0003003E, 0x00004D16, + 0x00001CDF, 0x00050041, 0x0000028B, 0x00004D17, 0x00000CDA, 0x00000A0B, + 0x0003003E, 0x00004D17, 0x00001CDF, 0x00050041, 0x0000028B, 0x00005B08, + 0x00000CDA, 0x00000A0E, 0x0003003E, 0x00005B08, 0x00001CDF, 0x000100FD, + 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_quad_4cp_hs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_quad_4cp_hs.h new file mode 100644 index 000000000..3b879abaa --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_quad_4cp_hs.h @@ -0,0 +1,150 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 24684 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %5663 "main" %3307 %gl_InvocationID %3884 %gl_TessLevelOuter %gl_TessLevelInner + OpExecutionMode %5663 OutputVertices 4 + OpDecorate %3307 Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %3884 Location 0 + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelInner Patch + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 + %3307 = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %uint_32 = OpConstant %uint 32 +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %3884 = OpVariable %_ptr_Input__arr_float_uint_32 Input +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %5663 = OpFunction %void None %1282 + %24683 = OpLabel + %20062 = OpLoad %int %gl_InvocationID + %10147 = OpAccessChain %_ptr_Input_float %3884 %20062 + %22427 = OpLoad %float %10147 + %21976 = OpAccessChain %_ptr_Output_float %3307 %20062 + OpStore %21976 %22427 + %20857 = OpIEqual %bool %20062 %int_0 + OpSelectionMerge %19578 None + OpBranchConditional %20857 %12129 %19578 + %12129 = OpLabel + %18210 = OpAccessChain %_ptr_Uniform_float %4930 %int_0 %uint_1 + %15646 = OpLoad %float %18210 + %19981 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %19981 %15646 + %19732 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %19732 %15646 + %19733 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %19733 %15646 + %19734 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %19734 %15646 + %19735 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %19735 %15646 + %23228 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %23228 %15646 + OpBranch %19578 + %19578 = OpLabel + OpReturn + OpFunctionEnd +#endif + +const uint32_t continuous_quad_4cp_hs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x0000606C, 0x00000000, 0x00020011, + 0x00000003, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x000A000F, 0x00000001, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00000CEB, 0x000011E9, 0x00000F2C, + 0x00001548, 0x00000CDA, 0x00040010, 0x0000161F, 0x0000001A, 0x00000004, + 0x00040047, 0x00000CEB, 0x0000001E, 0x00000000, 0x00040047, 0x000011E9, + 0x0000000B, 0x00000008, 0x00040047, 0x00000F2C, 0x0000001E, 0x00000000, + 0x00030047, 0x00000457, 0x00000002, 0x00050048, 0x00000457, 0x00000000, + 0x00000023, 0x00000000, 0x00050048, 0x00000457, 0x00000001, 0x00000023, + 0x00000008, 0x00050048, 0x00000457, 0x00000002, 0x00000023, 0x00000010, + 0x00050048, 0x00000457, 0x00000003, 0x00000023, 0x00000014, 0x00050048, + 0x00000457, 0x00000004, 0x00000023, 0x00000018, 0x00040047, 0x00001342, + 0x00000021, 0x00000006, 0x00040047, 0x00001342, 0x00000022, 0x00000001, + 0x00040047, 0x00001548, 0x0000000B, 0x0000000B, 0x00030047, 0x00001548, + 0x0000000F, 0x00040047, 0x00000CDA, 0x0000000B, 0x0000000C, 0x00030047, + 0x00000CDA, 0x0000000F, 0x00020013, 0x00000008, 0x00030021, 0x00000502, + 0x00000008, 0x00030016, 0x0000000D, 0x00000020, 0x00040015, 0x0000000B, + 0x00000020, 0x00000000, 0x0004002B, 0x0000000B, 0x00000A16, 0x00000004, + 0x0004001C, 0x00000225, 0x0000000D, 0x00000A16, 0x00040020, 0x000004A2, + 0x00000003, 0x00000225, 0x0004003B, 0x000004A2, 0x00000CEB, 0x00000003, + 0x00040015, 0x0000000C, 0x00000020, 0x00000001, 0x00040020, 0x00000289, + 0x00000001, 0x0000000C, 0x0004003B, 0x00000289, 0x000011E9, 0x00000001, + 0x0004002B, 0x0000000B, 0x00000A6A, 0x00000020, 0x0004001C, 0x0000024D, + 0x0000000D, 0x00000A6A, 0x00040020, 0x000004CA, 0x00000001, 0x0000024D, + 0x0004003B, 0x000004CA, 0x00000F2C, 0x00000001, 0x00040020, 0x0000028A, + 0x00000001, 0x0000000D, 0x00040020, 0x0000028B, 0x00000003, 0x0000000D, + 0x0004002B, 0x0000000C, 0x00000A0B, 0x00000000, 0x00020014, 0x00000009, + 0x00040017, 0x00000013, 0x0000000D, 0x00000002, 0x00040017, 0x00000011, + 0x0000000B, 0x00000002, 0x0007001E, 0x00000457, 0x00000013, 0x00000013, + 0x0000000B, 0x0000000B, 0x00000011, 0x00040020, 0x000006D4, 0x00000002, + 0x00000457, 0x0004003B, 0x000006D4, 0x00001342, 0x00000002, 0x0004002B, + 0x0000000B, 0x00000A0D, 0x00000001, 0x00040020, 0x0000028C, 0x00000002, + 0x0000000D, 0x0004003B, 0x000004A2, 0x00001548, 0x00000003, 0x0004002B, + 0x0000000C, 0x00000A0E, 0x00000001, 0x0004002B, 0x0000000C, 0x00000A11, + 0x00000002, 0x0004002B, 0x0000000C, 0x00000A14, 0x00000003, 0x0004002B, + 0x0000000B, 0x00000A10, 0x00000002, 0x0004001C, 0x00000310, 0x0000000D, + 0x00000A10, 0x00040020, 0x0000058D, 0x00000003, 0x00000310, 0x0004003B, + 0x0000058D, 0x00000CDA, 0x00000003, 0x00050036, 0x00000008, 0x0000161F, + 0x00000000, 0x00000502, 0x000200F8, 0x0000606B, 0x0004003D, 0x0000000C, + 0x00004E5E, 0x000011E9, 0x00050041, 0x0000028A, 0x000027A3, 0x00000F2C, + 0x00004E5E, 0x0004003D, 0x0000000D, 0x0000579B, 0x000027A3, 0x00050041, + 0x0000028B, 0x000055D8, 0x00000CEB, 0x00004E5E, 0x0003003E, 0x000055D8, + 0x0000579B, 0x000500AA, 0x00000009, 0x00005179, 0x00004E5E, 0x00000A0B, + 0x000300F7, 0x00004C7A, 0x00000000, 0x000400FA, 0x00005179, 0x00002F61, + 0x00004C7A, 0x000200F8, 0x00002F61, 0x00060041, 0x0000028C, 0x00004722, + 0x00001342, 0x00000A0B, 0x00000A0D, 0x0004003D, 0x0000000D, 0x00003D1E, + 0x00004722, 0x00050041, 0x0000028B, 0x00004E0D, 0x00001548, 0x00000A0B, + 0x0003003E, 0x00004E0D, 0x00003D1E, 0x00050041, 0x0000028B, 0x00004D14, + 0x00001548, 0x00000A0E, 0x0003003E, 0x00004D14, 0x00003D1E, 0x00050041, + 0x0000028B, 0x00004D15, 0x00001548, 0x00000A11, 0x0003003E, 0x00004D15, + 0x00003D1E, 0x00050041, 0x0000028B, 0x00004D16, 0x00001548, 0x00000A14, + 0x0003003E, 0x00004D16, 0x00003D1E, 0x00050041, 0x0000028B, 0x00004D17, + 0x00000CDA, 0x00000A0B, 0x0003003E, 0x00004D17, 0x00003D1E, 0x00050041, + 0x0000028B, 0x00005ABC, 0x00000CDA, 0x00000A0E, 0x0003003E, 0x00005ABC, + 0x00003D1E, 0x000200F9, 0x00004C7A, 0x000200F8, 0x00004C7A, 0x000100FD, + 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_triangle_1cp_hs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_triangle_1cp_hs.h new file mode 100644 index 000000000..5d14adc79 --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_triangle_1cp_hs.h @@ -0,0 +1,134 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 24684 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %5663 "main" %3307 %gl_InvocationID %3884 %gl_TessLevelOuter %gl_TessLevelInner + OpExecutionMode %5663 OutputVertices 1 + OpDecorate %3307 Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %3884 Location 0 + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelInner Patch + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Output__arr_float_uint_1 = OpTypePointer Output %_arr_float_uint_1 + %3307 = OpVariable %_ptr_Output__arr_float_uint_1 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %uint_32 = OpConstant %uint 32 +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %3884 = OpVariable %_ptr_Input__arr_float_uint_32 Input +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %5663 = OpFunction %void None %1282 + %24683 = OpLabel + %20062 = OpLoad %int %gl_InvocationID + %10147 = OpAccessChain %_ptr_Input_float %3884 %20062 + %22427 = OpLoad %float %10147 + %19981 = OpAccessChain %_ptr_Output_float %3307 %20062 + OpStore %19981 %22427 + %19905 = OpAccessChain %_ptr_Uniform_float %4930 %int_0 %uint_1 + %7391 = OpLoad %float %19905 + %19982 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %19982 %7391 + %19732 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %19732 %7391 + %19733 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %19733 %7391 + %23304 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %23304 %7391 + OpReturn + OpFunctionEnd +#endif + +const uint32_t continuous_triangle_1cp_hs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x0000606C, 0x00000000, 0x00020011, + 0x00000003, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x000A000F, 0x00000001, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00000CEB, 0x000011E9, 0x00000F2C, + 0x00001548, 0x00000CDA, 0x00040010, 0x0000161F, 0x0000001A, 0x00000001, + 0x00040047, 0x00000CEB, 0x0000001E, 0x00000000, 0x00040047, 0x000011E9, + 0x0000000B, 0x00000008, 0x00040047, 0x00000F2C, 0x0000001E, 0x00000000, + 0x00030047, 0x00000457, 0x00000002, 0x00050048, 0x00000457, 0x00000000, + 0x00000023, 0x00000000, 0x00050048, 0x00000457, 0x00000001, 0x00000023, + 0x00000008, 0x00050048, 0x00000457, 0x00000002, 0x00000023, 0x00000010, + 0x00050048, 0x00000457, 0x00000003, 0x00000023, 0x00000014, 0x00050048, + 0x00000457, 0x00000004, 0x00000023, 0x00000018, 0x00040047, 0x00001342, + 0x00000021, 0x00000006, 0x00040047, 0x00001342, 0x00000022, 0x00000001, + 0x00040047, 0x00001548, 0x0000000B, 0x0000000B, 0x00030047, 0x00001548, + 0x0000000F, 0x00040047, 0x00000CDA, 0x0000000B, 0x0000000C, 0x00030047, + 0x00000CDA, 0x0000000F, 0x00020013, 0x00000008, 0x00030021, 0x00000502, + 0x00000008, 0x00030016, 0x0000000D, 0x00000020, 0x00040015, 0x0000000B, + 0x00000020, 0x00000000, 0x0004002B, 0x0000000B, 0x00000A0D, 0x00000001, + 0x0004001C, 0x00000225, 0x0000000D, 0x00000A0D, 0x00040020, 0x000004A2, + 0x00000003, 0x00000225, 0x0004003B, 0x000004A2, 0x00000CEB, 0x00000003, + 0x00040015, 0x0000000C, 0x00000020, 0x00000001, 0x00040020, 0x00000289, + 0x00000001, 0x0000000C, 0x0004003B, 0x00000289, 0x000011E9, 0x00000001, + 0x0004002B, 0x0000000B, 0x00000A6A, 0x00000020, 0x0004001C, 0x0000024D, + 0x0000000D, 0x00000A6A, 0x00040020, 0x000004CA, 0x00000001, 0x0000024D, + 0x0004003B, 0x000004CA, 0x00000F2C, 0x00000001, 0x00040020, 0x0000028A, + 0x00000001, 0x0000000D, 0x00040020, 0x0000028B, 0x00000003, 0x0000000D, + 0x00040017, 0x00000013, 0x0000000D, 0x00000002, 0x00040017, 0x00000011, + 0x0000000B, 0x00000002, 0x0007001E, 0x00000457, 0x00000013, 0x00000013, + 0x0000000B, 0x0000000B, 0x00000011, 0x00040020, 0x000006D4, 0x00000002, + 0x00000457, 0x0004003B, 0x000006D4, 0x00001342, 0x00000002, 0x0004002B, + 0x0000000C, 0x00000A0B, 0x00000000, 0x00040020, 0x0000028C, 0x00000002, + 0x0000000D, 0x0004002B, 0x0000000B, 0x00000A16, 0x00000004, 0x0004001C, + 0x000002B6, 0x0000000D, 0x00000A16, 0x00040020, 0x00000533, 0x00000003, + 0x000002B6, 0x0004003B, 0x00000533, 0x00001548, 0x00000003, 0x0004002B, + 0x0000000C, 0x00000A0E, 0x00000001, 0x0004002B, 0x0000000C, 0x00000A11, + 0x00000002, 0x0004002B, 0x0000000B, 0x00000A10, 0x00000002, 0x0004001C, + 0x000002F2, 0x0000000D, 0x00000A10, 0x00040020, 0x0000056F, 0x00000003, + 0x000002F2, 0x0004003B, 0x0000056F, 0x00000CDA, 0x00000003, 0x00050036, + 0x00000008, 0x0000161F, 0x00000000, 0x00000502, 0x000200F8, 0x0000606B, + 0x0004003D, 0x0000000C, 0x00004E5E, 0x000011E9, 0x00050041, 0x0000028A, + 0x000027A3, 0x00000F2C, 0x00004E5E, 0x0004003D, 0x0000000D, 0x0000579B, + 0x000027A3, 0x00050041, 0x0000028B, 0x00004E0D, 0x00000CEB, 0x00004E5E, + 0x0003003E, 0x00004E0D, 0x0000579B, 0x00060041, 0x0000028C, 0x00004DC1, + 0x00001342, 0x00000A0B, 0x00000A0D, 0x0004003D, 0x0000000D, 0x00001CDF, + 0x00004DC1, 0x00050041, 0x0000028B, 0x00004E0E, 0x00001548, 0x00000A0B, + 0x0003003E, 0x00004E0E, 0x00001CDF, 0x00050041, 0x0000028B, 0x00004D14, + 0x00001548, 0x00000A0E, 0x0003003E, 0x00004D14, 0x00001CDF, 0x00050041, + 0x0000028B, 0x00004D15, 0x00001548, 0x00000A11, 0x0003003E, 0x00004D15, + 0x00001CDF, 0x00050041, 0x0000028B, 0x00005B08, 0x00000CDA, 0x00000A0B, + 0x0003003E, 0x00005B08, 0x00001CDF, 0x000100FD, 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_triangle_3cp_hs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_triangle_3cp_hs.h new file mode 100644 index 000000000..632513f30 --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_triangle_3cp_hs.h @@ -0,0 +1,146 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 24684 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %5663 "main" %3307 %gl_InvocationID %3884 %gl_TessLevelOuter %gl_TessLevelInner + OpExecutionMode %5663 OutputVertices 3 + OpDecorate %3307 Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %3884 Location 0 + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelInner Patch + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Output__arr_float_uint_3 = OpTypePointer Output %_arr_float_uint_3 + %3307 = OpVariable %_ptr_Output__arr_float_uint_3 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %uint_32 = OpConstant %uint 32 +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %3884 = OpVariable %_ptr_Input__arr_float_uint_32 Input +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %5663 = OpFunction %void None %1282 + %24683 = OpLabel + %20062 = OpLoad %int %gl_InvocationID + %10147 = OpAccessChain %_ptr_Input_float %3884 %20062 + %22427 = OpLoad %float %10147 + %21976 = OpAccessChain %_ptr_Output_float %3307 %20062 + OpStore %21976 %22427 + %20857 = OpIEqual %bool %20062 %int_0 + OpSelectionMerge %19578 None + OpBranchConditional %20857 %12129 %19578 + %12129 = OpLabel + %18210 = OpAccessChain %_ptr_Uniform_float %4930 %int_0 %uint_1 + %15646 = OpLoad %float %18210 + %19981 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %19981 %15646 + %19732 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %19732 %15646 + %19733 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %19733 %15646 + %23228 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %23228 %15646 + OpBranch %19578 + %19578 = OpLabel + OpReturn + OpFunctionEnd +#endif + +const uint32_t continuous_triangle_3cp_hs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x0000606C, 0x00000000, 0x00020011, + 0x00000003, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x000A000F, 0x00000001, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00000CEB, 0x000011E9, 0x00000F2C, + 0x00001548, 0x00000CDA, 0x00040010, 0x0000161F, 0x0000001A, 0x00000003, + 0x00040047, 0x00000CEB, 0x0000001E, 0x00000000, 0x00040047, 0x000011E9, + 0x0000000B, 0x00000008, 0x00040047, 0x00000F2C, 0x0000001E, 0x00000000, + 0x00030047, 0x00000457, 0x00000002, 0x00050048, 0x00000457, 0x00000000, + 0x00000023, 0x00000000, 0x00050048, 0x00000457, 0x00000001, 0x00000023, + 0x00000008, 0x00050048, 0x00000457, 0x00000002, 0x00000023, 0x00000010, + 0x00050048, 0x00000457, 0x00000003, 0x00000023, 0x00000014, 0x00050048, + 0x00000457, 0x00000004, 0x00000023, 0x00000018, 0x00040047, 0x00001342, + 0x00000021, 0x00000006, 0x00040047, 0x00001342, 0x00000022, 0x00000001, + 0x00040047, 0x00001548, 0x0000000B, 0x0000000B, 0x00030047, 0x00001548, + 0x0000000F, 0x00040047, 0x00000CDA, 0x0000000B, 0x0000000C, 0x00030047, + 0x00000CDA, 0x0000000F, 0x00020013, 0x00000008, 0x00030021, 0x00000502, + 0x00000008, 0x00030016, 0x0000000D, 0x00000020, 0x00040015, 0x0000000B, + 0x00000020, 0x00000000, 0x0004002B, 0x0000000B, 0x00000A13, 0x00000003, + 0x0004001C, 0x00000225, 0x0000000D, 0x00000A13, 0x00040020, 0x000004A2, + 0x00000003, 0x00000225, 0x0004003B, 0x000004A2, 0x00000CEB, 0x00000003, + 0x00040015, 0x0000000C, 0x00000020, 0x00000001, 0x00040020, 0x00000289, + 0x00000001, 0x0000000C, 0x0004003B, 0x00000289, 0x000011E9, 0x00000001, + 0x0004002B, 0x0000000B, 0x00000A6A, 0x00000020, 0x0004001C, 0x0000024D, + 0x0000000D, 0x00000A6A, 0x00040020, 0x000004CA, 0x00000001, 0x0000024D, + 0x0004003B, 0x000004CA, 0x00000F2C, 0x00000001, 0x00040020, 0x0000028A, + 0x00000001, 0x0000000D, 0x00040020, 0x0000028B, 0x00000003, 0x0000000D, + 0x0004002B, 0x0000000C, 0x00000A0B, 0x00000000, 0x00020014, 0x00000009, + 0x00040017, 0x00000013, 0x0000000D, 0x00000002, 0x00040017, 0x00000011, + 0x0000000B, 0x00000002, 0x0007001E, 0x00000457, 0x00000013, 0x00000013, + 0x0000000B, 0x0000000B, 0x00000011, 0x00040020, 0x000006D4, 0x00000002, + 0x00000457, 0x0004003B, 0x000006D4, 0x00001342, 0x00000002, 0x0004002B, + 0x0000000B, 0x00000A0D, 0x00000001, 0x00040020, 0x0000028C, 0x00000002, + 0x0000000D, 0x0004002B, 0x0000000B, 0x00000A16, 0x00000004, 0x0004001C, + 0x000002D4, 0x0000000D, 0x00000A16, 0x00040020, 0x00000551, 0x00000003, + 0x000002D4, 0x0004003B, 0x00000551, 0x00001548, 0x00000003, 0x0004002B, + 0x0000000C, 0x00000A0E, 0x00000001, 0x0004002B, 0x0000000C, 0x00000A11, + 0x00000002, 0x0004002B, 0x0000000B, 0x00000A10, 0x00000002, 0x0004001C, + 0x00000310, 0x0000000D, 0x00000A10, 0x00040020, 0x0000058D, 0x00000003, + 0x00000310, 0x0004003B, 0x0000058D, 0x00000CDA, 0x00000003, 0x00050036, + 0x00000008, 0x0000161F, 0x00000000, 0x00000502, 0x000200F8, 0x0000606B, + 0x0004003D, 0x0000000C, 0x00004E5E, 0x000011E9, 0x00050041, 0x0000028A, + 0x000027A3, 0x00000F2C, 0x00004E5E, 0x0004003D, 0x0000000D, 0x0000579B, + 0x000027A3, 0x00050041, 0x0000028B, 0x000055D8, 0x00000CEB, 0x00004E5E, + 0x0003003E, 0x000055D8, 0x0000579B, 0x000500AA, 0x00000009, 0x00005179, + 0x00004E5E, 0x00000A0B, 0x000300F7, 0x00004C7A, 0x00000000, 0x000400FA, + 0x00005179, 0x00002F61, 0x00004C7A, 0x000200F8, 0x00002F61, 0x00060041, + 0x0000028C, 0x00004722, 0x00001342, 0x00000A0B, 0x00000A0D, 0x0004003D, + 0x0000000D, 0x00003D1E, 0x00004722, 0x00050041, 0x0000028B, 0x00004E0D, + 0x00001548, 0x00000A0B, 0x0003003E, 0x00004E0D, 0x00003D1E, 0x00050041, + 0x0000028B, 0x00004D14, 0x00001548, 0x00000A0E, 0x0003003E, 0x00004D14, + 0x00003D1E, 0x00050041, 0x0000028B, 0x00004D15, 0x00001548, 0x00000A11, + 0x0003003E, 0x00004D15, 0x00003D1E, 0x00050041, 0x0000028B, 0x00005ABC, + 0x00000CDA, 0x00000A0B, 0x0003003E, 0x00005ABC, 0x00003D1E, 0x000200F9, + 0x00004C7A, 0x000200F8, 0x00004C7A, 0x000100FD, 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_quad_1cp_hs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_quad_1cp_hs.h new file mode 100644 index 000000000..e427cb392 --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_quad_1cp_hs.h @@ -0,0 +1,143 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 24684 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %5663 "main" %3307 %gl_InvocationID %3884 %gl_TessLevelOuter %gl_TessLevelInner + OpExecutionMode %5663 OutputVertices 1 + OpDecorate %3307 Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %3884 Location 0 + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelInner Patch + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Output__arr_float_uint_1 = OpTypePointer Output %_arr_float_uint_1 + %3307 = OpVariable %_ptr_Output__arr_float_uint_1 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %uint_32 = OpConstant %uint 32 +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %3884 = OpVariable %_ptr_Input__arr_float_uint_32 Input +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %5663 = OpFunction %void None %1282 + %24683 = OpLabel + %20062 = OpLoad %int %gl_InvocationID + %10147 = OpAccessChain %_ptr_Input_float %3884 %20062 + %22427 = OpLoad %float %10147 + %19981 = OpAccessChain %_ptr_Output_float %3307 %20062 + OpStore %19981 %22427 + %19905 = OpAccessChain %_ptr_Uniform_float %4930 %int_0 %uint_1 + %7391 = OpLoad %float %19905 + %19982 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %19982 %7391 + %19732 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %19732 %7391 + %19733 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %19733 %7391 + %19734 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %19734 %7391 + %19735 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %19735 %7391 + %23304 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %23304 %7391 + OpReturn + OpFunctionEnd +#endif + +const uint32_t discrete_quad_1cp_hs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x0000606C, 0x00000000, 0x00020011, + 0x00000003, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x000A000F, 0x00000001, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00000CEB, 0x000011E9, 0x00000F2C, + 0x00001548, 0x00000CDA, 0x00040010, 0x0000161F, 0x0000001A, 0x00000001, + 0x00040047, 0x00000CEB, 0x0000001E, 0x00000000, 0x00040047, 0x000011E9, + 0x0000000B, 0x00000008, 0x00040047, 0x00000F2C, 0x0000001E, 0x00000000, + 0x00030047, 0x00000457, 0x00000002, 0x00050048, 0x00000457, 0x00000000, + 0x00000023, 0x00000000, 0x00050048, 0x00000457, 0x00000001, 0x00000023, + 0x00000008, 0x00050048, 0x00000457, 0x00000002, 0x00000023, 0x00000010, + 0x00050048, 0x00000457, 0x00000003, 0x00000023, 0x00000014, 0x00050048, + 0x00000457, 0x00000004, 0x00000023, 0x00000018, 0x00040047, 0x00001342, + 0x00000021, 0x00000006, 0x00040047, 0x00001342, 0x00000022, 0x00000001, + 0x00040047, 0x00001548, 0x0000000B, 0x0000000B, 0x00030047, 0x00001548, + 0x0000000F, 0x00040047, 0x00000CDA, 0x0000000B, 0x0000000C, 0x00030047, + 0x00000CDA, 0x0000000F, 0x00020013, 0x00000008, 0x00030021, 0x00000502, + 0x00000008, 0x00030016, 0x0000000D, 0x00000020, 0x00040015, 0x0000000B, + 0x00000020, 0x00000000, 0x0004002B, 0x0000000B, 0x00000A0D, 0x00000001, + 0x0004001C, 0x00000225, 0x0000000D, 0x00000A0D, 0x00040020, 0x000004A2, + 0x00000003, 0x00000225, 0x0004003B, 0x000004A2, 0x00000CEB, 0x00000003, + 0x00040015, 0x0000000C, 0x00000020, 0x00000001, 0x00040020, 0x00000289, + 0x00000001, 0x0000000C, 0x0004003B, 0x00000289, 0x000011E9, 0x00000001, + 0x0004002B, 0x0000000B, 0x00000A6A, 0x00000020, 0x0004001C, 0x0000024D, + 0x0000000D, 0x00000A6A, 0x00040020, 0x000004CA, 0x00000001, 0x0000024D, + 0x0004003B, 0x000004CA, 0x00000F2C, 0x00000001, 0x00040020, 0x0000028A, + 0x00000001, 0x0000000D, 0x00040020, 0x0000028B, 0x00000003, 0x0000000D, + 0x00040017, 0x00000013, 0x0000000D, 0x00000002, 0x00040017, 0x00000011, + 0x0000000B, 0x00000002, 0x0007001E, 0x00000457, 0x00000013, 0x00000013, + 0x0000000B, 0x0000000B, 0x00000011, 0x00040020, 0x000006D4, 0x00000002, + 0x00000457, 0x0004003B, 0x000006D4, 0x00001342, 0x00000002, 0x0004002B, + 0x0000000C, 0x00000A0B, 0x00000000, 0x00040020, 0x0000028C, 0x00000002, + 0x0000000D, 0x0004002B, 0x0000000B, 0x00000A16, 0x00000004, 0x0004001C, + 0x000002B6, 0x0000000D, 0x00000A16, 0x00040020, 0x00000533, 0x00000003, + 0x000002B6, 0x0004003B, 0x00000533, 0x00001548, 0x00000003, 0x0004002B, + 0x0000000C, 0x00000A0E, 0x00000001, 0x0004002B, 0x0000000C, 0x00000A11, + 0x00000002, 0x0004002B, 0x0000000C, 0x00000A14, 0x00000003, 0x0004002B, + 0x0000000B, 0x00000A10, 0x00000002, 0x0004001C, 0x00000301, 0x0000000D, + 0x00000A10, 0x00040020, 0x0000057E, 0x00000003, 0x00000301, 0x0004003B, + 0x0000057E, 0x00000CDA, 0x00000003, 0x00050036, 0x00000008, 0x0000161F, + 0x00000000, 0x00000502, 0x000200F8, 0x0000606B, 0x0004003D, 0x0000000C, + 0x00004E5E, 0x000011E9, 0x00050041, 0x0000028A, 0x000027A3, 0x00000F2C, + 0x00004E5E, 0x0004003D, 0x0000000D, 0x0000579B, 0x000027A3, 0x00050041, + 0x0000028B, 0x00004E0D, 0x00000CEB, 0x00004E5E, 0x0003003E, 0x00004E0D, + 0x0000579B, 0x00060041, 0x0000028C, 0x00004DC1, 0x00001342, 0x00000A0B, + 0x00000A0D, 0x0004003D, 0x0000000D, 0x00001CDF, 0x00004DC1, 0x00050041, + 0x0000028B, 0x00004E0E, 0x00001548, 0x00000A0B, 0x0003003E, 0x00004E0E, + 0x00001CDF, 0x00050041, 0x0000028B, 0x00004D14, 0x00001548, 0x00000A0E, + 0x0003003E, 0x00004D14, 0x00001CDF, 0x00050041, 0x0000028B, 0x00004D15, + 0x00001548, 0x00000A11, 0x0003003E, 0x00004D15, 0x00001CDF, 0x00050041, + 0x0000028B, 0x00004D16, 0x00001548, 0x00000A14, 0x0003003E, 0x00004D16, + 0x00001CDF, 0x00050041, 0x0000028B, 0x00004D17, 0x00000CDA, 0x00000A0B, + 0x0003003E, 0x00004D17, 0x00001CDF, 0x00050041, 0x0000028B, 0x00005B08, + 0x00000CDA, 0x00000A0E, 0x0003003E, 0x00005B08, 0x00001CDF, 0x000100FD, + 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_quad_4cp_hs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_quad_4cp_hs.h new file mode 100644 index 000000000..dce3b6ad4 --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_quad_4cp_hs.h @@ -0,0 +1,150 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 24684 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %5663 "main" %3307 %gl_InvocationID %3884 %gl_TessLevelOuter %gl_TessLevelInner + OpExecutionMode %5663 OutputVertices 4 + OpDecorate %3307 Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %3884 Location 0 + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelInner Patch + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 + %3307 = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %uint_32 = OpConstant %uint 32 +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %3884 = OpVariable %_ptr_Input__arr_float_uint_32 Input +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %5663 = OpFunction %void None %1282 + %24683 = OpLabel + %20062 = OpLoad %int %gl_InvocationID + %10147 = OpAccessChain %_ptr_Input_float %3884 %20062 + %22427 = OpLoad %float %10147 + %21976 = OpAccessChain %_ptr_Output_float %3307 %20062 + OpStore %21976 %22427 + %20857 = OpIEqual %bool %20062 %int_0 + OpSelectionMerge %19578 None + OpBranchConditional %20857 %12129 %19578 + %12129 = OpLabel + %18210 = OpAccessChain %_ptr_Uniform_float %4930 %int_0 %uint_1 + %15646 = OpLoad %float %18210 + %19981 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %19981 %15646 + %19732 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %19732 %15646 + %19733 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %19733 %15646 + %19734 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_3 + OpStore %19734 %15646 + %19735 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %19735 %15646 + %23228 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_1 + OpStore %23228 %15646 + OpBranch %19578 + %19578 = OpLabel + OpReturn + OpFunctionEnd +#endif + +const uint32_t discrete_quad_4cp_hs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x0000606C, 0x00000000, 0x00020011, + 0x00000003, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x000A000F, 0x00000001, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00000CEB, 0x000011E9, 0x00000F2C, + 0x00001548, 0x00000CDA, 0x00040010, 0x0000161F, 0x0000001A, 0x00000004, + 0x00040047, 0x00000CEB, 0x0000001E, 0x00000000, 0x00040047, 0x000011E9, + 0x0000000B, 0x00000008, 0x00040047, 0x00000F2C, 0x0000001E, 0x00000000, + 0x00030047, 0x00000457, 0x00000002, 0x00050048, 0x00000457, 0x00000000, + 0x00000023, 0x00000000, 0x00050048, 0x00000457, 0x00000001, 0x00000023, + 0x00000008, 0x00050048, 0x00000457, 0x00000002, 0x00000023, 0x00000010, + 0x00050048, 0x00000457, 0x00000003, 0x00000023, 0x00000014, 0x00050048, + 0x00000457, 0x00000004, 0x00000023, 0x00000018, 0x00040047, 0x00001342, + 0x00000021, 0x00000006, 0x00040047, 0x00001342, 0x00000022, 0x00000001, + 0x00040047, 0x00001548, 0x0000000B, 0x0000000B, 0x00030047, 0x00001548, + 0x0000000F, 0x00040047, 0x00000CDA, 0x0000000B, 0x0000000C, 0x00030047, + 0x00000CDA, 0x0000000F, 0x00020013, 0x00000008, 0x00030021, 0x00000502, + 0x00000008, 0x00030016, 0x0000000D, 0x00000020, 0x00040015, 0x0000000B, + 0x00000020, 0x00000000, 0x0004002B, 0x0000000B, 0x00000A16, 0x00000004, + 0x0004001C, 0x00000225, 0x0000000D, 0x00000A16, 0x00040020, 0x000004A2, + 0x00000003, 0x00000225, 0x0004003B, 0x000004A2, 0x00000CEB, 0x00000003, + 0x00040015, 0x0000000C, 0x00000020, 0x00000001, 0x00040020, 0x00000289, + 0x00000001, 0x0000000C, 0x0004003B, 0x00000289, 0x000011E9, 0x00000001, + 0x0004002B, 0x0000000B, 0x00000A6A, 0x00000020, 0x0004001C, 0x0000024D, + 0x0000000D, 0x00000A6A, 0x00040020, 0x000004CA, 0x00000001, 0x0000024D, + 0x0004003B, 0x000004CA, 0x00000F2C, 0x00000001, 0x00040020, 0x0000028A, + 0x00000001, 0x0000000D, 0x00040020, 0x0000028B, 0x00000003, 0x0000000D, + 0x0004002B, 0x0000000C, 0x00000A0B, 0x00000000, 0x00020014, 0x00000009, + 0x00040017, 0x00000013, 0x0000000D, 0x00000002, 0x00040017, 0x00000011, + 0x0000000B, 0x00000002, 0x0007001E, 0x00000457, 0x00000013, 0x00000013, + 0x0000000B, 0x0000000B, 0x00000011, 0x00040020, 0x000006D4, 0x00000002, + 0x00000457, 0x0004003B, 0x000006D4, 0x00001342, 0x00000002, 0x0004002B, + 0x0000000B, 0x00000A0D, 0x00000001, 0x00040020, 0x0000028C, 0x00000002, + 0x0000000D, 0x0004003B, 0x000004A2, 0x00001548, 0x00000003, 0x0004002B, + 0x0000000C, 0x00000A0E, 0x00000001, 0x0004002B, 0x0000000C, 0x00000A11, + 0x00000002, 0x0004002B, 0x0000000C, 0x00000A14, 0x00000003, 0x0004002B, + 0x0000000B, 0x00000A10, 0x00000002, 0x0004001C, 0x00000310, 0x0000000D, + 0x00000A10, 0x00040020, 0x0000058D, 0x00000003, 0x00000310, 0x0004003B, + 0x0000058D, 0x00000CDA, 0x00000003, 0x00050036, 0x00000008, 0x0000161F, + 0x00000000, 0x00000502, 0x000200F8, 0x0000606B, 0x0004003D, 0x0000000C, + 0x00004E5E, 0x000011E9, 0x00050041, 0x0000028A, 0x000027A3, 0x00000F2C, + 0x00004E5E, 0x0004003D, 0x0000000D, 0x0000579B, 0x000027A3, 0x00050041, + 0x0000028B, 0x000055D8, 0x00000CEB, 0x00004E5E, 0x0003003E, 0x000055D8, + 0x0000579B, 0x000500AA, 0x00000009, 0x00005179, 0x00004E5E, 0x00000A0B, + 0x000300F7, 0x00004C7A, 0x00000000, 0x000400FA, 0x00005179, 0x00002F61, + 0x00004C7A, 0x000200F8, 0x00002F61, 0x00060041, 0x0000028C, 0x00004722, + 0x00001342, 0x00000A0B, 0x00000A0D, 0x0004003D, 0x0000000D, 0x00003D1E, + 0x00004722, 0x00050041, 0x0000028B, 0x00004E0D, 0x00001548, 0x00000A0B, + 0x0003003E, 0x00004E0D, 0x00003D1E, 0x00050041, 0x0000028B, 0x00004D14, + 0x00001548, 0x00000A0E, 0x0003003E, 0x00004D14, 0x00003D1E, 0x00050041, + 0x0000028B, 0x00004D15, 0x00001548, 0x00000A11, 0x0003003E, 0x00004D15, + 0x00003D1E, 0x00050041, 0x0000028B, 0x00004D16, 0x00001548, 0x00000A14, + 0x0003003E, 0x00004D16, 0x00003D1E, 0x00050041, 0x0000028B, 0x00004D17, + 0x00000CDA, 0x00000A0B, 0x0003003E, 0x00004D17, 0x00003D1E, 0x00050041, + 0x0000028B, 0x00005ABC, 0x00000CDA, 0x00000A0E, 0x0003003E, 0x00005ABC, + 0x00003D1E, 0x000200F9, 0x00004C7A, 0x000200F8, 0x00004C7A, 0x000100FD, + 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_triangle_1cp_hs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_triangle_1cp_hs.h new file mode 100644 index 000000000..391125128 --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_triangle_1cp_hs.h @@ -0,0 +1,134 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 24684 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %5663 "main" %3307 %gl_InvocationID %3884 %gl_TessLevelOuter %gl_TessLevelInner + OpExecutionMode %5663 OutputVertices 1 + OpDecorate %3307 Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %3884 Location 0 + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelInner Patch + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_arr_float_uint_1 = OpTypeArray %float %uint_1 +%_ptr_Output__arr_float_uint_1 = OpTypePointer Output %_arr_float_uint_1 + %3307 = OpVariable %_ptr_Output__arr_float_uint_1 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %uint_32 = OpConstant %uint 32 +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %3884 = OpVariable %_ptr_Input__arr_float_uint_32 Input +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %5663 = OpFunction %void None %1282 + %24683 = OpLabel + %20062 = OpLoad %int %gl_InvocationID + %10147 = OpAccessChain %_ptr_Input_float %3884 %20062 + %22427 = OpLoad %float %10147 + %19981 = OpAccessChain %_ptr_Output_float %3307 %20062 + OpStore %19981 %22427 + %19905 = OpAccessChain %_ptr_Uniform_float %4930 %int_0 %uint_1 + %7391 = OpLoad %float %19905 + %19982 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %19982 %7391 + %19732 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %19732 %7391 + %19733 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %19733 %7391 + %23304 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %23304 %7391 + OpReturn + OpFunctionEnd +#endif + +const uint32_t discrete_triangle_1cp_hs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x0000606C, 0x00000000, 0x00020011, + 0x00000003, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x000A000F, 0x00000001, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00000CEB, 0x000011E9, 0x00000F2C, + 0x00001548, 0x00000CDA, 0x00040010, 0x0000161F, 0x0000001A, 0x00000001, + 0x00040047, 0x00000CEB, 0x0000001E, 0x00000000, 0x00040047, 0x000011E9, + 0x0000000B, 0x00000008, 0x00040047, 0x00000F2C, 0x0000001E, 0x00000000, + 0x00030047, 0x00000457, 0x00000002, 0x00050048, 0x00000457, 0x00000000, + 0x00000023, 0x00000000, 0x00050048, 0x00000457, 0x00000001, 0x00000023, + 0x00000008, 0x00050048, 0x00000457, 0x00000002, 0x00000023, 0x00000010, + 0x00050048, 0x00000457, 0x00000003, 0x00000023, 0x00000014, 0x00050048, + 0x00000457, 0x00000004, 0x00000023, 0x00000018, 0x00040047, 0x00001342, + 0x00000021, 0x00000006, 0x00040047, 0x00001342, 0x00000022, 0x00000001, + 0x00040047, 0x00001548, 0x0000000B, 0x0000000B, 0x00030047, 0x00001548, + 0x0000000F, 0x00040047, 0x00000CDA, 0x0000000B, 0x0000000C, 0x00030047, + 0x00000CDA, 0x0000000F, 0x00020013, 0x00000008, 0x00030021, 0x00000502, + 0x00000008, 0x00030016, 0x0000000D, 0x00000020, 0x00040015, 0x0000000B, + 0x00000020, 0x00000000, 0x0004002B, 0x0000000B, 0x00000A0D, 0x00000001, + 0x0004001C, 0x00000225, 0x0000000D, 0x00000A0D, 0x00040020, 0x000004A2, + 0x00000003, 0x00000225, 0x0004003B, 0x000004A2, 0x00000CEB, 0x00000003, + 0x00040015, 0x0000000C, 0x00000020, 0x00000001, 0x00040020, 0x00000289, + 0x00000001, 0x0000000C, 0x0004003B, 0x00000289, 0x000011E9, 0x00000001, + 0x0004002B, 0x0000000B, 0x00000A6A, 0x00000020, 0x0004001C, 0x0000024D, + 0x0000000D, 0x00000A6A, 0x00040020, 0x000004CA, 0x00000001, 0x0000024D, + 0x0004003B, 0x000004CA, 0x00000F2C, 0x00000001, 0x00040020, 0x0000028A, + 0x00000001, 0x0000000D, 0x00040020, 0x0000028B, 0x00000003, 0x0000000D, + 0x00040017, 0x00000013, 0x0000000D, 0x00000002, 0x00040017, 0x00000011, + 0x0000000B, 0x00000002, 0x0007001E, 0x00000457, 0x00000013, 0x00000013, + 0x0000000B, 0x0000000B, 0x00000011, 0x00040020, 0x000006D4, 0x00000002, + 0x00000457, 0x0004003B, 0x000006D4, 0x00001342, 0x00000002, 0x0004002B, + 0x0000000C, 0x00000A0B, 0x00000000, 0x00040020, 0x0000028C, 0x00000002, + 0x0000000D, 0x0004002B, 0x0000000B, 0x00000A16, 0x00000004, 0x0004001C, + 0x000002B6, 0x0000000D, 0x00000A16, 0x00040020, 0x00000533, 0x00000003, + 0x000002B6, 0x0004003B, 0x00000533, 0x00001548, 0x00000003, 0x0004002B, + 0x0000000C, 0x00000A0E, 0x00000001, 0x0004002B, 0x0000000C, 0x00000A11, + 0x00000002, 0x0004002B, 0x0000000B, 0x00000A10, 0x00000002, 0x0004001C, + 0x000002F2, 0x0000000D, 0x00000A10, 0x00040020, 0x0000056F, 0x00000003, + 0x000002F2, 0x0004003B, 0x0000056F, 0x00000CDA, 0x00000003, 0x00050036, + 0x00000008, 0x0000161F, 0x00000000, 0x00000502, 0x000200F8, 0x0000606B, + 0x0004003D, 0x0000000C, 0x00004E5E, 0x000011E9, 0x00050041, 0x0000028A, + 0x000027A3, 0x00000F2C, 0x00004E5E, 0x0004003D, 0x0000000D, 0x0000579B, + 0x000027A3, 0x00050041, 0x0000028B, 0x00004E0D, 0x00000CEB, 0x00004E5E, + 0x0003003E, 0x00004E0D, 0x0000579B, 0x00060041, 0x0000028C, 0x00004DC1, + 0x00001342, 0x00000A0B, 0x00000A0D, 0x0004003D, 0x0000000D, 0x00001CDF, + 0x00004DC1, 0x00050041, 0x0000028B, 0x00004E0E, 0x00001548, 0x00000A0B, + 0x0003003E, 0x00004E0E, 0x00001CDF, 0x00050041, 0x0000028B, 0x00004D14, + 0x00001548, 0x00000A0E, 0x0003003E, 0x00004D14, 0x00001CDF, 0x00050041, + 0x0000028B, 0x00004D15, 0x00001548, 0x00000A11, 0x0003003E, 0x00004D15, + 0x00001CDF, 0x00050041, 0x0000028B, 0x00005B08, 0x00000CDA, 0x00000A0B, + 0x0003003E, 0x00005B08, 0x00001CDF, 0x000100FD, 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_triangle_3cp_hs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_triangle_3cp_hs.h new file mode 100644 index 000000000..028be3f85 --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_triangle_3cp_hs.h @@ -0,0 +1,146 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 24684 +; Schema: 0 + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %5663 "main" %3307 %gl_InvocationID %3884 %gl_TessLevelOuter %gl_TessLevelInner + OpExecutionMode %5663 OutputVertices 3 + OpDecorate %3307 Location 0 + OpDecorate %gl_InvocationID BuiltIn InvocationId + OpDecorate %3884 Location 0 + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + OpDecorate %gl_TessLevelOuter BuiltIn TessLevelOuter + OpDecorate %gl_TessLevelOuter Patch + OpDecorate %gl_TessLevelInner BuiltIn TessLevelInner + OpDecorate %gl_TessLevelInner Patch + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 +%_arr_float_uint_3 = OpTypeArray %float %uint_3 +%_ptr_Output__arr_float_uint_3 = OpTypePointer Output %_arr_float_uint_3 + %3307 = OpVariable %_ptr_Output__arr_float_uint_3 Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_InvocationID = OpVariable %_ptr_Input_int Input + %uint_32 = OpConstant %uint 32 +%_arr_float_uint_32 = OpTypeArray %float %uint_32 +%_ptr_Input__arr_float_uint_32 = OpTypePointer Input %_arr_float_uint_32 + %3884 = OpVariable %_ptr_Input__arr_float_uint_32 Input +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform + %uint_1 = OpConstant %uint 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_4 = OpConstant %uint 4 +%_arr_float_uint_4 = OpTypeArray %float %uint_4 +%_ptr_Output__arr_float_uint_4 = OpTypePointer Output %_arr_float_uint_4 +%gl_TessLevelOuter = OpVariable %_ptr_Output__arr_float_uint_4 Output + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%_ptr_Output__arr_float_uint_2 = OpTypePointer Output %_arr_float_uint_2 +%gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output + %5663 = OpFunction %void None %1282 + %24683 = OpLabel + %20062 = OpLoad %int %gl_InvocationID + %10147 = OpAccessChain %_ptr_Input_float %3884 %20062 + %22427 = OpLoad %float %10147 + %21976 = OpAccessChain %_ptr_Output_float %3307 %20062 + OpStore %21976 %22427 + %20857 = OpIEqual %bool %20062 %int_0 + OpSelectionMerge %19578 None + OpBranchConditional %20857 %12129 %19578 + %12129 = OpLabel + %18210 = OpAccessChain %_ptr_Uniform_float %4930 %int_0 %uint_1 + %15646 = OpLoad %float %18210 + %19981 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_0 + OpStore %19981 %15646 + %19732 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_1 + OpStore %19732 %15646 + %19733 = OpAccessChain %_ptr_Output_float %gl_TessLevelOuter %int_2 + OpStore %19733 %15646 + %23228 = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %int_0 + OpStore %23228 %15646 + OpBranch %19578 + %19578 = OpLabel + OpReturn + OpFunctionEnd +#endif + +const uint32_t discrete_triangle_3cp_hs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x0000606C, 0x00000000, 0x00020011, + 0x00000003, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x000A000F, 0x00000001, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00000CEB, 0x000011E9, 0x00000F2C, + 0x00001548, 0x00000CDA, 0x00040010, 0x0000161F, 0x0000001A, 0x00000003, + 0x00040047, 0x00000CEB, 0x0000001E, 0x00000000, 0x00040047, 0x000011E9, + 0x0000000B, 0x00000008, 0x00040047, 0x00000F2C, 0x0000001E, 0x00000000, + 0x00030047, 0x00000457, 0x00000002, 0x00050048, 0x00000457, 0x00000000, + 0x00000023, 0x00000000, 0x00050048, 0x00000457, 0x00000001, 0x00000023, + 0x00000008, 0x00050048, 0x00000457, 0x00000002, 0x00000023, 0x00000010, + 0x00050048, 0x00000457, 0x00000003, 0x00000023, 0x00000014, 0x00050048, + 0x00000457, 0x00000004, 0x00000023, 0x00000018, 0x00040047, 0x00001342, + 0x00000021, 0x00000006, 0x00040047, 0x00001342, 0x00000022, 0x00000001, + 0x00040047, 0x00001548, 0x0000000B, 0x0000000B, 0x00030047, 0x00001548, + 0x0000000F, 0x00040047, 0x00000CDA, 0x0000000B, 0x0000000C, 0x00030047, + 0x00000CDA, 0x0000000F, 0x00020013, 0x00000008, 0x00030021, 0x00000502, + 0x00000008, 0x00030016, 0x0000000D, 0x00000020, 0x00040015, 0x0000000B, + 0x00000020, 0x00000000, 0x0004002B, 0x0000000B, 0x00000A13, 0x00000003, + 0x0004001C, 0x00000225, 0x0000000D, 0x00000A13, 0x00040020, 0x000004A2, + 0x00000003, 0x00000225, 0x0004003B, 0x000004A2, 0x00000CEB, 0x00000003, + 0x00040015, 0x0000000C, 0x00000020, 0x00000001, 0x00040020, 0x00000289, + 0x00000001, 0x0000000C, 0x0004003B, 0x00000289, 0x000011E9, 0x00000001, + 0x0004002B, 0x0000000B, 0x00000A6A, 0x00000020, 0x0004001C, 0x0000024D, + 0x0000000D, 0x00000A6A, 0x00040020, 0x000004CA, 0x00000001, 0x0000024D, + 0x0004003B, 0x000004CA, 0x00000F2C, 0x00000001, 0x00040020, 0x0000028A, + 0x00000001, 0x0000000D, 0x00040020, 0x0000028B, 0x00000003, 0x0000000D, + 0x0004002B, 0x0000000C, 0x00000A0B, 0x00000000, 0x00020014, 0x00000009, + 0x00040017, 0x00000013, 0x0000000D, 0x00000002, 0x00040017, 0x00000011, + 0x0000000B, 0x00000002, 0x0007001E, 0x00000457, 0x00000013, 0x00000013, + 0x0000000B, 0x0000000B, 0x00000011, 0x00040020, 0x000006D4, 0x00000002, + 0x00000457, 0x0004003B, 0x000006D4, 0x00001342, 0x00000002, 0x0004002B, + 0x0000000B, 0x00000A0D, 0x00000001, 0x00040020, 0x0000028C, 0x00000002, + 0x0000000D, 0x0004002B, 0x0000000B, 0x00000A16, 0x00000004, 0x0004001C, + 0x000002D4, 0x0000000D, 0x00000A16, 0x00040020, 0x00000551, 0x00000003, + 0x000002D4, 0x0004003B, 0x00000551, 0x00001548, 0x00000003, 0x0004002B, + 0x0000000C, 0x00000A0E, 0x00000001, 0x0004002B, 0x0000000C, 0x00000A11, + 0x00000002, 0x0004002B, 0x0000000B, 0x00000A10, 0x00000002, 0x0004001C, + 0x00000310, 0x0000000D, 0x00000A10, 0x00040020, 0x0000058D, 0x00000003, + 0x00000310, 0x0004003B, 0x0000058D, 0x00000CDA, 0x00000003, 0x00050036, + 0x00000008, 0x0000161F, 0x00000000, 0x00000502, 0x000200F8, 0x0000606B, + 0x0004003D, 0x0000000C, 0x00004E5E, 0x000011E9, 0x00050041, 0x0000028A, + 0x000027A3, 0x00000F2C, 0x00004E5E, 0x0004003D, 0x0000000D, 0x0000579B, + 0x000027A3, 0x00050041, 0x0000028B, 0x000055D8, 0x00000CEB, 0x00004E5E, + 0x0003003E, 0x000055D8, 0x0000579B, 0x000500AA, 0x00000009, 0x00005179, + 0x00004E5E, 0x00000A0B, 0x000300F7, 0x00004C7A, 0x00000000, 0x000400FA, + 0x00005179, 0x00002F61, 0x00004C7A, 0x000200F8, 0x00002F61, 0x00060041, + 0x0000028C, 0x00004722, 0x00001342, 0x00000A0B, 0x00000A0D, 0x0004003D, + 0x0000000D, 0x00003D1E, 0x00004722, 0x00050041, 0x0000028B, 0x00004E0D, + 0x00001548, 0x00000A0B, 0x0003003E, 0x00004E0D, 0x00003D1E, 0x00050041, + 0x0000028B, 0x00004D14, 0x00001548, 0x00000A0E, 0x0003003E, 0x00004D14, + 0x00003D1E, 0x00050041, 0x0000028B, 0x00004D15, 0x00001548, 0x00000A11, + 0x0003003E, 0x00004D15, 0x00003D1E, 0x00050041, 0x0000028B, 0x00005ABC, + 0x00000CDA, 0x00000A0B, 0x0003003E, 0x00005ABC, 0x00003D1E, 0x000200F9, + 0x00004C7A, 0x000200F8, 0x00004C7A, 0x000100FD, 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/tessellation_adaptive_vs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/tessellation_adaptive_vs.h new file mode 100644 index 000000000..bba36fab9 --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/tessellation_adaptive_vs.h @@ -0,0 +1,203 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 25239 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %5663 "main" %gl_VertexIndex %5229 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + OpDecorate %5229 Location 0 + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%uint_16711935 = OpConstant %uint 16711935 + %uint_8 = OpConstant %uint 8 +%uint_4278255360 = OpConstant %uint 4278255360 + %uint_2 = OpConstant %uint 2 + %uint_255 = OpConstant %uint 255 + %uint_24 = OpConstant %uint 24 + %uint_65280 = OpConstant %uint 65280 +%uint_16711680 = OpConstant %uint 16711680 +%uint_4278190080 = OpConstant %uint 4278190080 + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 +%uint_4294901760 = OpConstant %uint 4294901760 + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform + %int_2 = OpConstant %int 2 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %5229 = OpVariable %_ptr_Output_float Output + %int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float + %5663 = OpFunction %void None %1282 + %6733 = OpLabel + %9931 = OpLoad %int %gl_VertexIndex + %15381 = OpBitcast %uint %9931 + %9656 = OpAccessChain %_ptr_Uniform_uint %4930 %int_2 + %22442 = OpLoad %uint %9656 + OpSelectionMerge %10204 None + OpSwitch %uint_0 %16320 + %16320 = OpLabel + %23197 = OpIEqual %bool %22442 %uint_0 + OpSelectionMerge %25238 None + OpBranchConditional %23197 %11868 %16569 + %16569 = OpLabel + %19162 = OpIEqual %bool %22442 %uint_1 + OpSelectionMerge %13164 None + OpBranchConditional %19162 %19530 %16570 + %16570 = OpLabel + %19163 = OpIEqual %bool %22442 %uint_2 + OpSelectionMerge %13163 None + OpBranchConditional %19163 %21863 %10583 + %10583 = OpLabel + %18271 = OpBitwiseAnd %uint %15381 %uint_65535 + %9425 = OpShiftLeftLogical %uint %18271 %uint_16 + %20652 = OpBitwiseAnd %uint %15381 %uint_4294901760 + %17549 = OpShiftRightLogical %uint %20652 %uint_16 + %16376 = OpBitwiseOr %uint %9425 %17549 + OpBranch %10204 + %21863 = OpLabel + %20693 = OpBitwiseAnd %uint %15381 %uint_255 + %9463 = OpShiftLeftLogical %uint %20693 %uint_24 + %20306 = OpBitwiseAnd %uint %15381 %uint_65280 + %19284 = OpShiftLeftLogical %uint %20306 %uint_8 + %17045 = OpBitwiseOr %uint %9463 %19284 + %21212 = OpBitwiseAnd %uint %15381 %uint_16711680 + %20634 = OpShiftRightLogical %uint %21212 %uint_8 + %24000 = OpBitwiseOr %uint %17045 %20634 + %19599 = OpBitwiseAnd %uint %15381 %uint_4278190080 + %21584 = OpShiftRightLogical %uint %19599 %uint_24 + %16377 = OpBitwiseOr %uint %24000 %21584 + OpBranch %10204 + %13163 = OpLabel + OpUnreachable + %19530 = OpLabel + %19075 = OpBitwiseAnd %uint %15381 %uint_16711935 + %9426 = OpShiftLeftLogical %uint %19075 %uint_8 + %20653 = OpBitwiseAnd %uint %15381 %uint_4278255360 + %17550 = OpShiftRightLogical %uint %20653 %uint_8 + %16378 = OpBitwiseOr %uint %9426 %17550 + OpBranch %10204 + %13164 = OpLabel + OpUnreachable + %11868 = OpLabel + OpBranch %10204 + %25238 = OpLabel + OpUnreachable + %10204 = OpLabel + %15672 = OpPhi %uint %15381 %11868 %16378 %19530 %16377 %21863 %16376 %10583 + %24496 = OpBitcast %float %15672 + %21708 = OpFAdd %float %24496 %float_1 + %7335 = OpAccessChain %_ptr_Uniform_float %4930 %int_0 %uint_0 + %12980 = OpLoad %float %7335 + %19190 = OpAccessChain %_ptr_Uniform_float %4930 %int_0 %uint_1 + %10126 = OpLoad %float %19190 + %23029 = OpExtInst %float %1 FClamp %21708 %12980 %10126 + OpStore %5229 %23029 + OpReturn + OpFunctionEnd +#endif + +const uint32_t tessellation_adaptive_vs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x00006297, 0x00000000, 0x00020011, + 0x00000001, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x0007000F, 0x00000000, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00001029, 0x0000146D, 0x00040047, + 0x00001029, 0x0000000B, 0x0000002A, 0x00030047, 0x00000457, 0x00000002, + 0x00050048, 0x00000457, 0x00000000, 0x00000023, 0x00000000, 0x00050048, + 0x00000457, 0x00000001, 0x00000023, 0x00000008, 0x00050048, 0x00000457, + 0x00000002, 0x00000023, 0x00000010, 0x00050048, 0x00000457, 0x00000003, + 0x00000023, 0x00000014, 0x00050048, 0x00000457, 0x00000004, 0x00000023, + 0x00000018, 0x00040047, 0x00001342, 0x00000021, 0x00000006, 0x00040047, + 0x00001342, 0x00000022, 0x00000001, 0x00040047, 0x0000146D, 0x0000001E, + 0x00000000, 0x00020013, 0x00000008, 0x00030021, 0x00000502, 0x00000008, + 0x00040015, 0x0000000B, 0x00000020, 0x00000000, 0x0004002B, 0x0000000B, + 0x00000A0A, 0x00000000, 0x00020014, 0x00000009, 0x0004002B, 0x0000000B, + 0x00000A0D, 0x00000001, 0x0004002B, 0x0000000B, 0x000008A6, 0x00FF00FF, + 0x0004002B, 0x0000000B, 0x00000A22, 0x00000008, 0x0004002B, 0x0000000B, + 0x000005FD, 0xFF00FF00, 0x0004002B, 0x0000000B, 0x00000A10, 0x00000002, + 0x0004002B, 0x0000000B, 0x00000144, 0x000000FF, 0x0004002B, 0x0000000B, + 0x00000A52, 0x00000018, 0x0004002B, 0x0000000B, 0x00000A87, 0x0000FF00, + 0x0004002B, 0x0000000B, 0x000005A9, 0x00FF0000, 0x0004002B, 0x0000000B, + 0x00000580, 0xFF000000, 0x0004002B, 0x0000000B, 0x000001C1, 0x0000FFFF, + 0x0004002B, 0x0000000B, 0x00000A3A, 0x00000010, 0x0004002B, 0x0000000B, + 0x0000068D, 0xFFFF0000, 0x00040015, 0x0000000C, 0x00000020, 0x00000001, + 0x00040020, 0x00000289, 0x00000001, 0x0000000C, 0x0004003B, 0x00000289, + 0x00001029, 0x00000001, 0x00030016, 0x0000000D, 0x00000020, 0x00040017, + 0x00000013, 0x0000000D, 0x00000002, 0x00040017, 0x00000011, 0x0000000B, + 0x00000002, 0x0007001E, 0x00000457, 0x00000013, 0x00000013, 0x0000000B, + 0x0000000B, 0x00000011, 0x00040020, 0x000006D4, 0x00000002, 0x00000457, + 0x0004003B, 0x000006D4, 0x00001342, 0x00000002, 0x0004002B, 0x0000000C, + 0x00000A11, 0x00000002, 0x00040020, 0x00000288, 0x00000002, 0x0000000B, + 0x0004002B, 0x0000000D, 0x0000008A, 0x3F800000, 0x00040020, 0x0000028A, + 0x00000003, 0x0000000D, 0x0004003B, 0x0000028A, 0x0000146D, 0x00000003, + 0x0004002B, 0x0000000C, 0x00000A0B, 0x00000000, 0x00040020, 0x0000028B, + 0x00000002, 0x0000000D, 0x00050036, 0x00000008, 0x0000161F, 0x00000000, + 0x00000502, 0x000200F8, 0x00001A4D, 0x0004003D, 0x0000000C, 0x000026CB, + 0x00001029, 0x0004007C, 0x0000000B, 0x00003C15, 0x000026CB, 0x00050041, + 0x00000288, 0x000025B8, 0x00001342, 0x00000A11, 0x0004003D, 0x0000000B, + 0x000057AA, 0x000025B8, 0x000300F7, 0x000027DC, 0x00000000, 0x000300FB, + 0x00000A0A, 0x00003FC0, 0x000200F8, 0x00003FC0, 0x000500AA, 0x00000009, + 0x00005A9D, 0x000057AA, 0x00000A0A, 0x000300F7, 0x00006296, 0x00000000, + 0x000400FA, 0x00005A9D, 0x00002E5C, 0x000040B9, 0x000200F8, 0x000040B9, + 0x000500AA, 0x00000009, 0x00004ADA, 0x000057AA, 0x00000A0D, 0x000300F7, + 0x0000336C, 0x00000000, 0x000400FA, 0x00004ADA, 0x00004C4A, 0x000040BA, + 0x000200F8, 0x000040BA, 0x000500AA, 0x00000009, 0x00004ADB, 0x000057AA, + 0x00000A10, 0x000300F7, 0x0000336B, 0x00000000, 0x000400FA, 0x00004ADB, + 0x00005567, 0x00002957, 0x000200F8, 0x00002957, 0x000500C7, 0x0000000B, + 0x0000475F, 0x00003C15, 0x000001C1, 0x000500C4, 0x0000000B, 0x000024D1, + 0x0000475F, 0x00000A3A, 0x000500C7, 0x0000000B, 0x000050AC, 0x00003C15, + 0x0000068D, 0x000500C2, 0x0000000B, 0x0000448D, 0x000050AC, 0x00000A3A, + 0x000500C5, 0x0000000B, 0x00003FF8, 0x000024D1, 0x0000448D, 0x000200F9, + 0x000027DC, 0x000200F8, 0x00005567, 0x000500C7, 0x0000000B, 0x000050D5, + 0x00003C15, 0x00000144, 0x000500C4, 0x0000000B, 0x000024F7, 0x000050D5, + 0x00000A52, 0x000500C7, 0x0000000B, 0x00004F52, 0x00003C15, 0x00000A87, + 0x000500C4, 0x0000000B, 0x00004B54, 0x00004F52, 0x00000A22, 0x000500C5, + 0x0000000B, 0x00004295, 0x000024F7, 0x00004B54, 0x000500C7, 0x0000000B, + 0x000052DC, 0x00003C15, 0x000005A9, 0x000500C2, 0x0000000B, 0x0000509A, + 0x000052DC, 0x00000A22, 0x000500C5, 0x0000000B, 0x00005DC0, 0x00004295, + 0x0000509A, 0x000500C7, 0x0000000B, 0x00004C8F, 0x00003C15, 0x00000580, + 0x000500C2, 0x0000000B, 0x00005450, 0x00004C8F, 0x00000A52, 0x000500C5, + 0x0000000B, 0x00003FF9, 0x00005DC0, 0x00005450, 0x000200F9, 0x000027DC, + 0x000200F8, 0x0000336B, 0x000100FF, 0x000200F8, 0x00004C4A, 0x000500C7, + 0x0000000B, 0x00004A83, 0x00003C15, 0x000008A6, 0x000500C4, 0x0000000B, + 0x000024D2, 0x00004A83, 0x00000A22, 0x000500C7, 0x0000000B, 0x000050AD, + 0x00003C15, 0x000005FD, 0x000500C2, 0x0000000B, 0x0000448E, 0x000050AD, + 0x00000A22, 0x000500C5, 0x0000000B, 0x00003FFA, 0x000024D2, 0x0000448E, + 0x000200F9, 0x000027DC, 0x000200F8, 0x0000336C, 0x000100FF, 0x000200F8, + 0x00002E5C, 0x000200F9, 0x000027DC, 0x000200F8, 0x00006296, 0x000100FF, + 0x000200F8, 0x000027DC, 0x000B00F5, 0x0000000B, 0x00003D38, 0x00003C15, + 0x00002E5C, 0x00003FFA, 0x00004C4A, 0x00003FF9, 0x00005567, 0x00003FF8, + 0x00002957, 0x0004007C, 0x0000000D, 0x00005FB0, 0x00003D38, 0x00050081, + 0x0000000D, 0x000054CC, 0x00005FB0, 0x0000008A, 0x00060041, 0x0000028B, + 0x00001CA7, 0x00001342, 0x00000A0B, 0x00000A0A, 0x0004003D, 0x0000000D, + 0x000032B4, 0x00001CA7, 0x00060041, 0x0000028B, 0x00004AF6, 0x00001342, + 0x00000A0B, 0x00000A0D, 0x0004003D, 0x0000000D, 0x0000278E, 0x00004AF6, + 0x0008000C, 0x0000000D, 0x000059F5, 0x00000001, 0x0000002B, 0x000054CC, + 0x000032B4, 0x0000278E, 0x0003003E, 0x0000146D, 0x000059F5, 0x000100FD, + 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/bytecode/vulkan_spirv/tessellation_indexed_vs.h b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/tessellation_indexed_vs.h new file mode 100644 index 000000000..be7018eb4 --- /dev/null +++ b/src/xenia/gpu/shaders/bytecode/vulkan_spirv/tessellation_indexed_vs.h @@ -0,0 +1,208 @@ +// Generated with `xb buildshaders`. +#if 0 +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 11 +; Bound: 25239 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %5663 "main" %gl_VertexIndex %3307 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpDecorate %_struct_1111 Block + OpMemberDecorate %_struct_1111 0 Offset 0 + OpMemberDecorate %_struct_1111 1 Offset 8 + OpMemberDecorate %_struct_1111 2 Offset 16 + OpMemberDecorate %_struct_1111 3 Offset 20 + OpMemberDecorate %_struct_1111 4 Offset 24 + OpDecorate %4930 Binding 6 + OpDecorate %4930 DescriptorSet 1 + OpDecorate %3307 Location 0 + %void = OpTypeVoid + %1282 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %bool = OpTypeBool + %uint_1 = OpConstant %uint 1 +%uint_16711935 = OpConstant %uint 16711935 + %uint_8 = OpConstant %uint 8 +%uint_4278255360 = OpConstant %uint 4278255360 + %uint_2 = OpConstant %uint 2 + %uint_255 = OpConstant %uint 255 + %uint_24 = OpConstant %uint 24 + %uint_65280 = OpConstant %uint 65280 +%uint_16711680 = OpConstant %uint 16711680 +%uint_4278190080 = OpConstant %uint 4278190080 + %uint_65535 = OpConstant %uint 65535 + %uint_16 = OpConstant %uint 16 +%uint_4294901760 = OpConstant %uint 4294901760 + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v2uint = OpTypeVector %uint 2 +%_struct_1111 = OpTypeStruct %v2float %v2float %uint %uint %v2uint +%_ptr_Uniform__struct_1111 = OpTypePointer Uniform %_struct_1111 + %4930 = OpVariable %_ptr_Uniform__struct_1111 Uniform + %int_2 = OpConstant %int 2 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_ptr_Output_float = OpTypePointer Output %float + %3307 = OpVariable %_ptr_Output_float Output + %int_3 = OpConstant %int 3 +%uint_16777215 = OpConstant %uint 16777215 + %int_4 = OpConstant %int 4 + %5663 = OpFunction %void None %1282 + %6733 = OpLabel + %9931 = OpLoad %int %gl_VertexIndex + %15381 = OpBitcast %uint %9931 + %9656 = OpAccessChain %_ptr_Uniform_uint %4930 %int_2 + %22442 = OpLoad %uint %9656 + OpSelectionMerge %9083 None + OpSwitch %uint_0 %16320 + %16320 = OpLabel + %23197 = OpIEqual %bool %22442 %uint_0 + OpSelectionMerge %25238 None + OpBranchConditional %23197 %11868 %16569 + %16569 = OpLabel + %19162 = OpIEqual %bool %22442 %uint_1 + OpSelectionMerge %13164 None + OpBranchConditional %19162 %19530 %16570 + %16570 = OpLabel + %19163 = OpIEqual %bool %22442 %uint_2 + OpSelectionMerge %13163 None + OpBranchConditional %19163 %21863 %10583 + %10583 = OpLabel + %18271 = OpBitwiseAnd %uint %15381 %uint_65535 + %9425 = OpShiftLeftLogical %uint %18271 %uint_16 + %20652 = OpBitwiseAnd %uint %15381 %uint_4294901760 + %17549 = OpShiftRightLogical %uint %20652 %uint_16 + %16376 = OpBitwiseOr %uint %9425 %17549 + OpBranch %9083 + %21863 = OpLabel + %20693 = OpBitwiseAnd %uint %15381 %uint_255 + %9463 = OpShiftLeftLogical %uint %20693 %uint_24 + %20306 = OpBitwiseAnd %uint %15381 %uint_65280 + %19284 = OpShiftLeftLogical %uint %20306 %uint_8 + %17045 = OpBitwiseOr %uint %9463 %19284 + %21212 = OpBitwiseAnd %uint %15381 %uint_16711680 + %20634 = OpShiftRightLogical %uint %21212 %uint_8 + %24000 = OpBitwiseOr %uint %17045 %20634 + %19599 = OpBitwiseAnd %uint %15381 %uint_4278190080 + %21584 = OpShiftRightLogical %uint %19599 %uint_24 + %16377 = OpBitwiseOr %uint %24000 %21584 + OpBranch %9083 + %13163 = OpLabel + OpUnreachable + %19530 = OpLabel + %19075 = OpBitwiseAnd %uint %15381 %uint_16711935 + %9426 = OpShiftLeftLogical %uint %19075 %uint_8 + %20653 = OpBitwiseAnd %uint %15381 %uint_4278255360 + %17550 = OpShiftRightLogical %uint %20653 %uint_8 + %16378 = OpBitwiseOr %uint %9426 %17550 + OpBranch %9083 + %13164 = OpLabel + OpUnreachable + %11868 = OpLabel + OpBranch %9083 + %25238 = OpLabel + OpUnreachable + %9083 = OpLabel + %24587 = OpPhi %uint %15381 %11868 %16378 %19530 %16377 %21863 %16376 %10583 + %24998 = OpAccessChain %_ptr_Uniform_uint %4930 %int_3 + %8159 = OpLoad %uint %24998 + %7652 = OpIAdd %uint %24587 %8159 + %18847 = OpBitwiseAnd %uint %7652 %uint_16777215 + %10702 = OpAccessChain %_ptr_Uniform_uint %4930 %int_4 %uint_0 + %24236 = OpLoad %uint %10702 + %19191 = OpAccessChain %_ptr_Uniform_uint %4930 %int_4 %uint_1 + %22108 = OpLoad %uint %19191 + %23723 = OpExtInst %uint %1 UClamp %18847 %24236 %22108 + %9576 = OpConvertUToF %float %23723 + OpStore %3307 %9576 + OpReturn + OpFunctionEnd +#endif + +const uint32_t tessellation_indexed_vs[] = { + 0x07230203, 0x00010000, 0x0008000B, 0x00006297, 0x00000000, 0x00020011, + 0x00000001, 0x0006000B, 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E, + 0x00000000, 0x0003000E, 0x00000000, 0x00000001, 0x0007000F, 0x00000000, + 0x0000161F, 0x6E69616D, 0x00000000, 0x00001029, 0x00000CEB, 0x00040047, + 0x00001029, 0x0000000B, 0x0000002A, 0x00030047, 0x00000457, 0x00000002, + 0x00050048, 0x00000457, 0x00000000, 0x00000023, 0x00000000, 0x00050048, + 0x00000457, 0x00000001, 0x00000023, 0x00000008, 0x00050048, 0x00000457, + 0x00000002, 0x00000023, 0x00000010, 0x00050048, 0x00000457, 0x00000003, + 0x00000023, 0x00000014, 0x00050048, 0x00000457, 0x00000004, 0x00000023, + 0x00000018, 0x00040047, 0x00001342, 0x00000021, 0x00000006, 0x00040047, + 0x00001342, 0x00000022, 0x00000001, 0x00040047, 0x00000CEB, 0x0000001E, + 0x00000000, 0x00020013, 0x00000008, 0x00030021, 0x00000502, 0x00000008, + 0x00040015, 0x0000000B, 0x00000020, 0x00000000, 0x0004002B, 0x0000000B, + 0x00000A0A, 0x00000000, 0x00020014, 0x00000009, 0x0004002B, 0x0000000B, + 0x00000A0D, 0x00000001, 0x0004002B, 0x0000000B, 0x000008A6, 0x00FF00FF, + 0x0004002B, 0x0000000B, 0x00000A22, 0x00000008, 0x0004002B, 0x0000000B, + 0x000005FD, 0xFF00FF00, 0x0004002B, 0x0000000B, 0x00000A10, 0x00000002, + 0x0004002B, 0x0000000B, 0x00000144, 0x000000FF, 0x0004002B, 0x0000000B, + 0x00000A52, 0x00000018, 0x0004002B, 0x0000000B, 0x00000A87, 0x0000FF00, + 0x0004002B, 0x0000000B, 0x000005A9, 0x00FF0000, 0x0004002B, 0x0000000B, + 0x00000580, 0xFF000000, 0x0004002B, 0x0000000B, 0x000001C1, 0x0000FFFF, + 0x0004002B, 0x0000000B, 0x00000A3A, 0x00000010, 0x0004002B, 0x0000000B, + 0x0000068D, 0xFFFF0000, 0x00040015, 0x0000000C, 0x00000020, 0x00000001, + 0x00040020, 0x00000289, 0x00000001, 0x0000000C, 0x0004003B, 0x00000289, + 0x00001029, 0x00000001, 0x00030016, 0x0000000D, 0x00000020, 0x00040017, + 0x00000013, 0x0000000D, 0x00000002, 0x00040017, 0x00000011, 0x0000000B, + 0x00000002, 0x0007001E, 0x00000457, 0x00000013, 0x00000013, 0x0000000B, + 0x0000000B, 0x00000011, 0x00040020, 0x000006D4, 0x00000002, 0x00000457, + 0x0004003B, 0x000006D4, 0x00001342, 0x00000002, 0x0004002B, 0x0000000C, + 0x00000A11, 0x00000002, 0x00040020, 0x00000288, 0x00000002, 0x0000000B, + 0x00040020, 0x0000028A, 0x00000003, 0x0000000D, 0x0004003B, 0x0000028A, + 0x00000CEB, 0x00000003, 0x0004002B, 0x0000000C, 0x00000A14, 0x00000003, + 0x0004002B, 0x0000000B, 0x00000923, 0x00FFFFFF, 0x0004002B, 0x0000000C, + 0x00000A17, 0x00000004, 0x00050036, 0x00000008, 0x0000161F, 0x00000000, + 0x00000502, 0x000200F8, 0x00001A4D, 0x0004003D, 0x0000000C, 0x000026CB, + 0x00001029, 0x0004007C, 0x0000000B, 0x00003C15, 0x000026CB, 0x00050041, + 0x00000288, 0x000025B8, 0x00001342, 0x00000A11, 0x0004003D, 0x0000000B, + 0x000057AA, 0x000025B8, 0x000300F7, 0x0000237B, 0x00000000, 0x000300FB, + 0x00000A0A, 0x00003FC0, 0x000200F8, 0x00003FC0, 0x000500AA, 0x00000009, + 0x00005A9D, 0x000057AA, 0x00000A0A, 0x000300F7, 0x00006296, 0x00000000, + 0x000400FA, 0x00005A9D, 0x00002E5C, 0x000040B9, 0x000200F8, 0x000040B9, + 0x000500AA, 0x00000009, 0x00004ADA, 0x000057AA, 0x00000A0D, 0x000300F7, + 0x0000336C, 0x00000000, 0x000400FA, 0x00004ADA, 0x00004C4A, 0x000040BA, + 0x000200F8, 0x000040BA, 0x000500AA, 0x00000009, 0x00004ADB, 0x000057AA, + 0x00000A10, 0x000300F7, 0x0000336B, 0x00000000, 0x000400FA, 0x00004ADB, + 0x00005567, 0x00002957, 0x000200F8, 0x00002957, 0x000500C7, 0x0000000B, + 0x0000475F, 0x00003C15, 0x000001C1, 0x000500C4, 0x0000000B, 0x000024D1, + 0x0000475F, 0x00000A3A, 0x000500C7, 0x0000000B, 0x000050AC, 0x00003C15, + 0x0000068D, 0x000500C2, 0x0000000B, 0x0000448D, 0x000050AC, 0x00000A3A, + 0x000500C5, 0x0000000B, 0x00003FF8, 0x000024D1, 0x0000448D, 0x000200F9, + 0x0000237B, 0x000200F8, 0x00005567, 0x000500C7, 0x0000000B, 0x000050D5, + 0x00003C15, 0x00000144, 0x000500C4, 0x0000000B, 0x000024F7, 0x000050D5, + 0x00000A52, 0x000500C7, 0x0000000B, 0x00004F52, 0x00003C15, 0x00000A87, + 0x000500C4, 0x0000000B, 0x00004B54, 0x00004F52, 0x00000A22, 0x000500C5, + 0x0000000B, 0x00004295, 0x000024F7, 0x00004B54, 0x000500C7, 0x0000000B, + 0x000052DC, 0x00003C15, 0x000005A9, 0x000500C2, 0x0000000B, 0x0000509A, + 0x000052DC, 0x00000A22, 0x000500C5, 0x0000000B, 0x00005DC0, 0x00004295, + 0x0000509A, 0x000500C7, 0x0000000B, 0x00004C8F, 0x00003C15, 0x00000580, + 0x000500C2, 0x0000000B, 0x00005450, 0x00004C8F, 0x00000A52, 0x000500C5, + 0x0000000B, 0x00003FF9, 0x00005DC0, 0x00005450, 0x000200F9, 0x0000237B, + 0x000200F8, 0x0000336B, 0x000100FF, 0x000200F8, 0x00004C4A, 0x000500C7, + 0x0000000B, 0x00004A83, 0x00003C15, 0x000008A6, 0x000500C4, 0x0000000B, + 0x000024D2, 0x00004A83, 0x00000A22, 0x000500C7, 0x0000000B, 0x000050AD, + 0x00003C15, 0x000005FD, 0x000500C2, 0x0000000B, 0x0000448E, 0x000050AD, + 0x00000A22, 0x000500C5, 0x0000000B, 0x00003FFA, 0x000024D2, 0x0000448E, + 0x000200F9, 0x0000237B, 0x000200F8, 0x0000336C, 0x000100FF, 0x000200F8, + 0x00002E5C, 0x000200F9, 0x0000237B, 0x000200F8, 0x00006296, 0x000100FF, + 0x000200F8, 0x0000237B, 0x000B00F5, 0x0000000B, 0x0000600B, 0x00003C15, + 0x00002E5C, 0x00003FFA, 0x00004C4A, 0x00003FF9, 0x00005567, 0x00003FF8, + 0x00002957, 0x00050041, 0x00000288, 0x000061A6, 0x00001342, 0x00000A14, + 0x0004003D, 0x0000000B, 0x00001FDF, 0x000061A6, 0x00050080, 0x0000000B, + 0x00001DE4, 0x0000600B, 0x00001FDF, 0x000500C7, 0x0000000B, 0x0000499F, + 0x00001DE4, 0x00000923, 0x00060041, 0x00000288, 0x000029CE, 0x00001342, + 0x00000A17, 0x00000A0A, 0x0004003D, 0x0000000B, 0x00005EAC, 0x000029CE, + 0x00060041, 0x00000288, 0x00004AF7, 0x00001342, 0x00000A17, 0x00000A0D, + 0x0004003D, 0x0000000B, 0x0000565C, 0x00004AF7, 0x0008000C, 0x0000000B, + 0x00005CAB, 0x00000001, 0x0000002C, 0x0000499F, 0x00005EAC, 0x0000565C, + 0x00040070, 0x0000000D, 0x00002568, 0x00005CAB, 0x0003003E, 0x00000CEB, + 0x00002568, 0x000100FD, 0x00010038, +}; diff --git a/src/xenia/gpu/shaders/continuous_quad_1cp.hs.glsl b/src/xenia/gpu/shaders/continuous_quad_1cp.hs.glsl new file mode 100644 index 000000000..11a77e875 --- /dev/null +++ b/src/xenia/gpu/shaders/continuous_quad_1cp.hs.glsl @@ -0,0 +1,43 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Tessellation control shader for continuous quad tessellation with 1 control +// point (patch indexed). +// Uses fractional_even spacing for smooth tessellation. + +layout(vertices = 1) out; + +#include "xenos_draw.glsli" + +// Input from vertex shader - vertex index as float. +layout(location = 0) in float in_index[]; + +// Output to tessellation evaluation shader - vertex index as float. +layout(location = 0) out float out_index[]; + +void main() { + // Pass through the vertex index. + out_index[gl_InvocationID] = in_index[gl_InvocationID]; + + // Set tessellation levels (only one invocation for 1cp). + // 1.0 already added to the factor on the CPU, according to the images in + // https://www.slideshare.net/blackdevilvikas/next-generation-graphics-programming-on-xbox-360 + // (fractional_even also requires a factor of at least 2.0). + float factor = xe_tessellation_factor_range.y; + + gl_TessLevelOuter[0] = factor; + gl_TessLevelOuter[1] = factor; + gl_TessLevelOuter[2] = factor; + gl_TessLevelOuter[3] = factor; + gl_TessLevelInner[0] = factor; + gl_TessLevelInner[1] = factor; +} diff --git a/src/xenia/gpu/shaders/continuous_quad_4cp.hs.glsl b/src/xenia/gpu/shaders/continuous_quad_4cp.hs.glsl new file mode 100644 index 000000000..885d6bfd4 --- /dev/null +++ b/src/xenia/gpu/shaders/continuous_quad_4cp.hs.glsl @@ -0,0 +1,45 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Tessellation control shader for continuous quad tessellation with 4 control +// points (control point indexed). +// Uses fractional_even spacing for smooth tessellation. + +layout(vertices = 4) out; + +#include "xenos_draw.glsli" + +// Input from vertex shader - vertex index as float. +layout(location = 0) in float in_index[]; + +// Output to tessellation evaluation shader - vertex index as float. +layout(location = 0) out float out_index[]; + +void main() { + // Pass through the vertex index. + out_index[gl_InvocationID] = in_index[gl_InvocationID]; + + // Set tessellation levels (only needs to be done by one invocation). + if (gl_InvocationID == 0) { + // 1.0 already added to the factor on the CPU, according to the images in + // https://www.slideshare.net/blackdevilvikas/next-generation-graphics-programming-on-xbox-360 + // (fractional_even also requires a factor of at least 2.0). + float factor = xe_tessellation_factor_range.y; + + gl_TessLevelOuter[0] = factor; + gl_TessLevelOuter[1] = factor; + gl_TessLevelOuter[2] = factor; + gl_TessLevelOuter[3] = factor; + gl_TessLevelInner[0] = factor; + gl_TessLevelInner[1] = factor; + } +} diff --git a/src/xenia/gpu/shaders/continuous_triangle_1cp.hs.glsl b/src/xenia/gpu/shaders/continuous_triangle_1cp.hs.glsl new file mode 100644 index 000000000..f5f9429ad --- /dev/null +++ b/src/xenia/gpu/shaders/continuous_triangle_1cp.hs.glsl @@ -0,0 +1,41 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Tessellation control shader for continuous triangle tessellation with 1 +// control point (patch indexed). +// Uses fractional_even spacing for smooth tessellation. + +layout(vertices = 1) out; + +#include "xenos_draw.glsli" + +// Input from vertex shader - vertex index as float. +layout(location = 0) in float in_index[]; + +// Output to tessellation evaluation shader - vertex index as float. +layout(location = 0) out float out_index[]; + +void main() { + // Pass through the vertex index. + out_index[gl_InvocationID] = in_index[gl_InvocationID]; + + // Set tessellation levels (only one invocation for 1cp). + // 1.0 already added to the factor on the CPU, according to the images in + // https://www.slideshare.net/blackdevilvikas/next-generation-graphics-programming-on-xbox-360 + // (fractional_even also requires a factor of at least 2.0). + float factor = xe_tessellation_factor_range.y; + + gl_TessLevelOuter[0] = factor; + gl_TessLevelOuter[1] = factor; + gl_TessLevelOuter[2] = factor; + gl_TessLevelInner[0] = factor; +} diff --git a/src/xenia/gpu/shaders/continuous_triangle_3cp.hs.glsl b/src/xenia/gpu/shaders/continuous_triangle_3cp.hs.glsl new file mode 100644 index 000000000..f3040725d --- /dev/null +++ b/src/xenia/gpu/shaders/continuous_triangle_3cp.hs.glsl @@ -0,0 +1,43 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Tessellation control shader for continuous triangle tessellation with 3 +// control points (control point indexed). +// Uses fractional_even spacing for smooth tessellation. + +layout(vertices = 3) out; + +#include "xenos_draw.glsli" + +// Input from vertex shader - vertex index as float. +layout(location = 0) in float in_index[]; + +// Output to tessellation evaluation shader - vertex index as float. +layout(location = 0) out float out_index[]; + +void main() { + // Pass through the vertex index. + out_index[gl_InvocationID] = in_index[gl_InvocationID]; + + // Set tessellation levels (only needs to be done by one invocation). + if (gl_InvocationID == 0) { + // 1.0 already added to the factor on the CPU, according to the images in + // https://www.slideshare.net/blackdevilvikas/next-generation-graphics-programming-on-xbox-360 + // (fractional_even also requires a factor of at least 2.0). + float factor = xe_tessellation_factor_range.y; + + gl_TessLevelOuter[0] = factor; + gl_TessLevelOuter[1] = factor; + gl_TessLevelOuter[2] = factor; + gl_TessLevelInner[0] = factor; + } +} diff --git a/src/xenia/gpu/shaders/discrete_quad_1cp.hs.glsl b/src/xenia/gpu/shaders/discrete_quad_1cp.hs.glsl new file mode 100644 index 000000000..73fe803f6 --- /dev/null +++ b/src/xenia/gpu/shaders/discrete_quad_1cp.hs.glsl @@ -0,0 +1,41 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Tessellation control shader for discrete quad tessellation with 1 control +// point (patch indexed). + +layout(vertices = 1) out; + +#include "xenos_draw.glsli" + +// Input from vertex shader - vertex index as float. +layout(location = 0) in float in_index[]; + +// Output to tessellation evaluation shader - vertex index as float. +layout(location = 0) out float out_index[]; + +void main() { + // Pass through the vertex index. + out_index[gl_InvocationID] = in_index[gl_InvocationID]; + + // Set tessellation levels (only one invocation for 1cp). + // 1.0 already added to the factor on the CPU, according to the images in + // https://www.slideshare.net/blackdevilvikas/next-generation-graphics-programming-on-xbox-360 + float factor = xe_tessellation_factor_range.y; + + gl_TessLevelOuter[0] = factor; + gl_TessLevelOuter[1] = factor; + gl_TessLevelOuter[2] = factor; + gl_TessLevelOuter[3] = factor; + gl_TessLevelInner[0] = factor; + gl_TessLevelInner[1] = factor; +} diff --git a/src/xenia/gpu/shaders/discrete_quad_4cp.hs.glsl b/src/xenia/gpu/shaders/discrete_quad_4cp.hs.glsl new file mode 100644 index 000000000..9b1e3dce9 --- /dev/null +++ b/src/xenia/gpu/shaders/discrete_quad_4cp.hs.glsl @@ -0,0 +1,43 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Tessellation control shader for discrete quad tessellation with 4 control +// points (control point indexed). + +layout(vertices = 4) out; + +#include "xenos_draw.glsli" + +// Input from vertex shader - vertex index as float. +layout(location = 0) in float in_index[]; + +// Output to tessellation evaluation shader - vertex index as float. +layout(location = 0) out float out_index[]; + +void main() { + // Pass through the vertex index. + out_index[gl_InvocationID] = in_index[gl_InvocationID]; + + // Set tessellation levels (only needs to be done by one invocation). + if (gl_InvocationID == 0) { + // 1.0 already added to the factor on the CPU, according to the images in + // https://www.slideshare.net/blackdevilvikas/next-generation-graphics-programming-on-xbox-360 + float factor = xe_tessellation_factor_range.y; + + gl_TessLevelOuter[0] = factor; + gl_TessLevelOuter[1] = factor; + gl_TessLevelOuter[2] = factor; + gl_TessLevelOuter[3] = factor; + gl_TessLevelInner[0] = factor; + gl_TessLevelInner[1] = factor; + } +} diff --git a/src/xenia/gpu/shaders/discrete_triangle_1cp.hs.glsl b/src/xenia/gpu/shaders/discrete_triangle_1cp.hs.glsl new file mode 100644 index 000000000..43ebaa68a --- /dev/null +++ b/src/xenia/gpu/shaders/discrete_triangle_1cp.hs.glsl @@ -0,0 +1,44 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Tessellation control shader for discrete triangle tessellation with 1 control +// point (patch indexed). + +layout(vertices = 1) out; + +#include "xenos_draw.glsli" + +// Input from vertex shader - vertex index as float. +layout(location = 0) in float in_index[]; + +// Output to tessellation evaluation shader - vertex index as float. +layout(location = 0) out float out_index[]; + +void main() { + // Pass through the vertex index. + out_index[gl_InvocationID] = in_index[gl_InvocationID]; + + // Set tessellation levels (only one invocation for 1cp). + // Xenos creates a uniform grid for triangles, but this can't be reproduced + // using the tessellator on the PC, so just use what has the closest level + // of detail. + // https://www.slideshare.net/blackdevilvikas/next-generation-graphics-programming-on-xbox-360 + // + // 1.0 already added to the factor on the CPU, according to the images in + // the slides above. + float factor = xe_tessellation_factor_range.y; + + gl_TessLevelOuter[0] = factor; + gl_TessLevelOuter[1] = factor; + gl_TessLevelOuter[2] = factor; + gl_TessLevelInner[0] = factor; +} diff --git a/src/xenia/gpu/shaders/discrete_triangle_3cp.hs.glsl b/src/xenia/gpu/shaders/discrete_triangle_3cp.hs.glsl new file mode 100644 index 000000000..d08381848 --- /dev/null +++ b/src/xenia/gpu/shaders/discrete_triangle_3cp.hs.glsl @@ -0,0 +1,46 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Tessellation control shader for discrete triangle tessellation with 3 control +// points (control point indexed). + +layout(vertices = 3) out; + +#include "xenos_draw.glsli" + +// Input from vertex shader - vertex index as float. +layout(location = 0) in float in_index[]; + +// Output to tessellation evaluation shader - vertex index as float. +layout(location = 0) out float out_index[]; + +void main() { + // Pass through the vertex index. + out_index[gl_InvocationID] = in_index[gl_InvocationID]; + + // Set tessellation levels (only needs to be done by one invocation). + if (gl_InvocationID == 0) { + // Xenos creates a uniform grid for triangles, but this can't be reproduced + // using the tessellator on the PC, so just use what has the closest level + // of detail. + // https://www.slideshare.net/blackdevilvikas/next-generation-graphics-programming-on-xbox-360 + // + // 1.0 already added to the factor on the CPU, according to the images in + // the slides above. + float factor = xe_tessellation_factor_range.y; + + gl_TessLevelOuter[0] = factor; + gl_TessLevelOuter[1] = factor; + gl_TessLevelOuter[2] = factor; + gl_TessLevelInner[0] = factor; + } +} diff --git a/src/xenia/gpu/shaders/tesc.spv b/src/xenia/gpu/shaders/tesc.spv new file mode 100644 index 000000000..7df38c873 Binary files /dev/null and b/src/xenia/gpu/shaders/tesc.spv differ diff --git a/src/xenia/gpu/shaders/tessellation_adaptive.vs.glsl b/src/xenia/gpu/shaders/tessellation_adaptive.vs.glsl new file mode 100644 index 000000000..2b4e523c4 --- /dev/null +++ b/src/xenia/gpu/shaders/tessellation_adaptive.vs.glsl @@ -0,0 +1,55 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Vertex shader for adaptive tessellation. +// Reads edge tessellation factors from the index buffer (as float32) and passes +// them to the tessellation control shader. + +#include "xenos_draw.glsli" + +// Output to tessellation control shader - edge tessellation factor. +layout(location = 0) out float out_edge_factor; + +// Endian swap for 32-bit value. +uint XeEndianSwap32(uint value, uint endian) { + if (endian == 0u) { + // No swap. + return value; + } else if (endian == 1u) { + // 8-in-16. + return ((value & 0x00FF00FFu) << 8u) | ((value & 0xFF00FF00u) >> 8u); + } else if (endian == 2u) { + // 8-in-32. + return ((value & 0x000000FFu) << 24u) | ((value & 0x0000FF00u) << 8u) | + ((value & 0x00FF0000u) >> 8u) | ((value & 0xFF000000u) >> 24u); + } else { + // 16-in-32. + return ((value & 0x0000FFFFu) << 16u) | ((value & 0xFFFF0000u) >> 16u); + } +} + +void main() { + // The Xbox 360's GPU accepts the float32 tessellation factors for edges + // through a special kind of an index buffer. + // While 4D5307F2 sets the factors to 0 for frustum-culled (quad) patches, in + // 4D5307E6 only allowing patches with factors above 0 makes distant + // (triangle) patches disappear - it appears that there are no special values + // for culled patches on the Xbox 360 (unlike zero, negative and NaN on + // Direct3D 11). + // + // The vertex index (gl_VertexIndex) contains the raw edge factor bits from + // the index buffer. We need to endian swap and interpret as float. + uint factor_bits = XeEndianSwap32(uint(gl_VertexIndex), xe_vertex_index_endian); + float factor = uintBitsToFloat(factor_bits) + 1.0; + out_edge_factor = clamp(factor, xe_tessellation_factor_range.x, + xe_tessellation_factor_range.y); +} diff --git a/src/xenia/gpu/shaders/tessellation_indexed.vs.glsl b/src/xenia/gpu/shaders/tessellation_indexed.vs.glsl new file mode 100644 index 000000000..cbac9f70d --- /dev/null +++ b/src/xenia/gpu/shaders/tessellation_indexed.vs.glsl @@ -0,0 +1,46 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#version 460 +#extension GL_GOOGLE_include_directive : require + +// Vertex shader for indexed tessellation (discrete/continuous modes). +// Passes the vertex index to the tessellation control shader. + +#include "xenos_draw.glsli" + +// Output to tessellation control shader - vertex index as float. +layout(location = 0) out float out_index; + +// Endian swap for 32-bit value. +uint XeEndianSwap32(uint value, uint endian) { + if (endian == 0u) { + // No swap. + return value; + } else if (endian == 1u) { + // 8-in-16. + return ((value & 0x00FF00FFu) << 8u) | ((value & 0xFF00FF00u) >> 8u); + } else if (endian == 2u) { + // 8-in-32. + return ((value & 0x000000FFu) << 24u) | ((value & 0x0000FF00u) << 8u) | + ((value & 0x00FF0000u) >> 8u) | ((value & 0xFF000000u) >> 24u); + } else { + // 16-in-32. + return ((value & 0x0000FFFFu) << 16u) | ((value & 0xFFFF0000u) >> 16u); + } +} + +void main() { + // Only the lower 24 bits of the vertex index are used (tested on an Adreno + // 200 phone). `((index & 0xFFFFFF) + offset) & 0xFFFFFF` is the same as + // `(index + offset) & 0xFFFFFF`. + uint vertex_index = XeEndianSwap32(uint(gl_VertexIndex), xe_vertex_index_endian); + out_index = float(clamp((vertex_index + xe_vertex_index_offset) & 0xFFFFFFu, + xe_vertex_index_min_max.x, xe_vertex_index_min_max.y)); +} diff --git a/src/xenia/gpu/shaders/vert.spv b/src/xenia/gpu/shaders/vert.spv new file mode 100644 index 000000000..c16f29e5b Binary files /dev/null and b/src/xenia/gpu/shaders/vert.spv differ diff --git a/src/xenia/gpu/shaders/xenos_draw.glsli b/src/xenia/gpu/shaders/xenos_draw.glsli new file mode 100644 index 000000000..407b8e085 --- /dev/null +++ b/src/xenia/gpu/shaders/xenos_draw.glsli @@ -0,0 +1,37 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2025. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_GPU_SHADERS_XENOS_DRAW_GLSLI_ +#define XENIA_GPU_SHADERS_XENOS_DRAW_GLSLI_ + +// Tessellation constants for Vulkan tessellation shaders. +// This is a separate constant buffer dedicated to tessellation, not part of +// the main system constants, to avoid changing the existing SystemConstants +// layout. +// +// Binding: set 1 (kDescriptorSetConstants), binding 6 (after the existing +// constant buffers: +// 0 = System, 1 = FloatVertex, 2 = FloatPixel, 3 = BoolLoop, 4 = Fetch, +// 5 = ClipPlanes, 6 = Tessellation) + +layout(std140, set = 1, binding = 6) uniform XeTessellationConstants { + // Tessellation factor range: .x = min, .y = max. + // 1.0 is added on the CPU according to Xbox 360 tessellation documentation. + // For fractional_even partitioning, minimum factor must be >= 2.0. + vec2 xe_tessellation_factor_range; + // Padding to align next member to 8 bytes (std140 rules). + vec2 xe_tessellation_padding0; + + // Vertex/index processing parameters. + uint xe_vertex_index_endian; + uint xe_vertex_index_offset; + uvec2 xe_vertex_index_min_max; +}; + +#endif // XENIA_GPU_SHADERS_XENOS_DRAW_GLSLI_ diff --git a/src/xenia/gpu/spirv_compatibility.h b/src/xenia/gpu/spirv_compatibility.h index 94e703141..fe8127509 100644 --- a/src/xenia/gpu/spirv_compatibility.h +++ b/src/xenia/gpu/spirv_compatibility.h @@ -416,10 +416,17 @@ namespace spv { ExecutionMode::SampleInterlockOrderedEXT #define ExecutionModeInputPoints ExecutionMode::InputPoints #define ExecutionModeTriangles ExecutionMode::Triangles +#define ExecutionModeQuads ExecutionMode::Quads +#define ExecutionModeIsolines ExecutionMode::Isolines #define ExecutionModeInputLinesAdjacency ExecutionMode::InputLinesAdjacency #define ExecutionModeOutputTriangleStrip ExecutionMode::OutputTriangleStrip #define ExecutionModeInvocations ExecutionMode::Invocations #define ExecutionModeOutputVertices ExecutionMode::OutputVertices +#define ExecutionModeSpacingEqual ExecutionMode::SpacingEqual +#define ExecutionModeSpacingFractionalEven ExecutionMode::SpacingFractionalEven +#define ExecutionModeSpacingFractionalOdd ExecutionMode::SpacingFractionalOdd +#define ExecutionModeVertexOrderCw ExecutionMode::VertexOrderCw +#define ExecutionModeVertexOrderCcw ExecutionMode::VertexOrderCcw #define ExecutionModeDepthReplacing ExecutionMode::DepthReplacing #define ExecutionModeStencilRefReplacingEXT \ ExecutionMode::StencilRefReplacingEXT diff --git a/src/xenia/gpu/spirv_shader_translator.cc b/src/xenia/gpu/spirv_shader_translator.cc index 90ffcab11..43418bb4e 100644 --- a/src/xenia/gpu/spirv_shader_translator.cc +++ b/src/xenia/gpu/spirv_shader_translator.cc @@ -15,6 +15,7 @@ #include "third_party/fmt/include/fmt/format.h" #include "third_party/glslang/SPIRV/GLSL.std.450.h" #include "xenia/base/assert.h" +#include "xenia/base/logging.h" #include "xenia/base/math.h" #include "xenia/base/string_buffer.h" #include "xenia/gpu/spirv_compatibility.h" @@ -111,6 +112,12 @@ void SpirvShaderTranslator::Reset() { uniform_float_constants_ = spv::NoResult; + // Vertex shader inputs. + input_vertex_index_ = spv::NoResult; + // Tessellation evaluation shader inputs. + input_primitive_id_ = spv::NoResult; + input_tess_coord_ = spv::NoResult; + // Pixel shader inputs. input_point_coordinates_ = spv::NoResult; input_fragment_coordinates_ = spv::NoResult; input_front_facing_ = spv::NoResult; @@ -730,9 +737,45 @@ std::vector SpirvShaderTranslator::CompleteTranslation() { } } else { assert_true(is_vertex_shader()); - execution_model = IsSpirvTessEvalShader() - ? spv::ExecutionModelTessellationEvaluation - : spv::ExecutionModelVertex; + if (IsSpirvTessEvalShader()) { + execution_model = spv::ExecutionModelTessellationEvaluation; + // Set tessellation execution modes based on the domain shader type. + Modification shader_modification = GetSpirvShaderModification(); + Shader::HostVertexShaderType host_type = + shader_modification.vertex.host_vertex_shader_type; + // Tessellation domain (triangles vs quads). + switch (host_type) { + case Shader::HostVertexShaderType::kTriangleDomainCPIndexed: + case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed: + builder_->addExecutionMode(function_main_, + spv::ExecutionModeTriangles); + break; + case Shader::HostVertexShaderType::kQuadDomainCPIndexed: + case Shader::HostVertexShaderType::kQuadDomainPatchIndexed: + builder_->addExecutionMode(function_main_, spv::ExecutionModeQuads); + break; + case Shader::HostVertexShaderType::kLineDomainCPIndexed: + case Shader::HostVertexShaderType::kLineDomainPatchIndexed: + builder_->addExecutionMode(function_main_, + spv::ExecutionModeIsolines); + break; + default: + assert_unhandled_case(host_type); + break; + } + // Tessellation spacing - fractional_even for continuous mode, equal + // (integer) for discrete mode. The actual mode is determined by the TCS + // (hull shader), but we use fractional_even here as the default since it + // provides smooth results. The TCS sets the actual tessellation levels. + // For now, use fractional_even as it's more compatible. + builder_->addExecutionMode(function_main_, + spv::ExecutionModeSpacingFractionalEven); + // Vertex ordering - counter-clockwise (Vulkan default for front face). + builder_->addExecutionMode(function_main_, + spv::ExecutionModeVertexOrderCcw); + } else { + execution_model = spv::ExecutionModelVertex; + } } if (features_.denorm_flush_to_zero_float32) { // Flush to zero, similar to the real hardware, also for things like Shader @@ -1203,6 +1246,14 @@ void SpirvShaderTranslator::StartVertexOrTessEvalShaderBeforeMain() { builder_->addDecoration(input_primitive_id_, spv::DecorationBuiltIn, static_cast(spv::BuiltIn::PrimitiveId)); main_interface_.push_back(input_primitive_id_); + + // Tessellation coordinates (barycentric coordinates for the tessellated + // vertex within the patch). + input_tess_coord_ = builder_->createVariable( + spv::NoPrecision, spv::StorageClassInput, type_float3_, "gl_TessCoord"); + builder_->addDecoration(input_tess_coord_, spv::DecorationBuiltIn, + static_cast(spv::BuiltIn::TessCoord)); + main_interface_.push_back(input_tess_coord_); } else { input_vertex_index_ = builder_->createVariable( spv::NoPrecision, spv::StorageClassInput, type_int_, "gl_VertexIndex"); @@ -1421,8 +1472,166 @@ void SpirvShaderTranslator::StartVertexOrTessEvalShaderInMain() { // Load the vertex index or the tessellation parameters. if (register_count()) { - // TODO(Triang3l): Barycentric coordinates and patch index. - if (IsSpirvVertexShader()) { + if (IsSpirvTessEvalShader()) { + // Tessellation evaluation shader (domain shader). + // Copy barycentric coordinates (gl_TessCoord) to r0 with appropriate + // swizzle based on the domain type. + Shader::HostVertexShaderType host_type = + shader_modification.vertex.host_vertex_shader_type; + + spv::Id tess_coord = + builder_->createLoad(input_tess_coord_, spv::NoPrecision); + + switch (host_type) { + case Shader::HostVertexShaderType::kTriangleDomainCPIndexed: + case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed: { + // Triangle domain requires at least 2 registers (r0 for barycentric, + // r1 for control point indices or patch index). + assert_true(register_count() >= 2); + // Triangle domain: gl_TessCoord.xyz -> r0.zyx + // ZYX swizzle according to 415607E1 and 4D5307F2. + uint_vector_temp_.clear(); + uint_vector_temp_.push_back(2); // z -> r0.x + uint_vector_temp_.push_back(1); // y -> r0.y + uint_vector_temp_.push_back(0); // x -> r0.z + spv::Id tess_coord_zyx = builder_->createRvalueSwizzle( + spv::NoPrecision, type_float3_, tess_coord, uint_vector_temp_); + // Store to r0.xyz + id_vector_temp_.clear(); + id_vector_temp_.push_back(const_int_0_); + spv::Id r0_ptr = builder_->createAccessChain( + spv::StorageClassFunction, var_main_registers_, id_vector_temp_); + // Build float4 from swizzled xyz and w=1.0 + id_vector_temp_.clear(); + id_vector_temp_.push_back( + builder_->createCompositeExtract(tess_coord_zyx, type_float_, 0)); + id_vector_temp_.push_back( + builder_->createCompositeExtract(tess_coord_zyx, type_float_, 1)); + id_vector_temp_.push_back( + builder_->createCompositeExtract(tess_coord_zyx, type_float_, 2)); + id_vector_temp_.push_back(const_float_1_); + builder_->createStore( + builder_->createCompositeConstruct(type_float4_, id_vector_temp_), + r0_ptr); + break; + } + case Shader::HostVertexShaderType::kQuadDomainCPIndexed: { + // Quad domain requires at least 2 registers (r0 for domain location, + // r1 for control point indices). + assert_true(register_count() >= 2); + // Quad domain CP-indexed: gl_TessCoord.xy -> r0.yz, r0.x = 0, r0.w = + // 1 XY swizzle according to the ground shader in 4D5307F2. + uint_vector_temp_.clear(); + uint_vector_temp_.push_back(0); // x -> r0.y + uint_vector_temp_.push_back(1); // y -> r0.z + spv::Id tess_coord_xy = builder_->createRvalueSwizzle( + spv::NoPrecision, type_float2_, tess_coord, uint_vector_temp_); + // Store to r0 + id_vector_temp_.clear(); + id_vector_temp_.push_back(const_int_0_); + spv::Id r0_ptr = builder_->createAccessChain( + spv::StorageClassFunction, var_main_registers_, id_vector_temp_); + // Build float4 with x=0, yz from tess coord, w=1 + id_vector_temp_.clear(); + id_vector_temp_.push_back(const_float_0_); + id_vector_temp_.push_back( + builder_->createCompositeExtract(tess_coord_xy, type_float_, 0)); + id_vector_temp_.push_back( + builder_->createCompositeExtract(tess_coord_xy, type_float_, 1)); + id_vector_temp_.push_back(const_float_1_); + builder_->createStore( + builder_->createCompositeConstruct(type_float4_, id_vector_temp_), + r0_ptr); + break; + } + case Shader::HostVertexShaderType::kQuadDomainPatchIndexed: { + // Quad domain requires at least 2 registers (r0 for domain location + // and patch index, r1 for swizzle indicator). + assert_true(register_count() >= 2); + // Quad domain patch-indexed: gl_TessCoord.xy -> r0.yz, + // patch index -> r0.x, r0.w = 1 + // XY swizzle according to the ground shader in 4D5307F2. + uint_vector_temp_.clear(); + uint_vector_temp_.push_back(0); // x -> r0.y + uint_vector_temp_.push_back(1); // y -> r0.z + spv::Id tess_coord_xy = builder_->createRvalueSwizzle( + spv::NoPrecision, type_float2_, tess_coord, uint_vector_temp_); + // Load primitive ID (patch index) and convert to float. + spv::Id primitive_id = + builder_->createLoad(input_primitive_id_, spv::NoPrecision); + spv::Id patch_index_float = builder_->createUnaryOp( + spv::OpConvertSToF, type_float_, primitive_id); + // Store to r0: x = patch index, yz = tess coord, w = 1 + id_vector_temp_.clear(); + id_vector_temp_.push_back(const_int_0_); + spv::Id r0_ptr = builder_->createAccessChain( + spv::StorageClassFunction, var_main_registers_, id_vector_temp_); + id_vector_temp_.clear(); + id_vector_temp_.push_back(patch_index_float); + id_vector_temp_.push_back( + builder_->createCompositeExtract(tess_coord_xy, type_float_, 0)); + id_vector_temp_.push_back( + builder_->createCompositeExtract(tess_coord_xy, type_float_, 1)); + id_vector_temp_.push_back(const_float_1_); + builder_->createStore( + builder_->createCompositeConstruct(type_float4_, id_vector_temp_), + r0_ptr); + // Also set r1.x = 0.0f (swizzle indicator for identity swizzle). + if (register_count() >= 2) { + id_vector_temp_.clear(); + id_vector_temp_.push_back(builder_->makeIntConstant(1)); + id_vector_temp_.push_back(const_int_0_); + builder_->createStore(const_float_0_, + builder_->createAccessChain( + spv::StorageClassFunction, + var_main_registers_, id_vector_temp_)); + } + break; + } + case Shader::HostVertexShaderType::kLineDomainCPIndexed: + case Shader::HostVertexShaderType::kLineDomainPatchIndexed: + // Line domain tessellation is not yet implemented. + XELOGE( + "SPIRV: Line domain tessellation not implemented for host type " + "{}", + static_cast(host_type)); + assert_unhandled_case(host_type); + break; + default: + break; + } + + // For triangle patch-indexed mode, store patch index to r1.x and + // swizzle indicator (0.0f) to r1.y. + if (register_count() >= 2) { + if (host_type == + Shader::HostVertexShaderType::kTriangleDomainPatchIndexed) { + // Load primitive ID (patch index) and convert to float. + spv::Id primitive_id = + builder_->createLoad(input_primitive_id_, spv::NoPrecision); + spv::Id patch_index_float = builder_->createUnaryOp( + spv::OpConvertSToF, type_float_, primitive_id); + // Store patch index to r1.x + id_vector_temp_.clear(); + id_vector_temp_.push_back(builder_->makeIntConstant(1)); + id_vector_temp_.push_back(const_int_0_); + builder_->createStore(patch_index_float, + builder_->createAccessChain( + spv::StorageClassFunction, + var_main_registers_, id_vector_temp_)); + // Store swizzle indicator (0.0f = identity) to r1.y + // According to D3D12 implementation and comments in + // adaptive_triangle.hs.glsl, r1.y == 0 means identity swizzle. + id_vector_temp_.clear(); + id_vector_temp_.push_back(builder_->makeIntConstant(1)); + id_vector_temp_.push_back(builder_->makeIntConstant(1)); + builder_->createStore(const_float_0_, + builder_->createAccessChain( + spv::StorageClassFunction, + var_main_registers_, id_vector_temp_)); + } + } + } else if (IsSpirvVertexShader()) { spv::Id vertex_index = builder_->createUnaryOp( spv::OpBitcast, type_uint_, builder_->createLoad(input_vertex_index_, spv::NoPrecision)); diff --git a/src/xenia/gpu/spirv_shader_translator.h b/src/xenia/gpu/spirv_shader_translator.h index 99c0d72fd..c73ffb4b3 100644 --- a/src/xenia/gpu/spirv_shader_translator.h +++ b/src/xenia/gpu/spirv_shader_translator.h @@ -271,6 +271,21 @@ class SpirvShaderTranslator : public ShaderTranslator { float user_clip_planes[6][4]; }; + // Separate constant buffer for tessellation parameters. + // Must match the layout in xenos_draw.glsli (std140). + struct TessellationConstants { + // Tessellation factor range: [0] = min, [1] = max. + // 1.0 is added on the CPU according to Xbox 360 tessellation documentation. + // For fractional_even partitioning, minimum factor must be >= 2.0. + float tessellation_factor_range[2]; + // Padding to align next member to 8 bytes (std140 rules). + float padding0[2]; + // Vertex/index processing parameters. + uint32_t vertex_index_endian; + uint32_t vertex_index_offset; + uint32_t vertex_index_min_max[2]; + }; + enum ConstantBuffer : uint32_t { kConstantBufferSystem, kConstantBufferFloatVertex, @@ -278,6 +293,7 @@ class SpirvShaderTranslator : public ShaderTranslator { kConstantBufferBoolLoop, kConstantBufferFetch, kConstantBufferClipPlanes, + kConstantBufferTessellation, kConstantBufferCount, }; @@ -895,6 +911,8 @@ class SpirvShaderTranslator : public ShaderTranslator { spv::Id input_vertex_index_; // VS as TES only - int. spv::Id input_primitive_id_; + // VS as TES only - float3 (barycentric coordinates). + spv::Id input_tess_coord_; // PS, only when needed - float2. spv::Id input_point_coordinates_; // PS, only when needed - float4. diff --git a/src/xenia/gpu/vulkan/vulkan_command_processor.cc b/src/xenia/gpu/vulkan/vulkan_command_processor.cc index adf47c24f..390ea74fe 100644 --- a/src/xenia/gpu/vulkan/vulkan_command_processor.cc +++ b/src/xenia/gpu/vulkan/vulkan_command_processor.cc @@ -225,6 +225,21 @@ bool VulkanCommandProcessor::SetupContext() { descriptor_set_layout_bindings_constants [SpirvShaderTranslator::kConstantBufferFetch] .stageFlags = guest_shader_stages; + // Clip plane constants - used by vertex shader (and TES for tessellation). + descriptor_set_layout_bindings_constants + [SpirvShaderTranslator::kConstantBufferClipPlanes] + .stageFlags = guest_shader_vertex_stages_; + // Tessellation constants - used by tessellation control shader, the + // tessellation vertex shader (for index/factor processing), and the + // tessellation evaluation shader (domain shader, which is the translated + // Xenos vertex shader). + descriptor_set_layout_bindings_constants + [SpirvShaderTranslator::kConstantBufferTessellation] + .stageFlags = device_properties.tessellationShader + ? (VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT | + VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT | + VK_SHADER_STAGE_VERTEX_BIT) + : 0; descriptor_set_layout_create_info.bindingCount = uint32_t(xe::countof(descriptor_set_layout_bindings_constants)); descriptor_set_layout_create_info.pBindings = @@ -2302,12 +2317,17 @@ bool VulkanCommandProcessor::IssueDraw(xenos::PrimitiveType prim_type, // Nothing to draw. return true; } - // TODO(Triang3l): Tessellation, geometry-type-specific vertex shader, - // vertex shader as compute. + // TODO(Triang3l): Geometry-type-specific vertex shader, vertex shader as + // compute. + // Skip unsupported host vertex shader types (but allow tessellation types + // through - they will be handled in pipeline creation or rejected there if + // not fully supported yet). if (primitive_processing_result.host_vertex_shader_type != Shader::HostVertexShaderType::kVertex && primitive_processing_result.host_vertex_shader_type != - Shader::HostVertexShaderType::kPointListAsTriangleStrip) { + Shader::HostVertexShaderType::kPointListAsTriangleStrip && + !Shader::IsHostVertexShaderTypeDomain( + primitive_processing_result.host_vertex_shader_type)) { return false; } @@ -4514,6 +4534,49 @@ bool VulkanCommandProcessor::UpdateBindings(const VulkanShader* vertex_shader, current_constant_buffers_up_to_date_ |= UINT32_C(1) << SpirvShaderTranslator::kConstantBufferClipPlanes; } + // Tessellation constants. + // Always initialize the buffer info, even if tessellation is not active, + // because the descriptor set write always includes all constant buffers. + if (!(current_constant_buffers_up_to_date_ & + (UINT32_C(1) + << SpirvShaderTranslator::kConstantBufferTessellation))) { + VkDescriptorBufferInfo& buffer_info = current_constant_buffer_infos_ + [SpirvShaderTranslator::kConstantBufferTessellation]; + uint8_t* mapping = uniform_buffer_pool_->Request( + frame_current_, sizeof(SpirvShaderTranslator::TessellationConstants), + uniform_buffer_alignment, buffer_info.buffer, buffer_info.offset); + if (!mapping) { + return false; + } + buffer_info.range = sizeof(SpirvShaderTranslator::TessellationConstants); + // Populate tessellation constants from registers. + SpirvShaderTranslator::TessellationConstants tessellation_constants; + // Tessellation factor range, plus 1.0 according to Xbox 360 docs. + // For fractional_even partitioning (continuous mode), minimum must be + // >= 2.0. + float tess_factor_min = + regs.Get(XE_GPU_REG_VGT_HOS_MIN_TESS_LEVEL) + 1.0f; + float tess_factor_max = + regs.Get(XE_GPU_REG_VGT_HOS_MAX_TESS_LEVEL) + 1.0f; + tessellation_constants.tessellation_factor_range[0] = tess_factor_min; + tessellation_constants.tessellation_factor_range[1] = tess_factor_max; + tessellation_constants.padding0[0] = 0.0f; + tessellation_constants.padding0[1] = 0.0f; + // Vertex index processing parameters for tessellation shaders. + auto vgt_dma_size = regs.Get(); + tessellation_constants.vertex_index_endian = + static_cast(vgt_dma_size.swap_mode); + tessellation_constants.vertex_index_offset = + regs[XE_GPU_REG_VGT_INDX_OFFSET]; + tessellation_constants.vertex_index_min_max[0] = + regs[XE_GPU_REG_VGT_MIN_VTX_INDX]; + tessellation_constants.vertex_index_min_max[1] = + regs[XE_GPU_REG_VGT_MAX_VTX_INDX]; + std::memcpy(mapping, &tessellation_constants, + sizeof(SpirvShaderTranslator::TessellationConstants)); + current_constant_buffers_up_to_date_ |= + UINT32_C(1) << SpirvShaderTranslator::kConstantBufferTessellation; + } // Vertex shader float constants. if (!(current_constant_buffers_up_to_date_ & (UINT32_C(1) << SpirvShaderTranslator::kConstantBufferFloatVertex))) { diff --git a/src/xenia/gpu/vulkan/vulkan_pipeline_cache.cc b/src/xenia/gpu/vulkan/vulkan_pipeline_cache.cc index dc0129da9..1e89e5b3d 100644 --- a/src/xenia/gpu/vulkan/vulkan_pipeline_cache.cc +++ b/src/xenia/gpu/vulkan/vulkan_pipeline_cache.cc @@ -30,6 +30,21 @@ #include "xenia/gpu/xenos.h" #include "xenia/ui/vulkan/vulkan_util.h" +// Tessellation shader bytecode. +namespace shaders { +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/adaptive_quad_hs.h" +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/adaptive_triangle_hs.h" +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_quad_1cp_hs.h" +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_quad_4cp_hs.h" +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_triangle_1cp_hs.h" +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/continuous_triangle_3cp_hs.h" +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_quad_1cp_hs.h" +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_quad_4cp_hs.h" +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_triangle_1cp_hs.h" +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/discrete_triangle_3cp_hs.h" +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/tessellation_adaptive_vs.h" +#include "xenia/gpu/shaders/bytecode/vulkan_spirv/tessellation_indexed_vs.h" +} // namespace shaders namespace xe { namespace gpu { namespace vulkan { @@ -80,6 +95,68 @@ bool VulkanPipelineCache::Initialize() { } } + // Create tessellation shaders if tessellation is supported. + if (vulkan_device->properties().tessellationShader) { + // Vertex shaders for tessellation. + tessellation_indexed_vs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::tessellation_indexed_vs, + sizeof(shaders::tessellation_indexed_vs)); + tessellation_adaptive_vs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::tessellation_adaptive_vs, + sizeof(shaders::tessellation_adaptive_vs)); + // Discrete mode hull shaders. + discrete_triangle_1cp_hs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::discrete_triangle_1cp_hs, + sizeof(shaders::discrete_triangle_1cp_hs)); + discrete_triangle_3cp_hs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::discrete_triangle_3cp_hs, + sizeof(shaders::discrete_triangle_3cp_hs)); + discrete_quad_1cp_hs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::discrete_quad_1cp_hs, + sizeof(shaders::discrete_quad_1cp_hs)); + discrete_quad_4cp_hs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::discrete_quad_4cp_hs, + sizeof(shaders::discrete_quad_4cp_hs)); + // Continuous mode hull shaders. + continuous_triangle_1cp_hs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::continuous_triangle_1cp_hs, + sizeof(shaders::continuous_triangle_1cp_hs)); + continuous_triangle_3cp_hs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::continuous_triangle_3cp_hs, + sizeof(shaders::continuous_triangle_3cp_hs)); + continuous_quad_1cp_hs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::continuous_quad_1cp_hs, + sizeof(shaders::continuous_quad_1cp_hs)); + continuous_quad_4cp_hs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::continuous_quad_4cp_hs, + sizeof(shaders::continuous_quad_4cp_hs)); + // Adaptive mode hull shaders. + adaptive_triangle_hs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::adaptive_triangle_hs, + sizeof(shaders::adaptive_triangle_hs)); + adaptive_quad_hs_ = ui::vulkan::util::CreateShaderModule( + vulkan_device, shaders::adaptive_quad_hs, + sizeof(shaders::adaptive_quad_hs)); + + // Verify all tessellation shaders were created successfully. + if (tessellation_indexed_vs_ == VK_NULL_HANDLE || + tessellation_adaptive_vs_ == VK_NULL_HANDLE || + discrete_triangle_1cp_hs_ == VK_NULL_HANDLE || + discrete_triangle_3cp_hs_ == VK_NULL_HANDLE || + discrete_quad_1cp_hs_ == VK_NULL_HANDLE || + discrete_quad_4cp_hs_ == VK_NULL_HANDLE || + continuous_triangle_1cp_hs_ == VK_NULL_HANDLE || + continuous_triangle_3cp_hs_ == VK_NULL_HANDLE || + continuous_quad_1cp_hs_ == VK_NULL_HANDLE || + continuous_quad_4cp_hs_ == VK_NULL_HANDLE || + adaptive_triangle_hs_ == VK_NULL_HANDLE || + adaptive_quad_hs_ == VK_NULL_HANDLE) { + XELOGW( + "VulkanPipelineCache: Failed to create one or more tessellation " + "shaders - tessellation will not be available"); + } + } + // Create Vulkan pipeline cache for faster pipeline creation. VkPipelineCacheCreateInfo pipeline_cache_create_info = {}; pipeline_cache_create_info.sType = @@ -118,6 +195,31 @@ void VulkanPipelineCache::Shutdown() { // Destroy all internal shaders. ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, depth_only_fragment_shader_); + // Destroy tessellation shaders. + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + tessellation_indexed_vs_); + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + tessellation_adaptive_vs_); + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + discrete_triangle_1cp_hs_); + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + discrete_triangle_3cp_hs_); + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + discrete_quad_1cp_hs_); + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + discrete_quad_4cp_hs_); + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + continuous_triangle_1cp_hs_); + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + continuous_triangle_3cp_hs_); + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + continuous_quad_1cp_hs_); + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + continuous_quad_4cp_hs_); + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + adaptive_triangle_hs_); + ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyShaderModule, device, + adaptive_quad_hs_); for (const auto& geometry_shader_pair : geometry_shaders_) { if (geometry_shader_pair.second != VK_NULL_HANDLE) { dfn.vkDestroyShaderModule(device, geometry_shader_pair.second, nullptr); @@ -368,10 +470,34 @@ bool VulkanPipelineCache::ConfigurePipeline( PipelineCreationArguments creation_arguments; auto& pipeline = *pipelines_.emplace(description, Pipeline(pipeline_layout)).first; + // Get tessellation shaders if needed. + VkShaderModule tessellation_vertex_shader = VK_NULL_HANDLE; + VkShaderModule tessellation_control_shader = VK_NULL_HANDLE; + if (description.tessellation_mode != PipelineTessellationMode::kNone) { + tessellation_vertex_shader = + GetTessellationVertexShader(description.tessellation_mode); + bool use_control_point_count = + (description.tessellation_mode == PipelineTessellationMode::kAdaptive); + tessellation_control_shader = GetTessellationControlShader( + description.tessellation_mode, description.tessellation_patch, + use_control_point_count); + if (tessellation_vertex_shader == VK_NULL_HANDLE || + tessellation_control_shader == VK_NULL_HANDLE) { + XELOGE( + "VulkanPipelineCache: Failed to get tessellation shaders for mode {} " + "patch {}", + static_cast(description.tessellation_mode), + static_cast(description.tessellation_patch)); + return false; + } + } + creation_arguments.pipeline = &pipeline; creation_arguments.vertex_shader = vertex_shader; creation_arguments.pixel_shader = pixel_shader; creation_arguments.geometry_shader = geometry_shader; + creation_arguments.tessellation_vertex_shader = tessellation_vertex_shader; + creation_arguments.tessellation_control_shader = tessellation_control_shader; creation_arguments.render_pass = render_pass; if (!EnsurePipelineCreated(creation_arguments)) { return false; @@ -556,45 +682,90 @@ bool VulkanPipelineCache::GetCurrentStateDescription( // without them. PipelineGeometryShader geometry_shader = PipelineGeometryShader::kNone; PipelinePrimitiveTopology primitive_topology; - switch (primitive_processing_result.host_primitive_type) { - case xenos::PrimitiveType::kPointList: - geometry_shader = PipelineGeometryShader::kPointList; - primitive_topology = PipelinePrimitiveTopology::kPointList; - break; - case xenos::PrimitiveType::kLineList: - primitive_topology = PipelinePrimitiveTopology::kLineList; - break; - case xenos::PrimitiveType::kLineStrip: - primitive_topology = PipelinePrimitiveTopology::kLineStrip; - break; - case xenos::PrimitiveType::kTriangleList: - primitive_topology = PipelinePrimitiveTopology::kTriangleList; - break; - case xenos::PrimitiveType::kTriangleFan: - // The check should be performed at primitive processing time. - assert_true(device_properties.triangleFans); - primitive_topology = PipelinePrimitiveTopology::kTriangleFan; - break; - case xenos::PrimitiveType::kTriangleStrip: - primitive_topology = PipelinePrimitiveTopology::kTriangleStrip; - break; - case xenos::PrimitiveType::kRectangleList: - // Only use geometry shader if not using the fallback AsTriangleStrip - // vertex shader type (which is used when geometry shaders aren't - // supported). - if (primitive_processing_result.host_vertex_shader_type != - Shader::HostVertexShaderType::kRectangleListAsTriangleStrip) { - geometry_shader = PipelineGeometryShader::kRectangleList; - } - primitive_topology = PipelinePrimitiveTopology::kTriangleList; - break; - case xenos::PrimitiveType::kQuadList: - geometry_shader = PipelineGeometryShader::kQuadList; - primitive_topology = PipelinePrimitiveTopology::kLineListWithAdjacency; - break; - default: - // TODO(Triang3l): All primitive types and tessellation. - return false; + + // Handle tessellated and non-tessellated draws separately, like D3D12. + if (primitive_processing_result.IsTessellated()) { + // Tessellation is enabled - use patch list topology. + primitive_topology = PipelinePrimitiveTopology::kPatchList; + + // Get tessellation mode from registers. + auto vgt_hos_cntl = regs.Get(); + switch (vgt_hos_cntl.tess_mode) { + case xenos::TessellationMode::kDiscrete: + description_out.tessellation_mode = PipelineTessellationMode::kDiscrete; + break; + case xenos::TessellationMode::kContinuous: + description_out.tessellation_mode = + PipelineTessellationMode::kContinuous; + break; + case xenos::TessellationMode::kAdaptive: + description_out.tessellation_mode = PipelineTessellationMode::kAdaptive; + break; + default: + // Unknown tessellation mode, fall back to discrete. + description_out.tessellation_mode = PipelineTessellationMode::kDiscrete; + break; + } + + // Determine patch type based on primitive type. + switch (primitive_processing_result.host_primitive_type) { + case xenos::PrimitiveType::kTriangleList: + case xenos::PrimitiveType::kTrianglePatch: + description_out.tessellation_patch = + PipelineTessellationPatchType::kTriangle; + break; + case xenos::PrimitiveType::kQuadList: + case xenos::PrimitiveType::kQuadPatch: + description_out.tessellation_patch = + PipelineTessellationPatchType::kQuad; + break; + default: + XELOGE("VulkanPipelineCache: Unsupported tessellated primitive type {}", + uint32_t(primitive_processing_result.host_primitive_type)); + return false; + } + } else { + // Non-tessellated draw. + switch (primitive_processing_result.host_primitive_type) { + case xenos::PrimitiveType::kPointList: + geometry_shader = PipelineGeometryShader::kPointList; + primitive_topology = PipelinePrimitiveTopology::kPointList; + break; + case xenos::PrimitiveType::kLineList: + primitive_topology = PipelinePrimitiveTopology::kLineList; + break; + case xenos::PrimitiveType::kLineStrip: + primitive_topology = PipelinePrimitiveTopology::kLineStrip; + break; + case xenos::PrimitiveType::kTriangleList: + primitive_topology = PipelinePrimitiveTopology::kTriangleList; + break; + case xenos::PrimitiveType::kTriangleFan: + // The check should be performed at primitive processing time. + assert_true(device_properties.triangleFans); + primitive_topology = PipelinePrimitiveTopology::kTriangleFan; + break; + case xenos::PrimitiveType::kTriangleStrip: + primitive_topology = PipelinePrimitiveTopology::kTriangleStrip; + break; + case xenos::PrimitiveType::kRectangleList: + // Only use geometry shader if not using the fallback AsTriangleStrip + // vertex shader type (which is used when geometry shaders aren't + // supported). + if (primitive_processing_result.host_vertex_shader_type != + Shader::HostVertexShaderType::kRectangleListAsTriangleStrip) { + geometry_shader = PipelineGeometryShader::kRectangleList; + } + primitive_topology = PipelinePrimitiveTopology::kTriangleList; + break; + case xenos::PrimitiveType::kQuadList: + geometry_shader = PipelineGeometryShader::kQuadList; + primitive_topology = PipelinePrimitiveTopology::kLineListWithAdjacency; + break; + default: + // TODO(Triang3l): Remaining primitive types. + return false; + } } description_out.geometry_shader = geometry_shader; description_out.primitive_topology = primitive_topology; @@ -1804,6 +1975,55 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) { return shader_module; } +VkShaderModule VulkanPipelineCache::GetTessellationControlShader( + PipelineTessellationMode mode, PipelineTessellationPatchType patch_type, + bool use_control_point_count) const { + if (mode == PipelineTessellationMode::kNone || + patch_type == PipelineTessellationPatchType::kNone) { + return VK_NULL_HANDLE; + } + + switch (mode) { + case PipelineTessellationMode::kDiscrete: + if (patch_type == PipelineTessellationPatchType::kTriangle) { + return use_control_point_count ? discrete_triangle_3cp_hs_ + : discrete_triangle_1cp_hs_; + } else { + return use_control_point_count ? discrete_quad_4cp_hs_ + : discrete_quad_1cp_hs_; + } + case PipelineTessellationMode::kContinuous: + if (patch_type == PipelineTessellationPatchType::kTriangle) { + return use_control_point_count ? continuous_triangle_3cp_hs_ + : continuous_triangle_1cp_hs_; + } else { + return use_control_point_count ? continuous_quad_4cp_hs_ + : continuous_quad_1cp_hs_; + } + case PipelineTessellationMode::kAdaptive: + // Adaptive mode always uses per-corner control points. + if (patch_type == PipelineTessellationPatchType::kTriangle) { + return adaptive_triangle_hs_; + } else { + return adaptive_quad_hs_; + } + default: + return VK_NULL_HANDLE; + } +} + +VkShaderModule VulkanPipelineCache::GetTessellationVertexShader( + PipelineTessellationMode mode) const { + if (mode == PipelineTessellationMode::kNone) { + return VK_NULL_HANDLE; + } + // Adaptive mode reads edge factors from index buffer; other modes pass + // vertex indices. + return (mode == PipelineTessellationMode::kAdaptive) + ? tessellation_adaptive_vs_ + : tessellation_indexed_vs_; +} + bool VulkanPipelineCache::EnsurePipelineCreated( const PipelineCreationArguments& creation_arguments) { if (creation_arguments.pipeline->second.pipeline != VK_NULL_HANDLE) { @@ -1839,26 +2059,77 @@ bool VulkanPipelineCache::EnsurePipelineCreated( render_target_cache_.GetPath() == RenderTargetCache::Path::kPixelShaderInterlock; - std::array shader_stages; + bool is_tessellated = + description.tessellation_mode != PipelineTessellationMode::kNone; + + // Up to 5 shader stages: VS, TCS, TES, GS, FS. + std::array shader_stages; uint32_t shader_stage_count = 0; - // Vertex or tessellation evaluation shader. + // Vertex shader or tessellation evaluation shader. assert_true(creation_arguments.vertex_shader->is_translated()); if (!creation_arguments.vertex_shader->is_valid()) { return false; } - VkPipelineShaderStageCreateInfo& shader_stage_vertex = - shader_stages[shader_stage_count++]; - shader_stage_vertex.sType = - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; - shader_stage_vertex.pNext = nullptr; - shader_stage_vertex.flags = 0; - shader_stage_vertex.stage = VK_SHADER_STAGE_VERTEX_BIT; - shader_stage_vertex.module = - creation_arguments.vertex_shader->shader_module(); - assert_true(shader_stage_vertex.module != VK_NULL_HANDLE); - shader_stage_vertex.pName = "main"; - shader_stage_vertex.pSpecializationInfo = nullptr; + + if (is_tessellated) { + // For tessellation: use our pre-compiled VS for passing data to TCS, + // then TCS (hull shader), then the translated Xenos vertex shader as TES + // (domain shader). + + // Tessellation vertex shader (passes indices to TCS). + VkPipelineShaderStageCreateInfo& shader_stage_tess_vs = + shader_stages[shader_stage_count++]; + shader_stage_tess_vs.sType = + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; + shader_stage_tess_vs.pNext = nullptr; + shader_stage_tess_vs.flags = 0; + shader_stage_tess_vs.stage = VK_SHADER_STAGE_VERTEX_BIT; + shader_stage_tess_vs.module = creation_arguments.tessellation_vertex_shader; + shader_stage_tess_vs.pName = "main"; + shader_stage_tess_vs.pSpecializationInfo = nullptr; + + // Tessellation control shader (hull shader). + VkPipelineShaderStageCreateInfo& shader_stage_tcs = + shader_stages[shader_stage_count++]; + shader_stage_tcs.sType = + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; + shader_stage_tcs.pNext = nullptr; + shader_stage_tcs.flags = 0; + shader_stage_tcs.stage = VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT; + shader_stage_tcs.module = creation_arguments.tessellation_control_shader; + shader_stage_tcs.pName = "main"; + shader_stage_tcs.pSpecializationInfo = nullptr; + + // Tessellation evaluation shader (domain shader) - the translated Xenos + // vertex shader. + VkPipelineShaderStageCreateInfo& shader_stage_tes = + shader_stages[shader_stage_count++]; + shader_stage_tes.sType = + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; + shader_stage_tes.pNext = nullptr; + shader_stage_tes.flags = 0; + shader_stage_tes.stage = VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT; + shader_stage_tes.module = creation_arguments.vertex_shader->shader_module(); + assert_true(shader_stage_tes.module != VK_NULL_HANDLE); + shader_stage_tes.pName = "main"; + shader_stage_tes.pSpecializationInfo = nullptr; + } else { + // Non-tessellated: standard vertex shader. + VkPipelineShaderStageCreateInfo& shader_stage_vertex = + shader_stages[shader_stage_count++]; + shader_stage_vertex.sType = + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; + shader_stage_vertex.pNext = nullptr; + shader_stage_vertex.flags = 0; + shader_stage_vertex.stage = VK_SHADER_STAGE_VERTEX_BIT; + shader_stage_vertex.module = + creation_arguments.vertex_shader->shader_module(); + assert_true(shader_stage_vertex.module != VK_NULL_HANDLE); + shader_stage_vertex.pName = "main"; + shader_stage_vertex.pSpecializationInfo = nullptr; + } + // Geometry shader. if (creation_arguments.geometry_shader != VK_NULL_HANDLE) { VkPipelineShaderStageCreateInfo& shader_stage_geometry = @@ -2174,6 +2445,27 @@ bool VulkanPipelineCache::EnsurePipelineCreated( VK_DYNAMIC_STATE_STENCIL_REFERENCE; } + // Tessellation state (only used when tessellation is active). + VkPipelineTessellationStateCreateInfo tessellation_state = {}; + tessellation_state.sType = + VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO; + if (is_tessellated) { + // Determine patch control point count based on mode and patch type. + // For adaptive mode, we use the actual patch corner count (3 for triangles, + // 4 for quads) since each control point has its own edge factor. + // For discrete/continuous modes, we use 1 control point (the Xenos vertex + // shader receives the patch index and computes all corners internally). + if (description.tessellation_mode == PipelineTessellationMode::kAdaptive) { + tessellation_state.patchControlPoints = + (description.tessellation_patch == + PipelineTessellationPatchType::kTriangle) + ? 3 + : 4; + } else { + tessellation_state.patchControlPoints = 1; + } + } + VkGraphicsPipelineCreateInfo pipeline_create_info; pipeline_create_info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; pipeline_create_info.pNext = nullptr; @@ -2182,7 +2474,8 @@ bool VulkanPipelineCache::EnsurePipelineCreated( pipeline_create_info.pStages = shader_stages.data(); pipeline_create_info.pVertexInputState = &vertex_input_state; pipeline_create_info.pInputAssemblyState = &input_assembly_state; - pipeline_create_info.pTessellationState = nullptr; + pipeline_create_info.pTessellationState = + is_tessellated ? &tessellation_state : nullptr; pipeline_create_info.pViewportState = &viewport_state; pipeline_create_info.pRasterizationState = &rasterization_state; pipeline_create_info.pMultisampleState = &multisample_state; @@ -2199,19 +2492,23 @@ bool VulkanPipelineCache::EnsurePipelineCreated( const ui::vulkan::VulkanDevice::Functions& dfn = vulkan_device->functions(); const VkDevice device = vulkan_device->device(); VkPipeline pipeline; - if (dfn.vkCreateGraphicsPipelines(device, vk_pipeline_cache_, 1, - &pipeline_create_info, nullptr, - &pipeline) != VK_SUCCESS) { - // TODO(Triang3l): Move these error messages outside. - /* if (creation_arguments.pixel_shader) { + VkResult result = dfn.vkCreateGraphicsPipelines( + device, vk_pipeline_cache_, 1, &pipeline_create_info, nullptr, &pipeline); + if (result != VK_SUCCESS) { + if (creation_arguments.pixel_shader) { XELOGE( - "Failed to create graphics pipeline with VS {:016X}, PS {:016X}", + "Failed to create graphics pipeline with VS {:016X}, PS {:016X} " + "(tessellated={}, result={})", creation_arguments.vertex_shader->shader().ucode_data_hash(), - creation_arguments.pixel_shader->shader().ucode_data_hash()); + creation_arguments.pixel_shader->shader().ucode_data_hash(), + is_tessellated, static_cast(result)); } else { - XELOGE("Failed to create graphics pipeline with VS {:016X}", - creation_arguments.vertex_shader->shader().ucode_data_hash()); - } */ + XELOGE( + "Failed to create graphics pipeline with VS {:016X} " + "(tessellated={}, result={})", + creation_arguments.vertex_shader->shader().ucode_data_hash(), + is_tessellated, static_cast(result)); + } return false; } creation_arguments.pipeline->second.pipeline = pipeline; diff --git a/src/xenia/gpu/vulkan/vulkan_pipeline_cache.h b/src/xenia/gpu/vulkan/vulkan_pipeline_cache.h index 4e92c29f6..2e1f28335 100644 --- a/src/xenia/gpu/vulkan/vulkan_pipeline_cache.h +++ b/src/xenia/gpu/vulkan/vulkan_pipeline_cache.h @@ -114,6 +114,22 @@ class VulkanPipelineCache { kPoint, }; + // Tessellation mode for pipeline creation. + // Must match the TCS (hull shader) selection logic. + enum class PipelineTessellationMode : uint32_t { + kNone, + kDiscrete, // Integer tessellation factors. + kContinuous, // Fractional (fractional_even) tessellation factors. + kAdaptive, // Per-edge factors from index buffer. + }; + + // Tessellation primitive type. + enum class PipelineTessellationPatchType : uint32_t { + kNone, + kTriangle, + kQuad, + }; + enum class PipelineBlendFactor : uint32_t { kZero, kOne, @@ -152,10 +168,12 @@ class VulkanPipelineCache { VulkanRenderTargetCache::RenderPassKey render_pass_key; // Shader stages. - PipelineGeometryShader geometry_shader : 2; // 2 + PipelineGeometryShader geometry_shader : 2; // 2 + PipelineTessellationMode tessellation_mode : 2; // 4 + PipelineTessellationPatchType tessellation_patch : 2; // 6 // Input assembly. - PipelinePrimitiveTopology primitive_topology : 3; // 5 - uint32_t primitive_restart : 1; // 6 + PipelinePrimitiveTopology primitive_topology : 3; // 9 + uint32_t primitive_restart : 1; // 10 // Rasterization. uint32_t depth_clamp_enable : 1; // 7 PipelinePolygonMode polygon_mode : 2; // 9 @@ -216,6 +234,9 @@ class VulkanPipelineCache { const VulkanShader::VulkanTranslation* vertex_shader; const VulkanShader::VulkanTranslation* pixel_shader; VkShaderModule geometry_shader; + // Tessellation shaders (only used when tessellation is active). + VkShaderModule tessellation_vertex_shader; // VS for passing data to TCS. + VkShaderModule tessellation_control_shader; // TCS (hull shader). VkRenderPass render_pass; }; @@ -271,6 +292,15 @@ class VulkanPipelineCache { GeometryShaderKey& key_out); VkShaderModule GetGeometryShader(GeometryShaderKey key); + // Get the appropriate tessellation control shader (hull shader) module. + VkShaderModule GetTessellationControlShader( + PipelineTessellationMode mode, PipelineTessellationPatchType patch_type, + bool use_control_point_count) const; + + // Get the appropriate tessellation vertex shader module. + VkShaderModule GetTessellationVertexShader( + PipelineTessellationMode mode) const; + // Can be called from creation threads - all needed data must be fully set up // at the point of the call: shaders must be translated, pipeline layout and // render pass objects must be available. @@ -317,6 +347,26 @@ class VulkanPipelineCache { // shader interlock when no Xenos pixel shader provided. VkShaderModule depth_only_fragment_shader_ = VK_NULL_HANDLE; + // Tessellation shaders. + // Vertex shaders for tessellation - pass indices/factors to TCS. + VkShaderModule tessellation_indexed_vs_ = VK_NULL_HANDLE; + VkShaderModule tessellation_adaptive_vs_ = VK_NULL_HANDLE; + // Tessellation control shaders (hull shaders) for different modes and + // primitive types. + // Discrete mode (integer tessellation factors). + VkShaderModule discrete_triangle_1cp_hs_ = VK_NULL_HANDLE; + VkShaderModule discrete_triangle_3cp_hs_ = VK_NULL_HANDLE; + VkShaderModule discrete_quad_1cp_hs_ = VK_NULL_HANDLE; + VkShaderModule discrete_quad_4cp_hs_ = VK_NULL_HANDLE; + // Continuous mode (fractional_even tessellation factors). + VkShaderModule continuous_triangle_1cp_hs_ = VK_NULL_HANDLE; + VkShaderModule continuous_triangle_3cp_hs_ = VK_NULL_HANDLE; + VkShaderModule continuous_quad_1cp_hs_ = VK_NULL_HANDLE; + VkShaderModule continuous_quad_4cp_hs_ = VK_NULL_HANDLE; + // Adaptive mode (per-edge factors from index buffer). + VkShaderModule adaptive_triangle_hs_ = VK_NULL_HANDLE; + VkShaderModule adaptive_quad_hs_ = VK_NULL_HANDLE; + // Vulkan pipeline cache for faster pipeline creation. VkPipelineCache vk_pipeline_cache_ = VK_NULL_HANDLE;