Browse Source

Pica: Add TevStageConfigRaw to PicaShaderConfig (MSVC workaround)

pull/15/merge
Jannik Vogel 10 years ago
parent
commit
5fc8eb227a
  1. 23
      src/video_core/renderer_opengl/gl_rasterizer.h
  2. 2
      src/video_core/renderer_opengl/gl_shader_gen.cpp

23
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 {

2
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);

Loading…
Cancel
Save