summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jannik Vogel2016-04-30 10:45:17 +0200
committerGravatar Jannik Vogel2016-05-03 15:06:46 +0200
commit5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec (patch)
treea5b1f1039a0dae99d4fa8ad9376723b5bbf05fa9 /src
parentPica: Make PicaShaderConfig trivially_copyable and clear it before use (diff)
downloadyuzu-5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec.tar.gz
yuzu-5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec.tar.xz
yuzu-5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec.zip
Pica: Add TevStageConfigRaw to PicaShaderConfig (MSVC workaround)
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h23
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp2
2 files changed, 23 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 47fd40f97..cc12a5f62 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -138,7 +138,28 @@ struct PicaShaderConfig {
138 }; 138 };
139 139
140 Pica::Regs::CompareFunc alpha_test_func; 140 Pica::Regs::CompareFunc alpha_test_func;
141 std::array<Pica::Regs::TevStageConfig, 6> tev_stages; 141
142 // NOTE: MSVC15 (Update 2) doesn't think `delete`'d constructors and operators are TC.
143 // This makes BitField not TC when used in a union or struct so we have to resort
144 // to this ugly hack.
145 // Once that bug is fixed we can use Pica::Regs::TevStageConfig here.
146 // Doesn't include const_color because we don't sync it, see comment in CurrentConfig()
147 struct TevStageConfigRaw {
148 u32 sources_raw;
149 u32 modifiers_raw;
150 u32 ops_raw;
151 u32 scales_raw;
152 explicit operator Pica::Regs::TevStageConfig() const noexcept {
153 Pica::Regs::TevStageConfig stage;
154 stage.sources_raw = sources_raw;
155 stage.modifiers_raw = modifiers_raw;
156 stage.ops_raw = ops_raw;
157 stage.const_color = 0;
158 stage.scales_raw = scales_raw;
159 return stage;
160 }
161 };
162 std::array<TevStageConfigRaw, 6> tev_stages;
142 u8 combiner_buffer_input; 163 u8 combiner_buffer_input;
143 164
144 struct { 165 struct {
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp
index 9011caa39..51984389c 100644
--- a/src/video_core/renderer_opengl/gl_shader_gen.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -287,7 +287,7 @@ static void AppendAlphaTestCondition(std::string& out, Regs::CompareFunc func) {
287 287
288/// Writes the code to emulate the specified TEV stage 288/// Writes the code to emulate the specified TEV stage
289static void WriteTevStage(std::string& out, const PicaShaderConfig& config, unsigned index) { 289static void WriteTevStage(std::string& out, const PicaShaderConfig& config, unsigned index) {
290 auto& stage = config.tev_stages[index]; 290 const auto stage = static_cast<const Pica::Regs::TevStageConfig>(config.tev_stages[index]);
291 if (!IsPassThroughTevStage(stage)) { 291 if (!IsPassThroughTevStage(stage)) {
292 std::string index_name = std::to_string(index); 292 std::string index_name = std::to_string(index);
293 293