MCPcopy Create free account
hub / github.com/XiaoBaiiiiii/colmap-pcd / LoadDescriptorProgramPKSL

Method LoadDescriptorProgramPKSL

lib/SiftGPU/ProgramGLSL.cpp:2459–2593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2457}
2458
2459ProgramGLSL* ShaderBagPKSL::LoadDescriptorProgramPKSL()
2460{
2461 //one shader outpout 128/8 = 16 , each fragout encodes 4
2462 //const double twopi = 2.0*3.14159265358979323846;
2463 //const double rpi = 8.0/twopi;
2464 ostringstream out;
2465 out<<setprecision(8);
2466
2467 if(GlobalUtil::_KeepShaderLoop)
2468 {
2469 out << "#define REPEAT4(FUNCTION)\\\n"
2470 "for(int i = 0; i < 4; ++i)\\\n"
2471 "{\\\n"
2472 " FUNCTION(i);\\\n"
2473 "}\n";
2474 }else
2475 {
2476 //loop unroll for ATI
2477 out << "#define REPEAT4(FUNCTION)\\\n"
2478 "FUNCTION(0);\\\n"
2479 "FUNCTION(1);\\\n"
2480 "FUNCTION(2);\\\n"
2481 "FUNCTION(3);\n";
2482 }
2483
2484 out<<"\n"
2485 "#define M_PI 3.14159265358979323846\n"
2486 "#define TWO_PI (2.0*M_PI)\n"
2487 "#define RPI 1.2732395447351626861510701069801\n"
2488 "#define WF size.z\n"
2489 "uniform sampler2DRect tex; \n"
2490 "uniform sampler2DRect gtex; \n"
2491 "uniform sampler2DRect otex; \n"
2492 "uniform vec4 dsize; \n"
2493 "uniform vec3 size; \n"
2494 "void main() \n"
2495 "{\n"
2496 " vec2 dim = size.xy; //image size \n"
2497 " float index = dsize.x*floor(gl_TexCoord[0].y * 0.5) + gl_TexCoord[0].x;\n"
2498 " float idx = 8.0* fract(index * 0.125) + 8.0 * floor(2.0* fract(gl_TexCoord[0].y * 0.5)); \n"
2499 " index = floor(index*0.125)+ 0.49; \n"
2500 " vec2 coord = floor( vec2( mod(index, dsize.z), index*dsize.w)) + 0.5 ;\n"
2501 " vec2 pos = texture2DRect(tex, coord).xy; \n"
2502 " if(any(lessThan(pos.xy, vec2(1.0))) || any(greaterThan(pos.xy, dim-1.0))) "
2503 " //discard; \n"
2504 " { gl_FragData[0] = gl_FragData[1] = vec4(0.0); return; }\n"
2505 " float anglef = texture2DRect(tex, coord).z;\n"
2506 " if(anglef > M_PI) anglef -= TWO_PI;\n"
2507 " float sigma = texture2DRect(tex, coord).w; \n"
2508 " float spt = abs(sigma * WF); //default to be 3*sigma \n";
2509 //rotation
2510 out<<
2511 " vec4 cscs, rots; \n"
2512 " cscs.x = cos(anglef); cscs.y = sin(anglef); \n"
2513 " cscs.zw = - cscs.xy; \n"
2514 " rots = cscs /spt; \n"
2515 " cscs *= spt; \n";
2516

Callers

nothing calls this directly

Calls 1

IsNativeMethod · 0.80

Tested by

no test coverage detected