mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-18 17:40:05 +00:00
OpenGL: Pass Pica regs via parameter
This commit is contained in:
parent
a6fd4533f6
commit
52a4489d65
@ -1004,7 +1004,7 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SetShader() {
|
void RasterizerOpenGL::SetShader() {
|
||||||
GLShader::PicaShaderConfig config = GLShader::PicaShaderConfig::CurrentConfig();
|
auto config = GLShader::PicaShaderConfig::BuildFromRegs(Pica::g_state.regs);
|
||||||
std::unique_ptr<PicaShader> shader = std::make_unique<PicaShader>();
|
std::unique_ptr<PicaShader> shader = std::make_unique<PicaShader>();
|
||||||
|
|
||||||
// Find (or generate) the GLSL shader for the current TEV state
|
// Find (or generate) the GLSL shader for the current TEV state
|
||||||
|
@ -24,14 +24,12 @@ using TevStageConfig = TexturingRegs::TevStageConfig;
|
|||||||
|
|
||||||
namespace GLShader {
|
namespace GLShader {
|
||||||
|
|
||||||
PicaShaderConfig PicaShaderConfig::CurrentConfig() {
|
PicaShaderConfig PicaShaderConfig::BuildFromRegs(const Pica::Regs& regs) {
|
||||||
PicaShaderConfig res;
|
PicaShaderConfig res;
|
||||||
|
|
||||||
auto& state = res.state;
|
auto& state = res.state;
|
||||||
std::memset(&state, 0, sizeof(PicaShaderConfig::State));
|
std::memset(&state, 0, sizeof(PicaShaderConfig::State));
|
||||||
|
|
||||||
const auto& regs = Pica::g_state.regs;
|
|
||||||
|
|
||||||
state.scissor_test_mode = regs.rasterizer.scissor_test.mode;
|
state.scissor_test_mode = regs.rasterizer.scissor_test.mode;
|
||||||
|
|
||||||
state.depthmap_enable = regs.rasterizer.depthmap_enable;
|
state.depthmap_enable = regs.rasterizer.depthmap_enable;
|
||||||
|
@ -39,8 +39,8 @@ enum Attributes {
|
|||||||
*/
|
*/
|
||||||
union PicaShaderConfig {
|
union PicaShaderConfig {
|
||||||
|
|
||||||
/// Construct a PicaShaderConfig with the current Pica register configuration.
|
/// Construct a PicaShaderConfig with the given Pica register configuration.
|
||||||
static PicaShaderConfig CurrentConfig();
|
static PicaShaderConfig BuildFromRegs(const Pica::Regs& regs);
|
||||||
|
|
||||||
bool TevStageUpdatesCombinerBufferColor(unsigned stage_index) const {
|
bool TevStageUpdatesCombinerBufferColor(unsigned stage_index) const {
|
||||||
return (stage_index < 4) && (state.combiner_buffer_input & (1 << stage_index));
|
return (stage_index < 4) && (state.combiner_buffer_input & (1 << stage_index));
|
||||||
@ -58,7 +58,7 @@ union PicaShaderConfig {
|
|||||||
// This makes BitField not TC when used in a union or struct so we have to resort
|
// This makes BitField not TC when used in a union or struct so we have to resort
|
||||||
// to this ugly hack.
|
// to this ugly hack.
|
||||||
// Once that bug is fixed we can use Pica::Regs::TevStageConfig here.
|
// 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()
|
// Doesn't include const_color because we don't sync it, see comment in BuildFromRegs()
|
||||||
struct TevStageConfigRaw {
|
struct TevStageConfigRaw {
|
||||||
u32 sources_raw;
|
u32 sources_raw;
|
||||||
u32 modifiers_raw;
|
u32 modifiers_raw;
|
||||||
|
Loading…
Reference in New Issue
Block a user