[D3D12] Allow non-adaptive tessellation for patch primitive types, and all triangle and quad tessellation modes

This commit is contained in:
Triang3l 2020-05-11 22:40:52 +03:00
parent 4631b2b16c
commit 0d14ae01bb
17 changed files with 352 additions and 305 deletions

View File

@ -751,6 +751,7 @@ Shader::HostVertexShaderType PipelineCache::GetHostVertexShaderTypeIfValid()
regs.Get<reg::VGT_HOS_CNTL>().tess_mode; regs.Get<reg::VGT_HOS_CNTL>().tess_mode;
switch (vgt_draw_initiator.prim_type) { switch (vgt_draw_initiator.prim_type) {
case PrimitiveType::kTriangleList: case PrimitiveType::kTriangleList:
case PrimitiveType::kTrianglePatch:
// Also supported by triangle strips and fans according to: // Also supported by triangle strips and fans according to:
// https://www.khronos.org/registry/OpenGL/extensions/AMD/AMD_vertex_shader_tessellator.txt // 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 // Would need to convert those to triangle lists, but haven't seen any
@ -764,39 +765,44 @@ Shader::HostVertexShaderType PipelineCache::GetHostVertexShaderTypeIfValid()
// - Viva Pinata - tree building with a beehive in the beginning // - Viva Pinata - tree building with a beehive in the beginning
// (visible on the start screen behind the logo), waterfall in the // (visible on the start screen behind the logo), waterfall in the
// beginning - kTriangleList. // beginning - kTriangleList.
return Shader::HostVertexShaderType::kTriangleDomainConstant; return Shader::HostVertexShaderType::kTriangleDomainCPIndexed;
case xenos::TessellationMode::kAdaptive:
if (vgt_draw_initiator.prim_type == PrimitiveType::kTrianglePatch) {
// - Banjo-Kazooie: Nuts & Bolts - water.
// - Halo 3 - water.
return Shader::HostVertexShaderType::kTriangleDomainPatchIndexed;
}
break;
default: default:
break; break;
} }
break; break;
case PrimitiveType::kQuadList: case PrimitiveType::kQuadList:
case PrimitiveType::kQuadPatch:
switch (tessellation_mode) { switch (tessellation_mode) {
// Also supported by quad strips according to: // Also supported by quad strips according to:
// https://www.khronos.org/registry/OpenGL/extensions/AMD/AMD_vertex_shader_tessellator.txt // https://www.khronos.org/registry/OpenGL/extensions/AMD/AMD_vertex_shader_tessellator.txt
// Would need to convert those to quad lists, but haven't seen any games // Would need to convert those to quad lists, but haven't seen any games
// using tessellated strips so far. // using tessellated strips so far.
case xenos::TessellationMode::kDiscrete:
// Not seen in games so far.
case xenos::TessellationMode::kContinuous: case xenos::TessellationMode::kContinuous:
// - Defender - retro screen and beams in the main menu - kQuadList. // - Defender - retro screen and beams in the main menu - kQuadList.
return Shader::HostVertexShaderType::kQuadDomainConstant; // - Fable 2 - kQuadPatch.
return Shader::HostVertexShaderType::kQuadDomainCPIndexed;
case xenos::TessellationMode::kAdaptive:
if (vgt_draw_initiator.prim_type == PrimitiveType::kQuadPatch) {
// - Viva Pinata - garden ground.
return Shader::HostVertexShaderType::kQuadDomainPatchIndexed;
}
break;
default: default:
break; break;
} }
break; break;
case PrimitiveType::kTrianglePatch: default:
if (tessellation_mode == xenos::TessellationMode::kAdaptive) { // TODO(Triang3l): Support line patches.
// - Banjo-Kazooie: Nuts & Bolts - water.
// - Halo 3 - water.
return Shader::HostVertexShaderType::kTriangleDomainAdaptive;
}
break; break;
case PrimitiveType::kQuadPatch:
if (tessellation_mode == xenos::TessellationMode::kAdaptive) {
// - Viva Pinata - garden ground.
return Shader::HostVertexShaderType::kQuadDomainAdaptive;
}
break;
// TODO(Triang3l): Support line patches and non-adaptive quad
// tessellation.
} }
XELOGE( XELOGE(
"Unsupported tessellation mode {} for primitive type {}. Report the game " "Unsupported tessellation mode {} for primitive type {}. Report the game "
@ -970,23 +976,23 @@ bool PipelineCache::TranslateShader(
const char* host_shader_type; const char* host_shader_type;
if (shader->type() == ShaderType::kVertex) { if (shader->type() == ShaderType::kVertex) {
switch (shader->host_vertex_shader_type()) { switch (shader->host_vertex_shader_type()) {
case Shader::HostVertexShaderType::kLineDomainConstant: case Shader::HostVertexShaderType::kLineDomainCPIndexed:
host_shader_type = "constant line domain"; host_shader_type = "control-point-indexed line domain";
break; break;
case Shader::HostVertexShaderType::kLineDomainAdaptive: case Shader::HostVertexShaderType::kLineDomainPatchIndexed:
host_shader_type = "adaptive line domain"; host_shader_type = "patch-indexed line domain";
break; break;
case Shader::HostVertexShaderType::kTriangleDomainConstant: case Shader::HostVertexShaderType::kTriangleDomainCPIndexed:
host_shader_type = "constant triangle domain"; host_shader_type = "control-point-indexed triangle domain";
break; break;
case Shader::HostVertexShaderType::kTriangleDomainAdaptive: case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed:
host_shader_type = "adaptive triangle domain"; host_shader_type = "patch-indexed triangle domain";
break; break;
case Shader::HostVertexShaderType::kQuadDomainConstant: case Shader::HostVertexShaderType::kQuadDomainCPIndexed:
host_shader_type = "constant quad domain"; host_shader_type = "control-point-indexed quad domain";
break; break;
case Shader::HostVertexShaderType::kQuadDomainAdaptive: case Shader::HostVertexShaderType::kQuadDomainPatchIndexed:
host_shader_type = "adaptive quad domain"; host_shader_type = "patch-indexed quad domain";
break; break;
default: default:
host_shader_type = "vertex"; host_shader_type = "vertex";
@ -1481,11 +1487,13 @@ ID3D12PipelineState* PipelineCache::CreateD3D12PipelineState(
switch (tessellation_mode) { switch (tessellation_mode) {
case xenos::TessellationMode::kDiscrete: case xenos::TessellationMode::kDiscrete:
switch (host_vertex_shader_type) { switch (host_vertex_shader_type) {
case Shader::HostVertexShaderType::kTriangleDomainConstant: case Shader::HostVertexShaderType::kTriangleDomainCPIndexed:
case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed:
state_desc.HS.pShaderBytecode = discrete_triangle_hs; state_desc.HS.pShaderBytecode = discrete_triangle_hs;
state_desc.HS.BytecodeLength = sizeof(discrete_triangle_hs); state_desc.HS.BytecodeLength = sizeof(discrete_triangle_hs);
break; break;
case Shader::HostVertexShaderType::kQuadDomainConstant: case Shader::HostVertexShaderType::kQuadDomainCPIndexed:
case Shader::HostVertexShaderType::kQuadDomainPatchIndexed:
state_desc.HS.pShaderBytecode = discrete_quad_hs; state_desc.HS.pShaderBytecode = discrete_quad_hs;
state_desc.HS.BytecodeLength = sizeof(discrete_quad_hs); state_desc.HS.BytecodeLength = sizeof(discrete_quad_hs);
break; break;
@ -1496,11 +1504,13 @@ ID3D12PipelineState* PipelineCache::CreateD3D12PipelineState(
break; break;
case xenos::TessellationMode::kContinuous: case xenos::TessellationMode::kContinuous:
switch (host_vertex_shader_type) { switch (host_vertex_shader_type) {
case Shader::HostVertexShaderType::kTriangleDomainConstant: case Shader::HostVertexShaderType::kTriangleDomainCPIndexed:
case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed:
state_desc.HS.pShaderBytecode = continuous_triangle_hs; state_desc.HS.pShaderBytecode = continuous_triangle_hs;
state_desc.HS.BytecodeLength = sizeof(continuous_triangle_hs); state_desc.HS.BytecodeLength = sizeof(continuous_triangle_hs);
break; break;
case Shader::HostVertexShaderType::kQuadDomainConstant: case Shader::HostVertexShaderType::kQuadDomainCPIndexed:
case Shader::HostVertexShaderType::kQuadDomainPatchIndexed:
state_desc.HS.pShaderBytecode = continuous_quad_hs; state_desc.HS.pShaderBytecode = continuous_quad_hs;
state_desc.HS.BytecodeLength = sizeof(continuous_quad_hs); state_desc.HS.BytecodeLength = sizeof(continuous_quad_hs);
break; break;
@ -1511,11 +1521,11 @@ ID3D12PipelineState* PipelineCache::CreateD3D12PipelineState(
break; break;
case xenos::TessellationMode::kAdaptive: case xenos::TessellationMode::kAdaptive:
switch (host_vertex_shader_type) { switch (host_vertex_shader_type) {
case Shader::HostVertexShaderType::kTriangleDomainAdaptive: case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed:
state_desc.HS.pShaderBytecode = adaptive_triangle_hs; state_desc.HS.pShaderBytecode = adaptive_triangle_hs;
state_desc.HS.BytecodeLength = sizeof(adaptive_triangle_hs); state_desc.HS.BytecodeLength = sizeof(adaptive_triangle_hs);
break; break;
case Shader::HostVertexShaderType::kQuadDomainAdaptive: case Shader::HostVertexShaderType::kQuadDomainPatchIndexed:
state_desc.HS.pShaderBytecode = adaptive_quad_hs; state_desc.HS.pShaderBytecode = adaptive_quad_hs;
state_desc.HS.BytecodeLength = sizeof(adaptive_quad_hs); state_desc.HS.BytecodeLength = sizeof(adaptive_quad_hs);
break; break;

View File

@ -48,8 +48,10 @@ XeHSConstantDataOutput XePatchConstant(
[outputtopology("triangle_cw")] [outputtopology("triangle_cw")]
[outputcontrolpoints(4)] [outputcontrolpoints(4)]
[patchconstantfunc("XePatchConstant")] [patchconstantfunc("XePatchConstant")]
XeHSAdaptiveControlPointOutput main( XeHSControlPointOutput main(
InputPatch<XeHSControlPointInput, 4> xe_input_patch) { InputPatch<XeHSControlPointInput, 4> xe_input_patch) {
XeHSAdaptiveControlPointOutput output; XeHSControlPointOutput output;
// Not used with control point indices.
output.index = 0.0f;
return output; return output;
} }

View File

@ -54,8 +54,10 @@ XeHSConstantDataOutput XePatchConstant(
[outputtopology("triangle_cw")] [outputtopology("triangle_cw")]
[outputcontrolpoints(3)] [outputcontrolpoints(3)]
[patchconstantfunc("XePatchConstant")] [patchconstantfunc("XePatchConstant")]
XeHSAdaptiveControlPointOutput main( XeHSControlPointOutput main(
InputPatch<XeHSControlPointInput, 3> xe_input_patch) { InputPatch<XeHSControlPointInput, 3> xe_input_patch) {
XeHSAdaptiveControlPointOutput output; XeHSControlPointOutput output;
// Not used with control point indices.
output.index = 0.0f;
return output; return output;
} }

View File

@ -1,11 +1,11 @@
// generated from `xb buildhlsl` // generated from `xb buildhlsl`
// source: adaptive_quad.hs.hlsl // source: adaptive_quad.hs.hlsl
const uint8_t adaptive_quad_hs[] = { const uint8_t adaptive_quad_hs[] = {
0x44, 0x58, 0x42, 0x43, 0x2B, 0xDD, 0xCA, 0x77, 0xA6, 0x08, 0x56, 0x29, 0x44, 0x58, 0x42, 0x43, 0xCF, 0x52, 0x7A, 0xCB, 0xDE, 0xD4, 0x25, 0x99,
0xFC, 0x1C, 0xD2, 0x70, 0xAB, 0x67, 0xE3, 0x7A, 0x01, 0x00, 0x00, 0x00, 0x61, 0xDE, 0x02, 0x16, 0x47, 0x8F, 0xBB, 0x48, 0x01, 0x00, 0x00, 0x00,
0x0C, 0x0E, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x50, 0x0E, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
0xEC, 0x09, 0x00, 0x00, 0x20, 0x0A, 0x00, 0x00, 0x30, 0x0A, 0x00, 0x00, 0xEC, 0x09, 0x00, 0x00, 0x20, 0x0A, 0x00, 0x00, 0x54, 0x0A, 0x00, 0x00,
0xF4, 0x0A, 0x00, 0x00, 0x70, 0x0D, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x18, 0x0B, 0x00, 0x00, 0xB4, 0x0D, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46,
0xAC, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xAC, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x48, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x48,
0x00, 0x05, 0x00, 0x00, 0x82, 0x09, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, 0x00, 0x05, 0x00, 0x00, 0x82, 0x09, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25,
@ -217,8 +217,11 @@ const uint8_t adaptive_quad_hs[] = {
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00,
0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB, 0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB,
0x4F, 0x53, 0x47, 0x4E, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x50, 0x43, 0x53, 0x47, 0xBC, 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, 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, 0x0B, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x0E, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0E, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00,
@ -235,70 +238,73 @@ const uint8_t adaptive_quad_hs[] = {
0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x56, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x56,
0x5F, 0x49, 0x6E, 0x73, 0x69, 0x64, 0x65, 0x54, 0x65, 0x73, 0x73, 0x46, 0x5F, 0x49, 0x6E, 0x73, 0x69, 0x64, 0x65, 0x54, 0x65, 0x73, 0x73, 0x46,
0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58,
0x74, 0x02, 0x00, 0x00, 0x51, 0x00, 0x03, 0x00, 0x9D, 0x00, 0x00, 0x00, 0x94, 0x02, 0x00, 0x00, 0x51, 0x00, 0x03, 0x00, 0xA5, 0x00, 0x00, 0x00,
0x71, 0x00, 0x00, 0x01, 0x93, 0x20, 0x00, 0x01, 0x94, 0x20, 0x00, 0x01, 0x71, 0x00, 0x00, 0x01, 0x93, 0x20, 0x00, 0x01, 0x94, 0x20, 0x00, 0x01,
0x95, 0x18, 0x00, 0x01, 0x96, 0x20, 0x00, 0x01, 0x97, 0x18, 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, 0x6A, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x07, 0x46, 0x8E, 0x30, 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,
0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01,
0x3E, 0x00, 0x00, 0x01, 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, 0x65, 0x00, 0x00, 0x03, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x05, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5F, 0x00, 0x00, 0x04, 0x12, 0x90, 0x21, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, 0x5F, 0x00, 0x00, 0x04,
0x12, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x12, 0x90, 0x21, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0D, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x0B, 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, 0x0C, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04,
0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x12, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x06, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x70, 0x01, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x5B, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x06, 0x12, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x70, 0x01, 0x00, 0x01, 0x40, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x00, 0x00, 0x80, 0x3F, 0x0A, 0x90, 0xA1, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x09,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x09, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x09,
0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x0A, 0x90, 0xA1, 0x00, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x34, 0x00, 0x00, 0x09, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x30, 0x00, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x70, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0x12, 0x20, 0x90, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x33, 0x00, 0x00, 0x09, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x74, 0x00, 0x00, 0x01, 0x9A, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x12, 0xB0, 0x11, 0x00,
0x36, 0x00, 0x00, 0x04, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x12, 0xB0, 0x11, 0x00,
0x0A, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x06, 0x12, 0x20, 0x90, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x12, 0xB0, 0x11, 0x00,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x12, 0xB0, 0x11, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x74, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, 0x00, 0x80, 0x01, 0x00,
0x9A, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00,
0x12, 0xB0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x0F, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00,
0x12, 0xB0, 0x11, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02,
0x12, 0xB0, 0x11, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00,
0x12, 0xB0, 0x11, 0x00, 0x03, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04,
0x00, 0x80, 0x01, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x12, 0xB0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x12, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x01, 0x00, 0x33, 0x00, 0x00, 0x0A, 0x22, 0x00, 0x10, 0x00,
0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB0, 0x91, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x12, 0x20, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB0, 0xD1, 0x00, 0x02, 0x00, 0x00, 0x00,
0x5B, 0x00, 0x00, 0x04, 0x12, 0xB0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x07,
0x04, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04, 0x12, 0x00, 0x10, 0x00, 0x12, 0x20, 0xD0, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x01, 0x00, 0x33, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB0, 0x91, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB0, 0xD1, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x36, 0x00, 0x00, 0x07, 0x12, 0x20, 0xD0, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54,
0x94, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 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, 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, 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, 0x05, 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, 0x00, 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,
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, 0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x03, 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,
}; };

View File

@ -71,7 +71,8 @@
// //
// Name Index Mask Register SysValue Format Used // Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------ // -------------------- ----- ------ -------- -------- ------- ------
// no Output // XEVERTEXID 0 x 0 NONE float x
//
// Tessellation Domain # of control points // Tessellation Domain # of control points
// -------------------- -------------------- // -------------------- --------------------
// Quadrilateral 4 // Quadrilateral 4
@ -90,6 +91,8 @@ dcl_tessellator_output_primitive output_triangle_cw
dcl_globalFlags refactoringAllowed dcl_globalFlags refactoringAllowed
dcl_constantbuffer CB0[0:0][15], immediateIndexed, space=0 dcl_constantbuffer CB0[0:0][15], immediateIndexed, space=0
hs_control_point_phase hs_control_point_phase
dcl_output o0.x
mov o0.x, l(0)
ret ret
hs_fork_phase hs_fork_phase
dcl_hs_fork_phase_instance_count 4 dcl_hs_fork_phase_instance_count 4
@ -125,4 +128,4 @@ mov r0.x, vJoinInstanceID.x
min r0.y, vpc[r0.x + 0].x, vpc[r0.x + 2].x min r0.y, vpc[r0.x + 0].x, vpc[r0.x + 2].x
mov o[r0.x + 4].x, r0.y mov o[r0.x + 4].x, r0.y
ret ret
// Approximately 13 instruction slots used // Approximately 14 instruction slots used

View File

@ -1,11 +1,11 @@
// generated from `xb buildhlsl` // generated from `xb buildhlsl`
// source: adaptive_triangle.hs.hlsl // source: adaptive_triangle.hs.hlsl
const uint8_t adaptive_triangle_hs[] = { const uint8_t adaptive_triangle_hs[] = {
0x44, 0x58, 0x42, 0x43, 0x13, 0x0C, 0x44, 0xD6, 0x02, 0xD3, 0xE5, 0x3F, 0x44, 0x58, 0x42, 0x43, 0x41, 0x39, 0x62, 0x5B, 0xFA, 0xB0, 0x76, 0x71,
0x91, 0x34, 0x3B, 0x56, 0x91, 0x3F, 0xC6, 0x49, 0x01, 0x00, 0x00, 0x00, 0x6F, 0x29, 0xA7, 0x5B, 0x80, 0x3F, 0x1E, 0x80, 0x01, 0x00, 0x00, 0x00,
0x68, 0x0D, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0xAC, 0x0D, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
0xEC, 0x09, 0x00, 0x00, 0x20, 0x0A, 0x00, 0x00, 0x30, 0x0A, 0x00, 0x00, 0xEC, 0x09, 0x00, 0x00, 0x20, 0x0A, 0x00, 0x00, 0x54, 0x0A, 0x00, 0x00,
0xC4, 0x0A, 0x00, 0x00, 0xCC, 0x0C, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xE8, 0x0A, 0x00, 0x00, 0x10, 0x0D, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46,
0xAC, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xAC, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x48, 0x01, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x48,
0x00, 0x05, 0x00, 0x00, 0x82, 0x09, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, 0x00, 0x05, 0x00, 0x00, 0x82, 0x09, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25,
@ -217,8 +217,11 @@ const uint8_t adaptive_triangle_hs[] = {
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00,
0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB, 0x58, 0x45, 0x56, 0x45, 0x52, 0x54, 0x45, 0x58, 0x49, 0x44, 0x00, 0xAB,
0x4F, 0x53, 0x47, 0x4E, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x50, 0x43, 0x53, 0x47, 0x8C, 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, 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, 0x0D, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x0E, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0E, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00,
@ -231,60 +234,63 @@ const uint8_t adaptive_triangle_hs[] = {
0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x56, 0x65, 0x73, 0x73, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x56,
0x5F, 0x49, 0x6E, 0x73, 0x69, 0x64, 0x65, 0x54, 0x65, 0x73, 0x73, 0x46, 0x5F, 0x49, 0x6E, 0x73, 0x69, 0x64, 0x65, 0x54, 0x65, 0x73, 0x73, 0x46,
0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x45, 0x58,
0x00, 0x02, 0x00, 0x00, 0x51, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x51, 0x00, 0x03, 0x00, 0x88, 0x00, 0x00, 0x00,
0x71, 0x00, 0x00, 0x01, 0x93, 0x18, 0x00, 0x01, 0x94, 0x18, 0x00, 0x01, 0x71, 0x00, 0x00, 0x01, 0x93, 0x18, 0x00, 0x01, 0x94, 0x18, 0x00, 0x01,
0x95, 0x10, 0x00, 0x01, 0x96, 0x20, 0x00, 0x01, 0x97, 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, 0x6A, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x07, 0x46, 0x8E, 0x30, 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,
0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x01,
0x3E, 0x00, 0x00, 0x01, 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, 0x65, 0x00, 0x00, 0x03, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x05, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x5F, 0x00, 0x00, 0x04, 0x12, 0x90, 0x21, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x73, 0x00, 0x00, 0x01, 0x99, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x5F, 0x00, 0x00, 0x02, 0x00, 0x70, 0x01, 0x00, 0x5F, 0x00, 0x00, 0x04,
0x12, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x12, 0x90, 0x21, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x13, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00,
0x5B, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04,
0x03, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x06, 0x12, 0x00, 0x10, 0x00, 0x12, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x70, 0x01, 0x00, 0x01, 0x40, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x04,
0x01, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x00, 0x08, 0x00, 0xD0, 0x00, 0x00, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x1E, 0x00, 0x00, 0x06, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x70, 0x01, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x4E, 0x00, 0x00, 0x08, 0x00, 0xD0, 0x00, 0x00, 0x12, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x00, 0x00, 0x80, 0x3F, 0x0A, 0x90, 0xA1, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x09,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x09, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x09,
0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F, 0x0A, 0x90, 0xA1, 0x00, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x34, 0x00, 0x00, 0x09, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x30, 0x00, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x70, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0x12, 0x20, 0x90, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x33, 0x00, 0x00, 0x09, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x80, 0x30, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x74, 0x00, 0x00, 0x01, 0x5F, 0x00, 0x00, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x12, 0xB0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03,
0x36, 0x00, 0x00, 0x04, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xB0, 0x11, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03,
0x0A, 0x70, 0x01, 0x00, 0x36, 0x00, 0x00, 0x06, 0x12, 0x20, 0x90, 0x00, 0x12, 0xB0, 0x11, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x74, 0x00, 0x00, 0x01, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x07,
0x5F, 0x00, 0x00, 0x03, 0x12, 0xB0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB0, 0x11, 0x00,
0x5F, 0x00, 0x00, 0x03, 0x12, 0xB0, 0x11, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB0, 0x11, 0x00, 0x01, 0x00, 0x00, 0x00,
0x5F, 0x00, 0x00, 0x03, 0x12, 0xB0, 0x11, 0x00, 0x02, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x07, 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00,
0x67, 0x00, 0x00, 0x04, 0x12, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB0, 0x11, 0x00,
0x14, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54,
0x33, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x0A, 0xB0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0xB0, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x07, 0x12, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0xB0, 0x11, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01,
0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x01, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 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, 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, 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, 0x00, 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, 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,
}; };

View File

@ -69,7 +69,8 @@
// //
// Name Index Mask Register SysValue Format Used // Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------ // -------------------- ----- ------ -------- -------- ------- ------
// no Output // XEVERTEXID 0 x 0 NONE float x
//
// Tessellation Domain # of control points // Tessellation Domain # of control points
// -------------------- -------------------- // -------------------- --------------------
// Triangle 3 // Triangle 3
@ -88,6 +89,8 @@ dcl_tessellator_output_primitive output_triangle_cw
dcl_globalFlags refactoringAllowed dcl_globalFlags refactoringAllowed
dcl_constantbuffer CB0[0:0][15], immediateIndexed, space=0 dcl_constantbuffer CB0[0:0][15], immediateIndexed, space=0
hs_control_point_phase hs_control_point_phase
dcl_output o0.x
mov o0.x, l(0)
ret ret
hs_fork_phase hs_fork_phase
dcl_hs_fork_phase_instance_count 3 dcl_hs_fork_phase_instance_count 3
@ -115,4 +118,4 @@ dcl_temps 1
min r0.x, vpc0.x, vpc1.x min r0.x, vpc0.x, vpc1.x
min o3.x, r0.x, vpc2.x min o3.x, r0.x, vpc2.x
ret ret
// Approximately 12 instruction slots used // Approximately 13 instruction slots used

View File

@ -61,8 +61,6 @@ struct XeHSControlPointOutput {
float index : XEVERTEXID; float index : XEVERTEXID;
}; };
struct XeHSAdaptiveControlPointOutput {};
struct XeVertexPostGS { struct XeVertexPostGS {
float4 interpolators[16] : TEXCOORD0; float4 interpolators[16] : TEXCOORD0;
float3 point_params : TEXCOORD16; float3 point_params : TEXCOORD16;

View File

@ -162,6 +162,8 @@ void DxbcShaderTranslator::Reset() {
system_constants_used_ = 0; system_constants_used_ = 0;
in_domain_location_used_ = 0;
in_primitive_id_used_ = false;
in_control_point_index_used_ = false; in_control_point_index_used_ = false;
system_temp_count_current_ = 0; system_temp_count_current_ = 0;
@ -459,11 +461,12 @@ void DxbcShaderTranslator::StartVertexOrDomainShader() {
StartVertexShader_LoadVertexIndex(); StartVertexShader_LoadVertexIndex();
break; break;
case Shader::HostVertexShaderType::kTriangleDomainConstant: case Shader::HostVertexShaderType::kTriangleDomainCPIndexed:
assert_true(register_count() >= 2); assert_true(register_count() >= 2);
if (register_count() >= 1) { if (register_count() >= 1) {
// Copy the domain location to r0.xyz. // Copy the domain location to r0.xyz.
// ZYX swizzle according to Call of Duty 3 and Viva Pinata. // ZYX swizzle according to Call of Duty 3 and Viva Pinata.
in_domain_location_used_ |= 0b0111;
DxbcOpMov(uses_register_dynamic_addressing() ? DxbcDest::X(0, 0, 0b0111) DxbcOpMov(uses_register_dynamic_addressing() ? DxbcDest::X(0, 0, 0b0111)
: DxbcDest::R(0, 0b0111), : DxbcDest::R(0, 0b0111),
DxbcSrc::VDomain(0b000110)); DxbcSrc::VDomain(0b000110));
@ -484,12 +487,13 @@ void DxbcShaderTranslator::StartVertexOrDomainShader() {
} }
break; break;
case Shader::HostVertexShaderType::kTriangleDomainAdaptive: case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed:
assert_true(register_count() >= 2); assert_true(register_count() >= 2);
if (register_count() >= 1) { if (register_count() >= 1) {
// Copy the domain location to r0.xyz. // Copy the domain location to r0.xyz.
// ZYX swizzle with r1.y == 0, according to the water shader in // ZYX swizzle with r1.y == 0, according to the water shader in
// Banjo-Kazooie: Nuts & Bolts. // Banjo-Kazooie: Nuts & Bolts.
in_domain_location_used_ |= 0b0111;
DxbcOpMov(uses_register_dynamic_addressing() ? DxbcDest::X(0, 0, 0b0111) DxbcOpMov(uses_register_dynamic_addressing() ? DxbcDest::X(0, 0, 0b0111)
: DxbcDest::R(0, 0b0111), : DxbcDest::R(0, 0b0111),
DxbcSrc::VDomain(0b000110)); DxbcSrc::VDomain(0b000110));
@ -497,6 +501,7 @@ void DxbcShaderTranslator::StartVertexOrDomainShader() {
// Copy the primitive index to r1.x as a float. // Copy the primitive index to r1.x as a float.
uint32_t primitive_id_temp = uint32_t primitive_id_temp =
uses_register_dynamic_addressing() ? PushSystemTemp() : 1; uses_register_dynamic_addressing() ? PushSystemTemp() : 1;
in_primitive_id_used_ = true;
DxbcOpUToF(DxbcDest::R(primitive_id_temp, 0b0001), DxbcSrc::VPrim()); DxbcOpUToF(DxbcDest::R(primitive_id_temp, 0b0001), DxbcSrc::VPrim());
if (uses_register_dynamic_addressing()) { if (uses_register_dynamic_addressing()) {
DxbcOpMov(DxbcDest::X(0, 1, 0b0001), DxbcOpMov(DxbcDest::X(0, 1, 0b0001),
@ -531,10 +536,11 @@ void DxbcShaderTranslator::StartVertexOrDomainShader() {
} }
break; break;
case Shader::HostVertexShaderType::kQuadDomainConstant: case Shader::HostVertexShaderType::kQuadDomainCPIndexed:
assert_true(register_count() >= 2); assert_true(register_count() >= 2);
if (register_count() >= 1) { if (register_count() >= 1) {
// Copy the domain location to r0.xy. // Copy the domain location to r0.xy.
in_domain_location_used_ |= 0b0011;
DxbcOpMov(uses_register_dynamic_addressing() ? DxbcDest::X(0, 0, 0b0011) DxbcOpMov(uses_register_dynamic_addressing() ? DxbcDest::X(0, 0, 0b0011)
: DxbcDest::R(0, 0b0011), : DxbcDest::R(0, 0b0011),
DxbcSrc::VDomain()); DxbcSrc::VDomain());
@ -566,17 +572,19 @@ void DxbcShaderTranslator::StartVertexOrDomainShader() {
} }
break; break;
case Shader::HostVertexShaderType::kQuadDomainAdaptive: case Shader::HostVertexShaderType::kQuadDomainPatchIndexed:
assert_true(register_count() >= 2); assert_true(register_count() >= 2);
if (register_count() >= 1) { if (register_count() >= 1) {
// Copy the domain location to r0.yz. // Copy the domain location to r0.yz.
// XY swizzle according to the ground shader in Viva Pinata. // XY swizzle according to the ground shader in Viva Pinata.
in_domain_location_used_ |= 0b0011;
DxbcOpMov(uses_register_dynamic_addressing() ? DxbcDest::X(0, 0, 0b0110) DxbcOpMov(uses_register_dynamic_addressing() ? DxbcDest::X(0, 0, 0b0110)
: DxbcDest::R(0, 0b0110), : DxbcDest::R(0, 0b0110),
DxbcSrc::VDomain(0b010000)); DxbcSrc::VDomain(0b010000));
// Copy the primitive index to r0.x as a float. // Copy the primitive index to r0.x as a float.
uint32_t primitive_id_temp = uint32_t primitive_id_temp =
uses_register_dynamic_addressing() ? PushSystemTemp() : 0; uses_register_dynamic_addressing() ? PushSystemTemp() : 0;
in_primitive_id_used_ = true;
DxbcOpUToF(DxbcDest::R(primitive_id_temp, 0b0001), DxbcSrc::VPrim()); DxbcOpUToF(DxbcDest::R(primitive_id_temp, 0b0001), DxbcSrc::VPrim());
if (uses_register_dynamic_addressing()) { if (uses_register_dynamic_addressing()) {
DxbcOpMov(DxbcDest::X(0, 0, 0b0001), DxbcOpMov(DxbcDest::X(0, 0, 0b0001),
@ -2931,15 +2939,12 @@ void DxbcShaderTranslator::WriteInputSignature() {
} }
semantic_offset += AppendString(shader_object_, "SV_VertexID"); semantic_offset += AppendString(shader_object_, "SV_VertexID");
} else if (IsDxbcDomainShader()) { } else if (IsDxbcDomainShader()) {
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 // Control point indices, byte-swapped, biased according to the base index
// and converted to float by the host vertex and hull shaders // and converted to float by the host vertex and hull shaders
// (XEVERTEXID). // (XEVERTEXID). Needed even for patch-indexed tessellation modes because
// hull and domain shaders have strict linkage requirements, all hull shader
// outputs must be declared in a domain shader, and the same hull shaders
// are used for control-point-indexed and patch-indexed tessellation modes.
size_t control_point_index_position = shader_object_.size(); size_t control_point_index_position = shader_object_.size();
shader_object_.resize(shader_object_.size() + kParameterDwords); shader_object_.resize(shader_object_.size() + kParameterDwords);
++parameter_count; ++parameter_count;
@ -2966,7 +2971,6 @@ void DxbcShaderTranslator::WriteInputSignature() {
control_point_index.semantic_name = semantic_offset; control_point_index.semantic_name = semantic_offset;
} }
semantic_offset += AppendString(shader_object_, "XEVERTEXID"); semantic_offset += AppendString(shader_object_, "XEVERTEXID");
}
} else if (IsDxbcPixelShader()) { } else if (IsDxbcPixelShader()) {
// Written dynamically, so assume it's always used if it can be written to // Written dynamically, so assume it's always used if it can be written to
// any interpolator register. // any interpolator register.
@ -3133,15 +3137,15 @@ void DxbcShaderTranslator::WritePatchConstantSignature() {
uint32_t tess_factor_inside_count = 0; uint32_t tess_factor_inside_count = 0;
DxbcName tess_factor_inside_system_value = DxbcName::kUndefined; DxbcName tess_factor_inside_system_value = DxbcName::kUndefined;
switch (host_vertex_shader_type()) { switch (host_vertex_shader_type()) {
case Shader::HostVertexShaderType::kTriangleDomainConstant: case Shader::HostVertexShaderType::kTriangleDomainCPIndexed:
case Shader::HostVertexShaderType::kTriangleDomainAdaptive: case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed:
tess_factor_edge_count = 3; tess_factor_edge_count = 3;
tess_factor_edge_system_value = DxbcName::kFinalTriEdgeTessFactor; tess_factor_edge_system_value = DxbcName::kFinalTriEdgeTessFactor;
tess_factor_inside_count = 1; tess_factor_inside_count = 1;
tess_factor_inside_system_value = DxbcName::kFinalTriInsideTessFactor; tess_factor_inside_system_value = DxbcName::kFinalTriInsideTessFactor;
break; break;
case Shader::HostVertexShaderType::kQuadDomainConstant: case Shader::HostVertexShaderType::kQuadDomainCPIndexed:
case Shader::HostVertexShaderType::kQuadDomainAdaptive: case Shader::HostVertexShaderType::kQuadDomainPatchIndexed:
tess_factor_edge_count = 4; tess_factor_edge_count = 4;
tess_factor_edge_system_value = DxbcName::kFinalQuadEdgeTessFactor; tess_factor_edge_system_value = DxbcName::kFinalQuadEdgeTessFactor;
tess_factor_inside_count = 2; tess_factor_inside_count = 2;
@ -3501,24 +3505,21 @@ void DxbcShaderTranslator::WriteShaderCode() {
// Inputs/outputs have 1D-indexed operands with a component mask and a // Inputs/outputs have 1D-indexed operands with a component mask and a
// register index. // register index.
uint32_t domain_location_mask = 0b0111;
if (IsDxbcDomainShader()) { if (IsDxbcDomainShader()) {
// Not using control point data since Xenos only has a vertex shader acting // Not using control point data since Xenos only has a vertex shader acting
// as both vertex shader and domain shader. // as both vertex shader and domain shader.
stat_.c_control_points = 3; stat_.c_control_points = 3;
stat_.tessellator_domain = DxbcTessellatorDomain::kTriangle; stat_.tessellator_domain = DxbcTessellatorDomain::kTriangle;
switch (host_vertex_shader_type()) { switch (host_vertex_shader_type()) {
case Shader::HostVertexShaderType::kTriangleDomainConstant: case Shader::HostVertexShaderType::kTriangleDomainCPIndexed:
case Shader::HostVertexShaderType::kTriangleDomainAdaptive: case Shader::HostVertexShaderType::kTriangleDomainPatchIndexed:
stat_.c_control_points = 3; stat_.c_control_points = 3;
stat_.tessellator_domain = DxbcTessellatorDomain::kTriangle; stat_.tessellator_domain = DxbcTessellatorDomain::kTriangle;
domain_location_mask = 0b0111;
break; break;
case Shader::HostVertexShaderType::kQuadDomainConstant: case Shader::HostVertexShaderType::kQuadDomainCPIndexed:
case Shader::HostVertexShaderType::kQuadDomainAdaptive: case Shader::HostVertexShaderType::kQuadDomainPatchIndexed:
stat_.c_control_points = 4; stat_.c_control_points = 4;
stat_.tessellator_domain = DxbcTessellatorDomain::kQuad; stat_.tessellator_domain = DxbcTessellatorDomain::kQuad;
domain_location_mask = 0b0011;
break; break;
default: default:
// TODO(Triang3l): Support line patches. // TODO(Triang3l): Support line patches.
@ -3705,26 +3706,41 @@ void DxbcShaderTranslator::WriteShaderCode() {
// Inputs and outputs. // Inputs and outputs.
if (IsDxbcVertexOrDomainShader()) { if (IsDxbcVertexOrDomainShader()) {
if (IsDxbcDomainShader()) { if (IsDxbcDomainShader()) {
// Domain location input (barycentric for triangles, UV for quads). if (in_domain_location_used_) {
// Domain location input.
shader_object_.push_back( shader_object_.push_back(
ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INPUT) | ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INPUT) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(2)); ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(2));
shader_object_.push_back(EncodeVectorMaskedOperand( shader_object_.push_back(
D3D11_SB_OPERAND_TYPE_INPUT_DOMAIN_POINT, domain_location_mask, 0)); EncodeVectorMaskedOperand(D3D11_SB_OPERAND_TYPE_INPUT_DOMAIN_POINT,
in_domain_location_used_, 0));
++stat_.dcl_count; ++stat_.dcl_count;
// Control point indices as float for discrete/continuous tessellation, or }
// primitive index for adaptive tessellation. if (in_primitive_id_used_) {
// Primitive (patch) 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;
}
if (in_control_point_index_used_) {
// Control point indices as float input.
uint32_t control_point_array_size; uint32_t control_point_array_size;
switch (host_vertex_shader_type()) { switch (host_vertex_shader_type()) {
case Shader::HostVertexShaderType::kTriangleDomainConstant: case Shader::HostVertexShaderType::kTriangleDomainCPIndexed:
control_point_array_size = 3; control_point_array_size = 3;
break; break;
case Shader::HostVertexShaderType::kQuadDomainConstant: case Shader::HostVertexShaderType::kQuadDomainCPIndexed:
control_point_array_size = 4; control_point_array_size = 4;
break; break;
default: default:
// TODO(Triang3l): Support line patches. // TODO(Triang3l): Support line patches.
// Adaptive. assert_unhandled_case(host_vertex_shader_type());
EmitTranslationError(
"Unsupported host vertex shader type in "
"StartVertexOrDomainShader");
control_point_array_size = 0; control_point_array_size = 0;
} }
if (control_point_array_size) { if (control_point_array_size) {
@ -3737,15 +3753,10 @@ void DxbcShaderTranslator::WriteShaderCode() {
shader_object_.push_back( shader_object_.push_back(
uint32_t(InOutRegister::kDSInControlPointIndex)); uint32_t(InOutRegister::kDSInControlPointIndex));
++stat_.dcl_count; ++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 { } else {
if (register_count()) {
// Unswapped vertex index input (only X component). // Unswapped vertex index input (only X component).
shader_object_.push_back( shader_object_.push_back(
ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INPUT_SGV) | ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INPUT_SGV) |
@ -3756,6 +3767,7 @@ void DxbcShaderTranslator::WriteShaderCode() {
shader_object_.push_back(ENCODE_D3D10_SB_NAME(D3D10_SB_NAME_VERTEX_ID)); shader_object_.push_back(ENCODE_D3D10_SB_NAME(D3D10_SB_NAME_VERTEX_ID));
++stat_.dcl_count; ++stat_.dcl_count;
} }
}
// Interpolator output. // Interpolator output.
for (uint32_t i = 0; i < kInterpolatorCount; ++i) { for (uint32_t i = 0; i < kInterpolatorCount; ++i) {
shader_object_.push_back( shader_object_.push_back(
@ -3832,6 +3844,7 @@ void DxbcShaderTranslator::WriteShaderCode() {
i); i);
++stat_.dcl_count; ++stat_.dcl_count;
} }
if (register_count()) {
// Point parameters input (only coordinates, not size, needed). // Point parameters input (only coordinates, not size, needed).
shader_object_.push_back( shader_object_.push_back(
ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INPUT_PS) | ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INPUT_PS) |
@ -3843,6 +3856,7 @@ void DxbcShaderTranslator::WriteShaderCode() {
shader_object_.push_back(uint32_t(InOutRegister::kPSInPointParameters)); shader_object_.push_back(uint32_t(InOutRegister::kPSInPointParameters));
++stat_.dcl_count; ++stat_.dcl_count;
} }
}
if (edram_rov_used_) { if (edram_rov_used_) {
// Z and W in clip space, for per-sample depth. // Z and W in clip space, for per-sample depth.
shader_object_.push_back( shader_object_.push_back(
@ -3855,6 +3869,7 @@ void DxbcShaderTranslator::WriteShaderCode() {
shader_object_.push_back(uint32_t(InOutRegister::kPSInClipSpaceZW)); shader_object_.push_back(uint32_t(InOutRegister::kPSInClipSpaceZW));
++stat_.dcl_count; ++stat_.dcl_count;
} }
if (edram_rov_used_ || (!is_depth_only_pixel_shader_ && register_count())) {
// Position input (only XY needed for ps_param_gen, and the ROV depth code // Position input (only XY needed for ps_param_gen, and the ROV depth code
// calculates the depth from clip space Z and W). // calculates the depth from clip space Z and W).
shader_object_.push_back( shader_object_.push_back(
@ -3867,7 +3882,6 @@ void DxbcShaderTranslator::WriteShaderCode() {
shader_object_.push_back(uint32_t(InOutRegister::kPSInPosition)); shader_object_.push_back(uint32_t(InOutRegister::kPSInPosition));
shader_object_.push_back(ENCODE_D3D10_SB_NAME(D3D10_SB_NAME_POSITION)); shader_object_.push_back(ENCODE_D3D10_SB_NAME(D3D10_SB_NAME_POSITION));
++stat_.dcl_count; ++stat_.dcl_count;
if (edram_rov_used_ || !is_depth_only_pixel_shader_) {
// Is front face. // Is front face.
shader_object_.push_back( shader_object_.push_back(
ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INPUT_PS_SGV) | ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_DCL_INPUT_PS_SGV) |

View File

@ -2357,6 +2357,10 @@ class DxbcShaderTranslator : public ShaderTranslator {
// the remaining ones can be marked as unused in RDEF. // the remaining ones can be marked as unused in RDEF.
uint64_t system_constants_used_; uint64_t system_constants_used_;
// Mask of domain location actually used in the domain shader.
uint32_t in_domain_location_used_;
// Whether the primitive ID has been used in the domain shader.
bool in_primitive_id_used_;
// Whether InOutRegister::kDSInControlPointIndex has been used in the shader. // Whether InOutRegister::kDSInControlPointIndex has been used in the shader.
bool in_control_point_index_used_; bool in_control_point_index_used_;

View File

@ -646,12 +646,12 @@ class Shader {
// packed. This is : uint32_t for simplicity of packing in bit fields. // packed. This is : uint32_t for simplicity of packing in bit fields.
enum class HostVertexShaderType : uint32_t { enum class HostVertexShaderType : uint32_t {
kVertex, kVertex,
kLineDomainConstant, kLineDomainCPIndexed,
kLineDomainAdaptive, kLineDomainPatchIndexed,
kTriangleDomainConstant, kTriangleDomainCPIndexed,
kTriangleDomainAdaptive, kTriangleDomainPatchIndexed,
kQuadDomainConstant, kQuadDomainCPIndexed,
kQuadDomainAdaptive, kQuadDomainPatchIndexed,
}; };
struct Error { struct Error {

View File

@ -38,8 +38,8 @@ DEFINE_string(shader_output_type, "ucode",
DEFINE_string( DEFINE_string(
vertex_shader_output_type, "", vertex_shader_output_type, "",
"Type of the host interface to produce the vertex or domain shader for: " "Type of the host interface to produce the vertex or domain shader for: "
"[vertex or unspecified, linedomain, linedomainadaptive, triangledomain, " "[vertex or unspecified, linedomaincp, linedomainpatch, triangledomaincp, "
"triangledomainadaptive, quaddomain, quaddomainadaptive].", "triangledomainpatch, quaddomaincp, quaddomainpatch].",
"GPU"); "GPU");
DEFINE_bool(shader_output_dxbc_rov, false, DEFINE_bool(shader_output_dxbc_rov, false,
"Output ROV-based output-merger code in DXBC pixel shaders.", "Output ROV-based output-merger code in DXBC pixel shaders.",
@ -117,24 +117,24 @@ int shader_compiler_main(const std::vector<std::string>& args) {
Shader::HostVertexShaderType host_vertex_shader_type = Shader::HostVertexShaderType host_vertex_shader_type =
Shader::HostVertexShaderType::kVertex; Shader::HostVertexShaderType::kVertex;
if (shader_type == ShaderType::kVertex) { if (shader_type == ShaderType::kVertex) {
if (cvars::vertex_shader_output_type == "linedomain") { if (cvars::vertex_shader_output_type == "linedomaincp") {
host_vertex_shader_type = host_vertex_shader_type =
Shader::HostVertexShaderType::kLineDomainConstant; Shader::HostVertexShaderType::kLineDomainCPIndexed;
} else if (cvars::vertex_shader_output_type == "linedomainadaptive") { } else if (cvars::vertex_shader_output_type == "linedomainpatch") {
host_vertex_shader_type = host_vertex_shader_type =
Shader::HostVertexShaderType::kLineDomainAdaptive; Shader::HostVertexShaderType::kLineDomainPatchIndexed;
} else if (cvars::vertex_shader_output_type == "triangledomain") { } else if (cvars::vertex_shader_output_type == "triangledomaincp") {
host_vertex_shader_type = host_vertex_shader_type =
Shader::HostVertexShaderType::kTriangleDomainConstant; Shader::HostVertexShaderType::kTriangleDomainCPIndexed;
} else if (cvars::vertex_shader_output_type == "triangledomainadaptive") { } else if (cvars::vertex_shader_output_type == "triangledomainpatch") {
host_vertex_shader_type = host_vertex_shader_type =
Shader::HostVertexShaderType::kTriangleDomainAdaptive; Shader::HostVertexShaderType::kTriangleDomainPatchIndexed;
} else if (cvars::vertex_shader_output_type == "quaddomain") { } else if (cvars::vertex_shader_output_type == "quaddomaincp") {
host_vertex_shader_type = host_vertex_shader_type =
Shader::HostVertexShaderType::kQuadDomainConstant; Shader::HostVertexShaderType::kQuadDomainCPIndexed;
} else if (cvars::vertex_shader_output_type == "quaddomainadaptive") { } else if (cvars::vertex_shader_output_type == "quaddomainpatch") {
host_vertex_shader_type = host_vertex_shader_type =
Shader::HostVertexShaderType::kQuadDomainAdaptive; Shader::HostVertexShaderType::kQuadDomainPatchIndexed;
} }
} }

View File

@ -52,10 +52,9 @@ enum class PrimitiveType : uint32_t {
k2DLineStrip = 0x15, k2DLineStrip = 0x15,
k2DTriStrip = 0x16, k2DTriStrip = 0x16,
// Tessellation patches (D3DTPT) when VGT_OUTPUT_PATH_CNTL::path_select is // Tessellation patches when VGT_OUTPUT_PATH_CNTL::path_select is
// xenos::VGTOutputPath::kTessellationEnable. Seen being used with adaptive // xenos::VGTOutputPath::kTessellationEnable. The vertex shader receives patch
// tessellation in Banjo-Kazooie: Nuts & Bolts, Halo 3 and Viva Pinata; // index rather than control point indices.
// discrete/continuous uses kTriangleList in Call of Duty 3 and Viva Pinata.
kLinePatch = 0x10, kLinePatch = 0x10,
kTrianglePatch = 0x11, kTrianglePatch = 0x11,
kQuadPatch = 0x12, kQuadPatch = 0x12,

View File

@ -87,12 +87,12 @@
this.vertexShaderComboBox.FormattingEnabled = true; this.vertexShaderComboBox.FormattingEnabled = true;
this.vertexShaderComboBox.Items.AddRange(new object[] { this.vertexShaderComboBox.Items.AddRange(new object[] {
"VS to VS", "VS to VS",
"VS to isoline DS with constant factors", "VS to line DS with control point indices",
"VS to isoline DS with adaptive factors", "VS to line DS with patch index",
"VS to triangle DS with constant factors", "VS to triangle DS with control point indices",
"VS to triangle DS with adaptive factors", "VS to triangle DS with patch index",
"VS to quad DS with constant factors", "VS to quad DS with control point indices",
"VS to quad DS with adaptive factors"}); "VS to quad DS with patch index"});
this.vertexShaderComboBox.Location = new System.Drawing.Point(1224, 24); this.vertexShaderComboBox.Location = new System.Drawing.Point(1224, 24);
this.vertexShaderComboBox.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); this.vertexShaderComboBox.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.vertexShaderComboBox.Name = "vertexShaderComboBox"; this.vertexShaderComboBox.Name = "vertexShaderComboBox";

View File

@ -242,22 +242,22 @@ namespace shader_playground {
string vertexShaderType = "vertex"; string vertexShaderType = "vertex";
switch (vertexShaderComboBox.SelectedIndex) { switch (vertexShaderComboBox.SelectedIndex) {
case 1: case 1:
vertexShaderType = "linedomain"; vertexShaderType = "linedomaincp";
break; break;
case 2: case 2:
vertexShaderType = "linedomainadaptive"; vertexShaderType = "linedomainpatch";
break; break;
case 3: case 3:
vertexShaderType = "triangledomain"; vertexShaderType = "triangledomaincp";
break; break;
case 4: case 4:
vertexShaderType = "triangledomainadaptive"; vertexShaderType = "triangledomainpatch";
break; break;
case 5: case 5:
vertexShaderType = "quaddomain"; vertexShaderType = "quaddomaincp";
break; break;
case 6: case 6:
vertexShaderType = "quaddomainadaptive"; vertexShaderType = "quaddomainpatch";
break; break;
} }