summaryrefslogtreecommitdiff
path: root/src/video_core/engines
diff options
context:
space:
mode:
authorGravatar bunnei2018-04-15 20:45:56 -0400
committerGravatar bunnei2018-04-17 16:36:42 -0400
commit5a28dce9eb8db4571cc47352174c78f2c3cfd606 (patch)
treef879ecc81cb6737df1e2e0adea45acf53cba1e1e /src/video_core/engines
parentgl_shader_decompiler: Allow vertex position to be used in fragment shader. (diff)
downloadyuzu-5a28dce9eb8db4571cc47352174c78f2c3cfd606.tar.gz
yuzu-5a28dce9eb8db4571cc47352174c78f2c3cfd606.tar.xz
yuzu-5a28dce9eb8db4571cc47352174c78f2c3cfd606.zip
gl_shader_decompiler: Implement FMUL/FADD/FFMA immediate instructions.
Diffstat (limited to 'src/video_core/engines')
-rw-r--r--src/video_core/engines/shader_bytecode.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index 51cf4af9f..c368fa7fd 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstring>
7#include <map> 8#include <map>
8#include <string> 9#include <string>
9#include "common/bit_field.h" 10#include "common/bit_field.h"
@@ -289,6 +290,7 @@ enum class SubOp : u64 {
289 Lg2 = 0x3, 290 Lg2 = 0x3,
290 Rcp = 0x4, 291 Rcp = 0x4,
291 Rsq = 0x5, 292 Rsq = 0x5,
293 Min = 0x8,
292}; 294};
293 295
294union Instruction { 296union Instruction {
@@ -307,11 +309,22 @@ union Instruction {
307 BitField<39, 8, Register> gpr39; 309 BitField<39, 8, Register> gpr39;
308 310
309 union { 311 union {
312 BitField<20, 19, u64> imm20;
310 BitField<45, 1, u64> negate_b; 313 BitField<45, 1, u64> negate_b;
311 BitField<46, 1, u64> abs_a; 314 BitField<46, 1, u64> abs_a;
312 BitField<48, 1, u64> negate_a; 315 BitField<48, 1, u64> negate_a;
313 BitField<49, 1, u64> abs_b; 316 BitField<49, 1, u64> abs_b;
314 BitField<50, 1, u64> abs_d; 317 BitField<50, 1, u64> abs_d;
318 BitField<56, 1, u64> negate_imm;
319
320 float GetImm20() const {
321 float result{};
322 u32 imm{static_cast<u32>(imm20)};
323 imm <<= 12;
324 imm |= negate_imm ? 0x80000000 : 0;
325 std::memcpy(&result, &imm, sizeof(imm));
326 return result;
327 }
315 } alu; 328 } alu;
316 329
317 union { 330 union {
@@ -319,6 +332,7 @@ union Instruction {
319 BitField<49, 1, u64> negate_c; 332 BitField<49, 1, u64> negate_c;
320 } ffma; 333 } ffma;
321 334
335 BitField<61, 1, u64> is_b_imm;
322 BitField<60, 1, u64> is_b_gpr; 336 BitField<60, 1, u64> is_b_gpr;
323 BitField<59, 1, u64> is_c_gpr; 337 BitField<59, 1, u64> is_c_gpr;
324 338