Commit graph

6186 commits

Author SHA1 Message Date
Anthony Miles
949aecd862 Set optimization level 0 2019-12-18 20:12:24 +01:00
PatrickvL
adc065b0bc Revert "TMP mechassault hack"
This reverts commit d616e94c117d3e1f0e8ce35bfc97d9f845d3c5b7.
2019-12-18 20:12:24 +01:00
PatrickvL
325e663c9f Further cleanup 2019-12-18 20:12:24 +01:00
PatrickvL
ac36e6a0d4 Avoid using uninitialized class members 2019-12-18 20:12:24 +01:00
PatrickvL
ebbb8e961f Moved a few functions to a better suitable location, and marked a few class functions 'static' 2019-12-18 20:12:24 +01:00
PatrickvL
18a27a64de Refactor vertex shader decoding types and functions into a class 2019-12-18 20:12:23 +01:00
patrickvl
eeced5f0a9 Removed one unnecessary intermediate vertex shader decoding layer 2019-12-18 20:12:23 +01:00
patrickvl
5fe0a16cc6 Renamed vertex shader hlsl file, and prepared it for future extensions to behave closer to specifications (nothing changed for now) 2019-12-18 20:12:23 +01:00
patrickvl
cc594ca8d7 Further simplifications in vertex shader decoding to intermediate instructions 2019-12-18 20:12:22 +01:00
Anthony Miles
9ee7bb451f Fix logp z component 2019-12-18 20:12:22 +01:00
Anthony Miles
f9e5f51815 Fix dph src1.w double-add 2019-12-18 20:12:22 +01:00
Anthony Miles
1cebf018e2 Use int instead of uint for compatibility with optimizer level 0 2019-12-18 20:12:21 +01:00
Anthony Miles
f8b1e35482 fix pInstruction typo 2019-12-18 20:12:21 +01:00
Anthony Miles
ab1061634d TMP mechassault hack 2019-12-18 20:12:21 +01:00
Anthony Miles
0aa0dce8fb Hack to make sure pre-transformed and regular geometry go into the same coordinate space 2019-12-18 20:12:20 +01:00
PatrickvL
ec2032bf0d Made sure that intermediate vertex shader instructions are never empty
Move A0_X indexing boolean from per-parameter to per-instruction, where it belongs.
2019-12-18 20:12:20 +01:00
PatrickvL
ff1412b3d9 Use an HLSL accessor function for reading constant registers, allowing Xbox-native negative indices and out-of-bounds handling. This makes the generated HLSL look closed to the original Xbox vertex shader assembly. 2019-12-18 20:12:20 +01:00
PatrickvL
d74e5947ee Refactor vertex shader microcode conversion to intermediate isntructions, fixing pairing bugs like ignore MAC R1 writes 2019-12-18 20:12:20 +01:00
PatrickvL
50a51657b0 Force A0's X mask during decoding (in VshAddInstructionMAC_ARL) instead of HLSL conversion (in OutputHlsl)
Also applied Unix EOL style (again)
2019-12-18 20:12:20 +01:00
Anthony Miles
619b276d81 Generate more accurate viewport values, so we can reverse transforms in the vertex shader more generally 2019-12-18 20:12:19 +01:00
Anthony Miles
5d2ef854fb Remove popups about register usage, now that HLSL is used 2019-12-18 20:12:19 +01:00
Anthony Miles
b9db301791 Add LOG_TEST_CASE for writes to constants 2019-12-18 20:12:19 +01:00
Anthony Miles
136083d72a SetVertexData4f support 2019-12-18 20:12:19 +01:00
patrickvl
ba5d25e2ed Only disassemble HLSL under debug log level
Fix arl by forcing .x mask on a0 parameter
2019-12-18 20:12:19 +01:00
patrickvl
b330198fe6 Reorder vertex shader code 2019-12-18 20:12:19 +01:00
patrickvl
1365d2e7e1 Vertex shader HLSL : More commenting, reordering, renaming and fixing 2019-12-18 20:12:18 +01:00
patrickvl
cb95bbb46f Make sure HLSL scalar outputs are replicated 2019-12-18 20:12:17 +01:00
patrickvl
a0de74ffd9 Make sure all HLSL parameters regardless their swizzle, are cast to float4 before the actual calculation commences 2019-12-18 20:12:17 +01:00
patrickvl
8ed16b9f5a Reorder vertex shader decoding code 2019-12-18 20:12:15 +01:00
PatrickvL
07ceaf96d5 Avoid all implicit typecast warnings, by casting all HSLS calculations to a float4, and apply the output mask to that as well 2019-12-18 20:12:15 +01:00
PatrickvL
339af7b500 Pass mask as argument into the opcode defines.
Also fixed a few HLSL issues that crept in the previous commit
2019-12-18 20:12:15 +01:00
PatrickvL
5b2ff4e278 Simpler determination of used parameters per opcode 2019-12-18 20:12:14 +01:00
PatrickvL
127e51302e Wrap (or replace) HLSL functions with defines, so that destination swizzles work as expected without too much syntax deviation.
Also adjusted a few hlshl functions to be more accurate
2019-12-18 20:12:14 +01:00
PatrickvL
46fbfad52d Remove assembly version and replace regex with dedicated streaming 2019-12-18 20:12:14 +01:00
PatrickvL
c039562e7f Reformat HLSL code
Prefer HLSL functions over #defines
Avoid implicit conversion warnings in HLSL template code
Move scalar W selection towards HLSL helper function
Apply scalar component fixup after instead of before conversion to HLSL
2019-12-18 20:12:14 +01:00
Anthony Miles
200b7c493e Use log2, exp2 2019-12-18 20:12:14 +01:00
Anthony Miles
bd55f17f0d - Move ILU ops together
- Some ops use the .w component by default. Ensure they will use w instead of x, if the default xyzw swizzle was used
2019-12-18 20:12:14 +01:00
Anthony Miles
59c8ee936f Add line numbers to shader debug 2019-12-18 20:12:14 +01:00
Anthony Miles
05f1f90603 fixup texcoord comments 2019-12-18 20:12:13 +01:00
Anthony Miles
b61bfd32af - Use MAC defines, remove functions
- Fix truncation compiler warning in x_dp3
2019-12-18 20:12:12 +01:00
Anthony Miles
eaa7bbca41 At debug log level, log shader warnings even if the shader compiled 2019-12-18 20:12:12 +01:00
PatrickvL
a9d3b5cdde Better hlsl consistency 2019-12-18 20:12:12 +01:00
PatrickvL
c1ba533455 Include the hlsl code as a raw string
Make all Xbox VSh opcodes consistent (using an x_ function or macro)
Replace switch statements with table lookups, making the code much more compact
2019-12-18 20:12:11 +01:00
Anthony Miles
e372a80a8d Workaround bad masks on single component outputs 2019-12-18 20:12:09 +01:00
Anthony Miles
a258d5d759 file location hack 2019-12-18 20:12:09 +01:00
Anthony Miles
5d21af8a0e Implement more HLSL functions 2019-12-18 20:12:09 +01:00
Luke Usher
19f0affd21 Negate Screen Space Transforms instead of deleting from shader 2019-12-18 20:12:08 +01:00
Anthony Miles
fd1555535e HACK
Get HLSL compiling
2019-12-18 20:12:08 +01:00
Anthony Miles
8382adfaab fixup dp3, dph 2019-12-18 20:12:08 +01:00
Anthony Miles
620c98da80 Interpret r12 as oPos 2019-12-18 20:12:08 +01:00