diff --git a/src/xenia/gpu/d3d12/pipeline_cache.cc b/src/xenia/gpu/d3d12/pipeline_cache.cc index ac6a2d4b4..5371bd56d 100644 --- a/src/xenia/gpu/d3d12/pipeline_cache.cc +++ b/src/xenia/gpu/d3d12/pipeline_cache.cc @@ -714,6 +714,12 @@ D3D12Shader* PipelineCache::LoadShader(ShaderType shader_type, Shader::HostVertexShaderType PipelineCache::GetHostVertexShaderTypeIfValid() const { + // If the values this functions returns are changed, INVALIDATE THE SHADER + // STORAGE (increase kVersion for BOTH shaders and pipeline states)! The + // exception is when the function originally returned "unsupported", but + // started to return a valid value (in this case the shader wouldn't be cached + // in the first place). Otherwise games will not be able to locate shaders for + // draws for which the host vertex shader type has changed! auto& regs = *register_file_; auto vgt_draw_initiator = regs.Get(); if (!xenos::IsMajorModeExplicit(vgt_draw_initiator.major_mode, @@ -729,26 +735,35 @@ Shader::HostVertexShaderType PipelineCache::GetHostVertexShaderTypeIfValid() xenos::TessellationMode tessellation_mode = regs.Get().tess_mode; switch (vgt_draw_initiator.prim_type) { - // case PrimitiveType::kTriangleList: - // switch (tessellation_mode) { - // case xenos::TessellationMode::kDiscrete: - // // Call of Duty 3 - green terrain in the first mission. - // case xenos::TessellationMode::kContinuous: - // // Viva Pinata - something on the start screen. - // return Shader::HostVertexShaderType::kTriangleDomainConstant; - // } - // break; - // TODO(Triang3l): Support non-adaptive tessellation. + case PrimitiveType::kTriangleList: + // Also supported by triangle strips and fans according to: + // https://www.khronos.org/registry/OpenGL/extensions/AMD/AMD_vertex_shader_tessellator.txt + // Would need to convert those to triangle lists, but haven't seen any + // games using tessellated strips/fans so far. + switch (tessellation_mode) { + case xenos::TessellationMode::kDiscrete: + // - Call of Duty 3 - nets above barrels in the beginning of the + // first mission (turn right after the end of the intro) - + // kTriangleList. + case xenos::TessellationMode::kContinuous: + // - Viva Pinata - tree building with a beehive in the beginning + // (visible on the start screen behind the logo), waterfall in the + // beginning - kTriangleList. + return Shader::HostVertexShaderType::kTriangleDomainConstant; + default: + break; + } + break; case PrimitiveType::kTrianglePatch: if (tessellation_mode == xenos::TessellationMode::kAdaptive) { - // Banjo-Kazooie: Nuts & Bolts - water. - // Halo 3 - water. + // - Banjo-Kazooie: Nuts & Bolts - water. + // - Halo 3 - water. return Shader::HostVertexShaderType::kTriangleDomainAdaptive; } break; case PrimitiveType::kQuadPatch: if (tessellation_mode == xenos::TessellationMode::kAdaptive) { - // Viva Pinata - something on the start screen. + // - Viva Pinata - something on the start screen. return Shader::HostVertexShaderType::kQuadDomainAdaptive; } break; @@ -932,10 +947,36 @@ bool PipelineCache::TranslateShader( sampler_bindings, sampler_binding_count); if (shader->is_valid()) { + const char* host_shader_type; + if (shader->type() == ShaderType::kVertex) { + switch (shader->host_vertex_shader_type()) { + case Shader::HostVertexShaderType::kLineDomainConstant: + host_shader_type = "constant line domain"; + break; + case Shader::HostVertexShaderType::kLineDomainAdaptive: + host_shader_type = "adaptive line domain"; + break; + case Shader::HostVertexShaderType::kTriangleDomainConstant: + host_shader_type = "constant triangle domain"; + break; + case Shader::HostVertexShaderType::kTriangleDomainAdaptive: + host_shader_type = "adaptive triangle domain"; + break; + case Shader::HostVertexShaderType::kQuadDomainConstant: + host_shader_type = "constant quad domain"; + break; + case Shader::HostVertexShaderType::kQuadDomainAdaptive: + host_shader_type = "adaptive quad domain"; + break; + default: + host_shader_type = "vertex"; + } + } else { + host_shader_type = "pixel"; + } XELOGGPU("Generated %s shader (%db) - hash %.16" PRIX64 ":\n%s\n", - shader->type() == ShaderType::kVertex ? "vertex" : "pixel", - shader->ucode_dword_count() * 4, shader->ucode_data_hash(), - shader->ucode_disassembly().c_str()); + host_shader_type, shader->ucode_dword_count() * 4, + shader->ucode_data_hash(), shader->ucode_disassembly().c_str()); } // Create a version of the shader with early depth/stencil forced by Xenia diff --git a/src/xenia/gpu/d3d12/shaders/continuous_quad.hs.hlsl b/src/xenia/gpu/d3d12/shaders/continuous_quad.hs.hlsl index ce2202b3e..34283db5b 100644 --- a/src/xenia/gpu/d3d12/shaders/continuous_quad.hs.hlsl +++ b/src/xenia/gpu/d3d12/shaders/continuous_quad.hs.hlsl @@ -39,8 +39,7 @@ XeHSControlPointOutput main( InputPatch xe_input_patch, uint xe_control_point_id : SV_OutputControlPointID) { XeHSControlPointOutput output; - // TODO(Triang3l): Re-enable when non-adaptive tessellation is properly added. - /* output.index = - float(xe_input_patch[xe_control_point_id].index_or_edge_factor); */ + output.index = + float(xe_input_patch[xe_control_point_id].index_or_edge_factor); return output; } diff --git a/src/xenia/gpu/d3d12/shaders/continuous_triangle.hs.hlsl b/src/xenia/gpu/d3d12/shaders/continuous_triangle.hs.hlsl index 4e09f78d5..7e53a13e2 100644 --- a/src/xenia/gpu/d3d12/shaders/continuous_triangle.hs.hlsl +++ b/src/xenia/gpu/d3d12/shaders/continuous_triangle.hs.hlsl @@ -34,8 +34,7 @@ XeHSControlPointOutput main( InputPatch xe_input_patch, uint xe_control_point_id : SV_OutputControlPointID) { XeHSControlPointOutput output; - // TODO(Triang3l): Re-enable when non-adaptive tessellation is properly added. - /* output.index = - float(xe_input_patch[xe_control_point_id].index_or_edge_factor); */ + output.index = + float(xe_input_patch[xe_control_point_id].index_or_edge_factor); return output; } diff --git a/src/xenia/gpu/d3d12/shaders/discrete_quad.hs.hlsl b/src/xenia/gpu/d3d12/shaders/discrete_quad.hs.hlsl index edf971400..e402c00dd 100644 --- a/src/xenia/gpu/d3d12/shaders/discrete_quad.hs.hlsl +++ b/src/xenia/gpu/d3d12/shaders/discrete_quad.hs.hlsl @@ -39,8 +39,7 @@ XeHSControlPointOutput main( InputPatch xe_input_patch, uint xe_control_point_id : SV_OutputControlPointID) { XeHSControlPointOutput output; - // TODO(Triang3l): Re-enable when non-adaptive tessellation is properly added. - /* output.index = - float(xe_input_patch[xe_control_point_id].index_or_edge_factor); */ + output.index = + float(xe_input_patch[xe_control_point_id].index_or_edge_factor); return output; } diff --git a/src/xenia/gpu/d3d12/shaders/discrete_triangle.hs.hlsl b/src/xenia/gpu/d3d12/shaders/discrete_triangle.hs.hlsl index 7e3f85468..4894687c6 100644 --- a/src/xenia/gpu/d3d12/shaders/discrete_triangle.hs.hlsl +++ b/src/xenia/gpu/d3d12/shaders/discrete_triangle.hs.hlsl @@ -38,8 +38,7 @@ XeHSControlPointOutput main( InputPatch xe_input_patch, uint xe_control_point_id : SV_OutputControlPointID) { XeHSControlPointOutput output; - // TODO(Triang3l): Re-enable when non-adaptive tessellation is properly added. - /* output.index = - float(xe_input_patch[xe_control_point_id].index_or_edge_factor); */ + output.index = + float(xe_input_patch[xe_control_point_id].index_or_edge_factor); return output; } diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.cso b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.cso index 27a172146..256f406bc 100644 Binary files a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.cso and b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.cso differ diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.h b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.h index 596ece518..e8cd70688 100644 --- a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.h +++ b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.h @@ -1,11 +1,11 @@ // generated from `xb buildhlsl` // source: continuous_quad.hs.hlsl const uint8_t continuous_quad_hs[] = { - 0x44, 0x58, 0x42, 0x43, 0x76, 0xC7, 0xA0, 0x46, 0x15, 0xD6, 0xCA, 0xBC, - 0x4E, 0x86, 0xDF, 0xA5, 0xDD, 0x15, 0xF5, 0x21, 0x01, 0x00, 0x00, 0x00, - 0x48, 0x0D, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, - 0x30, 0x0A, 0x00, 0x00, 0x64, 0x0A, 0x00, 0x00, 0x74, 0x0A, 0x00, 0x00, - 0x38, 0x0B, 0x00, 0x00, 0xAC, 0x0C, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, + 0x44, 0x58, 0x42, 0x43, 0x54, 0x6C, 0x4B, 0xEC, 0x89, 0x62, 0x2A, 0xD1, + 0x5C, 0x19, 0xA6, 0x76, 0x00, 0x84, 0xA7, 0xF2, 0x01, 0x00, 0x00, 0x00, + 0xC4, 0x0D, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, + 0x30, 0x0A, 0x00, 0x00, 0x64, 0x0A, 0x00, 0x00, 0x98, 0x0A, 0x00, 0x00, + 0x5C, 0x0B, 0x00, 0x00, 0x28, 0x0D, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xF0, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x48, 0x00, 0x05, 0x00, 0x00, 0xC6, 0x09, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, @@ -221,9 +221,12 @@ const uint8_t continuous_quad_hs[] = { 0x31, 0x00, 0xAB, 0xAB, 0x49, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x58, 0x45, 0x56, 0x45, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB, 0x4F, 0x53, 0x47, 0x4E, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0E, 0x00, 0x00, + 0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB, 0x50, 0x43, 0x53, 0x47, 0xBC, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -240,49 +243,56 @@ const uint8_t continuous_quad_hs[] = { 0x01, 0x0E, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x54, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x56, 0x5F, 0x49, 0x6E, 0x73, 0x69, 0x64, 0x65, 0x54, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, - 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0x6C, 0x01, 0x00, 0x00, - 0x51, 0x00, 0x03, 0x00, 0x5B, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x01, + 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0xC4, 0x01, 0x00, 0x00, + 0x51, 0x00, 0x03, 0x00, 0x71, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x01, 0x93, 0x20, 0x00, 0x01, 0x94, 0x20, 0x00, 0x01, 0x95, 0x18, 0x00, 0x01, 0x96, 0x20, 0x00, 0x01, 0x97, 0x18, 0x00, 0x01, 0x6A, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x07, 0x46, 0x8E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01, 0x3E, 0x00, 0x00, 0x01, - 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, - 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, 0x67, 0x00, 0x00, 0x04, - 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, - 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0C, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, - 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, - 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, - 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0A, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x08, 0x12, 0x20, 0x90, 0x00, - 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01, 0x5F, 0x00, 0x00, 0x02, + 0x00, 0x60, 0x01, 0x00, 0x5F, 0x00, 0x00, 0x04, 0x12, 0x10, 0x20, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, + 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, + 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x60, 0x01, 0x00, 0x2B, 0x00, 0x00, 0x07, + 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x10, 0xA0, 0x00, + 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, - 0x02, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, - 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0F, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, - 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, - 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x70, 0x01, 0x00, - 0x36, 0x00, 0x00, 0x09, 0x12, 0x20, 0xD0, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, - 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, + 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0B, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, + 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, + 0x5B, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x08, + 0x12, 0x20, 0x90, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x73, 0x00, 0x00, 0x01, + 0x99, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, + 0x00, 0x70, 0x01, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x09, 0x12, 0x20, 0xD0, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, + 0x94, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.txt b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.txt index 8d164725e..8c9782ea4 100644 --- a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.txt +++ b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_quad_hs.txt @@ -65,14 +65,15 @@ // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ -// XEVERTEXID 0 x 0 NONE int +// XEVERTEXID 0 x 0 NONE int x // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ -// no Output +// XEVERTEXID 0 x 0 NONE float x +// // Tessellation Domain # of control points // -------------------- -------------------- // Quadrilateral 4 @@ -91,6 +92,12 @@ dcl_tessellator_output_primitive output_triangle_cw dcl_globalFlags refactoringAllowed dcl_constantbuffer CB0[0:0][15], immediateIndexed, space=0 hs_control_point_phase +dcl_input vOutputControlPointID +dcl_input v[4][0].x +dcl_output o0.x +dcl_temps 1 +mov r0.x, vOutputControlPointID +itof o0.x, v[r0.x + 0][0].x ret hs_fork_phase dcl_hs_fork_phase_instance_count 4 @@ -114,4 +121,4 @@ dcl_indexrange o4.x 2 mov r0.x, vForkInstanceID.x mov o[r0.x + 4].x, CB0[0][14].y ret -// Approximately 7 instruction slots used +// Approximately 9 instruction slots used diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.cso b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.cso index 976938972..d2e06ce9a 100644 Binary files a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.cso and b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.cso differ diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.h b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.h index 8b6f2b549..ead32d70b 100644 --- a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.h +++ b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.h @@ -1,11 +1,11 @@ // generated from `xb buildhlsl` // source: continuous_triangle.hs.hlsl const uint8_t continuous_triangle_hs[] = { - 0x44, 0x58, 0x42, 0x43, 0xB0, 0xD9, 0xC9, 0x59, 0xEF, 0xD3, 0xB8, 0x72, - 0x20, 0x5B, 0xC2, 0x4D, 0x99, 0x0C, 0x41, 0xC6, 0x01, 0x00, 0x00, 0x00, - 0xB8, 0x0C, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, - 0x30, 0x0A, 0x00, 0x00, 0x64, 0x0A, 0x00, 0x00, 0x74, 0x0A, 0x00, 0x00, - 0x08, 0x0B, 0x00, 0x00, 0x1C, 0x0C, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, + 0x44, 0x58, 0x42, 0x43, 0x0F, 0x28, 0xA3, 0x27, 0xAF, 0x06, 0xF6, 0x3C, + 0x45, 0x17, 0xD9, 0x0F, 0x54, 0xAD, 0xAA, 0xC4, 0x01, 0x00, 0x00, 0x00, + 0x34, 0x0D, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, + 0x30, 0x0A, 0x00, 0x00, 0x64, 0x0A, 0x00, 0x00, 0x98, 0x0A, 0x00, 0x00, + 0x2C, 0x0B, 0x00, 0x00, 0x98, 0x0C, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xF0, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x48, 0x00, 0x05, 0x00, 0x00, 0xC6, 0x09, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, @@ -221,9 +221,12 @@ const uint8_t continuous_triangle_hs[] = { 0x31, 0x00, 0xAB, 0xAB, 0x49, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x58, 0x45, 0x56, 0x45, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB, 0x4F, 0x53, 0x47, 0x4E, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0E, 0x00, 0x00, + 0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB, 0x50, 0x43, 0x53, 0x47, 0x8C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -236,41 +239,48 @@ const uint8_t continuous_triangle_hs[] = { 0x01, 0x0E, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x54, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x56, 0x5F, 0x49, 0x6E, 0x73, 0x69, 0x64, 0x65, 0x54, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, - 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0x0C, 0x01, 0x00, 0x00, - 0x51, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x01, + 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0x64, 0x01, 0x00, 0x00, + 0x51, 0x00, 0x03, 0x00, 0x59, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x01, 0x93, 0x18, 0x00, 0x01, 0x94, 0x18, 0x00, 0x01, 0x95, 0x10, 0x00, 0x01, 0x96, 0x20, 0x00, 0x01, 0x97, 0x18, 0x00, 0x01, 0x6A, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x07, 0x46, 0x8E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01, 0x3E, 0x00, 0x00, 0x01, - 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, - 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, 0x67, 0x00, 0x00, 0x04, - 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, - 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, - 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x70, 0x01, 0x00, - 0x36, 0x00, 0x00, 0x08, 0x12, 0x20, 0x90, 0x00, 0x0A, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, - 0x73, 0x00, 0x00, 0x01, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x07, - 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01, 0x5F, 0x00, 0x00, 0x02, + 0x00, 0x60, 0x01, 0x00, 0x5F, 0x00, 0x00, 0x04, 0x12, 0x10, 0x20, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, + 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, + 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x60, 0x01, 0x00, 0x2B, 0x00, 0x00, 0x07, + 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x10, 0xA0, 0x00, + 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x00, 0x00, 0x01, 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, + 0x03, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, + 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x08, 0x12, 0x20, 0x90, 0x00, + 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, - 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x00, 0x00, 0x01, 0x73, 0x00, 0x00, 0x01, 0x67, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x07, 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, + 0x94, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.txt b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.txt index 27ede2985..880ce992c 100644 --- a/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.txt +++ b/src/xenia/gpu/d3d12/shaders/dxbc/continuous_triangle_hs.txt @@ -63,14 +63,15 @@ // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ -// XEVERTEXID 0 x 0 NONE int +// XEVERTEXID 0 x 0 NONE int x // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ -// no Output +// XEVERTEXID 0 x 0 NONE float x +// // Tessellation Domain # of control points // -------------------- -------------------- // Triangle 3 @@ -89,6 +90,12 @@ dcl_tessellator_output_primitive output_triangle_cw dcl_globalFlags refactoringAllowed dcl_constantbuffer CB0[0:0][15], immediateIndexed, space=0 hs_control_point_phase +dcl_input vOutputControlPointID +dcl_input v[3][0].x +dcl_output o0.x +dcl_temps 1 +mov r0.x, vOutputControlPointID +itof o0.x, v[r0.x + 0][0].x ret hs_fork_phase dcl_hs_fork_phase_instance_count 3 @@ -105,4 +112,4 @@ hs_fork_phase dcl_output_siv o3.x, finalTriInsideTessFactor mov o3.x, CB0[0][14].y ret -// Approximately 6 instruction slots used +// Approximately 8 instruction slots used diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.cso b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.cso index 9522bc972..9221f8b0f 100644 Binary files a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.cso and b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.cso differ diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.h b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.h index e4a7daec6..83982c014 100644 --- a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.h +++ b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.h @@ -1,11 +1,11 @@ // generated from `xb buildhlsl` // source: discrete_quad.hs.hlsl const uint8_t discrete_quad_hs[] = { - 0x44, 0x58, 0x42, 0x43, 0xAE, 0xC1, 0x1F, 0x97, 0x00, 0x34, 0x91, 0x82, - 0x96, 0x0C, 0x8F, 0x6F, 0x4B, 0xF4, 0x27, 0x2F, 0x01, 0x00, 0x00, 0x00, - 0x48, 0x0D, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, - 0x30, 0x0A, 0x00, 0x00, 0x64, 0x0A, 0x00, 0x00, 0x74, 0x0A, 0x00, 0x00, - 0x38, 0x0B, 0x00, 0x00, 0xAC, 0x0C, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, + 0x44, 0x58, 0x42, 0x43, 0x8A, 0x06, 0x56, 0xDB, 0x1A, 0x2B, 0x72, 0x36, + 0x68, 0xB8, 0x74, 0xD8, 0x40, 0xD8, 0xD2, 0xBC, 0x01, 0x00, 0x00, 0x00, + 0xC4, 0x0D, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, + 0x30, 0x0A, 0x00, 0x00, 0x64, 0x0A, 0x00, 0x00, 0x98, 0x0A, 0x00, 0x00, + 0x5C, 0x0B, 0x00, 0x00, 0x28, 0x0D, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xF0, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x48, 0x00, 0x05, 0x00, 0x00, 0xC6, 0x09, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, @@ -221,9 +221,12 @@ const uint8_t discrete_quad_hs[] = { 0x31, 0x00, 0xAB, 0xAB, 0x49, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x58, 0x45, 0x56, 0x45, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB, 0x4F, 0x53, 0x47, 0x4E, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0E, 0x00, 0x00, + 0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB, 0x50, 0x43, 0x53, 0x47, 0xBC, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -240,49 +243,56 @@ const uint8_t discrete_quad_hs[] = { 0x01, 0x0E, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x54, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x56, 0x5F, 0x49, 0x6E, 0x73, 0x69, 0x64, 0x65, 0x54, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, - 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0x6C, 0x01, 0x00, 0x00, - 0x51, 0x00, 0x03, 0x00, 0x5B, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x01, + 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0xC4, 0x01, 0x00, 0x00, + 0x51, 0x00, 0x03, 0x00, 0x71, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x01, 0x93, 0x20, 0x00, 0x01, 0x94, 0x20, 0x00, 0x01, 0x95, 0x18, 0x00, 0x01, 0x96, 0x08, 0x00, 0x01, 0x97, 0x18, 0x00, 0x01, 0x6A, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x07, 0x46, 0x8E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01, 0x3E, 0x00, 0x00, 0x01, - 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, - 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, 0x67, 0x00, 0x00, 0x04, - 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, - 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x0C, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, - 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, - 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, - 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0A, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x08, 0x12, 0x20, 0x90, 0x00, - 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01, 0x5F, 0x00, 0x00, 0x02, + 0x00, 0x60, 0x01, 0x00, 0x5F, 0x00, 0x00, 0x04, 0x12, 0x10, 0x20, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, + 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, + 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x60, 0x01, 0x00, 0x2B, 0x00, 0x00, 0x07, + 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x10, 0xA0, 0x00, + 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, - 0x02, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, - 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0F, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, - 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, - 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x70, 0x01, 0x00, - 0x36, 0x00, 0x00, 0x09, 0x12, 0x20, 0xD0, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, - 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, + 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0B, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, + 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, + 0x5B, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0A, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x08, + 0x12, 0x20, 0x90, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x73, 0x00, 0x00, 0x01, + 0x99, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, + 0x00, 0x70, 0x01, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x09, 0x12, 0x20, 0xD0, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, + 0x94, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.txt b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.txt index cc3859dc4..b2eca3ba1 100644 --- a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.txt +++ b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_quad_hs.txt @@ -65,14 +65,15 @@ // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ -// XEVERTEXID 0 x 0 NONE int +// XEVERTEXID 0 x 0 NONE int x // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ -// no Output +// XEVERTEXID 0 x 0 NONE float x +// // Tessellation Domain # of control points // -------------------- -------------------- // Quadrilateral 4 @@ -91,6 +92,12 @@ dcl_tessellator_output_primitive output_triangle_cw dcl_globalFlags refactoringAllowed dcl_constantbuffer CB0[0:0][15], immediateIndexed, space=0 hs_control_point_phase +dcl_input vOutputControlPointID +dcl_input v[4][0].x +dcl_output o0.x +dcl_temps 1 +mov r0.x, vOutputControlPointID +itof o0.x, v[r0.x + 0][0].x ret hs_fork_phase dcl_hs_fork_phase_instance_count 4 @@ -114,4 +121,4 @@ dcl_indexrange o4.x 2 mov r0.x, vForkInstanceID.x mov o[r0.x + 4].x, CB0[0][14].y ret -// Approximately 7 instruction slots used +// Approximately 9 instruction slots used diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.cso b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.cso index 850930de2..ee61e2bcd 100644 Binary files a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.cso and b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.cso differ diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.h b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.h index 0e9b50d95..74cc56158 100644 --- a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.h +++ b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.h @@ -1,11 +1,11 @@ // generated from `xb buildhlsl` // source: discrete_triangle.hs.hlsl const uint8_t discrete_triangle_hs[] = { - 0x44, 0x58, 0x42, 0x43, 0xD3, 0xE0, 0x18, 0x9E, 0xED, 0xAE, 0x8C, 0x08, - 0xAA, 0xA1, 0xF2, 0xF0, 0x62, 0xDF, 0x88, 0xA0, 0x01, 0x00, 0x00, 0x00, - 0xB8, 0x0C, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, - 0x30, 0x0A, 0x00, 0x00, 0x64, 0x0A, 0x00, 0x00, 0x74, 0x0A, 0x00, 0x00, - 0x08, 0x0B, 0x00, 0x00, 0x1C, 0x0C, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, + 0x44, 0x58, 0x42, 0x43, 0x78, 0xB4, 0xD4, 0xFC, 0xA1, 0xD7, 0x9F, 0x70, + 0x23, 0x39, 0xD4, 0x01, 0x11, 0x6C, 0xC6, 0x61, 0x01, 0x00, 0x00, 0x00, + 0x34, 0x0D, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, + 0x30, 0x0A, 0x00, 0x00, 0x64, 0x0A, 0x00, 0x00, 0x98, 0x0A, 0x00, 0x00, + 0x2C, 0x0B, 0x00, 0x00, 0x98, 0x0C, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xF0, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x48, 0x00, 0x05, 0x00, 0x00, 0xC6, 0x09, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, @@ -221,9 +221,12 @@ const uint8_t discrete_triangle_hs[] = { 0x31, 0x00, 0xAB, 0xAB, 0x49, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x58, 0x45, 0x56, 0x45, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB, 0x4F, 0x53, 0x47, 0x4E, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0E, 0x00, 0x00, + 0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB, 0x50, 0x43, 0x53, 0x47, 0x8C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -236,41 +239,48 @@ const uint8_t discrete_triangle_hs[] = { 0x01, 0x0E, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x54, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x56, 0x5F, 0x49, 0x6E, 0x73, 0x69, 0x64, 0x65, 0x54, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, - 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0x0C, 0x01, 0x00, 0x00, - 0x51, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x01, + 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0x64, 0x01, 0x00, 0x00, + 0x51, 0x00, 0x03, 0x00, 0x59, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x01, 0x93, 0x18, 0x00, 0x01, 0x94, 0x18, 0x00, 0x01, 0x95, 0x10, 0x00, 0x01, 0x96, 0x08, 0x00, 0x01, 0x97, 0x18, 0x00, 0x01, 0x6A, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x07, 0x46, 0x8E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01, 0x3E, 0x00, 0x00, 0x01, - 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, - 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, 0x67, 0x00, 0x00, 0x04, - 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x12, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, - 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, - 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x70, 0x01, 0x00, - 0x36, 0x00, 0x00, 0x08, 0x12, 0x20, 0x90, 0x00, 0x0A, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, - 0x73, 0x00, 0x00, 0x01, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x07, - 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01, 0x5F, 0x00, 0x00, 0x02, + 0x00, 0x60, 0x01, 0x00, 0x5F, 0x00, 0x00, 0x04, 0x12, 0x10, 0x20, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, + 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, + 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x60, 0x01, 0x00, 0x2B, 0x00, 0x00, 0x07, + 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x10, 0xA0, 0x00, + 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x00, 0x00, 0x01, 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, + 0x03, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, + 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x08, 0x12, 0x20, 0x90, 0x00, + 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, - 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x00, 0x00, 0x01, 0x73, 0x00, 0x00, 0x01, 0x67, 0x00, 0x00, 0x04, + 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x07, 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, + 0x94, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.txt b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.txt index 26118b21a..337610d24 100644 --- a/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.txt +++ b/src/xenia/gpu/d3d12/shaders/dxbc/discrete_triangle_hs.txt @@ -63,14 +63,15 @@ // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ -// XEVERTEXID 0 x 0 NONE int +// XEVERTEXID 0 x 0 NONE int x // // // Output signature: // // Name Index Mask Register SysValue Format Used // -------------------- ----- ------ -------- -------- ------- ------ -// no Output +// XEVERTEXID 0 x 0 NONE float x +// // Tessellation Domain # of control points // -------------------- -------------------- // Triangle 3 @@ -89,6 +90,12 @@ dcl_tessellator_output_primitive output_triangle_cw dcl_globalFlags refactoringAllowed dcl_constantbuffer CB0[0:0][15], immediateIndexed, space=0 hs_control_point_phase +dcl_input vOutputControlPointID +dcl_input v[3][0].x +dcl_output o0.x +dcl_temps 1 +mov r0.x, vOutputControlPointID +itof o0.x, v[r0.x + 0][0].x ret hs_fork_phase dcl_hs_fork_phase_instance_count 3 @@ -105,4 +112,4 @@ hs_fork_phase dcl_output_siv o3.x, finalTriInsideTessFactor mov o3.x, CB0[0][14].y ret -// Approximately 6 instruction slots used +// Approximately 8 instruction slots used diff --git a/src/xenia/gpu/d3d12/shaders/xenos_draw.hlsli b/src/xenia/gpu/d3d12/shaders/xenos_draw.hlsli index 7cb1cf34b..8c887a561 100644 --- a/src/xenia/gpu/d3d12/shaders/xenos_draw.hlsli +++ b/src/xenia/gpu/d3d12/shaders/xenos_draw.hlsli @@ -59,8 +59,7 @@ struct XeHSControlPointInput { }; struct XeHSControlPointOutput { - // TODO(Triang3l): Re-enable when non-adaptive tessellation is properly added. - // float index : XEVERTEXID; + float index : XEVERTEXID; }; struct XeVertexPostGS { diff --git a/src/xenia/gpu/dxbc_shader_translator.cc b/src/xenia/gpu/dxbc_shader_translator.cc index 4692888b8..1414c8c09 100644 --- a/src/xenia/gpu/dxbc_shader_translator.cc +++ b/src/xenia/gpu/dxbc_shader_translator.cc @@ -448,7 +448,7 @@ void DxbcShaderTranslator::StartVertexShader_LoadVertexIndex() { void DxbcShaderTranslator::StartVertexOrDomainShader() { // Zero the interpolators. for (uint32_t i = 0; i < kInterpolatorCount; ++i) { - DxbcOpMov(DxbcDest::O(uint32_t(InOutRegister::kVSOutInterpolators) + i), + DxbcOpMov(DxbcDest::O(uint32_t(InOutRegister::kVSDSOutInterpolators) + i), DxbcSrc::LF(0.0f)); } @@ -459,6 +459,30 @@ void DxbcShaderTranslator::StartVertexOrDomainShader() { StartVertexShader_LoadVertexIndex(); break; + case Shader::HostVertexShaderType::kTriangleDomainConstant: + assert_true(register_count() >= 2); + if (register_count() >= 1) { + // Copy the domain location to r0.xyz. + // ZYX swizzle according to Call of Duty 3 and Viva Pinata. + DxbcOpMov(uses_register_dynamic_addressing() ? DxbcDest::X(0, 0, 0b0111) + : DxbcDest::R(0, 0b0111), + DxbcSrc::VDomain(0b000110)); + if (register_count() >= 2) { + // Copy the control point indices (already swapped and converted to + // float by the host vertex and hull shaders) to r1.xyz. + DxbcDest control_point_index_dest(uses_register_dynamic_addressing() + ? DxbcDest::X(0, 1) + : DxbcDest::R(1)); + for (uint32_t i = 0; i < 3; ++i) { + DxbcOpMov(control_point_index_dest.Mask(1 << i), + DxbcSrc::VICP( + i, uint32_t(InOutRegister::kDSInControlPointIndex), + DxbcSrc::kXXXX)); + } + } + } + break; + case Shader::HostVertexShaderType::kTriangleDomainAdaptive: assert_true(register_count() >= 2); if (register_count() >= 1) { @@ -1162,7 +1186,8 @@ void DxbcShaderTranslator::CompleteVertexOrDomainShader() { ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(12)); shader_code_.push_back( EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_OUTPUT, ucp_mask, 1)); - shader_code_.push_back(uint32_t(InOutRegister::kVSOutClipDistance0123) + i); + shader_code_.push_back(uint32_t(InOutRegister::kVSDSOutClipDistance0123) + + i); shader_code_.push_back(EncodeVectorSwizzledOperand( D3D10_SB_OPERAND_TYPE_TEMP, kSwizzleXYZW, 1)); shader_code_.push_back(ucp_enabled_temp); @@ -1276,7 +1301,7 @@ void DxbcShaderTranslator::CompleteVertexOrDomainShader() { ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(5)); shader_code_.push_back( EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_OUTPUT, 0b0011, 1)); - shader_code_.push_back(uint32_t(InOutRegister::kVSOutClipSpaceZW)); + shader_code_.push_back(uint32_t(InOutRegister::kVSDSOutClipSpaceZW)); shader_code_.push_back( EncodeVectorSwizzledOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b11111110, 1)); shader_code_.push_back(system_temp_position_); @@ -1284,10 +1309,10 @@ void DxbcShaderTranslator::CompleteVertexOrDomainShader() { ++stat_.mov_instruction_count; // Initialize SV_CullDistance. - DxbcOpMov( - DxbcDest::O(uint32_t(InOutRegister::kVSOutClipDistance45AndCullDistance), - 0b0100), - DxbcSrc::LF(0.0f)); + DxbcOpMov(DxbcDest::O( + uint32_t(InOutRegister::kVSDSOutClipDistance45AndCullDistance), + 0b0100), + DxbcSrc::LF(0.0f)); // Kill the primitive if needed - check if the shader wants to kill. // TODO(Triang3l): Find if the condition is actually the flag being non-zero. uint32_t kill_temp = PushSystemTemp(); @@ -1319,7 +1344,7 @@ void DxbcShaderTranslator::CompleteVertexOrDomainShader() { // negative. DxbcOpMov( DxbcDest::O( - uint32_t(InOutRegister::kVSOutClipDistance45AndCullDistance), + uint32_t(InOutRegister::kVSDSOutClipDistance45AndCullDistance), 0b0100), DxbcSrc::LF(-1.0f)); } @@ -1332,7 +1357,7 @@ void DxbcShaderTranslator::CompleteVertexOrDomainShader() { ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(5)); shader_code_.push_back( EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_OUTPUT, 0b1111, 1)); - shader_code_.push_back(uint32_t(InOutRegister::kVSOutPosition)); + shader_code_.push_back(uint32_t(InOutRegister::kVSDSOutPosition)); shader_code_.push_back( EncodeVectorSwizzledOperand(D3D10_SB_OPERAND_TYPE_TEMP, kSwizzleXYZW, 1)); shader_code_.push_back(system_temp_position_); @@ -1341,11 +1366,13 @@ void DxbcShaderTranslator::CompleteVertexOrDomainShader() { // Zero the point coordinate (will be set in the geometry shader if needed) // and write the point size. - DxbcOpMov(DxbcDest::O(uint32_t(InOutRegister::kVSOutPointParameters), 0b0011), - DxbcSrc::LF(0.0f)); - DxbcOpMov(DxbcDest::O(uint32_t(InOutRegister::kVSOutPointParameters), 0b0100), - DxbcSrc::R(system_temp_point_size_edge_flag_kill_vertex_, - DxbcSrc::kXXXX)); + DxbcOpMov( + DxbcDest::O(uint32_t(InOutRegister::kVSDSOutPointParameters), 0b0011), + DxbcSrc::LF(0.0f)); + DxbcOpMov( + DxbcDest::O(uint32_t(InOutRegister::kVSDSOutPointParameters), 0b0100), + DxbcSrc::R(system_temp_point_size_edge_flag_kill_vertex_, + DxbcSrc::kXXXX)); } void DxbcShaderTranslator::CompleteShaderCode() { @@ -2178,7 +2205,7 @@ void DxbcShaderTranslator::StoreResult(const InstructionResult& result, saturate_bit); shader_code_.push_back( EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_OUTPUT, mask, 1)); - shader_code_.push_back(uint32_t(InOutRegister::kVSOutInterpolators) + + shader_code_.push_back(uint32_t(InOutRegister::kVSDSOutInterpolators) + uint32_t(result.storage_index)); break; @@ -3605,10 +3632,42 @@ void DxbcShaderTranslator::WriteInputSignature() { // Vertex index semantic name. AppendString(shader_object_, "SV_VertexID"); } else if (IsDxbcDomainShader()) { - // No inputs - tessellation factors specified in PCSG. - shader_object_.push_back(0); - // Unknown. - shader_object_.push_back(8); + // Tessellation factors are specified in PCSG, not ISGN. + if (host_vertex_shader_type() == + Shader::HostVertexShaderType::kTriangleDomainConstant || + host_vertex_shader_type() == + Shader::HostVertexShaderType::kQuadDomainConstant) { + // TODO(Triang3l): Support line patches. + + // Control point indices, byte-swapped, biased according to the base index + // and converted to float by the host vertex and hull shaders. + shader_object_.push_back(1); + // Unknown. + shader_object_.push_back(8); + + // Control point indices. + // Semantic name XEVERTEXID (the only one in the signature). + shader_object_.push_back( + (signature_position_dwords + signature_size_dwords) * + sizeof(uint32_t)); + // Semantic index. + shader_object_.push_back(0); + // D3D_NAME_UNDEFINED. + shader_object_.push_back(0); + // D3D_REGISTER_COMPONENT_FLOAT32. + shader_object_.push_back(3); + shader_object_.push_back(uint32_t(InOutRegister::kDSInControlPointIndex)); + // x present, x used (always written to GPR 1). + shader_object_.push_back(0b0001 | (0b0001 << 8)); + + // Control point indices semantic name. + AppendString(shader_object_, "XEVERTEXID"); + } else { + // No inputs. + shader_object_.push_back(0); + // Unknown. + shader_object_.push_back(8); + } } else { assert_true(IsDxbcPixelShader()); // Interpolators, point parameters (coordinates, size), clip space ZW, @@ -3804,7 +3863,7 @@ void DxbcShaderTranslator::WriteOutputSignature() { shader_object_.push_back(0); // D3D_REGISTER_COMPONENT_FLOAT32. shader_object_.push_back(3); - shader_object_.push_back(uint32_t(InOutRegister::kVSOutInterpolators) + + shader_object_.push_back(uint32_t(InOutRegister::kVSDSOutInterpolators) + i); // Unlike in ISGN, the second byte contains the unused components, not the // used ones. All components are always used because they are reset to 0. @@ -3817,7 +3876,7 @@ void DxbcShaderTranslator::WriteOutputSignature() { shader_object_.push_back(kPointParametersTexCoord); shader_object_.push_back(0); shader_object_.push_back(3); - shader_object_.push_back(uint32_t(InOutRegister::kVSOutPointParameters)); + shader_object_.push_back(uint32_t(InOutRegister::kVSDSOutPointParameters)); shader_object_.push_back(0b0111 | (0b1000 << 8)); // Z and W in clip space, for getting per-sample depth with ROV. @@ -3825,7 +3884,7 @@ void DxbcShaderTranslator::WriteOutputSignature() { shader_object_.push_back(kClipSpaceZWTexCoord); shader_object_.push_back(0); shader_object_.push_back(3); - shader_object_.push_back(uint32_t(InOutRegister::kVSOutClipSpaceZW)); + shader_object_.push_back(uint32_t(InOutRegister::kVSDSOutClipSpaceZW)); shader_object_.push_back(0b0011 | (0b1100 << 8)); // Position. @@ -3834,7 +3893,7 @@ void DxbcShaderTranslator::WriteOutputSignature() { // D3D_NAME_POSITION. shader_object_.push_back(1); shader_object_.push_back(3); - shader_object_.push_back(uint32_t(InOutRegister::kVSOutPosition)); + shader_object_.push_back(uint32_t(InOutRegister::kVSDSOutPosition)); shader_object_.push_back(0b1111); // Clip and cull distances. @@ -3844,8 +3903,8 @@ void DxbcShaderTranslator::WriteOutputSignature() { // D3D_NAME_CLIP_DISTANCE. shader_object_.push_back(2); shader_object_.push_back(3); - shader_object_.push_back(uint32_t(InOutRegister::kVSOutClipDistance0123) + - i); + shader_object_.push_back( + uint32_t(InOutRegister::kDSVSOutClipDistance0123) + i); shader_object_.push_back(i ? (0b0011 | (0b1100 << 8)) : 0b1111); } shader_object_.push_back(0); @@ -3854,7 +3913,7 @@ void DxbcShaderTranslator::WriteOutputSignature() { shader_object_.push_back(3); shader_object_.push_back(3); shader_object_.push_back( - uint32_t(InOutRegister::kVSOutClipDistance45AndCullDistance)); + uint32_t(InOutRegister::kVSDSOutClipDistance45AndCullDistance)); shader_object_.push_back(0b0100 | (0b1011 << 8)); // Write the semantic names. @@ -4186,13 +4245,39 @@ void DxbcShaderTranslator::WriteShaderCode() { shader_object_.push_back(EncodeVectorMaskedOperand( D3D11_SB_OPERAND_TYPE_INPUT_DOMAIN_POINT, domain_location_mask, 0)); ++stat_.dcl_count; - // Primitive index input. - shader_object_.push_back( - ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INPUT) | - ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(2)); - shader_object_.push_back( - EncodeScalarOperand(D3D10_SB_OPERAND_TYPE_INPUT_PRIMITIVEID, 0)); - ++stat_.dcl_count; + // Control point indices as float for discrete/continuous tessellation, or + // primitive index for adaptive tessellation. + uint32_t control_point_array_size; + switch (host_vertex_shader_type()) { + case Shader::HostVertexShaderType::kTriangleDomainConstant: + control_point_array_size = 3; + break; + case Shader::HostVertexShaderType::kQuadDomainConstant: + control_point_array_size = 4; + break; + default: + // TODO(Triang3l): Support line patches. + // Adaptive. + control_point_array_size = 0; + } + if (control_point_array_size) { + shader_object_.push_back( + ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INPUT) | + ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(4)); + shader_object_.push_back(EncodeVectorMaskedOperand( + D3D11_SB_OPERAND_TYPE_INPUT_CONTROL_POINT, 0b0001, 2)); + shader_object_.push_back(control_point_array_size); + shader_object_.push_back( + uint32_t(InOutRegister::kDSInControlPointIndex)); + ++stat_.dcl_count; + } else { + shader_object_.push_back( + ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INPUT) | + ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(2)); + shader_object_.push_back( + EncodeScalarOperand(D3D10_SB_OPERAND_TYPE_INPUT_PRIMITIVEID, 0)); + ++stat_.dcl_count; + } } else { // Unswapped vertex index input (only X component). shader_object_.push_back( @@ -4211,7 +4296,7 @@ void DxbcShaderTranslator::WriteShaderCode() { ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(3)); shader_object_.push_back( EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_OUTPUT, 0b1111, 1)); - shader_object_.push_back(uint32_t(InOutRegister::kVSOutInterpolators) + + shader_object_.push_back(uint32_t(InOutRegister::kVSDSOutInterpolators) + i); ++stat_.dcl_count; } @@ -4221,7 +4306,7 @@ void DxbcShaderTranslator::WriteShaderCode() { ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(3)); shader_object_.push_back( EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_OUTPUT, 0b0111, 1)); - shader_object_.push_back(uint32_t(InOutRegister::kVSOutPointParameters)); + shader_object_.push_back(uint32_t(InOutRegister::kVSDSOutPointParameters)); ++stat_.dcl_count; // Clip space Z and W output. shader_object_.push_back( @@ -4229,7 +4314,7 @@ void DxbcShaderTranslator::WriteShaderCode() { ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(3)); shader_object_.push_back( EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_OUTPUT, 0b0011, 1)); - shader_object_.push_back(uint32_t(InOutRegister::kVSOutClipSpaceZW)); + shader_object_.push_back(uint32_t(InOutRegister::kVSDSOutClipSpaceZW)); ++stat_.dcl_count; // Position output. shader_object_.push_back( @@ -4237,7 +4322,7 @@ void DxbcShaderTranslator::WriteShaderCode() { ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(4)); shader_object_.push_back( EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_OUTPUT, 0b1111, 1)); - shader_object_.push_back(uint32_t(InOutRegister::kVSOutPosition)); + shader_object_.push_back(uint32_t(InOutRegister::kVSDSOutPosition)); shader_object_.push_back(ENCODE_D3D10_SB_NAME(D3D10_SB_NAME_POSITION)); ++stat_.dcl_count; // Clip distance outputs. @@ -4247,8 +4332,8 @@ void DxbcShaderTranslator::WriteShaderCode() { ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(4)); shader_object_.push_back(EncodeVectorMaskedOperand( D3D10_SB_OPERAND_TYPE_OUTPUT, i ? 0b0011 : 0b1111, 1)); - shader_object_.push_back(uint32_t(InOutRegister::kVSOutClipDistance0123) + - i); + shader_object_.push_back( + uint32_t(InOutRegister::kVDSSOutClipDistance0123) + i); shader_object_.push_back( ENCODE_D3D10_SB_NAME(D3D10_SB_NAME_CLIP_DISTANCE)); ++stat_.dcl_count; @@ -4260,7 +4345,7 @@ void DxbcShaderTranslator::WriteShaderCode() { shader_object_.push_back( EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_OUTPUT, 0b0100, 1)); shader_object_.push_back( - uint32_t(InOutRegister::kVSOutClipDistance45AndCullDistance)); + uint32_t(InOutRegister::kVSDSOutClipDistance45AndCullDistance)); shader_object_.push_back(ENCODE_D3D10_SB_NAME(D3D10_SB_NAME_CULL_DISTANCE)); ++stat_.dcl_count; } else if (IsDxbcPixelShader()) { diff --git a/src/xenia/gpu/dxbc_shader_translator.h b/src/xenia/gpu/dxbc_shader_translator.h index b5b0b2c04..20df309d2 100644 --- a/src/xenia/gpu/dxbc_shader_translator.h +++ b/src/xenia/gpu/dxbc_shader_translator.h @@ -461,6 +461,7 @@ class DxbcShaderTranslator : public ShaderTranslator { kInputPrimitiveID = 11, kOutputDepth = 12, kNull = 13, + kInputControlPoint = 25, kInputDomainPoint = 28, kUnorderedAccessView = 30, kInputCoverageMask = 35, @@ -477,6 +478,7 @@ class DxbcShaderTranslator : public ShaderTranslator { case DxbcOperandType::kIndexableTemp: case DxbcOperandType::kSampler: case DxbcOperandType::kResource: + case DxbcOperandType::kInputControlPoint: case DxbcOperandType::kUnorderedAccessView: return 2; case DxbcOperandType::kConstantBuffer: @@ -802,6 +804,11 @@ class DxbcShaderTranslator : public ShaderTranslator { static DxbcSrc VPrim() { return DxbcSrc(DxbcOperandType::kInputPrimitiveID, kXXXX); } + static DxbcSrc VICP(DxbcIndex index_1d, DxbcIndex index_2d, + uint32_t swizzle = kXYZW) { + return DxbcSrc(DxbcOperandType::kInputControlPoint, swizzle, index_1d, + index_2d); + } static DxbcSrc VDomain(uint32_t swizzle = kXYZW) { return DxbcSrc(DxbcOperandType::kInputDomainPoint, swizzle); } @@ -1563,13 +1570,15 @@ class DxbcShaderTranslator : public ShaderTranslator { // MUST BE UPDATED! kVSInVertexIndex = 0, - kVSOutInterpolators = 0, - kVSOutPointParameters = kVSOutInterpolators + kInterpolatorCount, - kVSOutClipSpaceZW, - kVSOutPosition, + kDSInControlPointIndex = 0, + + kVSDSOutInterpolators = 0, + kVSDSOutPointParameters = kVSDSOutInterpolators + kInterpolatorCount, + kVSDSOutClipSpaceZW, + kVSDSOutPosition, // Clip and cull distances must be tightly packed in Direct3D! - kVSOutClipDistance0123, - kVSOutClipDistance45AndCullDistance, + kVSDSOutClipDistance0123, + kVSDSOutClipDistance45AndCullDistance, // TODO(Triang3l): Use SV_CullDistance instead for // PA_CL_CLIP_CNTL::UCP_CULL_ONLY_ENA, but can't have more than 8 clip and // cull distances in total. Currently only using SV_CullDistance for vertex diff --git a/src/xenia/gpu/shader.h b/src/xenia/gpu/shader.h index c9f315183..50372ae12 100644 --- a/src/xenia/gpu/shader.h +++ b/src/xenia/gpu/shader.h @@ -530,9 +530,9 @@ struct ParsedAluInstruction { class Shader { public: - // If values are changed, invalidate shader storages where this is stored! And - // check bit count where this is packed. This is : uint32_t for simplicity of - // packing in bit fields. + // If values are changed, INVALIDATE SHADER STORAGES (increase their version + // constexpr) where those are stored! And check bit count where this is + // packed. This is : uint32_t for simplicity of packing in bit fields. enum class HostVertexShaderType : uint32_t { kVertex, kLineDomainConstant,