MCPcopy Create free account
hub / github.com/Hydr8gon/3Beans / writeCombOper

Method writeCombOper

src/core/gpu/gpu_cmd.cpp:469–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467}
468
469template <int i> void Gpu::writeCombOper(uint32_t mask, uint32_t value) {
470 // Write to some of the texture combiner operands
471 mask &= 0x777FFF;
472 gpuCombOper[i] = (gpuCombOper[i] & ~mask) | (value & mask);
473
474 // Set RGB operands for the renderer if they're valid
475 CombOper opers[6];
476 for (int j = 0; j < 3; j++) {
477 switch (uint8_t oper = (gpuCombOper[i] >> (j * 4)) & 0xF) {
478 case 0x0: opers[j] = OPER_SRC; continue;
479 case 0x1: opers[j] = OPER_1MSRC; continue;
480 case 0x2: opers[j] = OPER_SRCA; continue;
481 case 0x3: opers[j] = OPER_1MSRCA; continue;
482 case 0x4: opers[j] = OPER_SRCR; continue;
483 case 0x5: opers[j] = OPER_1MSRCR; continue;
484 case 0x8: opers[j] = OPER_SRCG; continue;
485 case 0x9: opers[j] = OPER_1MSRCG; continue;
486 case 0xC: opers[j] = OPER_SRCB; continue;
487 case 0xD: opers[j] = OPER_1MSRCB; continue;
488
489 default:
490 // Catch unknown RGB operand values
491 LOG_WARN("GPU texture combiner %d operand %d set to unknown value: 0x%X\n", i, j, oper);
492 opers[j] = OPER_SRC;
493 continue;
494 }
495 }
496
497 // Set alpha operands for the renderer
498 for (int j = 3; j < 6; j++) {
499 switch ((gpuCombOper[i] >> (j * 4)) & 0x7) {
500 case 0x0: opers[j] = OPER_SRCA; continue;
501 case 0x1: opers[j] = OPER_1MSRCA; continue;
502 case 0x2: opers[j] = OPER_SRCR; continue;
503 case 0x3: opers[j] = OPER_1MSRCR; continue;
504 case 0x4: opers[j] = OPER_SRCG; continue;
505 case 0x5: opers[j] = OPER_1MSRCG; continue;
506 case 0x6: opers[j] = OPER_SRCB; continue;
507 default: opers[j] = OPER_1MSRCB; continue;
508 }
509 }
510 gpuRender->setCombOpers(i, opers);
511}
512
513template <int i> void Gpu::writeCombMode(uint32_t mask, uint32_t value) {
514 // Write to one of the texture combiner mode registers

Callers

nothing calls this directly

Calls 1

setCombOpersMethod · 0.45

Tested by

no test coverage detected