diff options
author | Jannik Vogel <email@jannikvogel.de> | 2016-05-13 08:46:14 +0200 |
---|---|---|
committer | Jannik Vogel <email@jannikvogel.de> | 2016-05-13 09:20:14 +0200 |
commit | 4e01e9ffc54ddfc9a1a5b285b4434e2f3ac4854e (patch) | |
tree | 5c7873636fe7317c6c4489292c48a2a8f7f41595 /src/video_core/shader/shader.h | |
parent | Merge pull request #1695 from Subv/tls_alloc (diff) | |
download | yuzu-4e01e9ffc54ddfc9a1a5b285b4434e2f3ac4854e.tar yuzu-4e01e9ffc54ddfc9a1a5b285b4434e2f3ac4854e.tar.gz yuzu-4e01e9ffc54ddfc9a1a5b285b4434e2f3ac4854e.tar.bz2 yuzu-4e01e9ffc54ddfc9a1a5b285b4434e2f3ac4854e.tar.lz yuzu-4e01e9ffc54ddfc9a1a5b285b4434e2f3ac4854e.tar.xz yuzu-4e01e9ffc54ddfc9a1a5b285b4434e2f3ac4854e.tar.zst yuzu-4e01e9ffc54ddfc9a1a5b285b4434e2f3ac4854e.zip |
Diffstat (limited to 'src/video_core/shader/shader.h')
-rw-r--r-- | src/video_core/shader/shader.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h index 983e4a967..84898f21c 100644 --- a/src/video_core/shader/shader.h +++ b/src/video_core/shader/shader.h @@ -283,10 +283,10 @@ struct UnitState { static size_t InputOffset(const SourceRegister& reg) { switch (reg.GetRegisterType()) { case RegisterType::Input: - return offsetof(UnitState::Registers, input) + reg.GetIndex()*sizeof(Math::Vec4<float24>); + return offsetof(UnitState, registers.input) + reg.GetIndex()*sizeof(Math::Vec4<float24>); case RegisterType::Temporary: - return offsetof(UnitState::Registers, temporary) + reg.GetIndex()*sizeof(Math::Vec4<float24>); + return offsetof(UnitState, registers.temporary) + reg.GetIndex()*sizeof(Math::Vec4<float24>); default: UNREACHABLE(); @@ -297,10 +297,10 @@ struct UnitState { static size_t OutputOffset(const DestRegister& reg) { switch (reg.GetRegisterType()) { case RegisterType::Output: - return offsetof(UnitState::Registers, output) + reg.GetIndex()*sizeof(Math::Vec4<float24>); + return offsetof(UnitState, registers.output) + reg.GetIndex()*sizeof(Math::Vec4<float24>); case RegisterType::Temporary: - return offsetof(UnitState::Registers, temporary) + reg.GetIndex()*sizeof(Math::Vec4<float24>); + return offsetof(UnitState, registers.temporary) + reg.GetIndex()*sizeof(Math::Vec4<float24>); default: UNREACHABLE(); @@ -323,6 +323,23 @@ struct ShaderSetup { std::array<Math::Vec4<u8>, 4> i; } uniforms; + static size_t UniformOffset(RegisterType type, unsigned index) { + switch (type) { + case RegisterType::FloatUniform: + return offsetof(ShaderSetup, uniforms.f) + index*sizeof(Math::Vec4<float24>); + + case RegisterType::BoolUniform: + return offsetof(ShaderSetup, uniforms.b) + index*sizeof(bool); + + case RegisterType::IntUniform: + return offsetof(ShaderSetup, uniforms.i) + index*sizeof(Math::Vec4<u8>); + + default: + UNREACHABLE(); + return 0; + } + } + std::array<u32, 1024> program_code; std::array<u32, 1024> swizzle_data; |