summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar bunnei2015-09-12 18:56:12 -0400
committerGravatar bunnei2016-02-05 17:17:27 -0500
commit281bc90ad2afe16853178a56e0127cff8b53eb14 (patch)
treea0367dba3f07648a0fd8ba1ff809aebfe7677c30 /src/video_core
parentpica: Add decodings for distance attenuation and LUT registers. (diff)
downloadyuzu-281bc90ad2afe16853178a56e0127cff8b53eb14.tar.gz
yuzu-281bc90ad2afe16853178a56e0127cff8b53eb14.tar.xz
yuzu-281bc90ad2afe16853178a56e0127cff8b53eb14.zip
pica: Implement fragment lighting LUTs.
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/command_processor.cpp15
-rw-r--r--src/video_core/pica.h19
2 files changed, 34 insertions, 0 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 59c75042c..7409534b6 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -464,6 +464,21 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
464 break; 464 break;
465 } 465 }
466 466
467 case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[0], 0x1c8):
468 case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[1], 0x1c9):
469 case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[2], 0x1ca):
470 case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[3], 0x1cb):
471 case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[4], 0x1cc):
472 case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[5], 0x1cd):
473 case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[6], 0x1ce):
474 case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[7], 0x1cf):
475 {
476 auto& lut_config = regs.lighting.lut_config;
477 g_state.lighting.luts[lut_config.type][lut_config.index].raw = value;
478 lut_config.index = lut_config.index + 1;
479 break;
480 }
481
467 default: 482 default:
468 break; 483 break;
469 } 484 }
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 81a568e88..b09484de4 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -1156,6 +1156,25 @@ struct State {
1156 ShaderSetup vs; 1156 ShaderSetup vs;
1157 ShaderSetup gs; 1157 ShaderSetup gs;
1158 1158
1159 struct {
1160 union LutEntry {
1161 // Used for raw access
1162 u32 raw;
1163
1164 // LUT value, encoded as 12-bit fixed point, with 12 fraction bits
1165 BitField< 0, 12, u32> value;
1166
1167 // Used by HW for efficient interpolation, Citra does not use these
1168 BitField<12, 12, u32> difference;
1169
1170 float ToFloat() {
1171 return static_cast<float>(value) / 4095.f;
1172 }
1173 };
1174
1175 std::array<LutEntry, 256> luts[24];
1176 } lighting;
1177
1159 /// Current Pica command list 1178 /// Current Pica command list
1160 struct { 1179 struct {
1161 const u32* head_ptr; 1180 const u32* head_ptr;