summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorJannik Vogel <email@jannikvogel.de>2016-04-30 10:45:17 +0200
committerJannik Vogel <email@jannikvogel.de>2016-05-03 15:06:46 +0200
commit5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec (patch)
treea5b1f1039a0dae99d4fa8ad9376723b5bbf05fa9 /src/video_core
parentPica: Make PicaShaderConfig trivially_copyable and clear it before use (diff)
downloadyuzu-5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec.tar
yuzu-5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec.tar.gz
yuzu-5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec.tar.bz2
yuzu-5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec.tar.lz
yuzu-5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec.tar.xz
yuzu-5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec.tar.zst
yuzu-5fc8eb227a6a70b0cc9b268fb9d2f693af0d8fec.zip
Diffstat (limited to 'src/video_core')
-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 {
};
Pica::Regs::CompareFunc alpha_test_func;
- std::array<Pica::Regs::TevStageConfig, 6> tev_stages;
+
+ // NOTE: MSVC15 (Update 2) doesn't think `delete`'d constructors and operators are TC.
+ // This makes BitField not TC when used in a union or struct so we have to resort
+ // to this ugly hack.
+ // Once that bug is fixed we can use Pica::Regs::TevStageConfig here.
+ // Doesn't include const_color because we don't sync it, see comment in CurrentConfig()
+ struct TevStageConfigRaw {
+ u32 sources_raw;
+ u32 modifiers_raw;
+ u32 ops_raw;
+ u32 scales_raw;
+ explicit operator Pica::Regs::TevStageConfig() const noexcept {
+ Pica::Regs::TevStageConfig stage;
+ stage.sources_raw = sources_raw;
+ stage.modifiers_raw = modifiers_raw;
+ stage.ops_raw = ops_raw;
+ stage.const_color = 0;
+ stage.scales_raw = scales_raw;
+ return stage;
+ }
+ };
+ std::array<TevStageConfigRaw, 6> tev_stages;
u8 combiner_buffer_input;
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) {
/// Writes the code to emulate the specified TEV stage
static void WriteTevStage(std::string& out, const PicaShaderConfig& config, unsigned index) {
- auto& stage = config.tev_stages[index];
+ const auto stage = static_cast<const Pica::Regs::TevStageConfig>(config.tev_stages[index]);
if (!IsPassThroughTevStage(stage)) {
std::string index_name = std::to_string(index);