[D3D12] Runtime geometry shader generation

This commit is contained in:
Triang3l 2022-05-09 19:16:22 +03:00
parent 44cda56d35
commit 8f0e751909
10 changed files with 1198 additions and 4789 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2018 Ben Vanik. All rights reserved. *
* Copyright 2022 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
@ -13,6 +13,7 @@
#include <condition_variable>
#include <cstdio>
#include <deque>
#include <functional>
#include <memory>
#include <mutex>
#include <string>
@ -21,6 +22,7 @@
#include <utility>
#include <vector>
#include "xenia/base/assert.h"
#include "xenia/base/hash.h"
#include "xenia/base/platform.h"
#include "xenia/base/string_buffer.h"
@ -230,9 +232,37 @@ class PipelineCache {
ID3D12RootSignature* root_signature;
D3D12Shader::D3D12Translation* vertex_shader;
D3D12Shader::D3D12Translation* pixel_shader;
const std::vector<uint32_t>* geometry_shader;
PipelineDescription description;
};
union GeometryShaderKey {
uint32_t key;
struct {
PipelineGeometryShader type : 2;
uint32_t interpolator_count : 5;
uint32_t user_clip_plane_count : 3;
uint32_t user_clip_plane_cull : 1;
uint32_t has_vertex_kill_and : 1;
uint32_t has_point_size : 1;
uint32_t has_point_coordinates : 1;
};
GeometryShaderKey() : key(0) { static_assert_size(*this, sizeof(key)); }
struct Hasher {
size_t operator()(const GeometryShaderKey& key) const {
return std::hash<uint32_t>{}(key.key);
}
};
bool operator==(const GeometryShaderKey& other_key) const {
return key == other_key.key;
}
bool operator!=(const GeometryShaderKey& other_key) const {
return !(*this == other_key);
}
};
D3D12Shader* LoadShader(xenos::ShaderType shader_type,
const uint32_t* host_address, uint32_t dword_count,
uint64_t data_hash);
@ -257,6 +287,12 @@ class PipelineCache {
const uint32_t* bound_depth_and_color_render_target_formats,
PipelineRuntimeDescription& runtime_description_out);
static bool GetGeometryShaderKey(PipelineGeometryShader geometry_shader_type,
GeometryShaderKey& key_out);
static void CreateDxbcGeometryShader(GeometryShaderKey key,
std::vector<uint32_t>& shader_out);
const std::vector<uint32_t>& GetGeometryShader(GeometryShaderKey key);
ID3D12PipelineState* CreateD3D12Pipeline(
const PipelineRuntimeDescription& runtime_description);
@ -302,6 +338,11 @@ class PipelineCache {
xe::hash::IdentityHasher<uint64_t>>
bindless_sampler_layout_map_;
// Geometry shaders for Xenos primitive types not supported by Direct3D 12.
std::unordered_map<GeometryShaderKey, std::vector<uint32_t>,
GeometryShaderKey::Hasher>
geometry_shaders_;
// Empty depth-only pixel shader for writing to depth buffer via ROV when no
// Xenos pixel shader provided.
std::vector<uint8_t> depth_only_pixel_shader_;

View File

@ -166,11 +166,11 @@ struct alignas(uint32_t) BlobHeader {
// In order of appearance in a container.
kResourceDefinition = MakeFourCC('R', 'D', 'E', 'F'),
kInputSignature = MakeFourCC('I', 'S', 'G', 'N'),
kInputSignature11_1 = MakeFourCC('I', 'S', 'G', '1'),
kInputSignature_11_1 = MakeFourCC('I', 'S', 'G', '1'),
kPatchConstantSignature = MakeFourCC('P', 'C', 'S', 'G'),
kOutputSignature = MakeFourCC('O', 'S', 'G', 'N'),
kOutputSignatureForGS = MakeFourCC('O', 'S', 'G', '5'),
kOutputSignature11_1 = MakeFourCC('O', 'S', 'G', '1'),
kOutputSignature_11_1 = MakeFourCC('O', 'S', 'G', '1'),
kShaderEx = MakeFourCC('S', 'H', 'E', 'X'),
kShaderFeatureInfo = MakeFourCC('S', 'F', 'I', '0'),
kStatistics = MakeFourCC('S', 'T', 'A', 'T'),
@ -522,7 +522,7 @@ static_assert_size(SignatureParameterForGS, sizeof(uint32_t) * 7);
// D3D11_INTERNALSHADER_PARAMETER_11_1
// Extends SignatureParameterForGS, see it for more information.
struct alignas(uint32_t) SignatureParameter11_1 {
struct alignas(uint32_t) SignatureParameter_11_1 {
uint32_t stream;
uint32_t semantic_name_ptr;
uint32_t semantic_index;
@ -536,7 +536,7 @@ struct alignas(uint32_t) SignatureParameter11_1 {
};
MinPrecision min_precision;
};
static_assert_size(SignatureParameter11_1, sizeof(uint32_t) * 8);
static_assert_size(SignatureParameter_11_1, sizeof(uint32_t) * 8);
// D3D10_INTERNALSHADER_SIGNATURE
struct alignas(uint32_t) Signature {
@ -1527,6 +1527,10 @@ constexpr uint32_t OpcodeToken(Opcode opcode, uint32_t operands_length,
(extended_opcode_count ? (uint32_t(1) << 31) : 0);
}
constexpr uint32_t GetOpcodeTokenInstructionLength(uint32_t opcode_token) {
return (opcode_token >> 24) & ((UINT32_C(1) << 7) - 1);
}
constexpr uint32_t SampleControlsExtendedOpcodeToken(int32_t aoffimmi_u,
int32_t aoffimmi_v,
int32_t aoffimmi_w,
@ -2049,11 +2053,15 @@ class Assembler {
operand.Write(code_, false, 0b1111, false, true);
code_.push_back(space);
}
// In geometry shaders, only kPointList, kLineStrip and kTriangleStrip are
// allowed.
void OpDclOutputTopology(PrimitiveTopology output_topology) {
code_.push_back(OpcodeToken(Opcode::kDclOutputTopology, 0) |
(uint32_t(output_topology) << 11));
stat_.gs_output_topology = output_topology;
}
// In geometry shaders, only kPoint, kLine, kTriangle, kLineWithAdjacency and
// kTriangleWithAdjacency are allowed.
void OpDclInputPrimitive(Primitive input_primitive) {
code_.push_back(OpcodeToken(Opcode::kDclInputPrimitive, 0) |
(uint32_t(input_primitive) << 11));
@ -2194,6 +2202,9 @@ class Assembler {
code_.push_back(OpcodeToken(Opcode::kEmitThenCutStream, operands_length));
stream.Write(code_);
++stat_.instruction_count;
// TODO(Triang3l): Verify if the instruction counts should be incremented
// this way (haven't been able to obtain this from FXC because it generates
// separate emit_stream and cut_stream, at least for Shader Model 5.1).
++stat_.emit_instruction_count;
++stat_.cut_instruction_count;
}

View File

@ -130,16 +130,16 @@ union alignas(uint32_t) SQ_CONTEXT_MISC {
uint32_t sc_output_screen_xy : 1; // +1
xenos::SampleControl sc_sample_cntl : 2; // +2
uint32_t : 4; // +4
// Pixel shader interpolator (according to the XNA microcode compiler -
// Pixel shader interpolator (according to the XNA microcode validator -
// limited to the interpolator count, 16, not the total register count of
// 64) index to write pixel parameters to.
// See https://portal.unifiedpatents.com/ptab/case/IPR2015-00325 Exhibit
// 2039 R400 Sequencer Specification 2.11 (a significantly early version of
// the specification, however) section 19.2 "Sprites/ XY screen coordinates/
// FB information" for additional details.
// * |XY| - position on screen (vPos - the XNA microcode compiler translates
// ps_3_0 vPos directly to this, so at least in Direct3D 9 pixel center
// mode, this contains 0, 1, 2, not 0.5, 1.5, 2.5). flto also said in the
// * |XY| - position on screen (vPos - the XNA assembler translates ps_3_0
// vPos directly to this, so at least in Direct3D 9 pixel center mode,
// this contains 0, 1, 2, not 0.5, 1.5, 2.5). flto also said in the
// Freedreno IRC that it's .0 even in OpenGL:
// https://dri.freedesktop.org/~cbrill/dri-log/?channel=freedreno&date=2020-04-19
// According to the actual usage, in the final version of the hardware,

File diff suppressed because it is too large Load Diff

View File

@ -1,886 +0,0 @@
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD 0 xyzw 0 NONE float xyzw
// TEXCOORD 1 xyzw 1 NONE float xyzw
// TEXCOORD 2 xyzw 2 NONE float xyzw
// TEXCOORD 3 xyzw 3 NONE float xyzw
// TEXCOORD 4 xyzw 4 NONE float xyzw
// TEXCOORD 5 xyzw 5 NONE float xyzw
// TEXCOORD 6 xyzw 6 NONE float xyzw
// TEXCOORD 7 xyzw 7 NONE float xyzw
// TEXCOORD 8 xyzw 8 NONE float xyzw
// TEXCOORD 9 xyzw 9 NONE float xyzw
// TEXCOORD 10 xyzw 10 NONE float xyzw
// TEXCOORD 11 xyzw 11 NONE float xyzw
// TEXCOORD 12 xyzw 12 NONE float xyzw
// TEXCOORD 13 xyzw 13 NONE float xyzw
// TEXCOORD 14 xyzw 14 NONE float xyzw
// TEXCOORD 15 xyzw 15 NONE float xyzw
// TEXCOORD 16 xyz 16 NONE float xyz
// SV_Position 0 xyzw 17 POS float xyzw
// SV_ClipDistance 0 xyzw 18 CLIPDST float xyzw
// SV_ClipDistance 1 xy 19 CLIPDST float xy
// SV_CullDistance 0 z 19 CULLDST float
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD 0 xyzw 0 NONE float xyzw
// TEXCOORD 1 xyzw 1 NONE float xyzw
// TEXCOORD 2 xyzw 2 NONE float xyzw
// TEXCOORD 3 xyzw 3 NONE float xyzw
// TEXCOORD 4 xyzw 4 NONE float xyzw
// TEXCOORD 5 xyzw 5 NONE float xyzw
// TEXCOORD 6 xyzw 6 NONE float xyzw
// TEXCOORD 7 xyzw 7 NONE float xyzw
// TEXCOORD 8 xyzw 8 NONE float xyzw
// TEXCOORD 9 xyzw 9 NONE float xyzw
// TEXCOORD 10 xyzw 10 NONE float xyzw
// TEXCOORD 11 xyzw 11 NONE float xyzw
// TEXCOORD 12 xyzw 12 NONE float xyzw
// TEXCOORD 13 xyzw 13 NONE float xyzw
// TEXCOORD 14 xyzw 14 NONE float xyzw
// TEXCOORD 15 xyzw 15 NONE float xyzw
// TEXCOORD 16 xyz 16 NONE float xyz
// SV_Position 0 xyzw 17 POS float xyzw
// SV_ClipDistance 0 xyzw 18 CLIPDST float xyzw
// SV_ClipDistance 1 xy 19 CLIPDST float xy
//
gs_5_1
dcl_globalFlags refactoringAllowed
dcl_input v[4][0].xyzw
dcl_input v[4][1].xyzw
dcl_input v[4][2].xyzw
dcl_input v[4][3].xyzw
dcl_input v[4][4].xyzw
dcl_input v[4][5].xyzw
dcl_input v[4][6].xyzw
dcl_input v[4][7].xyzw
dcl_input v[4][8].xyzw
dcl_input v[4][9].xyzw
dcl_input v[4][10].xyzw
dcl_input v[4][11].xyzw
dcl_input v[4][12].xyzw
dcl_input v[4][13].xyzw
dcl_input v[4][14].xyzw
dcl_input v[4][15].xyzw
dcl_input v[4][16].xyz
dcl_input_siv v[4][17].xyzw, position
dcl_input v[4][18].xyzw
dcl_input v[4][19].xy
dcl_input v[4][19].z
dcl_inputprimitive lineadj
dcl_stream m0
dcl_outputtopology trianglestrip
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_output o7.xyzw
dcl_output o8.xyzw
dcl_output o9.xyzw
dcl_output o10.xyzw
dcl_output o11.xyzw
dcl_output o12.xyzw
dcl_output o13.xyzw
dcl_output o14.xyzw
dcl_output o15.xyzw
dcl_output o16.xyz
dcl_output_siv o17.xyzw, position
dcl_output_siv o18.xyzw, clip_distance
dcl_output_siv o19.xy, clip_distance
dcl_maxout 4
mov o0.xyzw, v[0][0].xyzw
mov o1.xyzw, v[0][1].xyzw
mov o2.xyzw, v[0][2].xyzw
mov o3.xyzw, v[0][3].xyzw
mov o4.xyzw, v[0][4].xyzw
mov o5.xyzw, v[0][5].xyzw
mov o6.xyzw, v[0][6].xyzw
mov o7.xyzw, v[0][7].xyzw
mov o8.xyzw, v[0][8].xyzw
mov o9.xyzw, v[0][9].xyzw
mov o10.xyzw, v[0][10].xyzw
mov o11.xyzw, v[0][11].xyzw
mov o12.xyzw, v[0][12].xyzw
mov o13.xyzw, v[0][13].xyzw
mov o14.xyzw, v[0][14].xyzw
mov o15.xyzw, v[0][15].xyzw
mov o16.xyz, v[0][16].xyzx
mov o17.xyzw, v[0][17].xyzw
mov o18.xyzw, v[0][18].xyzw
mov o19.xy, v[0][19].xyxx
emit_stream m0
mov o0.xyzw, v[1][0].xyzw
mov o1.xyzw, v[1][1].xyzw
mov o2.xyzw, v[1][2].xyzw
mov o3.xyzw, v[1][3].xyzw
mov o4.xyzw, v[1][4].xyzw
mov o5.xyzw, v[1][5].xyzw
mov o6.xyzw, v[1][6].xyzw
mov o7.xyzw, v[1][7].xyzw
mov o8.xyzw, v[1][8].xyzw
mov o9.xyzw, v[1][9].xyzw
mov o10.xyzw, v[1][10].xyzw
mov o11.xyzw, v[1][11].xyzw
mov o12.xyzw, v[1][12].xyzw
mov o13.xyzw, v[1][13].xyzw
mov o14.xyzw, v[1][14].xyzw
mov o15.xyzw, v[1][15].xyzw
mov o16.xyz, v[1][16].xyzx
mov o17.xyzw, v[1][17].xyzw
mov o18.xyzw, v[1][18].xyzw
mov o19.xy, v[1][19].xyxx
emit_stream m0
mov o0.xyzw, v[3][0].xyzw
mov o1.xyzw, v[3][1].xyzw
mov o2.xyzw, v[3][2].xyzw
mov o3.xyzw, v[3][3].xyzw
mov o4.xyzw, v[3][4].xyzw
mov o5.xyzw, v[3][5].xyzw
mov o6.xyzw, v[3][6].xyzw
mov o7.xyzw, v[3][7].xyzw
mov o8.xyzw, v[3][8].xyzw
mov o9.xyzw, v[3][9].xyzw
mov o10.xyzw, v[3][10].xyzw
mov o11.xyzw, v[3][11].xyzw
mov o12.xyzw, v[3][12].xyzw
mov o13.xyzw, v[3][13].xyzw
mov o14.xyzw, v[3][14].xyzw
mov o15.xyzw, v[3][15].xyzw
mov o16.xyz, v[3][16].xyzx
mov o17.xyzw, v[3][17].xyzw
mov o18.xyzw, v[3][18].xyzw
mov o19.xy, v[3][19].xyxx
emit_stream m0
mov o0.xyzw, v[2][0].xyzw
mov o1.xyzw, v[2][1].xyzw
mov o2.xyzw, v[2][2].xyzw
mov o3.xyzw, v[2][3].xyzw
mov o4.xyzw, v[2][4].xyzw
mov o5.xyzw, v[2][5].xyzw
mov o6.xyzw, v[2][6].xyzw
mov o7.xyzw, v[2][7].xyzw
mov o8.xyzw, v[2][8].xyzw
mov o9.xyzw, v[2][9].xyzw
mov o10.xyzw, v[2][10].xyzw
mov o11.xyzw, v[2][11].xyzw
mov o12.xyzw, v[2][12].xyzw
mov o13.xyzw, v[2][13].xyzw
mov o14.xyzw, v[2][14].xyzw
mov o15.xyzw, v[2][15].xyzw
mov o16.xyz, v[2][16].xyzx
mov o17.xyzw, v[2][17].xyzw
mov o18.xyzw, v[2][18].xyzw
mov o19.xy, v[2][19].xyxx
emit_stream m0
cut_stream m0
ret
// Approximately 86 instruction slots used
#endif
const BYTE primitive_quad_list_gs[] =
{
68, 88, 66, 67, 26, 143,
179, 72, 238, 147, 43, 130,
37, 11, 116, 191, 138, 68,
255, 76, 1, 0, 0, 0,
36, 16, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
160, 0, 0, 0, 224, 2,
0, 0, 72, 5, 0, 0,
136, 15, 0, 0, 82, 68,
69, 70, 100, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
60, 0, 0, 0, 1, 5,
83, 71, 0, 5, 0, 0,
60, 0, 0, 0, 19, 19,
68, 37, 60, 0, 0, 0,
24, 0, 0, 0, 40, 0,
0, 0, 40, 0, 0, 0,
36, 0, 0, 0, 12, 0,
0, 0, 0, 0, 0, 0,
77, 105, 99, 114, 111, 115,
111, 102, 116, 32, 40, 82,
41, 32, 72, 76, 83, 76,
32, 83, 104, 97, 100, 101,
114, 32, 67, 111, 109, 112,
105, 108, 101, 114, 32, 49,
48, 46, 49, 0, 73, 83,
71, 78, 56, 2, 0, 0,
21, 0, 0, 0, 8, 0,
0, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
1, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
2, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
2, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
3, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
3, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
4, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
4, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
5, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
5, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
6, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
6, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
7, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
7, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
8, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
8, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
9, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
9, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
10, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
10, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
11, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
11, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
12, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
12, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
13, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
13, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
14, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
14, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
15, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
15, 0, 0, 0, 15, 15,
0, 0, 0, 2, 0, 0,
16, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
16, 0, 0, 0, 7, 7,
0, 0, 9, 2, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 3, 0, 0, 0,
17, 0, 0, 0, 15, 15,
0, 0, 21, 2, 0, 0,
0, 0, 0, 0, 2, 0,
0, 0, 3, 0, 0, 0,
18, 0, 0, 0, 15, 15,
0, 0, 21, 2, 0, 0,
1, 0, 0, 0, 2, 0,
0, 0, 3, 0, 0, 0,
19, 0, 0, 0, 3, 3,
0, 0, 37, 2, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 3, 0, 0, 0,
19, 0, 0, 0, 4, 0,
0, 0, 84, 69, 88, 67,
79, 79, 82, 68, 0, 83,
86, 95, 80, 111, 115, 105,
116, 105, 111, 110, 0, 83,
86, 95, 67, 108, 105, 112,
68, 105, 115, 116, 97, 110,
99, 101, 0, 83, 86, 95,
67, 117, 108, 108, 68, 105,
115, 116, 97, 110, 99, 101,
0, 171, 171, 171, 79, 83,
71, 53, 96, 2, 0, 0,
20, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0,
56, 2, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 0, 0,
0, 0, 15, 0, 0, 0,
0, 0, 0, 0, 56, 2,
0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 1, 0, 0, 0,
15, 0, 0, 0, 0, 0,
0, 0, 56, 2, 0, 0,
2, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
2, 0, 0, 0, 15, 0,
0, 0, 0, 0, 0, 0,
56, 2, 0, 0, 3, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 3, 0,
0, 0, 15, 0, 0, 0,
0, 0, 0, 0, 56, 2,
0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 4, 0, 0, 0,
15, 0, 0, 0, 0, 0,
0, 0, 56, 2, 0, 0,
5, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
5, 0, 0, 0, 15, 0,
0, 0, 0, 0, 0, 0,
56, 2, 0, 0, 6, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 6, 0,
0, 0, 15, 0, 0, 0,
0, 0, 0, 0, 56, 2,
0, 0, 7, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 7, 0, 0, 0,
15, 0, 0, 0, 0, 0,
0, 0, 56, 2, 0, 0,
8, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
8, 0, 0, 0, 15, 0,
0, 0, 0, 0, 0, 0,
56, 2, 0, 0, 9, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 9, 0,
0, 0, 15, 0, 0, 0,
0, 0, 0, 0, 56, 2,
0, 0, 10, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 10, 0, 0, 0,
15, 0, 0, 0, 0, 0,
0, 0, 56, 2, 0, 0,
11, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
11, 0, 0, 0, 15, 0,
0, 0, 0, 0, 0, 0,
56, 2, 0, 0, 12, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 12, 0,
0, 0, 15, 0, 0, 0,
0, 0, 0, 0, 56, 2,
0, 0, 13, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 13, 0, 0, 0,
15, 0, 0, 0, 0, 0,
0, 0, 56, 2, 0, 0,
14, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
14, 0, 0, 0, 15, 0,
0, 0, 0, 0, 0, 0,
56, 2, 0, 0, 15, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 15, 0,
0, 0, 15, 0, 0, 0,
0, 0, 0, 0, 56, 2,
0, 0, 16, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 16, 0, 0, 0,
7, 8, 0, 0, 0, 0,
0, 0, 65, 2, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 3, 0, 0, 0,
17, 0, 0, 0, 15, 0,
0, 0, 0, 0, 0, 0,
77, 2, 0, 0, 0, 0,
0, 0, 2, 0, 0, 0,
3, 0, 0, 0, 18, 0,
0, 0, 15, 0, 0, 0,
0, 0, 0, 0, 77, 2,
0, 0, 1, 0, 0, 0,
2, 0, 0, 0, 3, 0,
0, 0, 19, 0, 0, 0,
3, 12, 0, 0, 84, 69,
88, 67, 79, 79, 82, 68,
0, 83, 86, 95, 80, 111,
115, 105, 116, 105, 111, 110,
0, 83, 86, 95, 67, 108,
105, 112, 68, 105, 115, 116,
97, 110, 99, 101, 0, 171,
171, 171, 83, 72, 69, 88,
56, 10, 0, 0, 81, 0,
2, 0, 142, 2, 0, 0,
106, 8, 0, 1, 95, 0,
0, 4, 242, 16, 32, 0,
4, 0, 0, 0, 0, 0,
0, 0, 95, 0, 0, 4,
242, 16, 32, 0, 4, 0,
0, 0, 1, 0, 0, 0,
95, 0, 0, 4, 242, 16,
32, 0, 4, 0, 0, 0,
2, 0, 0, 0, 95, 0,
0, 4, 242, 16, 32, 0,
4, 0, 0, 0, 3, 0,
0, 0, 95, 0, 0, 4,
242, 16, 32, 0, 4, 0,
0, 0, 4, 0, 0, 0,
95, 0, 0, 4, 242, 16,
32, 0, 4, 0, 0, 0,
5, 0, 0, 0, 95, 0,
0, 4, 242, 16, 32, 0,
4, 0, 0, 0, 6, 0,
0, 0, 95, 0, 0, 4,
242, 16, 32, 0, 4, 0,
0, 0, 7, 0, 0, 0,
95, 0, 0, 4, 242, 16,
32, 0, 4, 0, 0, 0,
8, 0, 0, 0, 95, 0,
0, 4, 242, 16, 32, 0,
4, 0, 0, 0, 9, 0,
0, 0, 95, 0, 0, 4,
242, 16, 32, 0, 4, 0,
0, 0, 10, 0, 0, 0,
95, 0, 0, 4, 242, 16,
32, 0, 4, 0, 0, 0,
11, 0, 0, 0, 95, 0,
0, 4, 242, 16, 32, 0,
4, 0, 0, 0, 12, 0,
0, 0, 95, 0, 0, 4,
242, 16, 32, 0, 4, 0,
0, 0, 13, 0, 0, 0,
95, 0, 0, 4, 242, 16,
32, 0, 4, 0, 0, 0,
14, 0, 0, 0, 95, 0,
0, 4, 242, 16, 32, 0,
4, 0, 0, 0, 15, 0,
0, 0, 95, 0, 0, 4,
114, 16, 32, 0, 4, 0,
0, 0, 16, 0, 0, 0,
97, 0, 0, 5, 242, 16,
32, 0, 4, 0, 0, 0,
17, 0, 0, 0, 1, 0,
0, 0, 95, 0, 0, 4,
242, 16, 32, 0, 4, 0,
0, 0, 18, 0, 0, 0,
95, 0, 0, 4, 50, 16,
32, 0, 4, 0, 0, 0,
19, 0, 0, 0, 95, 0,
0, 4, 66, 16, 32, 0,
4, 0, 0, 0, 19, 0,
0, 0, 93, 48, 0, 1,
143, 0, 0, 3, 0, 0,
17, 0, 0, 0, 0, 0,
92, 40, 0, 1, 101, 0,
0, 3, 242, 32, 16, 0,
0, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
1, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
2, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
3, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
4, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
5, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
6, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
7, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
8, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
9, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
10, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
11, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
12, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
13, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
14, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
15, 0, 0, 0, 101, 0,
0, 3, 114, 32, 16, 0,
16, 0, 0, 0, 103, 0,
0, 4, 242, 32, 16, 0,
17, 0, 0, 0, 1, 0,
0, 0, 103, 0, 0, 4,
242, 32, 16, 0, 18, 0,
0, 0, 2, 0, 0, 0,
103, 0, 0, 4, 50, 32,
16, 0, 19, 0, 0, 0,
2, 0, 0, 0, 94, 0,
0, 2, 4, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 0, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 0, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 1, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 1, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 2, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 2, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 3, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 3, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 4, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 4, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 5, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 5, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 6, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 6, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 7, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 7, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 8, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 8, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 9, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 9, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 10, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 10, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 11, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 11, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 12, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 12, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 13, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 13, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 14, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 14, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 15, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 15, 0, 0, 0,
54, 0, 0, 6, 114, 32,
16, 0, 16, 0, 0, 0,
70, 18, 32, 0, 0, 0,
0, 0, 16, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 17, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 17, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 18, 0, 0, 0,
70, 30, 32, 0, 0, 0,
0, 0, 18, 0, 0, 0,
54, 0, 0, 6, 50, 32,
16, 0, 19, 0, 0, 0,
70, 16, 32, 0, 0, 0,
0, 0, 19, 0, 0, 0,
117, 0, 0, 3, 0, 0,
17, 0, 0, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 0, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 0, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 1, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 1, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 2, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 2, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 3, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 3, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 4, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 4, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 5, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 5, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 6, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 6, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 7, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 7, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 8, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 8, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 9, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 9, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 10, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 10, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 11, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 11, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 12, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 12, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 13, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 13, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 14, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 14, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 15, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 15, 0, 0, 0,
54, 0, 0, 6, 114, 32,
16, 0, 16, 0, 0, 0,
70, 18, 32, 0, 1, 0,
0, 0, 16, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 17, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 17, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 18, 0, 0, 0,
70, 30, 32, 0, 1, 0,
0, 0, 18, 0, 0, 0,
54, 0, 0, 6, 50, 32,
16, 0, 19, 0, 0, 0,
70, 16, 32, 0, 1, 0,
0, 0, 19, 0, 0, 0,
117, 0, 0, 3, 0, 0,
17, 0, 0, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 0, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 0, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 1, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 1, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 2, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 2, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 3, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 3, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 4, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 4, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 5, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 5, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 6, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 6, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 7, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 7, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 8, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 8, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 9, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 9, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 10, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 10, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 11, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 11, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 12, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 12, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 13, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 13, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 14, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 14, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 15, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 15, 0, 0, 0,
54, 0, 0, 6, 114, 32,
16, 0, 16, 0, 0, 0,
70, 18, 32, 0, 3, 0,
0, 0, 16, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 17, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 17, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 18, 0, 0, 0,
70, 30, 32, 0, 3, 0,
0, 0, 18, 0, 0, 0,
54, 0, 0, 6, 50, 32,
16, 0, 19, 0, 0, 0,
70, 16, 32, 0, 3, 0,
0, 0, 19, 0, 0, 0,
117, 0, 0, 3, 0, 0,
17, 0, 0, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 0, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 0, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 1, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 1, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 2, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 2, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 3, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 3, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 4, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 4, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 5, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 5, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 6, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 6, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 7, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 7, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 8, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 8, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 9, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 9, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 10, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 10, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 11, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 11, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 12, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 12, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 13, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 13, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 14, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 14, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 15, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 15, 0, 0, 0,
54, 0, 0, 6, 114, 32,
16, 0, 16, 0, 0, 0,
70, 18, 32, 0, 2, 0,
0, 0, 16, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 17, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 17, 0, 0, 0,
54, 0, 0, 6, 242, 32,
16, 0, 18, 0, 0, 0,
70, 30, 32, 0, 2, 0,
0, 0, 18, 0, 0, 0,
54, 0, 0, 6, 50, 32,
16, 0, 19, 0, 0, 0,
70, 16, 32, 0, 2, 0,
0, 0, 19, 0, 0, 0,
117, 0, 0, 3, 0, 0,
17, 0, 0, 0, 0, 0,
118, 0, 0, 3, 0, 0,
17, 0, 0, 0, 0, 0,
62, 0, 0, 1, 83, 84,
65, 84, 148, 0, 0, 0,
86, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
41, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 4, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 6, 0, 0, 0,
5, 0, 0, 0, 4, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0
};

File diff suppressed because it is too large Load Diff

View File

@ -1,63 +0,0 @@
#include "xenos_draw.hlsli"
[maxvertexcount(4)]
void main(point XeVertexPreGS xe_in[1],
inout TriangleStream<XeVertexPostGS> xe_stream) {
// TODO(Triang3l): Handle ps_ucp_mode (transform the host clip space to the
// guest one, calculate the distances to the user clip planes, cull using the
// distance from the center for modes 0, 1 and 2, cull and clip per-vertex for
// modes 2 and 3).
if (xe_in[0].cull_distance < 0.0 || any(isnan(xe_in[0].post_gs.position))) {
return;
}
// The vertex shader's header writes -1.0 to point_size by default, so any
// non-negative value means that it was overwritten by the translated vertex
// shader. The per-vertex diameter is already clamped in the vertex shader
// (combined with making it non-negative).
float point_vertex_diameter = xe_in[0].post_gs.pre_ps.point_parameters.z;
float2 point_screen_diameter = (point_vertex_diameter >= 0.0)
? point_vertex_diameter
: xe_point_constant_diameter;
if (!all(point_screen_diameter > 0.0)) {
// 4D5307F1 has zero-size snowflakes, drop them quicker.
return;
}
float2 point_clip_space_radius =
point_screen_diameter * xe_point_screen_diameter_to_ndc_radius *
xe_in[0].post_gs.position.w;
XeVertexPostGS xe_out;
xe_out.pre_ps.interpolators = xe_in[0].post_gs.pre_ps.interpolators;
xe_out.pre_ps.point_parameters.z = xe_in[0].post_gs.pre_ps.point_parameters.z;
xe_out.position.zw = xe_in[0].post_gs.position.zw;
// TODO(Triang3l): Handle ps_ucp_mode.
xe_out.clip_distance_0123 = xe_in[0].post_gs.clip_distance_0123;
xe_out.clip_distance_45 = xe_in[0].post_gs.clip_distance_45;
// V = 0 in the top (+Y in Direct3D), 1 in the bottom, according to the
// analysis of Adreno 200 behavior (V = 1 towards -gl_FragCoord.y, the bottom,
// but the top-left rule is used for rasterization, and gl_FragCoord is
// generated from |PsParamGen.xy| via multiply-addition as opposed to just
// addition, so -gl_FragCoord.y is likely positive in screen coordinates, or
// +|PsParamGen.y|).
// TODO(Triang3l): On Vulkan, sign of Y needs to inverted because of the
// upper-left origin.
xe_out.pre_ps.point_parameters.xy = float2(0.0, 0.0);
xe_out.position.xy =
xe_in[0].post_gs.position.xy +
float2(-point_clip_space_radius.x, point_clip_space_radius.y);
xe_stream.Append(xe_out);
xe_out.pre_ps.point_parameters.xy = float2(0.0, 1.0);
xe_out.position.xy = xe_in[0].post_gs.position.xy - point_clip_space_radius;
xe_stream.Append(xe_out);
xe_out.pre_ps.point_parameters.xy = float2(1.0, 0.0);
xe_out.position.xy = xe_in[0].post_gs.position.xy + point_clip_space_radius;
xe_stream.Append(xe_out);
xe_out.pre_ps.point_parameters.xy = float2(1.0, 1.0);
xe_out.position.xy =
xe_in[0].post_gs.position.xy +
float2(point_clip_space_radius.x, -point_clip_space_radius.y);
xe_stream.Append(xe_out);
xe_stream.RestartStrip();
}

View File

@ -1,23 +0,0 @@
#include "xenos_draw.hlsli"
[maxvertexcount(4)]
void main(lineadj XeVertexPreGS xe_in[4],
inout TriangleStream<XeVertexPostGS> xe_stream) {
// Culling should probably be done per-triangle - while there's no
// RETAIN_QUADS on Adreno 2xx, on R6xx it's always disabled for
// non-tessellated quads, so they are always decomposed into triangles.
// Therefore, not doing any cull distance or NaN position checks here.
// TODO(Triang3l): Find whether vertex killing should actually work for each
// triangle or for the entire quad.
// TODO(Triang3l): Find the correct order.
XeVertexPostGS xe_out;
xe_out = xe_in[0].post_gs;
xe_stream.Append(xe_out);
xe_out = xe_in[1].post_gs;
xe_stream.Append(xe_out);
xe_out = xe_in[3].post_gs;
xe_stream.Append(xe_out);
xe_out = xe_in[2].post_gs;
xe_stream.Append(xe_out);
xe_stream.RestartStrip();
}

View File

@ -1,103 +0,0 @@
#include "xenos_draw.hlsli"
[maxvertexcount(6)]
void main(triangle XeVertexPreGS xe_in[3],
inout TriangleStream<XeVertexPostGS> xe_stream) {
if (max(max(xe_in[0].cull_distance, xe_in[1].cull_distance),
xe_in[2].cull_distance) < 0.0f ||
any(isnan(xe_in[0].post_gs.position)) ||
any(isnan(xe_in[1].post_gs.position)) ||
any(isnan(xe_in[2].post_gs.position))) {
return;
}
XeVertexPostGS xe_out;
xe_out = xe_in[0].post_gs;
xe_stream.Append(xe_out);
xe_out = xe_in[1].post_gs;
xe_stream.Append(xe_out);
xe_out = xe_in[2].post_gs;
xe_stream.Append(xe_out);
xe_stream.RestartStrip();
// Find the diagonal (the edge that is longer than both the other two) and
// mirror the other vertex across it.
float3 edge_01 =
xe_in[1].post_gs.position.xyz - xe_in[0].post_gs.position.xyz;
float3 edge_02 =
xe_in[2].post_gs.position.xyz - xe_in[0].post_gs.position.xyz;
float3 edge_12 =
xe_in[2].post_gs.position.xyz - xe_in[1].post_gs.position.xyz;
float3 edge_squares = float3(
dot(edge_01, edge_01), dot(edge_02, edge_02), dot(edge_12, edge_12));
float3 v3_signs;
if (edge_squares.z > edge_squares.x && edge_squares.z > edge_squares.y) {
// 12 is the diagonal. Most games use this form.
//
// 0 ------ 1 0: -1,-1
// | - | 1: 1,-1
// | // | 2: -1, 1
// | - | 3: [ 1, 1 ]
// 2 ----- [3]
//
// 0 ------ 2 0: -1,-1
// | - | 1: -1, 1
// | // | 2: 1,-1
// | - | 3: [ 1, 1 ]
// 1 ------[3]
xe_out = xe_in[2].post_gs;
xe_stream.Append(xe_out);
xe_out = xe_in[1].post_gs;
xe_stream.Append(xe_out);
v3_signs = float3(-1.0f, 1.0f, 1.0f);
} else if (edge_squares.y > edge_squares.x &&
edge_squares.y > edge_squares.z) {
// 02 is the diagonal.
//
// 0 ------ 1 0: -1,-1
// | - | 1: 1,-1
// | \\ | 2: 1, 1
// | - | 3: [-1, 1 ]
// [3] ----- 2
xe_out = xe_in[0].post_gs;
xe_stream.Append(xe_out);
xe_out = xe_in[2].post_gs;
xe_stream.Append(xe_out);
v3_signs = float3(1.0f, -1.0f, 1.0f);
} else {
// 01 is the diagonal. Not seen in any game so far.
//
// 0 ------ 2 0: -1,-1
// | - | 1: 1, 1
// | \\ | 2: 1,-1
// | - | 3: [-1, 1 ]
// [3] ----- 1
xe_out = xe_in[1].post_gs;
xe_stream.Append(xe_out);
xe_out = xe_in[0].post_gs;
xe_stream.Append(xe_out);
v3_signs = float3(1.0f, 1.0f, -1.0f);
}
[unroll] for (int i = 0; i < 16; ++i) {
xe_out.pre_ps.interpolators[i] =
v3_signs.x * xe_in[0].post_gs.pre_ps.interpolators[i] +
v3_signs.y * xe_in[1].post_gs.pre_ps.interpolators[i] +
v3_signs.z * xe_in[2].post_gs.pre_ps.interpolators[i];
}
xe_out.pre_ps.point_parameters =
v3_signs.x * xe_in[0].post_gs.pre_ps.point_parameters +
v3_signs.y * xe_in[1].post_gs.pre_ps.point_parameters +
v3_signs.z * xe_in[2].post_gs.pre_ps.point_parameters;
xe_out.position = v3_signs.x * xe_in[0].post_gs.position +
v3_signs.y * xe_in[1].post_gs.position +
v3_signs.z * xe_in[2].post_gs.position;
xe_out.clip_distance_0123 = v3_signs.x * xe_in[0].post_gs.clip_distance_0123 +
v3_signs.y * xe_in[1].post_gs.clip_distance_0123 +
v3_signs.z * xe_in[2].post_gs.clip_distance_0123;
xe_out.clip_distance_45 = v3_signs.x * xe_in[0].post_gs.clip_distance_45 +
v3_signs.y * xe_in[1].post_gs.clip_distance_45 +
v3_signs.z * xe_in[2].post_gs.clip_distance_45;
xe_stream.Append(xe_out);
xe_stream.RestartStrip();
}