MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / SprintShader

Function SprintShader

Source/SysGL/HLEGraphics/RendererGL.cpp:389–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389static void SprintShader(char (&frag_shader)[2048], const ShaderConfiguration & config)
390{
391 u32 mux0 = (u32)(config.Mux>>32);
392 u32 mux1 = (u32)(config.Mux);
393
394 u32 aRGB0 = (mux0>>20)&0x0F; // c1 c1 // a0
395 u32 bRGB0 = (mux1>>28)&0x0F; // c1 c2 // b0
396 u32 cRGB0 = (mux0>>15)&0x1F; // c1 c3 // c0
397 u32 dRGB0 = (mux1>>15)&0x07; // c1 c4 // d0
398
399 u32 aA0 = (mux0>>12)&0x07; // c1 a1 // Aa0
400 u32 bA0 = (mux1>>12)&0x07; // c1 a2 // Ab0
401 u32 cA0 = (mux0>>9 )&0x07; // c1 a3 // Ac0
402 u32 dA0 = (mux1>>9 )&0x07; // c1 a4 // Ad0
403
404 u32 aRGB1 = (mux0>>5 )&0x0F; // c2 c1 // a1
405 u32 bRGB1 = (mux1>>24)&0x0F; // c2 c2 // b1
406 u32 cRGB1 = (mux0 )&0x1F; // c2 c3 // c1
407 u32 dRGB1 = (mux1>>6 )&0x07; // c2 c4 // d1
408
409 u32 aA1 = (mux1>>21)&0x07; // c2 a1 // Aa1
410 u32 bA1 = (mux1>>3 )&0x07; // c2 a2 // Ab1
411 u32 cA1 = (mux1>>18)&0x07; // c2 a3 // Ac1
412 u32 dA1 = (mux1 )&0x07; // c2 a4 // Ad1
413
414 char body[1024];
415
416 u32 cycle_type = config.CycleType;
417
418 if (cycle_type == CYCLE_FILL)
419 {
420 strcpy(body, "\tcol = shade;\n");
421 }
422 else if (cycle_type == CYCLE_COPY)
423 {
424 strcpy(body, "\tcol = fetchCopy(sti, uTileShift0, uTileMirror0, uTileMask0, uTileTL0, uTileBR0, uTileClampEnable0, uTexture0, uTexScale0);\n");
425 }
426 else if (cycle_type == CYCLE_1CYCLE)
427 {
428 const char * filter0 = GetFilter(config.BilerpFilter, config.ClampS0, config.ClampT0);
429 const char * filter1 = GetFilter(config.BilerpFilter, config.ClampS1, config.ClampT1);
430
431 sprintf(body, "\tvec4 tex0 = %s(sti, uTileShift0, uTileMirror0, uTileMask0, uTileTL0, uTileBR0, uTileClampEnable0, uTexture0, uTexScale0);\n"
432 "\tvec4 tex1 = %s(sti, uTileShift1, uTileMirror1, uTileMask1, uTileTL1, uTileBR1, uTileClampEnable1, uTexture1, uTexScale1);\n"
433 "\tcol.rgb = (%s - %s) * %s + %s;\n"
434 "\tcol.a = (%s - %s) * %s + %s;\n",
435 filter0, filter1,
436 kRGBParams16[aRGB0], kRGBParams16[bRGB0], kRGBParams32[cRGB0], kRGBParams8[dRGB0],
437 kAlphaParams8[aA0], kAlphaParams8[bA0], kAlphaParams8[cA0], kAlphaParams8[dA0]);
438 }
439 else
440 {
441 const char * filter0 = GetFilter(config.BilerpFilter, config.ClampS0, config.ClampT0);
442 const char * filter1 = GetFilter(config.BilerpFilter, config.ClampS1, config.ClampT1);
443
444 sprintf(body, "\tvec4 tex0 = %s(sti, uTileShift0, uTileMirror0, uTileMask0, uTileTL0, uTileBR0, uTileClampEnable0, uTexture0, uTexScale0);\n"
445 "\tvec4 tex1 = %s(sti, uTileShift1, uTileMirror1, uTileMask1, uTileTL1, uTileBR1, uTileClampEnable1, uTexture1, uTexScale1);\n"
446 "\tcol.rgb = (%s - %s) * %s + %s;\n"

Callers 1

GetShaderForConfigFunction · 0.85

Calls 1

GetFilterFunction · 0.85

Tested by

no test coverage detected