summaryrefslogtreecommitdiff
path: root/src/video_core/engines
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2018-10-06 23:17:31 -0300
committerGravatar ReinUsesLisp2018-10-07 17:36:00 -0300
commitee4d53885099fee4290626b8940fcc3abbbb5e12 (patch)
tree07ed08b2ef168a1b13f6eca3f176f4ec651a9d82 /src/video_core/engines
parentvideo_core: Allow LabelGLObject to use extra info on any object (diff)
downloadyuzu-ee4d53885099fee4290626b8940fcc3abbbb5e12.tar.gz
yuzu-ee4d53885099fee4290626b8940fcc3abbbb5e12.tar.xz
yuzu-ee4d53885099fee4290626b8940fcc3abbbb5e12.zip
gl_shader_decompiler: Implement geometry shaders
Diffstat (limited to 'src/video_core/engines')
-rw-r--r--src/video_core/engines/shader_bytecode.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index b1f137b9c..550ab1148 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -314,6 +314,15 @@ enum class TextureMiscMode : u64 {
314 PTP, 314 PTP,
315}; 315};
316 316
317enum class IsberdMode : u64 {
318 None = 0,
319 Patch = 1,
320 Prim = 2,
321 Attr = 3,
322};
323
324enum class IsberdShift : u64 { None = 0, U16 = 1, B32 = 2 };
325
317enum class IpaInterpMode : u64 { 326enum class IpaInterpMode : u64 {
318 Linear = 0, 327 Linear = 0,
319 Perspective = 1, 328 Perspective = 1,
@@ -340,6 +349,87 @@ struct IpaMode {
340 } 349 }
341}; 350};
342 351
352enum class SystemVariable : u64 {
353 LaneId = 0x00,
354 VirtCfg = 0x02,
355 VirtId = 0x03,
356 Pm0 = 0x04,
357 Pm1 = 0x05,
358 Pm2 = 0x06,
359 Pm3 = 0x07,
360 Pm4 = 0x08,
361 Pm5 = 0x09,
362 Pm6 = 0x0a,
363 Pm7 = 0x0b,
364 OrderingTicket = 0x0f,
365 PrimType = 0x10,
366 InvocationId = 0x11,
367 Ydirection = 0x12,
368 ThreadKill = 0x13,
369 ShaderType = 0x14,
370 DirectBeWriteAddressLow = 0x15,
371 DirectBeWriteAddressHigh = 0x16,
372 DirectBeWriteEnabled = 0x17,
373 MachineId0 = 0x18,
374 MachineId1 = 0x19,
375 MachineId2 = 0x1a,
376 MachineId3 = 0x1b,
377 Affinity = 0x1c,
378 InvocationInfo = 0x1d,
379 WscaleFactorXY = 0x1e,
380 WscaleFactorZ = 0x1f,
381 Tid = 0x20,
382 TidX = 0x21,
383 TidY = 0x22,
384 TidZ = 0x23,
385 CtaParam = 0x24,
386 CtaIdX = 0x25,
387 CtaIdY = 0x26,
388 CtaIdZ = 0x27,
389 NtId = 0x28,
390 CirQueueIncrMinusOne = 0x29,
391 Nlatc = 0x2a,
392 SmSpaVersion = 0x2c,
393 MultiPassShaderInfo = 0x2d,
394 LwinHi = 0x2e,
395 SwinHi = 0x2f,
396 SwinLo = 0x30,
397 SwinSz = 0x31,
398 SmemSz = 0x32,
399 SmemBanks = 0x33,
400 LwinLo = 0x34,
401 LwinSz = 0x35,
402 LmemLosz = 0x36,
403 LmemHioff = 0x37,
404 EqMask = 0x38,
405 LtMask = 0x39,
406 LeMask = 0x3a,
407 GtMask = 0x3b,
408 GeMask = 0x3c,
409 RegAlloc = 0x3d,
410 CtxAddr = 0x3e, // .fmask = F_SM50
411 BarrierAlloc = 0x3e, // .fmask = F_SM60
412 GlobalErrorStatus = 0x40,
413 WarpErrorStatus = 0x42,
414 WarpErrorStatusClear = 0x43,
415 PmHi0 = 0x48,
416 PmHi1 = 0x49,
417 PmHi2 = 0x4a,
418 PmHi3 = 0x4b,
419 PmHi4 = 0x4c,
420 PmHi5 = 0x4d,
421 PmHi6 = 0x4e,
422 PmHi7 = 0x4f,
423 ClockLo = 0x50,
424 ClockHi = 0x51,
425 GlobalTimerLo = 0x52,
426 GlobalTimerHi = 0x53,
427 HwTaskId = 0x60,
428 CircularQueueEntryIndex = 0x61,
429 CircularQueueEntryAddressLow = 0x62,
430 CircularQueueEntryAddressHigh = 0x63,
431};
432
343union Instruction { 433union Instruction {
344 Instruction& operator=(const Instruction& instr) { 434 Instruction& operator=(const Instruction& instr) {
345 value = instr.value; 435 value = instr.value;
@@ -915,6 +1005,18 @@ union Instruction {
915 } bra; 1005 } bra;
916 1006
917 union { 1007 union {
1008 BitField<39, 1, u64> emit; // EmitVertex
1009 BitField<40, 1, u64> cut; // EndPrimitive
1010 } out;
1011
1012 union {
1013 BitField<31, 1, u64> skew;
1014 BitField<32, 1, u64> o;
1015 BitField<33, 2, IsberdMode> mode;
1016 BitField<47, 2, IsberdShift> shift;
1017 } isberd;
1018
1019 union {
918 BitField<20, 16, u64> imm20_16; 1020 BitField<20, 16, u64> imm20_16;
919 BitField<36, 1, u64> product_shift_left; 1021 BitField<36, 1, u64> product_shift_left;
920 BitField<37, 1, u64> merge_37; 1022 BitField<37, 1, u64> merge_37;
@@ -936,6 +1038,10 @@ union Instruction {
936 BitField<36, 5, u64> index; 1038 BitField<36, 5, u64> index;
937 } cbuf36; 1039 } cbuf36;
938 1040
1041 // Unsure about the size of this one.
1042 // It's always used with a gpr0, so any size should be fine.
1043 BitField<20, 8, SystemVariable> sys20;
1044
939 BitField<47, 1, u64> generates_cc; 1045 BitField<47, 1, u64> generates_cc;
940 BitField<61, 1, u64> is_b_imm; 1046 BitField<61, 1, u64> is_b_imm;
941 BitField<60, 1, u64> is_b_gpr; 1047 BitField<60, 1, u64> is_b_gpr;
@@ -975,6 +1081,8 @@ public:
975 TMML, // Texture Mip Map Level 1081 TMML, // Texture Mip Map Level
976 EXIT, 1082 EXIT,
977 IPA, 1083 IPA,
1084 OUT_R, // Emit vertex/primitive
1085 ISBERD,
978 FFMA_IMM, // Fused Multiply and Add 1086 FFMA_IMM, // Fused Multiply and Add
979 FFMA_CR, 1087 FFMA_CR,
980 FFMA_RC, 1088 FFMA_RC,
@@ -1034,6 +1142,7 @@ public:
1034 MOV_C, 1142 MOV_C,
1035 MOV_R, 1143 MOV_R,
1036 MOV_IMM, 1144 MOV_IMM,
1145 MOV_SYS,
1037 MOV32_IMM, 1146 MOV32_IMM,
1038 SHL_C, 1147 SHL_C,
1039 SHL_R, 1148 SHL_R,
@@ -1209,6 +1318,8 @@ private:
1209 INST("1101111101011---", Id::TMML, Type::Memory, "TMML"), 1318 INST("1101111101011---", Id::TMML, Type::Memory, "TMML"),
1210 INST("111000110000----", Id::EXIT, Type::Trivial, "EXIT"), 1319 INST("111000110000----", Id::EXIT, Type::Trivial, "EXIT"),
1211 INST("11100000--------", Id::IPA, Type::Trivial, "IPA"), 1320 INST("11100000--------", Id::IPA, Type::Trivial, "IPA"),
1321 INST("1111101111100---", Id::OUT_R, Type::Trivial, "OUT_R"),
1322 INST("1110111111010---", Id::ISBERD, Type::Trivial, "ISBERD"),
1212 INST("0011001-1-------", Id::FFMA_IMM, Type::Ffma, "FFMA_IMM"), 1323 INST("0011001-1-------", Id::FFMA_IMM, Type::Ffma, "FFMA_IMM"),
1213 INST("010010011-------", Id::FFMA_CR, Type::Ffma, "FFMA_CR"), 1324 INST("010010011-------", Id::FFMA_CR, Type::Ffma, "FFMA_CR"),
1214 INST("010100011-------", Id::FFMA_RC, Type::Ffma, "FFMA_RC"), 1325 INST("010100011-------", Id::FFMA_RC, Type::Ffma, "FFMA_RC"),
@@ -1255,6 +1366,7 @@ private:
1255 INST("0100110010011---", Id::MOV_C, Type::Arithmetic, "MOV_C"), 1366 INST("0100110010011---", Id::MOV_C, Type::Arithmetic, "MOV_C"),
1256 INST("0101110010011---", Id::MOV_R, Type::Arithmetic, "MOV_R"), 1367 INST("0101110010011---", Id::MOV_R, Type::Arithmetic, "MOV_R"),
1257 INST("0011100-10011---", Id::MOV_IMM, Type::Arithmetic, "MOV_IMM"), 1368 INST("0011100-10011---", Id::MOV_IMM, Type::Arithmetic, "MOV_IMM"),
1369 INST("1111000011001---", Id::MOV_SYS, Type::Trivial, "MOV_SYS"),
1258 INST("000000010000----", Id::MOV32_IMM, Type::ArithmeticImmediate, "MOV32_IMM"), 1370 INST("000000010000----", Id::MOV32_IMM, Type::ArithmeticImmediate, "MOV32_IMM"),
1259 INST("0100110001100---", Id::FMNMX_C, Type::Arithmetic, "FMNMX_C"), 1371 INST("0100110001100---", Id::FMNMX_C, Type::Arithmetic, "FMNMX_C"),
1260 INST("0101110001100---", Id::FMNMX_R, Type::Arithmetic, "FMNMX_R"), 1372 INST("0101110001100---", Id::FMNMX_R, Type::Arithmetic, "FMNMX_R"),