1
0
Fork 0

Merge pull request #4936 from BreadFish64/msvc-hack-extermination

remove ugly msvc hack
This commit is contained in:
Weiyi Wang 2019-09-16 16:01:35 -04:00 committed by GitHub
commit 3631490756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 204 additions and 233 deletions

View File

@ -156,9 +156,9 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
break; break;
// Load default vertex input attributes // Load default vertex input attributes
case PICA_REG_INDEX_WORKAROUND(pipeline.vs_default_attributes_setup.set_value[0], 0x233): case PICA_REG_INDEX(pipeline.vs_default_attributes_setup.set_value[0]):
case PICA_REG_INDEX_WORKAROUND(pipeline.vs_default_attributes_setup.set_value[1], 0x234): case PICA_REG_INDEX(pipeline.vs_default_attributes_setup.set_value[1]):
case PICA_REG_INDEX_WORKAROUND(pipeline.vs_default_attributes_setup.set_value[2], 0x235): { case PICA_REG_INDEX(pipeline.vs_default_attributes_setup.set_value[2]): {
// TODO: Does actual hardware indeed keep an intermediate buffer or does // TODO: Does actual hardware indeed keep an intermediate buffer or does
// it directly write the values? // it directly write the values?
g_state.default_attr_write_buffer[g_state.default_attr_counter++] = value; g_state.default_attr_write_buffer[g_state.default_attr_counter++] = value;
@ -254,8 +254,8 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
// This register likely just enables vertex processing and doesn't need any special handling // This register likely just enables vertex processing and doesn't need any special handling
break; break;
case PICA_REG_INDEX_WORKAROUND(pipeline.command_buffer.trigger[0], 0x23c): case PICA_REG_INDEX(pipeline.command_buffer.trigger[0]):
case PICA_REG_INDEX_WORKAROUND(pipeline.command_buffer.trigger[1], 0x23d): { case PICA_REG_INDEX(pipeline.command_buffer.trigger[1]): {
unsigned index = unsigned index =
static_cast<unsigned>(id - PICA_REG_INDEX(pipeline.command_buffer.trigger[0])); static_cast<unsigned>(id - PICA_REG_INDEX(pipeline.command_buffer.trigger[0]));
u32* head_ptr = (u32*)VideoCore::g_memory->GetPhysicalPointer( u32* head_ptr = (u32*)VideoCore::g_memory->GetPhysicalPointer(
@ -429,38 +429,38 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
WriteUniformBoolReg(g_state.gs, g_state.regs.gs.bool_uniforms.Value()); WriteUniformBoolReg(g_state.gs, g_state.regs.gs.bool_uniforms.Value());
break; break;
case PICA_REG_INDEX_WORKAROUND(gs.int_uniforms[0], 0x281): case PICA_REG_INDEX(gs.int_uniforms[0]):
case PICA_REG_INDEX_WORKAROUND(gs.int_uniforms[1], 0x282): case PICA_REG_INDEX(gs.int_uniforms[1]):
case PICA_REG_INDEX_WORKAROUND(gs.int_uniforms[2], 0x283): case PICA_REG_INDEX(gs.int_uniforms[2]):
case PICA_REG_INDEX_WORKAROUND(gs.int_uniforms[3], 0x284): { case PICA_REG_INDEX(gs.int_uniforms[3]): {
unsigned index = (id - PICA_REG_INDEX_WORKAROUND(gs.int_uniforms[0], 0x281)); unsigned index = (id - PICA_REG_INDEX(gs.int_uniforms[0]));
auto values = regs.gs.int_uniforms[index]; auto values = regs.gs.int_uniforms[index];
WriteUniformIntReg(g_state.gs, index, WriteUniformIntReg(g_state.gs, index,
Common::Vec4<u8>(values.x, values.y, values.z, values.w)); Common::Vec4<u8>(values.x, values.y, values.z, values.w));
break; break;
} }
case PICA_REG_INDEX_WORKAROUND(gs.uniform_setup.set_value[0], 0x291): case PICA_REG_INDEX(gs.uniform_setup.set_value[0]):
case PICA_REG_INDEX_WORKAROUND(gs.uniform_setup.set_value[1], 0x292): case PICA_REG_INDEX(gs.uniform_setup.set_value[1]):
case PICA_REG_INDEX_WORKAROUND(gs.uniform_setup.set_value[2], 0x293): case PICA_REG_INDEX(gs.uniform_setup.set_value[2]):
case PICA_REG_INDEX_WORKAROUND(gs.uniform_setup.set_value[3], 0x294): case PICA_REG_INDEX(gs.uniform_setup.set_value[3]):
case PICA_REG_INDEX_WORKAROUND(gs.uniform_setup.set_value[4], 0x295): case PICA_REG_INDEX(gs.uniform_setup.set_value[4]):
case PICA_REG_INDEX_WORKAROUND(gs.uniform_setup.set_value[5], 0x296): case PICA_REG_INDEX(gs.uniform_setup.set_value[5]):
case PICA_REG_INDEX_WORKAROUND(gs.uniform_setup.set_value[6], 0x297): case PICA_REG_INDEX(gs.uniform_setup.set_value[6]):
case PICA_REG_INDEX_WORKAROUND(gs.uniform_setup.set_value[7], 0x298): { case PICA_REG_INDEX(gs.uniform_setup.set_value[7]): {
WriteUniformFloatReg(g_state.regs.gs, g_state.gs, g_state.gs_float_regs_counter, WriteUniformFloatReg(g_state.regs.gs, g_state.gs, g_state.gs_float_regs_counter,
g_state.gs_uniform_write_buffer, value); g_state.gs_uniform_write_buffer, value);
break; break;
} }
case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[0], 0x29c): case PICA_REG_INDEX(gs.program.set_word[0]):
case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[1], 0x29d): case PICA_REG_INDEX(gs.program.set_word[1]):
case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[2], 0x29e): case PICA_REG_INDEX(gs.program.set_word[2]):
case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[3], 0x29f): case PICA_REG_INDEX(gs.program.set_word[3]):
case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[4], 0x2a0): case PICA_REG_INDEX(gs.program.set_word[4]):
case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[5], 0x2a1): case PICA_REG_INDEX(gs.program.set_word[5]):
case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[6], 0x2a2): case PICA_REG_INDEX(gs.program.set_word[6]):
case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[7], 0x2a3): { case PICA_REG_INDEX(gs.program.set_word[7]): {
u32& offset = g_state.regs.gs.program.offset; u32& offset = g_state.regs.gs.program.offset;
if (offset >= 4096) { if (offset >= 4096) {
LOG_ERROR(HW_GPU, "Invalid GS program offset {}", offset); LOG_ERROR(HW_GPU, "Invalid GS program offset {}", offset);
@ -472,14 +472,14 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
break; break;
} }
case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[0], 0x2a6): case PICA_REG_INDEX(gs.swizzle_patterns.set_word[0]):
case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[1], 0x2a7): case PICA_REG_INDEX(gs.swizzle_patterns.set_word[1]):
case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[2], 0x2a8): case PICA_REG_INDEX(gs.swizzle_patterns.set_word[2]):
case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[3], 0x2a9): case PICA_REG_INDEX(gs.swizzle_patterns.set_word[3]):
case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[4], 0x2aa): case PICA_REG_INDEX(gs.swizzle_patterns.set_word[4]):
case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[5], 0x2ab): case PICA_REG_INDEX(gs.swizzle_patterns.set_word[5]):
case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[6], 0x2ac): case PICA_REG_INDEX(gs.swizzle_patterns.set_word[6]):
case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[7], 0x2ad): { case PICA_REG_INDEX(gs.swizzle_patterns.set_word[7]): {
u32& offset = g_state.regs.gs.swizzle_patterns.offset; u32& offset = g_state.regs.gs.swizzle_patterns.offset;
if (offset >= g_state.gs.swizzle_data.size()) { if (offset >= g_state.gs.swizzle_data.size()) {
LOG_ERROR(HW_GPU, "Invalid GS swizzle pattern offset {}", offset); LOG_ERROR(HW_GPU, "Invalid GS swizzle pattern offset {}", offset);
@ -496,40 +496,40 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
WriteUniformBoolReg(g_state.vs, g_state.regs.vs.bool_uniforms.Value()); WriteUniformBoolReg(g_state.vs, g_state.regs.vs.bool_uniforms.Value());
break; break;
case PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[0], 0x2b1): case PICA_REG_INDEX(vs.int_uniforms[0]):
case PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[1], 0x2b2): case PICA_REG_INDEX(vs.int_uniforms[1]):
case PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[2], 0x2b3): case PICA_REG_INDEX(vs.int_uniforms[2]):
case PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[3], 0x2b4): { case PICA_REG_INDEX(vs.int_uniforms[3]): {
// TODO (wwylele): does regs.pipeline.gs_unit_exclusive_configuration affect this? // TODO (wwylele): does regs.pipeline.gs_unit_exclusive_configuration affect this?
unsigned index = (id - PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[0], 0x2b1)); unsigned index = (id - PICA_REG_INDEX(vs.int_uniforms[0]));
auto values = regs.vs.int_uniforms[index]; auto values = regs.vs.int_uniforms[index];
WriteUniformIntReg(g_state.vs, index, WriteUniformIntReg(g_state.vs, index,
Common::Vec4<u8>(values.x, values.y, values.z, values.w)); Common::Vec4<u8>(values.x, values.y, values.z, values.w));
break; break;
} }
case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[0], 0x2c1): case PICA_REG_INDEX(vs.uniform_setup.set_value[0]):
case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[1], 0x2c2): case PICA_REG_INDEX(vs.uniform_setup.set_value[1]):
case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[2], 0x2c3): case PICA_REG_INDEX(vs.uniform_setup.set_value[2]):
case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[3], 0x2c4): case PICA_REG_INDEX(vs.uniform_setup.set_value[3]):
case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[4], 0x2c5): case PICA_REG_INDEX(vs.uniform_setup.set_value[4]):
case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[5], 0x2c6): case PICA_REG_INDEX(vs.uniform_setup.set_value[5]):
case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[6], 0x2c7): case PICA_REG_INDEX(vs.uniform_setup.set_value[6]):
case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[7], 0x2c8): { case PICA_REG_INDEX(vs.uniform_setup.set_value[7]): {
// TODO (wwylele): does regs.pipeline.gs_unit_exclusive_configuration affect this? // TODO (wwylele): does regs.pipeline.gs_unit_exclusive_configuration affect this?
WriteUniformFloatReg(g_state.regs.vs, g_state.vs, g_state.vs_float_regs_counter, WriteUniformFloatReg(g_state.regs.vs, g_state.vs, g_state.vs_float_regs_counter,
g_state.vs_uniform_write_buffer, value); g_state.vs_uniform_write_buffer, value);
break; break;
} }
case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[0], 0x2cc): case PICA_REG_INDEX(vs.program.set_word[0]):
case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[1], 0x2cd): case PICA_REG_INDEX(vs.program.set_word[1]):
case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[2], 0x2ce): case PICA_REG_INDEX(vs.program.set_word[2]):
case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[3], 0x2cf): case PICA_REG_INDEX(vs.program.set_word[3]):
case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[4], 0x2d0): case PICA_REG_INDEX(vs.program.set_word[4]):
case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[5], 0x2d1): case PICA_REG_INDEX(vs.program.set_word[5]):
case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[6], 0x2d2): case PICA_REG_INDEX(vs.program.set_word[6]):
case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[7], 0x2d3): { case PICA_REG_INDEX(vs.program.set_word[7]): {
u32& offset = g_state.regs.vs.program.offset; u32& offset = g_state.regs.vs.program.offset;
if (offset >= 512) { if (offset >= 512) {
LOG_ERROR(HW_GPU, "Invalid VS program offset {}", offset); LOG_ERROR(HW_GPU, "Invalid VS program offset {}", offset);
@ -545,14 +545,14 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
break; break;
} }
case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[0], 0x2d6): case PICA_REG_INDEX(vs.swizzle_patterns.set_word[0]):
case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[1], 0x2d7): case PICA_REG_INDEX(vs.swizzle_patterns.set_word[1]):
case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[2], 0x2d8): case PICA_REG_INDEX(vs.swizzle_patterns.set_word[2]):
case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[3], 0x2d9): case PICA_REG_INDEX(vs.swizzle_patterns.set_word[3]):
case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[4], 0x2da): case PICA_REG_INDEX(vs.swizzle_patterns.set_word[4]):
case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[5], 0x2db): case PICA_REG_INDEX(vs.swizzle_patterns.set_word[5]):
case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[6], 0x2dc): case PICA_REG_INDEX(vs.swizzle_patterns.set_word[6]):
case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[7], 0x2dd): { case PICA_REG_INDEX(vs.swizzle_patterns.set_word[7]): {
u32& offset = g_state.regs.vs.swizzle_patterns.offset; u32& offset = g_state.regs.vs.swizzle_patterns.offset;
if (offset >= g_state.vs.swizzle_data.size()) { if (offset >= g_state.vs.swizzle_data.size()) {
LOG_ERROR(HW_GPU, "Invalid VS swizzle pattern offset {}", offset); LOG_ERROR(HW_GPU, "Invalid VS swizzle pattern offset {}", offset);
@ -568,14 +568,14 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
break; break;
} }
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[0], 0x1c8): case PICA_REG_INDEX(lighting.lut_data[0]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[1], 0x1c9): case PICA_REG_INDEX(lighting.lut_data[1]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[2], 0x1ca): case PICA_REG_INDEX(lighting.lut_data[2]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[3], 0x1cb): case PICA_REG_INDEX(lighting.lut_data[3]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[4], 0x1cc): case PICA_REG_INDEX(lighting.lut_data[4]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[5], 0x1cd): case PICA_REG_INDEX(lighting.lut_data[5]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[6], 0x1ce): case PICA_REG_INDEX(lighting.lut_data[6]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[7], 0x1cf): { case PICA_REG_INDEX(lighting.lut_data[7]): {
auto& lut_config = regs.lighting.lut_config; auto& lut_config = regs.lighting.lut_config;
ASSERT_MSG(lut_config.index < 256, "lut_config.index exceeded maximum value of 255!"); ASSERT_MSG(lut_config.index < 256, "lut_config.index exceeded maximum value of 255!");
@ -585,27 +585,27 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
break; break;
} }
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[0], 0xe8): case PICA_REG_INDEX(texturing.fog_lut_data[0]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[1], 0xe9): case PICA_REG_INDEX(texturing.fog_lut_data[1]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[2], 0xea): case PICA_REG_INDEX(texturing.fog_lut_data[2]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[3], 0xeb): case PICA_REG_INDEX(texturing.fog_lut_data[3]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[4], 0xec): case PICA_REG_INDEX(texturing.fog_lut_data[4]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[5], 0xed): case PICA_REG_INDEX(texturing.fog_lut_data[5]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[6], 0xee): case PICA_REG_INDEX(texturing.fog_lut_data[6]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[7], 0xef): { case PICA_REG_INDEX(texturing.fog_lut_data[7]): {
g_state.fog.lut[regs.texturing.fog_lut_offset % 128].raw = value; g_state.fog.lut[regs.texturing.fog_lut_offset % 128].raw = value;
regs.texturing.fog_lut_offset.Assign(regs.texturing.fog_lut_offset + 1); regs.texturing.fog_lut_offset.Assign(regs.texturing.fog_lut_offset + 1);
break; break;
} }
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[0], 0xb0): case PICA_REG_INDEX(texturing.proctex_lut_data[0]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[1], 0xb1): case PICA_REG_INDEX(texturing.proctex_lut_data[1]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[2], 0xb2): case PICA_REG_INDEX(texturing.proctex_lut_data[2]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[3], 0xb3): case PICA_REG_INDEX(texturing.proctex_lut_data[3]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[4], 0xb4): case PICA_REG_INDEX(texturing.proctex_lut_data[4]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[5], 0xb5): case PICA_REG_INDEX(texturing.proctex_lut_data[5]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[6], 0xb6): case PICA_REG_INDEX(texturing.proctex_lut_data[6]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[7], 0xb7): { case PICA_REG_INDEX(texturing.proctex_lut_data[7]): {
auto& index = regs.texturing.proctex_lut_config.index; auto& index = regs.texturing.proctex_lut_config.index;
auto& pt = g_state.proctex; auto& pt = g_state.proctex;

View File

@ -7,9 +7,6 @@
#include <array> #include <array>
#include <cstddef> #include <cstddef>
#include <string> #include <string>
#ifndef _MSC_VER
#include <type_traits> // for std::enable_if
#endif
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"
@ -22,27 +19,7 @@
namespace Pica { namespace Pica {
// Returns index corresponding to the Regs member labeled by field_name
// TODO: Due to Visual studio bug 209229, offsetof does not return constant expressions
// when used with array elements (e.g. PICA_REG_INDEX(vs_uniform_setup.set_value[1])).
// For details cf.
// https://connect.microsoft.com/VisualStudio/feedback/details/209229/offsetof-does-not-produce-a-constant-expression-for-array-members
// Hopefully, this will be fixed sometime in the future.
// For lack of better alternatives, we currently hardcode the offsets when constant
// expressions are needed via PICA_REG_INDEX_WORKAROUND (on sane compilers, static_asserts
// will then make sure the offsets indeed match the automatically calculated ones).
#define PICA_REG_INDEX(field_name) (offsetof(Pica::Regs, field_name) / sizeof(u32)) #define PICA_REG_INDEX(field_name) (offsetof(Pica::Regs, field_name) / sizeof(u32))
#if defined(_MSC_VER)
#define PICA_REG_INDEX_WORKAROUND(field_name, backup_workaround_index) (backup_workaround_index)
#else
// NOTE: Yeah, hacking in a static_assert here just to workaround the lacking MSVC compiler
// really is this annoying. This macro just forwards its first argument to PICA_REG_INDEX
// and then performs a (no-op) cast to std::size_t iff the second argument matches the
// expected field offset. Otherwise, the compiler will fail to compile this code.
#define PICA_REG_INDEX_WORKAROUND(field_name, backup_workaround_index) \
((typename std::enable_if<backup_workaround_index == PICA_REG_INDEX(field_name), \
std::size_t>::type) PICA_REG_INDEX(field_name))
#endif // _MSC_VER
struct Regs { struct Regs {
static constexpr std::size_t NUM_REGS = 0x300; static constexpr std::size_t NUM_REGS = 0x300;
@ -70,10 +47,6 @@ struct Regs {
static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32), "Regs struct has wrong size"); static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32), "Regs struct has wrong size");
// TODO: MSVC does not support using offsetof() on non-static data members even though this
// is technically allowed since C++11. This macro should be enabled once MSVC adds
// support for that.
#ifndef _MSC_VER
#define ASSERT_REG_POSITION(field_name, position) \ #define ASSERT_REG_POSITION(field_name, position) \
static_assert(offsetof(Regs, field_name) == position * 4, \ static_assert(offsetof(Regs, field_name) == position * 4, \
"Field " #field_name " has invalid position") "Field " #field_name " has invalid position")
@ -144,6 +117,4 @@ ASSERT_REG_POSITION(gs, 0x280);
ASSERT_REG_POSITION(vs, 0x2b0); ASSERT_REG_POSITION(vs, 0x2b0);
#undef ASSERT_REG_POSITION #undef ASSERT_REG_POSITION
#endif // !defined(_MSC_VER)
} // namespace Pica } // namespace Pica

View File

@ -866,10 +866,10 @@ void RasterizerOpenGL::NotifyPicaRegisterChanged(u32 id) {
SyncClipEnabled(); SyncClipEnabled();
break; break;
case PICA_REG_INDEX_WORKAROUND(rasterizer.clip_coef[0], 0x48): case PICA_REG_INDEX(rasterizer.clip_coef[0]):
case PICA_REG_INDEX_WORKAROUND(rasterizer.clip_coef[1], 0x49): case PICA_REG_INDEX(rasterizer.clip_coef[1]):
case PICA_REG_INDEX_WORKAROUND(rasterizer.clip_coef[2], 0x4a): case PICA_REG_INDEX(rasterizer.clip_coef[2]):
case PICA_REG_INDEX_WORKAROUND(rasterizer.clip_coef[3], 0x4b): case PICA_REG_INDEX(rasterizer.clip_coef[3]):
SyncClipCoef(); SyncClipCoef();
break; break;
@ -906,14 +906,14 @@ void RasterizerOpenGL::NotifyPicaRegisterChanged(u32 id) {
case PICA_REG_INDEX(texturing.fog_color): case PICA_REG_INDEX(texturing.fog_color):
SyncFogColor(); SyncFogColor();
break; break;
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[0], 0xe8): case PICA_REG_INDEX(texturing.fog_lut_data[0]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[1], 0xe9): case PICA_REG_INDEX(texturing.fog_lut_data[1]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[2], 0xea): case PICA_REG_INDEX(texturing.fog_lut_data[2]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[3], 0xeb): case PICA_REG_INDEX(texturing.fog_lut_data[3]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[4], 0xec): case PICA_REG_INDEX(texturing.fog_lut_data[4]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[5], 0xed): case PICA_REG_INDEX(texturing.fog_lut_data[5]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[6], 0xee): case PICA_REG_INDEX(texturing.fog_lut_data[6]):
case PICA_REG_INDEX_WORKAROUND(texturing.fog_lut_data[7], 0xef): case PICA_REG_INDEX(texturing.fog_lut_data[7]):
uniform_block_data.fog_lut_dirty = true; uniform_block_data.fog_lut_dirty = true;
break; break;
@ -931,14 +931,14 @@ void RasterizerOpenGL::NotifyPicaRegisterChanged(u32 id) {
SyncProcTexNoise(); SyncProcTexNoise();
break; break;
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[0], 0xb0): case PICA_REG_INDEX(texturing.proctex_lut_data[0]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[1], 0xb1): case PICA_REG_INDEX(texturing.proctex_lut_data[1]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[2], 0xb2): case PICA_REG_INDEX(texturing.proctex_lut_data[2]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[3], 0xb3): case PICA_REG_INDEX(texturing.proctex_lut_data[3]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[4], 0xb4): case PICA_REG_INDEX(texturing.proctex_lut_data[4]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[5], 0xb5): case PICA_REG_INDEX(texturing.proctex_lut_data[5]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[6], 0xb6): case PICA_REG_INDEX(texturing.proctex_lut_data[6]):
case PICA_REG_INDEX_WORKAROUND(texturing.proctex_lut_data[7], 0xb7): case PICA_REG_INDEX(texturing.proctex_lut_data[7]):
using Pica::TexturingRegs; using Pica::TexturingRegs;
switch (regs.texturing.proctex_lut_config.ref_table.Value()) { switch (regs.texturing.proctex_lut_config.ref_table.Value()) {
case TexturingRegs::ProcTexLutTable::Noise: case TexturingRegs::ProcTexLutTable::Noise:
@ -1085,255 +1085,255 @@ void RasterizerOpenGL::NotifyPicaRegisterChanged(u32 id) {
break; break;
// Fragment lighting specular 0 color // Fragment lighting specular 0 color
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].specular_0, 0x140 + 0 * 0x10): case PICA_REG_INDEX(lighting.light[0].specular_0):
SyncLightSpecular0(0); SyncLightSpecular0(0);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].specular_0, 0x140 + 1 * 0x10): case PICA_REG_INDEX(lighting.light[1].specular_0):
SyncLightSpecular0(1); SyncLightSpecular0(1);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].specular_0, 0x140 + 2 * 0x10): case PICA_REG_INDEX(lighting.light[2].specular_0):
SyncLightSpecular0(2); SyncLightSpecular0(2);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].specular_0, 0x140 + 3 * 0x10): case PICA_REG_INDEX(lighting.light[3].specular_0):
SyncLightSpecular0(3); SyncLightSpecular0(3);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].specular_0, 0x140 + 4 * 0x10): case PICA_REG_INDEX(lighting.light[4].specular_0):
SyncLightSpecular0(4); SyncLightSpecular0(4);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].specular_0, 0x140 + 5 * 0x10): case PICA_REG_INDEX(lighting.light[5].specular_0):
SyncLightSpecular0(5); SyncLightSpecular0(5);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].specular_0, 0x140 + 6 * 0x10): case PICA_REG_INDEX(lighting.light[6].specular_0):
SyncLightSpecular0(6); SyncLightSpecular0(6);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].specular_0, 0x140 + 7 * 0x10): case PICA_REG_INDEX(lighting.light[7].specular_0):
SyncLightSpecular0(7); SyncLightSpecular0(7);
break; break;
// Fragment lighting specular 1 color // Fragment lighting specular 1 color
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].specular_1, 0x141 + 0 * 0x10): case PICA_REG_INDEX(lighting.light[0].specular_1):
SyncLightSpecular1(0); SyncLightSpecular1(0);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].specular_1, 0x141 + 1 * 0x10): case PICA_REG_INDEX(lighting.light[1].specular_1):
SyncLightSpecular1(1); SyncLightSpecular1(1);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].specular_1, 0x141 + 2 * 0x10): case PICA_REG_INDEX(lighting.light[2].specular_1):
SyncLightSpecular1(2); SyncLightSpecular1(2);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].specular_1, 0x141 + 3 * 0x10): case PICA_REG_INDEX(lighting.light[3].specular_1):
SyncLightSpecular1(3); SyncLightSpecular1(3);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].specular_1, 0x141 + 4 * 0x10): case PICA_REG_INDEX(lighting.light[4].specular_1):
SyncLightSpecular1(4); SyncLightSpecular1(4);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].specular_1, 0x141 + 5 * 0x10): case PICA_REG_INDEX(lighting.light[5].specular_1):
SyncLightSpecular1(5); SyncLightSpecular1(5);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].specular_1, 0x141 + 6 * 0x10): case PICA_REG_INDEX(lighting.light[6].specular_1):
SyncLightSpecular1(6); SyncLightSpecular1(6);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].specular_1, 0x141 + 7 * 0x10): case PICA_REG_INDEX(lighting.light[7].specular_1):
SyncLightSpecular1(7); SyncLightSpecular1(7);
break; break;
// Fragment lighting diffuse color // Fragment lighting diffuse color
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].diffuse, 0x142 + 0 * 0x10): case PICA_REG_INDEX(lighting.light[0].diffuse):
SyncLightDiffuse(0); SyncLightDiffuse(0);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].diffuse, 0x142 + 1 * 0x10): case PICA_REG_INDEX(lighting.light[1].diffuse):
SyncLightDiffuse(1); SyncLightDiffuse(1);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].diffuse, 0x142 + 2 * 0x10): case PICA_REG_INDEX(lighting.light[2].diffuse):
SyncLightDiffuse(2); SyncLightDiffuse(2);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].diffuse, 0x142 + 3 * 0x10): case PICA_REG_INDEX(lighting.light[3].diffuse):
SyncLightDiffuse(3); SyncLightDiffuse(3);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].diffuse, 0x142 + 4 * 0x10): case PICA_REG_INDEX(lighting.light[4].diffuse):
SyncLightDiffuse(4); SyncLightDiffuse(4);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].diffuse, 0x142 + 5 * 0x10): case PICA_REG_INDEX(lighting.light[5].diffuse):
SyncLightDiffuse(5); SyncLightDiffuse(5);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].diffuse, 0x142 + 6 * 0x10): case PICA_REG_INDEX(lighting.light[6].diffuse):
SyncLightDiffuse(6); SyncLightDiffuse(6);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].diffuse, 0x142 + 7 * 0x10): case PICA_REG_INDEX(lighting.light[7].diffuse):
SyncLightDiffuse(7); SyncLightDiffuse(7);
break; break;
// Fragment lighting ambient color // Fragment lighting ambient color
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].ambient, 0x143 + 0 * 0x10): case PICA_REG_INDEX(lighting.light[0].ambient):
SyncLightAmbient(0); SyncLightAmbient(0);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].ambient, 0x143 + 1 * 0x10): case PICA_REG_INDEX(lighting.light[1].ambient):
SyncLightAmbient(1); SyncLightAmbient(1);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].ambient, 0x143 + 2 * 0x10): case PICA_REG_INDEX(lighting.light[2].ambient):
SyncLightAmbient(2); SyncLightAmbient(2);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].ambient, 0x143 + 3 * 0x10): case PICA_REG_INDEX(lighting.light[3].ambient):
SyncLightAmbient(3); SyncLightAmbient(3);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].ambient, 0x143 + 4 * 0x10): case PICA_REG_INDEX(lighting.light[4].ambient):
SyncLightAmbient(4); SyncLightAmbient(4);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].ambient, 0x143 + 5 * 0x10): case PICA_REG_INDEX(lighting.light[5].ambient):
SyncLightAmbient(5); SyncLightAmbient(5);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].ambient, 0x143 + 6 * 0x10): case PICA_REG_INDEX(lighting.light[6].ambient):
SyncLightAmbient(6); SyncLightAmbient(6);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].ambient, 0x143 + 7 * 0x10): case PICA_REG_INDEX(lighting.light[7].ambient):
SyncLightAmbient(7); SyncLightAmbient(7);
break; break;
// Fragment lighting position // Fragment lighting position
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].x, 0x144 + 0 * 0x10): case PICA_REG_INDEX(lighting.light[0].x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].z, 0x145 + 0 * 0x10): case PICA_REG_INDEX(lighting.light[0].z):
SyncLightPosition(0); SyncLightPosition(0);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].x, 0x144 + 1 * 0x10): case PICA_REG_INDEX(lighting.light[1].x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].z, 0x145 + 1 * 0x10): case PICA_REG_INDEX(lighting.light[1].z):
SyncLightPosition(1); SyncLightPosition(1);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].x, 0x144 + 2 * 0x10): case PICA_REG_INDEX(lighting.light[2].x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].z, 0x145 + 2 * 0x10): case PICA_REG_INDEX(lighting.light[2].z):
SyncLightPosition(2); SyncLightPosition(2);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].x, 0x144 + 3 * 0x10): case PICA_REG_INDEX(lighting.light[3].x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].z, 0x145 + 3 * 0x10): case PICA_REG_INDEX(lighting.light[3].z):
SyncLightPosition(3); SyncLightPosition(3);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].x, 0x144 + 4 * 0x10): case PICA_REG_INDEX(lighting.light[4].x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].z, 0x145 + 4 * 0x10): case PICA_REG_INDEX(lighting.light[4].z):
SyncLightPosition(4); SyncLightPosition(4);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].x, 0x144 + 5 * 0x10): case PICA_REG_INDEX(lighting.light[5].x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].z, 0x145 + 5 * 0x10): case PICA_REG_INDEX(lighting.light[5].z):
SyncLightPosition(5); SyncLightPosition(5);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].x, 0x144 + 6 * 0x10): case PICA_REG_INDEX(lighting.light[6].x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].z, 0x145 + 6 * 0x10): case PICA_REG_INDEX(lighting.light[6].z):
SyncLightPosition(6); SyncLightPosition(6);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].x, 0x144 + 7 * 0x10): case PICA_REG_INDEX(lighting.light[7].x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].z, 0x145 + 7 * 0x10): case PICA_REG_INDEX(lighting.light[7].z):
SyncLightPosition(7); SyncLightPosition(7);
break; break;
// Fragment spot lighting direction // Fragment spot lighting direction
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].spot_x, 0x146 + 0 * 0x10): case PICA_REG_INDEX(lighting.light[0].spot_x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].spot_z, 0x147 + 0 * 0x10): case PICA_REG_INDEX(lighting.light[0].spot_z):
SyncLightSpotDirection(0); SyncLightSpotDirection(0);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].spot_x, 0x146 + 1 * 0x10): case PICA_REG_INDEX(lighting.light[1].spot_x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].spot_z, 0x147 + 1 * 0x10): case PICA_REG_INDEX(lighting.light[1].spot_z):
SyncLightSpotDirection(1); SyncLightSpotDirection(1);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].spot_x, 0x146 + 2 * 0x10): case PICA_REG_INDEX(lighting.light[2].spot_x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].spot_z, 0x147 + 2 * 0x10): case PICA_REG_INDEX(lighting.light[2].spot_z):
SyncLightSpotDirection(2); SyncLightSpotDirection(2);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].spot_x, 0x146 + 3 * 0x10): case PICA_REG_INDEX(lighting.light[3].spot_x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].spot_z, 0x147 + 3 * 0x10): case PICA_REG_INDEX(lighting.light[3].spot_z):
SyncLightSpotDirection(3); SyncLightSpotDirection(3);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].spot_x, 0x146 + 4 * 0x10): case PICA_REG_INDEX(lighting.light[4].spot_x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].spot_z, 0x147 + 4 * 0x10): case PICA_REG_INDEX(lighting.light[4].spot_z):
SyncLightSpotDirection(4); SyncLightSpotDirection(4);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].spot_x, 0x146 + 5 * 0x10): case PICA_REG_INDEX(lighting.light[5].spot_x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].spot_z, 0x147 + 5 * 0x10): case PICA_REG_INDEX(lighting.light[5].spot_z):
SyncLightSpotDirection(5); SyncLightSpotDirection(5);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].spot_x, 0x146 + 6 * 0x10): case PICA_REG_INDEX(lighting.light[6].spot_x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].spot_z, 0x147 + 6 * 0x10): case PICA_REG_INDEX(lighting.light[6].spot_z):
SyncLightSpotDirection(6); SyncLightSpotDirection(6);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].spot_x, 0x146 + 7 * 0x10): case PICA_REG_INDEX(lighting.light[7].spot_x):
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].spot_z, 0x147 + 7 * 0x10): case PICA_REG_INDEX(lighting.light[7].spot_z):
SyncLightSpotDirection(7); SyncLightSpotDirection(7);
break; break;
// Fragment lighting light source config // Fragment lighting light source config
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].config, 0x149 + 0 * 0x10): case PICA_REG_INDEX(lighting.light[0].config):
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].config, 0x149 + 1 * 0x10): case PICA_REG_INDEX(lighting.light[1].config):
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].config, 0x149 + 2 * 0x10): case PICA_REG_INDEX(lighting.light[2].config):
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].config, 0x149 + 3 * 0x10): case PICA_REG_INDEX(lighting.light[3].config):
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].config, 0x149 + 4 * 0x10): case PICA_REG_INDEX(lighting.light[4].config):
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].config, 0x149 + 5 * 0x10): case PICA_REG_INDEX(lighting.light[5].config):
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].config, 0x149 + 6 * 0x10): case PICA_REG_INDEX(lighting.light[6].config):
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].config, 0x149 + 7 * 0x10): case PICA_REG_INDEX(lighting.light[7].config):
shader_dirty = true; shader_dirty = true;
break; break;
// Fragment lighting distance attenuation bias // Fragment lighting distance attenuation bias
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].dist_atten_bias, 0x014A + 0 * 0x10): case PICA_REG_INDEX(lighting.light[0].dist_atten_bias):
SyncLightDistanceAttenuationBias(0); SyncLightDistanceAttenuationBias(0);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].dist_atten_bias, 0x014A + 1 * 0x10): case PICA_REG_INDEX(lighting.light[1].dist_atten_bias):
SyncLightDistanceAttenuationBias(1); SyncLightDistanceAttenuationBias(1);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].dist_atten_bias, 0x014A + 2 * 0x10): case PICA_REG_INDEX(lighting.light[2].dist_atten_bias):
SyncLightDistanceAttenuationBias(2); SyncLightDistanceAttenuationBias(2);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].dist_atten_bias, 0x014A + 3 * 0x10): case PICA_REG_INDEX(lighting.light[3].dist_atten_bias):
SyncLightDistanceAttenuationBias(3); SyncLightDistanceAttenuationBias(3);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].dist_atten_bias, 0x014A + 4 * 0x10): case PICA_REG_INDEX(lighting.light[4].dist_atten_bias):
SyncLightDistanceAttenuationBias(4); SyncLightDistanceAttenuationBias(4);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].dist_atten_bias, 0x014A + 5 * 0x10): case PICA_REG_INDEX(lighting.light[5].dist_atten_bias):
SyncLightDistanceAttenuationBias(5); SyncLightDistanceAttenuationBias(5);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].dist_atten_bias, 0x014A + 6 * 0x10): case PICA_REG_INDEX(lighting.light[6].dist_atten_bias):
SyncLightDistanceAttenuationBias(6); SyncLightDistanceAttenuationBias(6);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].dist_atten_bias, 0x014A + 7 * 0x10): case PICA_REG_INDEX(lighting.light[7].dist_atten_bias):
SyncLightDistanceAttenuationBias(7); SyncLightDistanceAttenuationBias(7);
break; break;
// Fragment lighting distance attenuation scale // Fragment lighting distance attenuation scale
case PICA_REG_INDEX_WORKAROUND(lighting.light[0].dist_atten_scale, 0x014B + 0 * 0x10): case PICA_REG_INDEX(lighting.light[0].dist_atten_scale):
SyncLightDistanceAttenuationScale(0); SyncLightDistanceAttenuationScale(0);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[1].dist_atten_scale, 0x014B + 1 * 0x10): case PICA_REG_INDEX(lighting.light[1].dist_atten_scale):
SyncLightDistanceAttenuationScale(1); SyncLightDistanceAttenuationScale(1);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[2].dist_atten_scale, 0x014B + 2 * 0x10): case PICA_REG_INDEX(lighting.light[2].dist_atten_scale):
SyncLightDistanceAttenuationScale(2); SyncLightDistanceAttenuationScale(2);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[3].dist_atten_scale, 0x014B + 3 * 0x10): case PICA_REG_INDEX(lighting.light[3].dist_atten_scale):
SyncLightDistanceAttenuationScale(3); SyncLightDistanceAttenuationScale(3);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[4].dist_atten_scale, 0x014B + 4 * 0x10): case PICA_REG_INDEX(lighting.light[4].dist_atten_scale):
SyncLightDistanceAttenuationScale(4); SyncLightDistanceAttenuationScale(4);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[5].dist_atten_scale, 0x014B + 5 * 0x10): case PICA_REG_INDEX(lighting.light[5].dist_atten_scale):
SyncLightDistanceAttenuationScale(5); SyncLightDistanceAttenuationScale(5);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[6].dist_atten_scale, 0x014B + 6 * 0x10): case PICA_REG_INDEX(lighting.light[6].dist_atten_scale):
SyncLightDistanceAttenuationScale(6); SyncLightDistanceAttenuationScale(6);
break; break;
case PICA_REG_INDEX_WORKAROUND(lighting.light[7].dist_atten_scale, 0x014B + 7 * 0x10): case PICA_REG_INDEX(lighting.light[7].dist_atten_scale):
SyncLightDistanceAttenuationScale(7); SyncLightDistanceAttenuationScale(7);
break; break;
// Fragment lighting global ambient color (emission + ambient * ambient) // Fragment lighting global ambient color (emission + ambient * ambient)
case PICA_REG_INDEX_WORKAROUND(lighting.global_ambient, 0x1c0): case PICA_REG_INDEX(lighting.global_ambient):
SyncGlobalAmbient(); SyncGlobalAmbient();
break; break;
// Fragment lighting lookup tables // Fragment lighting lookup tables
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[0], 0x1c8): case PICA_REG_INDEX(lighting.lut_data[0]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[1], 0x1c9): case PICA_REG_INDEX(lighting.lut_data[1]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[2], 0x1ca): case PICA_REG_INDEX(lighting.lut_data[2]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[3], 0x1cb): case PICA_REG_INDEX(lighting.lut_data[3]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[4], 0x1cc): case PICA_REG_INDEX(lighting.lut_data[4]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[5], 0x1cd): case PICA_REG_INDEX(lighting.lut_data[5]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[6], 0x1ce): case PICA_REG_INDEX(lighting.lut_data[6]):
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[7], 0x1cf): { case PICA_REG_INDEX(lighting.lut_data[7]): {
auto& lut_config = regs.lighting.lut_config; auto& lut_config = regs.lighting.lut_config;
uniform_block_data.lighting_lut_dirty[lut_config.type] = true; uniform_block_data.lighting_lut_dirty[lut_config.type] = true;
uniform_block_data.lighting_lut_dirty_any = true; uniform_block_data.lighting_lut_dirty_any = true;