[D3D12] Move interpolators above position because it's more important for pixel shaders
This commit is contained in:
parent
bd868ae6cc
commit
7ba2526fa8
|
@ -1,6 +1,6 @@
|
||||||
struct XeVertex {
|
struct XeVertex {
|
||||||
float4 position : SV_Position;
|
|
||||||
float4 interpolators[16] : TEXCOORD;
|
float4 interpolators[16] : TEXCOORD;
|
||||||
|
float4 position : SV_Position;
|
||||||
float point_size : PSIZE;
|
float point_size : PSIZE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,16 +8,16 @@ struct XeVertex {
|
||||||
void main(triangle XeVertex xe_in[3], inout TriangleStream<XeVertex> xe_stream) {
|
void main(triangle XeVertex xe_in[3], inout TriangleStream<XeVertex> xe_stream) {
|
||||||
XeVertex xe_out;
|
XeVertex xe_out;
|
||||||
|
|
||||||
xe_out.position = xe_in[0].position;
|
|
||||||
xe_out.interpolators = xe_in[0].interpolators;
|
xe_out.interpolators = xe_in[0].interpolators;
|
||||||
|
xe_out.position = xe_in[0].position;
|
||||||
xe_out.point_size = xe_in[0].point_size;
|
xe_out.point_size = xe_in[0].point_size;
|
||||||
xe_stream.Append(xe_out);
|
xe_stream.Append(xe_out);
|
||||||
xe_out.position = xe_in[1].position;
|
|
||||||
xe_out.interpolators = xe_in[1].interpolators;
|
xe_out.interpolators = xe_in[1].interpolators;
|
||||||
|
xe_out.position = xe_in[1].position;
|
||||||
xe_out.point_size = xe_in[1].point_size;
|
xe_out.point_size = xe_in[1].point_size;
|
||||||
xe_stream.Append(xe_out);
|
xe_stream.Append(xe_out);
|
||||||
xe_out.position = xe_in[2].position;
|
|
||||||
xe_out.interpolators = xe_in[2].interpolators;
|
xe_out.interpolators = xe_in[2].interpolators;
|
||||||
|
xe_out.position = xe_in[2].position;
|
||||||
xe_out.point_size = xe_in[2].point_size;
|
xe_out.point_size = xe_in[2].point_size;
|
||||||
xe_stream.Append(xe_out);
|
xe_stream.Append(xe_out);
|
||||||
xe_stream.RestartStrip();
|
xe_stream.RestartStrip();
|
||||||
|
@ -38,46 +38,46 @@ void main(triangle XeVertex xe_in[3], inout TriangleStream<XeVertex> xe_stream)
|
||||||
// | // | 2: 1,-1
|
// | // | 2: 1,-1
|
||||||
// | - | 3: [ 1, 1 ]
|
// | - | 3: [ 1, 1 ]
|
||||||
// 1 ------[3]
|
// 1 ------[3]
|
||||||
xe_out.position = xe_in[2].position;
|
|
||||||
xe_out.interpolators = xe_in[2].interpolators;
|
xe_out.interpolators = xe_in[2].interpolators;
|
||||||
|
xe_out.position = xe_in[2].position;
|
||||||
xe_out.point_size = xe_in[2].point_size;
|
xe_out.point_size = xe_in[2].point_size;
|
||||||
xe_stream.Append(xe_out);
|
xe_stream.Append(xe_out);
|
||||||
xe_out.position = xe_in[1].position;
|
|
||||||
xe_out.interpolators = xe_in[1].interpolators;
|
xe_out.interpolators = xe_in[1].interpolators;
|
||||||
|
xe_out.position = xe_in[1].position;
|
||||||
xe_out.point_size = xe_in[1].point_size;
|
xe_out.point_size = xe_in[1].point_size;
|
||||||
xe_stream.Append(xe_out);
|
xe_stream.Append(xe_out);
|
||||||
xe_out.position = float4(xe_in[1].position.xy -
|
|
||||||
xe_in[0].position.xy +
|
|
||||||
xe_in[2].position.xy,
|
|
||||||
xe_in[2].position.zw);
|
|
||||||
[unroll] for (int i = 0; i < 16; ++i) {
|
[unroll] for (int i = 0; i < 16; ++i) {
|
||||||
xe_out.interpolators[i] = xe_in[1].interpolators[i] -
|
xe_out.interpolators[i] = xe_in[1].interpolators[i] -
|
||||||
xe_in[0].interpolators[i] +
|
xe_in[0].interpolators[i] +
|
||||||
xe_in[2].interpolators[i];
|
xe_in[2].interpolators[i];
|
||||||
}
|
}
|
||||||
|
xe_out.position = float4(xe_in[1].position.xy -
|
||||||
|
xe_in[0].position.xy +
|
||||||
|
xe_in[2].position.xy,
|
||||||
|
xe_in[2].position.zw);
|
||||||
} else {
|
} else {
|
||||||
// 0 ------ 1 0: -1,-1
|
// 0 ------ 1 0: -1,-1
|
||||||
// | - | 1: 1,-1
|
// | - | 1: 1,-1
|
||||||
// | \\ | 2: 1, 1
|
// | \\ | 2: 1, 1
|
||||||
// | - | 3: [-1, 1 ]
|
// | - | 3: [-1, 1 ]
|
||||||
// [3] ----- 2
|
// [3] ----- 2
|
||||||
xe_out.position = xe_in[0].position;
|
|
||||||
xe_out.interpolators = xe_in[0].interpolators;
|
xe_out.interpolators = xe_in[0].interpolators;
|
||||||
|
xe_out.position = xe_in[0].position;
|
||||||
xe_out.point_size = xe_in[0].point_size;
|
xe_out.point_size = xe_in[0].point_size;
|
||||||
xe_stream.Append(xe_out);
|
xe_stream.Append(xe_out);
|
||||||
xe_out.position = xe_in[2].position;
|
|
||||||
xe_out.interpolators = xe_in[2].interpolators;
|
xe_out.interpolators = xe_in[2].interpolators;
|
||||||
|
xe_out.position = xe_in[2].position;
|
||||||
xe_out.point_size = xe_in[2].point_size;
|
xe_out.point_size = xe_in[2].point_size;
|
||||||
xe_stream.Append(xe_out);
|
xe_stream.Append(xe_out);
|
||||||
xe_out.position = float4(xe_in[0].position.xy -
|
|
||||||
xe_in[1].position.xy +
|
|
||||||
xe_in[2].position.xy,
|
|
||||||
xe_in[2].position.zw);
|
|
||||||
[unroll] for (int i = 0; i < 16; ++i) {
|
[unroll] for (int i = 0; i < 16; ++i) {
|
||||||
xe_out.interpolators[i] = xe_in[0].interpolators[i] -
|
xe_out.interpolators[i] = xe_in[0].interpolators[i] -
|
||||||
xe_in[1].interpolators[i] +
|
xe_in[1].interpolators[i] +
|
||||||
xe_in[2].interpolators[i];
|
xe_in[2].interpolators[i];
|
||||||
}
|
}
|
||||||
|
xe_out.position = float4(xe_in[0].position.xy -
|
||||||
|
xe_in[1].position.xy +
|
||||||
|
xe_in[2].position.xy,
|
||||||
|
xe_in[2].position.zw);
|
||||||
}
|
}
|
||||||
xe_out.point_size = xe_in[2].point_size;
|
xe_out.point_size = xe_in[2].point_size;
|
||||||
xe_stream.Append(xe_out);
|
xe_stream.Append(xe_out);
|
||||||
|
|
|
@ -258,8 +258,8 @@ std::vector<uint8_t> HlslShaderTranslator::CompleteTranslation() {
|
||||||
"XE_BYTE_SWAP_OVERLOAD(uint4)\n"
|
"XE_BYTE_SWAP_OVERLOAD(uint4)\n"
|
||||||
"\n"
|
"\n"
|
||||||
"struct XeVertexShaderOutput {\n"
|
"struct XeVertexShaderOutput {\n"
|
||||||
" float4 position : SV_Position;\n"
|
|
||||||
" float4 interpolators[%u] : TEXCOORD;\n"
|
" float4 interpolators[%u] : TEXCOORD;\n"
|
||||||
|
" float4 position : SV_Position;\n"
|
||||||
" float point_size : PSIZE;\n"
|
" float point_size : PSIZE;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -283,8 +283,8 @@ std::vector<uint8_t> HlslShaderTranslator::CompleteTranslation() {
|
||||||
// XE_PIXEL_SHADER_WRITES_DEPTH in the beginning of the final output.
|
// XE_PIXEL_SHADER_WRITES_DEPTH in the beginning of the final output.
|
||||||
source.AppendFormat(
|
source.AppendFormat(
|
||||||
"struct XePixelShaderInput {\n"
|
"struct XePixelShaderInput {\n"
|
||||||
" float4 position : SV_Position;\n"
|
|
||||||
" float4 interpolators[%u] : TEXCOORD;\n"
|
" float4 interpolators[%u] : TEXCOORD;\n"
|
||||||
|
" float4 position : SV_Position;\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"struct XePixelShaderOutput {\n"
|
"struct XePixelShaderOutput {\n"
|
||||||
|
|
Loading…
Reference in New Issue