diff --git a/tests/d3d12.c b/tests/d3d12.c index 95e0d526..63a745d1 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -52284,6 +52284,385 @@ static void test_view_min_lod(void) destroy_test_context(&context); } +static void test_sv_barycentric(void) +{ + D3D12_FEATURE_DATA_D3D12_OPTIONS3 features3; + D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc; + float base_x, base_y, rot, off_x, off_y; + D3D12_INPUT_LAYOUT_DESC input_layout; + struct test_context_desc desc; + D3D12_VERTEX_BUFFER_VIEW vbv; + unsigned int i, x, y, offset; + struct test_context context; + D3D12_INDEX_BUFFER_VIEW ibv; + struct resource_readback rb; + unsigned int coverage_count; + float vbo_data[16 * 4 * 4]; + ID3D12PipelineState *pso; + UINT ibo_data[5 * 4 * 4]; + ID3D12Resource *vbo; + ID3D12Resource *ibo; + uint32_t value; + HRESULT hr; + + static const BYTE vs_code[] = + { +#if 0 + struct VOut + { + nointerpolation float attr0 : ATTR0; + float attr1 : ATTR1; + noperspective float attr2 : ATTR2; + float4 pos : SV_Position; + }; + VOut main(float3 pos : POSITION, float attr : ATTR) + { + VOut vout; + vout.pos = float4(pos.xy * pos.z, 0.0, pos.z); + vout.attr0 = attr; + vout.attr1 = attr; + vout.attr2 = attr; + return vout; + } +#endif + 0x44, 0x58, 0x42, 0x43, 0x60, 0xf5, 0xbc, 0x92, 0x6a, 0x42, 0x27, 0xd2, 0x68, 0x31, 0x04, 0x6c, 0xf8, 0x86, 0x12, 0xd9, 0x01, 0x00, 0x00, 0x00, 0x75, 0x07, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x34, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x4d, 0x01, 0x00, 0x00, 0x39, 0x02, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, 0x56, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x41, 0x54, 0x54, + 0x52, 0x00, 0x4f, 0x53, 0x47, 0x31, 0xa3, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x54, 0x54, 0x52, 0x00, 0x41, 0x54, 0x54, 0x52, 0x00, 0x41, 0x54, 0x54, 0x52, + 0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x50, 0x53, 0x56, 0x30, 0xe4, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x41, 0x54, 0x54, 0x52, 0x00, 0x41, 0x54, 0x54, 0x52, 0x00, 0x41, 0x54, 0x54, 0x52, 0x00, 0x41, 0x54, + 0x54, 0x52, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x43, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x41, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x41, 0x00, 0x03, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x41, 0x00, 0x03, 0x02, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x01, 0x02, 0x41, 0x00, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, + 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x34, 0x05, 0x00, + 0x00, 0x61, 0x00, 0x01, 0x00, 0x4d, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x01, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x05, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, + 0x00, 0x44, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, + 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x42, 0x88, 0x48, 0x90, 0x14, + 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x21, 0x46, 0x06, 0x51, 0x18, 0x00, + 0x00, 0x06, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x01, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x32, 0x22, 0x08, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, + 0x84, 0x04, 0x13, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c, 0x0b, 0x84, 0x84, 0x4c, 0x10, 0x30, 0x23, 0x00, 0x25, 0x00, 0x8a, 0x19, 0x80, 0x39, 0x02, 0x30, 0x98, 0x23, 0x40, + 0x8a, 0x31, 0x44, 0x54, 0x44, 0x56, 0x0c, 0x20, 0xa2, 0x1a, 0xc2, 0x81, 0x80, 0x3c, 0x20, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, + 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, + 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc8, 0x02, 0x01, 0x0d, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0xa2, 0x12, 0x28, 0x84, 0x62, 0x18, 0x01, 0x28, + 0x82, 0x32, 0xa0, 0x2a, 0x89, 0x11, 0x80, 0x32, 0x28, 0x81, 0x22, 0x28, 0x04, 0xda, 0xb1, 0x8e, 0x02, 0x02, 0x41, 0x02, 0x04, 0x11, 0x10, 0x64, 0x03, 0x20, 0x46, 0x00, 0x00, 0x79, 0x18, 0x00, + 0x00, 0x58, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0xc4, 0x88, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x0c, 0x44, 0x06, 0x26, 0x26, 0xc7, 0x05, 0xa6, 0xc6, 0x05, 0x06, 0x66, 0x43, + 0x10, 0x4c, 0x10, 0x88, 0x61, 0x83, 0x30, 0x0c, 0x13, 0x04, 0x82, 0xd8, 0x20, 0x0c, 0x05, 0x05, 0xbb, 0xb9, 0x09, 0x02, 0x51, 0x6c, 0x18, 0x0e, 0x64, 0x98, 0x20, 0x08, 0xc0, 0x04, 0x81, 0x30, + 0x36, 0x00, 0x1b, 0x86, 0x85, 0x61, 0x36, 0x04, 0xcd, 0x86, 0x61, 0x50, 0x9c, 0x09, 0xc2, 0xf2, 0x6c, 0x08, 0x20, 0x12, 0x6d, 0x61, 0x69, 0x6e, 0x44, 0xa0, 0x9e, 0xa6, 0x92, 0xa8, 0x92, 0x9e, + 0x9c, 0x26, 0x08, 0x45, 0x32, 0x41, 0x28, 0x94, 0x0d, 0xc1, 0x32, 0x41, 0x28, 0x96, 0x0d, 0xcb, 0x32, 0x51, 0x95, 0x55, 0x0d, 0xd7, 0x52, 0x01, 0x24, 0x82, 0xa8, 0xa8, 0xa4, 0x26, 0x08, 0x05, + 0xb3, 0x61, 0x19, 0x32, 0xaa, 0xb2, 0xaa, 0x41, 0x1b, 0x2a, 0x60, 0x83, 0x80, 0x6d, 0x1b, 0x96, 0x25, 0xa3, 0x2a, 0x4b, 0x1b, 0xb4, 0xa5, 0x02, 0x36, 0x04, 0xc3, 0x04, 0xa1, 0x68, 0x36, 0x2c, + 0x43, 0x46, 0x55, 0xde, 0x37, 0x68, 0x43, 0x05, 0x4c, 0x10, 0x88, 0x63, 0x43, 0x10, 0x06, 0x13, 0x84, 0xc2, 0xd9, 0xb0, 0x84, 0x41, 0x46, 0x55, 0x62, 0x30, 0x06, 0x83, 0x16, 0x06, 0x15, 0x30, + 0x41, 0x20, 0x10, 0x2e, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1b, 0x96, 0x32, 0x30, 0x03, 0xea, 0xb2, 0xc6, 0x60, 0x18, 0x83, 0x32, 0xa8, 0x80, 0x0d, 0x44, 0x07, + 0x06, 0x64, 0x70, 0x06, 0x1b, 0x06, 0x0e, 0x0d, 0x80, 0x0d, 0x85, 0x22, 0xa5, 0x01, 0x00, 0x54, 0x61, 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, + 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, 0xde, 0xdc, 0xa6, 0x04, 0x43, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, 0xbb, 0x32, 0xb9, 0x29, 0x41, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, 0x8c, 0xac, + 0x4c, 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0x54, 0x22, 0xc3, 0x73, 0xa1, 0xcb, 0x83, 0x2b, 0x0b, 0x72, 0x73, 0x7b, 0xa3, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0x9b, 0x9b, 0x12, 0x38, 0x75, + 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92, 0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, 0xa6, 0x04, 0x50, 0x1d, 0x32, 0x3c, 0x97, 0x32, 0x37, 0x3a, 0xb9, 0x3c, 0xa8, 0xb7, 0x34, 0x37, 0xba, 0xb9, + 0x29, 0x41, 0x1a, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, + 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, + 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, + 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, + 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0x03, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x16, 0x30, 0x0d, + 0x97, 0xef, 0x3c, 0xfe, 0xe2, 0x00, 0x83, 0xd8, 0x3c, 0xd4, 0xe4, 0x17, 0xb7, 0x6d, 0x02, 0xd5, 0x70, 0xf9, 0xce, 0xe3, 0x4b, 0x93, 0x13, 0x11, 0x28, 0x35, 0x3d, 0xd4, 0xe4, 0x17, 0xb7, 0x6d, + 0x00, 0x04, 0x03, 0x20, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x44, 0x33, 0x00, + 0xa5, 0x40, 0x33, 0x02, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x48, 0x0f, 0xd4, 0x24, 0xc3, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x18, 0x13, 0xe4, 0x38, 0x0a, 0x31, 0x62, 0x90, 0x00, + 0x20, 0x08, 0x06, 0x06, 0x15, 0x3d, 0x4f, 0x52, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0x51, 0x49, 0x10, 0x94, 0x18, 0x16, 0x0c, 0xf2, 0x31, 0x61, 0x90, 0xcf, 0x88, 0x41, 0x02, 0x80, 0x20, + 0x18, 0x20, 0x17, 0x12, 0x4d, 0x8f, 0x30, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xc8, 0x85, 0x44, 0x53, 0x13, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0x72, 0x21, 0xd1, 0xc4, 0x1c, 0x23, 0x06, + 0x09, 0x00, 0x82, 0x60, 0x80, 0x5c, 0x48, 0x34, 0x39, 0xc3, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x17, 0x32, 0x4d, 0x8f, 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xc8, 0x85, 0x58, 0xd3, + 0x63, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0x72, 0x21, 0xd2, 0xf4, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + static const BYTE ps_code[] = + { +#if 0 + struct VOut + { + nointerpolation float attr0 : ATTR0; + float attr1 : ATTR1; + noperspective float attr2 : ATTR2; + float4 pos : SV_Position; + }; + + float4 main(VOut vout, + float3 bary_perspective : SV_Barycentrics, + noperspective float3 bary_noperspective : SV_Barycentrics1) : SV_Target + { + float reference_perspective = vout.attr1; + float reference_noperspective = vout.attr2; + + float result_perspective = + GetAttributeAtVertex(vout.attr0, 0) * bary_perspective.x + + GetAttributeAtVertex(vout.attr0, 1) * bary_perspective.y + + GetAttributeAtVertex(vout.attr0, 2) * bary_perspective.z; + + float result_noperspective = + GetAttributeAtVertex(vout.attr0, 0) * bary_noperspective.x + + GetAttributeAtVertex(vout.attr0, 1) * bary_noperspective.y + + GetAttributeAtVertex(vout.attr0, 2) * bary_noperspective.z; + + float4 res; + // Results should be approximately equal. + res.x = abs(reference_perspective - result_perspective) * 20.0; + res.y = abs(reference_noperspective - result_noperspective) * 20.0; + + // Test that we can also read the provoking vertex. + res.z = vout.attr0 / 255.0; + + // Validate barycentrics approximately sum up as expected. Result should be 0x80 when rounded. + res.w = (64.0 / 255.0) * (dot(bary_perspective, 1.0.xxx) + dot(bary_noperspective, 1.0.xxx)); + + return res; + } +#endif + 0x44, 0x58, 0x42, 0x43, 0xe7, 0x9e, 0xc5, 0x10, 0x73, 0x9c, 0x3c, 0x3b, 0xf5, 0xba, 0xc7, 0x99, 0xe7, 0x9b, 0x0e, 0x3c, 0x01, 0x00, 0x00, 0x00, 0x45, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x34, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0x79, 0x01, 0x00, 0x00, 0x85, 0x02, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, 0xf3, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd2, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x54, 0x54, 0x52, 0x00, 0x41, 0x54, 0x54, 0x52, 0x00, 0x41, 0x54, + 0x54, 0x52, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x53, 0x56, 0x5f, 0x42, 0x61, 0x72, 0x79, 0x63, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x63, 0x73, 0x00, 0x4f, + 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0x50, 0x53, 0x56, 0x30, 0x04, 0x01, 0x00, + 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x06, 0x01, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x41, 0x54, 0x54, 0x52, 0x00, 0x41, 0x54, 0x54, 0x52, 0x00, 0x41, 0x54, 0x54, 0x52, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, + 0x00, 0x03, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x41, 0x00, 0x03, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x02, 0x41, + 0x00, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, + 0x1c, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x1c, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, + 0x10, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0xb8, 0x06, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0xae, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x01, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0xa0, 0x06, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xa5, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, + 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, + 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, + 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, + 0xff, 0xff, 0xff, 0x03, 0x20, 0x01, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, + 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x48, 0x23, + 0x00, 0x25, 0x00, 0x14, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x20, 0x84, 0x14, 0x42, 0xa6, 0x18, 0x80, 0x10, 0x52, 0x06, 0xa1, 0x62, 0x0c, 0x42, 0x48, 0x29, 0xa4, 0xca, + 0x30, 0xc8, 0x20, 0x56, 0x90, 0x41, 0xc6, 0x18, 0x63, 0x0c, 0x72, 0x03, 0x01, 0x29, 0x41, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, + 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, + 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x18, 0xf2, 0x28, 0x40, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x61, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0xe3, 0x00, + 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, + 0x22, 0x25, 0x50, 0x08, 0xc5, 0x30, 0x02, 0x50, 0x04, 0x65, 0x50, 0x03, 0xa5, 0x40, 0xa5, 0x24, 0x46, 0x00, 0x4a, 0xa0, 0x08, 0x0a, 0xa1, 0x0c, 0x0a, 0xa7, 0x06, 0x0a, 0x84, 0xe2, 0x58, 0x12, + 0x44, 0x10, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, + 0xc4, 0x88, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x0c, 0x44, 0x06, 0x26, 0x26, 0xc7, 0x05, 0xa6, 0xc6, 0x05, 0x06, 0x66, 0x43, 0x10, 0x4c, 0x10, 0x08, 0x63, 0x83, 0x30, 0x0c, 0x13, 0x04, 0xe2, 0xd8, + 0x20, 0x0c, 0x05, 0x05, 0xb8, 0xb9, 0x09, 0x02, 0x81, 0x6c, 0x18, 0x0e, 0x64, 0x98, 0x20, 0x08, 0xc0, 0x04, 0x81, 0x48, 0x36, 0x00, 0x1b, 0x86, 0x85, 0x61, 0x36, 0x04, 0xcd, 0x86, 0x61, 0x50, + 0x9c, 0x09, 0x42, 0x74, 0x6d, 0x08, 0x20, 0x12, 0x6d, 0x61, 0x69, 0x6e, 0x24, 0x82, 0xa8, 0xa8, 0xa4, 0x26, 0x08, 0x85, 0x33, 0x41, 0x28, 0x9e, 0x0d, 0xc1, 0x32, 0x41, 0x28, 0xa0, 0x0d, 0xcb, + 0x32, 0x51, 0x95, 0x75, 0x0d, 0xd7, 0x52, 0x01, 0x1b, 0x82, 0x61, 0x82, 0x50, 0x44, 0x1b, 0x96, 0x61, 0xa2, 0xaa, 0x4c, 0x1b, 0xae, 0xa1, 0x02, 0x26, 0x08, 0x84, 0xb2, 0x21, 0xe0, 0x26, 0x08, + 0x85, 0xb4, 0x61, 0xe1, 0x26, 0xaa, 0xea, 0xbc, 0xe1, 0xe2, 0x2a, 0x60, 0x82, 0x40, 0x2c, 0x5c, 0xa6, 0xac, 0xbe, 0xa0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x26, 0x08, 0xc5, 0xb4, 0x61, + 0x01, 0x83, 0x30, 0xa0, 0xc4, 0xc0, 0xf2, 0x06, 0x0f, 0x0c, 0x2a, 0x80, 0xcf, 0x94, 0xd5, 0x97, 0x50, 0x98, 0x5c, 0xde, 0x58, 0x99, 0x1b, 0x9d, 0x5c, 0xda, 0xd8, 0xdc, 0x04, 0xa1, 0xa0, 0x26, + 0x08, 0x04, 0x33, 0x41, 0x28, 0xaa, 0x0d, 0x4b, 0x41, 0x06, 0x54, 0x19, 0x58, 0xda, 0x20, 0x06, 0x66, 0x70, 0x06, 0xc0, 0x04, 0x81, 0x68, 0x36, 0x2c, 0x69, 0x40, 0x06, 0x54, 0x19, 0x64, 0xde, + 0x20, 0x06, 0x66, 0x70, 0x06, 0xc0, 0x06, 0x03, 0xdb, 0xbe, 0x31, 0x40, 0x03, 0x35, 0x60, 0x32, 0x65, 0xf5, 0x45, 0x15, 0x26, 0x77, 0x56, 0x46, 0x37, 0x41, 0x28, 0xac, 0x0d, 0xcb, 0xc2, 0x06, + 0x54, 0x1b, 0x58, 0xd5, 0xe0, 0x2d, 0x15, 0xb0, 0x21, 0x70, 0x83, 0x0d, 0xc3, 0x1a, 0xbc, 0x01, 0xb0, 0xa1, 0x50, 0x24, 0x38, 0x00, 0x80, 0x2a, 0x6c, 0x6c, 0x76, 0x6d, 0x2e, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x53, 0x82, 0xa0, 0x0a, 0x19, 0x9e, 0x8b, 0x5d, 0x99, 0xdc, 0x5c, 0xda, 0x9b, 0xdb, 0x94, 0x60, 0x68, 0x42, 0x86, 0xe7, 0x62, 0x17, 0xc6, 0x66, 0x57, 0x26, 0x37, 0x25, 0x28, 0xea, + 0x90, 0xe1, 0xb9, 0xcc, 0xa1, 0x85, 0x91, 0x95, 0xc9, 0x35, 0xbd, 0x91, 0x95, 0xb1, 0x4d, 0x09, 0x90, 0x4a, 0x64, 0x78, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x02, 0xa7, 0x0e, 0x19, 0x9e, 0x8b, 0x5d, 0x5a, 0xd9, 0x5d, 0x12, 0xd9, 0x14, 0x5d, 0x18, 0x5d, 0xd9, 0x94, 0x00, 0xaa, 0x43, 0x86, 0xe7, 0x52, 0xe6, 0x46, 0x27, + 0x97, 0x07, 0xf5, 0x96, 0xe6, 0x46, 0x37, 0x37, 0x25, 0x80, 0x03, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, + 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, + 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, + 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, + 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, + 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0x03, 0x00, 0x00, 0x71, 0x20, 0x00, + 0x00, 0x17, 0x00, 0x00, 0x00, 0x36, 0xb0, 0x0d, 0x97, 0xef, 0x3c, 0x3e, 0x30, 0x4d, 0x11, 0x12, 0x50, 0x13, 0xa1, 0x4d, 0x2f, 0x11, 0x4d, 0xc4, 0xe5, 0x17, 0xb7, 0x6d, 0x05, 0xce, 0x70, 0xf9, + 0xce, 0xe3, 0x0f, 0xce, 0x74, 0xfb, 0xc5, 0x6d, 0x5b, 0xc0, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62, 0xf3, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, + 0x4d, 0x4e, 0x44, 0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x11, 0x3c, 0xc3, 0xe5, 0x3b, 0x8f, 0x4f, 0x35, 0x40, 0x84, 0xf9, 0xc5, 0x6d, 0x1b, 0x00, 0xc1, 0x00, 0x48, 0x03, 0x00, 0x00, + 0x00, 0x61, 0x20, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x44, 0xca, 0xad, 0x24, 0x05, 0x66, 0x00, 0x68, 0x8c, 0x11, 0x84, + 0x24, 0x18, 0xa2, 0xdf, 0x18, 0x41, 0x48, 0x82, 0x21, 0xde, 0x8d, 0x11, 0x80, 0x20, 0x08, 0xea, 0x60, 0x30, 0x46, 0x00, 0x82, 0x20, 0x88, 0x7f, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, + 0x78, 0x98, 0x64, 0x41, 0xc5, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x18, 0x5f, 0x36, 0x5d, 0x90, 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x06, 0x18, 0x68, 0x14, 0x06, 0x1d, 0x23, 0x06, 0x09, + 0x00, 0x82, 0x60, 0x60, 0x84, 0xc1, 0xb6, 0x65, 0x13, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x86, 0x18, 0x70, 0x9c, 0x36, 0x25, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x8c, 0x41, 0xd7, + 0x6d, 0x93, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x06, 0x19, 0x78, 0x1b, 0x67, 0x2d, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x94, 0xc1, 0x07, 0x06, 0xdd, 0xc5, 0x8c, 0x18, 0x24, 0x00, + 0x08, 0x82, 0x81, 0x61, 0x06, 0x60, 0xe0, 0x79, 0x58, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x4a, 0x19, 0x3c, 0xdf, 0x97, 0x65, 0x16, 0x1c, 0xf2, 0x19, 0x31, 0x48, 0x00, 0x10, 0x04, 0x03, + 0xe5, 0x0c, 0xa2, 0x30, 0x08, 0x83, 0x4d, 0xb3, 0x00, 0x91, 0xcf, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x28, 0x69, 0x30, 0x8d, 0xc1, 0x18, 0x74, 0x9b, 0x05, 0x89, 0x7c, 0xcc, 0x78, 0xe4, 0x63, + 0xc5, 0x23, 0x1f, 0x23, 0x1e, 0xf9, 0xd8, 0x82, 0xc4, 0xc7, 0x82, 0x23, 0x3e, 0x16, 0x18, 0xf1, 0x19, 0x31, 0x30, 0x00, 0x10, 0x04, 0x03, 0x06, 0x0e, 0xd8, 0x20, 0xb0, 0x00, 0x93, 0x8f, 0x45, + 0x48, 0x7c, 0x2c, 0x40, 0xe2, 0x63, 0x01, 0x12, 0x9f, 0x11, 0x03, 0x03, 0x00, 0x41, 0x30, 0x60, 0xea, 0x20, 0x0e, 0x02, 0x0b, 0x3a, 0xf9, 0x18, 0xf5, 0xc9, 0x67, 0xc4, 0x60, 0x01, 0x40, 0x10, + 0x0c, 0x9c, 0x3b, 0x20, 0x03, 0x2d, 0xc3, 0x3c, 0xcf, 0x1b, 0x31, 0x58, 0x00, 0x10, 0x04, 0x03, 0x07, 0x0f, 0xca, 0xc0, 0xeb, 0xb8, 0xef, 0xfb, 0x2c, 0x10, 0xe0, 0x63, 0x01, 0x19, 0xc8, 0x67, + 0xc4, 0x20, 0x01, 0x40, 0x10, 0x0c, 0x10, 0x3f, 0x98, 0x83, 0x3b, 0xb8, 0x83, 0x38, 0x58, 0x46, 0x0c, 0x12, 0x00, 0x04, 0xc1, 0x00, 0xf1, 0x83, 0x39, 0xb8, 0x83, 0x3b, 0x80, 0x03, 0x63, 0xc4, + 0x20, 0x01, 0x40, 0x10, 0x0c, 0x10, 0x3f, 0x98, 0x83, 0x3b, 0xb8, 0x83, 0x37, 0x28, 0x46, 0x0c, 0x12, 0x00, 0x04, 0xc1, 0x00, 0xf1, 0x83, 0x39, 0xb8, 0x83, 0x3b, 0x68, 0x83, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, + }; + + static const struct D3D12_SHADER_BYTECODE vs = { vs_code, sizeof(vs_code) }; + static const struct D3D12_SHADER_BYTECODE ps = { ps_code, sizeof(ps_code) }; + static const D3D12_INPUT_ELEMENT_DESC input_elems[2] = { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + { "ATTR", 0, DXGI_FORMAT_R32_FLOAT, 0, 12, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, + }; + +#define BARY_RES 128 + + static const D3D12_VIEWPORT vp = { 0, 0, BARY_RES, BARY_RES, 0, 1 }; + static const float white[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; + static const D3D12_RECT sci = { 0, 0, BARY_RES, BARY_RES }; + static const uint8_t provoking_lut[] = { + 192, 212, 224, 244, + 128, 144, 160, 176, + 68, 80, 100, 112, + 4, 20, 36, 52, + }; + static const float quad_lut[4][2] = { + { -0.3f, -0.3f }, + { +0.3f, -0.3f }, + { -0.3f, +0.3f }, + { +0.3f, +0.3f }, + }; + + for (i = 0; i < 16; i++) + { + for (x = 0; x < 4; x++) + ibo_data[5 * i + x] = 4 * i + x; + ibo_data[5 * i + 4] = ~0u; + } + + for (y = 0; y < 4; y++) + { + for (x = 0; x < 4; x++) + { + offset = 16 * (4 * y + x); + base_x = -0.75f + 0.5f * (float)x; + base_y = -0.75f + 0.5f * (float)y; + + /* Offset by subpixels so we get consistent raster. */ + base_x += 2.0f / (64.0f * BARY_RES); + base_y += 2.0f / (64.0f * BARY_RES); + + /* Test different rotations. */ + rot = (0.5f + ((float)(y * 4 + x) / 16.0f)) * 2.0f * M_PI; + + for (i = 0; i < 4; i++) + { + /* Test different winding orders. */ + off_x = quad_lut[i ^ (x & 1)][0]; + off_y = quad_lut[i ^ (x & 1)][1]; + + vbo_data[offset + 4 * i + 0] = base_x + off_x * cosf(rot) - off_y * sinf(rot); + vbo_data[offset + 4 * i + 1] = base_y + off_x * sinf(rot) + off_y * cosf(rot); + + vbo_data[offset + 4 * i + 2] = (float)(offset + 4 * i + 0.5f); /* W. Make sure different results are observed for perspective and noperspective variants. */ + vbo_data[offset + 4 * i + 3] = (float)(offset + 4 * i); + } + } + } + + input_layout.NumElements = ARRAY_SIZE(input_elems); + input_layout.pInputElementDescs = input_elems; + + memset(&desc, 0, sizeof(desc)); + desc.no_root_signature = true; + desc.no_pipeline = true; + desc.rt_width = BARY_RES; + desc.rt_height = BARY_RES; + desc.rt_format = DXGI_FORMAT_R8G8B8A8_UNORM; + if (!init_test_context(&context, &desc)) + return; + + if (!context_supports_dxil(&context)) + { + skip("Context does not support DXIL.\n"); + destroy_test_context(&context); + return; + } + + memset(&features3, 0, sizeof(features3)); + if (FAILED(hr = ID3D12Device_CheckFeatureSupport(context.device, D3D12_FEATURE_D3D12_OPTIONS3, &features3, sizeof(features3))) || !features3.BarycentricsSupported) + { + skip("Context does not support barycentrics, hr #%x.\n", hr); + destroy_test_context(&context); + return; + } + + vbo = create_upload_buffer(context.device, sizeof(vbo_data), vbo_data); + ibo = create_upload_buffer(context.device, sizeof(ibo_data), ibo_data); + + context.root_signature = create_empty_root_signature(context.device, D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT); + + init_pipeline_state_desc_dxil(&pso_desc, context.root_signature, DXGI_FORMAT_R8G8B8A8_UNORM, &vs, &ps, &input_layout); + pso_desc.IBStripCutValue = D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFFFFFF; + pso_desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + pso_desc.RasterizerState.CullMode = D3D12_CULL_MODE_NONE; + + hr = ID3D12Device_CreateGraphicsPipelineState(context.device, &pso_desc, &IID_ID3D12PipelineState, (void **)&pso); + ok(SUCCEEDED(hr), "Failed to create pipeline, hr #%u.\n", hr); + + ID3D12GraphicsCommandList_OMSetRenderTargets(context.list, 1, &context.rtv, TRUE, NULL); + ibv.BufferLocation = ID3D12Resource_GetGPUVirtualAddress(ibo); + ibv.Format = DXGI_FORMAT_R32_UINT; + ibv.SizeInBytes = sizeof(ibo_data); + vbv.BufferLocation = ID3D12Resource_GetGPUVirtualAddress(vbo); + vbv.StrideInBytes = 4 * sizeof(float); + vbv.SizeInBytes = sizeof(vbo_data); + ID3D12GraphicsCommandList_IASetIndexBuffer(context.list, &ibv); + ID3D12GraphicsCommandList_IASetVertexBuffers(context.list, 0, 1, &vbv); + ID3D12GraphicsCommandList_SetPipelineState(context.list, pso); + ID3D12GraphicsCommandList_SetGraphicsRootSignature(context.list, context.root_signature); + ID3D12GraphicsCommandList_RSSetViewports(context.list, 1, &vp); + ID3D12GraphicsCommandList_RSSetScissorRects(context.list, 1, &sci); + ID3D12GraphicsCommandList_ClearRenderTargetView(context.list, context.rtv, white, 0, NULL); + ID3D12GraphicsCommandList_IASetPrimitiveTopology(context.list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + ID3D12GraphicsCommandList_DrawIndexedInstanced(context.list, ARRAY_SIZE(ibo_data), 1, 0, 0, 0); + + transition_resource_state(context.list, context.render_target, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + get_texture_readback_with_command_list(context.render_target, 0, &rb, context.queue, context.list); + coverage_count = 0; + for (y = 0; y < BARY_RES; y++) + { + for (x = 0; x < BARY_RES; x++) + { + value = get_readback_uint(&rb, x, y, 0); + if ((value >> 24) != 0xff) /* If we have coverage.*/ + { + ok((value & 0xffff) == 0, "Value for pixel %u, %u is 0x%x.\n", x, y, value); + ok((value >> 24) == 0x80, "Barycentrics don't sum to 1, alpha bits = 0x%x.\n", value >> 24); + coverage_count++; + } + else + ok(value == ~0u, "Value for pixel %u, %u is 0x%x.\n", x, y, value); + } + } + /* Make sure we have enough test coverage. */ + ok(coverage_count >= (BARY_RES * BARY_RES) / 4, "Coverage is too low = %u.\n", coverage_count); + + for (y = 0; y < 4; y++) + { + for (x = 0; x < 4; x++) + { + /* Sample at quad centers. Based on rotation we should sample the provoking vertex for either first or second strip tri. */ + value = get_readback_uint(&rb, (BARY_RES / 4) * x + (BARY_RES / 8), (BARY_RES / 4) * y + (BARY_RES / 8), 0); + ok(provoking_lut[y * 4 + x] == ((value >> 16) & 0xff), "Quad %u, %u, expected %u, got %u.\n", x, y, provoking_lut[y * 4 + x], (value >> 16) & 0xff); + } + } + + release_resource_readback(&rb); + ID3D12PipelineState_Release(pso); + ID3D12Resource_Release(vbo); + ID3D12Resource_Release(ibo); + destroy_test_context(&context); +} + START_TEST(d3d12) { pfn_D3D12CreateDevice = get_d3d12_pfn(D3D12CreateDevice); @@ -52543,4 +52922,5 @@ START_TEST(d3d12) run_test(test_null_descriptor_mismatch_type); run_test(test_vbv_stride_edge_cases); run_test(test_view_min_lod); + run_test(test_sv_barycentric); }