Pica: Add TevStageConfigRaw to PicaShaderConfig (MSVC workaround)

master
Jannik Vogel 2016-04-30 10:45:17 +07:00
parent f3f7018c9e
commit 5fc8eb227a
2 changed files with 23 additions and 2 deletions

@ -138,7 +138,28 @@ struct PicaShaderConfig {
}; };
Pica::Regs::CompareFunc alpha_test_func; 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; u8 combiner_buffer_input;
struct { struct {

@ -287,7 +287,7 @@ static void AppendAlphaTestCondition(std::string& out, Regs::CompareFunc func) {
/// Writes the code to emulate the specified TEV stage /// Writes the code to emulate the specified TEV stage
static void WriteTevStage(std::string& out, const PicaShaderConfig& config, unsigned index) { 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)) { if (!IsPassThroughTevStage(stage)) {
std::string index_name = std::to_string(index); std::string index_name = std::to_string(index);