Changeset 22883 in vbox
- Timestamp:
- Sep 9, 2009 9:26:01 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 1 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VirtualBoxShaders.qrc
r22776 r22883 9 9 <file alias="ckeyDst_void.c">shaders/ckeyDst_void.c</file> 10 10 <file alias="ckeyDst.c">shaders/ckeyDst.c</file> 11 <file alias="ckeyDst2.c">shaders/ckeyDst2.c</file> 11 12 <file alias="mainOverlay.c">shaders/mainOverlay.c</file> 12 13 <file alias="mainOverlayNoCKey.c">shaders/mainOverlayNoCKey.c</file> -
trunk/src/VBox/Frontends/VirtualBox/shaders/cconvAYUV.c
r22776 r22883 2 2 uniform sampler2DRect uSrcTex; 3 3 void vboxCConvApplyAYUV(vec4 color); 4 void vboxCConv( int srcI)4 void vboxCConv() 5 5 { 6 vec2 srcCoord = vec2(gl_TexCoord[ srcI]);6 vec2 srcCoord = vec2(gl_TexCoord[0]); 7 7 vec4 color = texture2DRect(uSrcTex, srcCoord); 8 8 vboxCConvApplyAYUV(color); -
trunk/src/VBox/Frontends/VirtualBox/shaders/cconvAYUV_void.c
r22776 r22883 1 void vboxCConv( int srcI)1 void vboxCConv() 2 2 {} -
trunk/src/VBox/Frontends/VirtualBox/shaders/cconvBGR.c
r22776 r22883 1 1 #extension GL_ARB_texture_rectangle : enable 2 2 uniform sampler2DRect uSrcTex; 3 void vboxCConv( int srcI)3 void vboxCConv() 4 4 { 5 vec2 srcCoord = vec2(gl_TexCoord[ srcI]);6 gl_FragColor = texture2DRect(uSrcTex, vec2(srcCoord.x, srcCoord.y));5 vec2 srcCoord = vec2(gl_TexCoord[0]); 6 gl_FragColor = texture2DRect(uSrcTex, srcCoord); 7 7 } -
trunk/src/VBox/Frontends/VirtualBox/shaders/cconvBGR_void.c
r22776 r22883 1 void vboxCConv( int srcI)1 void vboxCConv() 2 2 {} -
trunk/src/VBox/Frontends/VirtualBox/shaders/cconvUYVY.c
r22825 r22883 2 2 uniform sampler2DRect uSrcTex; 3 3 void vboxCConvApplyAYUV(vec4 color); 4 void vboxCConv( int srcI)4 void vboxCConv() 5 5 { 6 vec2 srcCoord = vec2(gl_TexCoord[ srcI]);6 vec2 srcCoord = vec2(gl_TexCoord[0]); 7 7 float x = srcCoord.x; 8 vec4 srcClr = texture2DRect(uSrcTex, vec2(x, srcCoord.y));8 vec4 srcClr = texture2DRect(uSrcTex, srcCoord); 9 9 float u = srcClr.b; 10 10 float v = srcClr.r; -
trunk/src/VBox/Frontends/VirtualBox/shaders/cconvUYVY_void.c
r22776 r22883 1 void vboxCConv( int srcI)1 void vboxCConv() 2 2 {} -
trunk/src/VBox/Frontends/VirtualBox/shaders/cconvYUY2.c
r22776 r22883 2 2 uniform sampler2DRect uSrcTex; 3 3 void vboxCConvApplyAYUV(vec4 color); 4 void vboxCConv( int srcI)4 void vboxCConv() 5 5 { 6 vec2 srcCoord = vec2(gl_TexCoord[ srcI]);6 vec2 srcCoord = vec2(gl_TexCoord[0]); 7 7 float x = srcCoord.x; 8 8 vec4 srcClr = texture2DRect(uSrcTex, vec2(x, srcCoord.y)); -
trunk/src/VBox/Frontends/VirtualBox/shaders/cconvYUY2_void.c
r22776 r22883 1 void vboxCConv( int srcI)1 void vboxCConv() 2 2 {} -
trunk/src/VBox/Frontends/VirtualBox/shaders/cconvYV12.c
r22776 r22883 5 5 float vboxSplitBGRA(vec4 color, float coord); 6 6 void vboxCConvApplyAYUV(vec4 color); 7 void vboxCConv( int srcI)7 void vboxCConv() 8 8 { 9 vec2 coordY = vec2(gl_TexCoord[srcI]); 10 vec2 coordV = vec2(gl_TexCoord[srcI+1]); 11 vec2 coordU = vec2(gl_TexCoord[srcI+2]); 9 vec2 coordY = vec2(gl_TexCoord[0]); 10 vec2 coordV = vec2(gl_TexCoord[1]); 12 11 vec4 clrY = texture2DRect(uSrcTex, vec2(coordY)); 13 12 vec4 clrV = texture2DRect(uVTex, vec2(coordV)); 14 vec4 clrU = texture2DRect(uUTex, vec2(coord U));13 vec4 clrU = texture2DRect(uUTex, vec2(coordV)); 15 14 float y = vboxSplitBGRA(clrY, coordY.x); 16 15 float v = vboxSplitBGRA(clrV, coordV.x); 17 float u = vboxSplitBGRA(clrU, coord U.x);16 float u = vboxSplitBGRA(clrU, coordV.x); 18 17 vboxCConvApplyAYUV(vec4(u, y, 0.0, v)); 19 18 } -
trunk/src/VBox/Frontends/VirtualBox/shaders/cconvYV12_void.c
r22776 r22883 1 void vboxCConv( int srcI)1 void vboxCConv() 2 2 {} -
trunk/src/VBox/Frontends/VirtualBox/shaders/ckeyDst.c
r22776 r22883 2 2 uniform sampler2DRect uDstTex; 3 3 uniform vec4 uDstClr; 4 intvboxCKeyDst(void)4 void vboxCKeyDst(void) 5 5 { 6 vec4 dstClr = texture2DRect(uDstTex, vec2(gl_TexCoord[ 0]));6 vec4 dstClr = texture2DRect(uDstTex, vec2(gl_TexCoord[1])); 7 7 vec3 difClr = dstClr.rgb - uDstClr.rgb; 8 8 if(any(greaterThan(difClr, vec3(0.01, 0.01, 0.01))) 9 9 || any(lessThan(difClr, vec3(-0.01, -0.01, -0.01)))) 10 10 discard; 11 return 1;12 11 } -
trunk/src/VBox/Frontends/VirtualBox/shaders/ckeyDst_void.c
r22776 r22883 1 intvboxCKeyDst(void)1 void vboxCKeyDst(void) 2 2 { 3 return 0;4 3 } -
trunk/src/VBox/Frontends/VirtualBox/shaders/mainOverlay.c
r22776 r22883 1 intvboxCKeyDst(void);2 void vboxCConv( int srcI);1 void vboxCKeyDst(void); 2 void vboxCConv(); 3 3 void main(void) 4 4 { 5 int srci =vboxCKeyDst();6 vboxCConv(srci);5 vboxCKeyDst(); 6 vboxCConv(); 7 7 } -
trunk/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoCKey.c
r22787 r22883 1 void vboxCConv( int srcI);1 void vboxCConv(); 2 2 void main(void) 3 3 { 4 vboxCConv( 0);4 vboxCConv(); 5 5 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
r22852 r22883 1266 1266 do 1267 1267 { 1268 GLint tex = 0; 1268 1269 mUniSrcTex = vboxglGetUniformLocation(program(), "uSrcTex"); 1269 1270 Assert(mUniSrcTex != -1); 1270 1271 if(mUniSrcTex == -1) 1271 1272 break; 1272 if(type() & VBOXVHWA_PROGRAM_DSTCOLORKEY) 1273 { 1274 VBOXQGL_CHECKERR( 1275 vboxglUniform1i(mUniSrcTex, 1); 1276 ); 1277 mSrcTex = 1; 1278 1279 mUniDstTex = vboxglGetUniformLocation(program(), "uDstTex"); 1280 Assert(mUniDstTex != -1); 1281 if(mUniDstTex == -1) 1282 break; 1283 VBOXQGL_CHECKERR( 1284 vboxglUniform1i(mUniDstTex, 0); 1285 ); 1286 mDstTex = 0; 1287 mUniDstLowerColor = vboxglGetUniformLocation(program(), "uDstClr"); 1288 Assert(mUniDstLowerColor != -1); 1289 if(mUniDstLowerColor == -1) 1290 break; 1291 1292 mDstLowerR = 0.0; mDstLowerG = 0.0; mDstLowerB = 0.0; 1293 1294 VBOXQGL_CHECKERR( 1295 vboxglUniform4f(mUniDstLowerColor, 0.0, 0.0, 0.0, 0.0); 1296 ); 1297 } 1298 else 1299 { 1300 VBOXQGL_CHECKERR( 1301 vboxglUniform1i(mUniSrcTex, 1); 1302 ); 1303 mSrcTex = 0; 1304 } 1273 1274 VBOXQGL_CHECKERR( 1275 vboxglUniform1i(mUniSrcTex, tex); 1276 ); 1277 mSrcTex = tex; 1278 ++tex; 1305 1279 1306 1280 if(type() & VBOXVHWA_PROGRAM_SRCCOLORKEY) … … 1323 1297 case FOURCC_YV12: 1324 1298 { 1325 GLint tex = mSrcTex + 1;1326 1327 1299 mUniVTex = vboxglGetUniformLocation(program(), "uVTex"); 1328 1329 1300 Assert(mUniVTex != -1); 1330 1301 if(mUniVTex == -1) … … 1335 1306 ); 1336 1307 mVTex = tex; 1337 1338 tex++; 1308 ++tex; 1339 1309 1340 1310 mUniUTex = vboxglGetUniformLocation(program(), "uUTex"); … … 1342 1312 if(mUniUTex == -1) 1343 1313 break; 1344 1345 1314 VBOXQGL_CHECKERR( 1346 1315 vboxglUniform1i(mUniUTex, tex); 1347 1316 ); 1348 1317 mUTex = tex; 1318 ++tex; 1349 1319 1350 1320 break; … … 1358 1328 break; 1359 1329 } 1330 } 1331 1332 if(type() & VBOXVHWA_PROGRAM_DSTCOLORKEY) 1333 { 1334 1335 mUniDstTex = vboxglGetUniformLocation(program(), "uDstTex"); 1336 Assert(mUniDstTex != -1); 1337 if(mUniDstTex == -1) 1338 break; 1339 VBOXQGL_CHECKERR( 1340 vboxglUniform1i(mUniDstTex, tex); 1341 ); 1342 mDstTex = tex; 1343 ++tex; 1344 1345 mUniDstLowerColor = vboxglGetUniformLocation(program(), "uDstClr"); 1346 Assert(mUniDstLowerColor != -1); 1347 if(mUniDstLowerColor == -1) 1348 break; 1349 1350 mDstLowerR = 0.0; mDstLowerG = 0.0; mDstLowerB = 0.0; 1351 1352 VBOXQGL_CHECKERR( 1353 vboxglUniform4f(mUniDstLowerColor, 0.0, 0.0, 0.0, 0.0); 1354 ); 1360 1355 } 1361 1356 … … 1453 1448 mShaderSplitBGRA(":/splitBGRA.c", GL_FRAGMENT_SHADER), 1454 1449 mShaderCKeyDst(":/ckeyDst.c", GL_FRAGMENT_SHADER), 1450 mShaderCKeyDst2(":/ckeyDst2.c", GL_FRAGMENT_SHADER), 1455 1451 // mShaderCKeyDstVoid(":/ckeyDst_void.c", GL_FRAGMENT_SHADER), 1456 1452 // mShaderCKeySrc; … … 1494 1490 VBoxVHWAGlShader mShaderSplitBGRA; 1495 1491 1492 /* expected the dst surface texture to be bound to the 1-st tex unit */ 1496 1493 VBoxVHWAGlShader mShaderCKeyDst; 1494 /* expected the dst surface texture to be bound to the 2-nd tex unit */ 1495 VBoxVHWAGlShader mShaderCKeyDst2; 1497 1496 // VBoxVHWAGlShader mShaderCKeyDstVoid; 1498 1497 // VBoxVHWAGlShader mShaderCKeySrc; … … 1517 1516 if(type & VBOXVHWA_PROGRAM_DSTCOLORKEY) 1518 1517 { 1519 apShaders[cShaders++] = &mShaderCKeyDst; 1518 if(fourcc == FOURCC_YV12) 1519 { 1520 apShaders[cShaders++] = &mShaderCKeyDst2; 1521 } 1522 else 1523 { 1524 apShaders[cShaders++] = &mShaderCKeyDst; 1525 } 1520 1526 } 1521 1527 // ensure we don't have empty functions /* paranoya for for ATI on linux */ … … 2573 2579 // VBOXQGL_CHECKERR( 2574 2580 glBegin(GL_QUADS); 2575 pDstTex->multiTexCoord(GL_TEXTURE0, bx1, by1); 2581 2576 2582 for(int i = 0; i < cSrcTex; i++) 2577 2583 { 2578 // vboxglMultiTexCoord2d(GL_TEXTURE1 + i, ((double)tx1)/mpTex[i]->texRect().width()/(width()/mpTex[i]->rect().width()), 2579 // ((double)ty1)/mpTex[i]->texRect().height()/(height()/mpTex[i]->rect().height())); 2580 mpTex[i]->multiTexCoord(GL_TEXTURE1 + i, tx1/(t0width/mpTex[i]->rect().width()), ty1/(t0height/mpTex[i]->rect().height())); 2581 2584 mpTex[i]->multiTexCoord(GL_TEXTURE0 + i, tx1/(t0width/mpTex[i]->rect().width()), ty1/(t0height/mpTex[i]->rect().height())); 2582 2585 } 2586 pDstTex->multiTexCoord(GL_TEXTURE0 + cSrcTex, bx1, by1); 2583 2587 glVertex2i(bx1, by1); 2584 pDstTex->multiTexCoord(GL_TEXTURE0, bx1, by2); 2588 2585 2589 for(int i = 0; i < cSrcTex; i++) 2586 2590 { 2587 // vboxglMultiTexCoord2d(GL_TEXTURE1 + i, ((double)tx1)/mpTex[i]->texRect().width()/(width()/mpTex[i]->rect().width()), 2588 // ((double)ty2)/mpTex[i]->texRect().height()/(height()/mpTex[i]->rect().height())); 2589 mpTex[i]->multiTexCoord(GL_TEXTURE1 + i, tx1/(t0width/mpTex[i]->rect().width()), ty2/(t0height/mpTex[i]->rect().height())); 2590 2591 mpTex[i]->multiTexCoord(GL_TEXTURE0 + i, tx1/(t0width/mpTex[i]->rect().width()), ty2/(t0height/mpTex[i]->rect().height())); 2591 2592 } 2593 pDstTex->multiTexCoord(GL_TEXTURE0 + cSrcTex, bx1, by2); 2592 2594 glVertex2i(bx1, by2); 2593 pDstTex->multiTexCoord(GL_TEXTURE0, bx2, by2); 2595 2594 2596 for(int i = 0; i < cSrcTex; i++) 2595 2597 { 2596 // vboxglMultiTexCoord2d(GL_TEXTURE1 + i, ((double)tx2)/mpTex[i]->texRect().width()/(width()/mpTex[i]->rect().width()), 2597 // ((double)ty2)/mpTex[i]->texRect().height()/(height()/mpTex[i]->rect().height())); 2598 mpTex[i]->multiTexCoord(GL_TEXTURE1 + i, tx2/(t0width/mpTex[i]->rect().width()), ty2/(t0height/mpTex[i]->rect().height())); 2599 2598 mpTex[i]->multiTexCoord(GL_TEXTURE0 + i, tx2/(t0width/mpTex[i]->rect().width()), ty2/(t0height/mpTex[i]->rect().height())); 2600 2599 } 2600 pDstTex->multiTexCoord(GL_TEXTURE0 + cSrcTex, bx2, by2); 2601 2601 glVertex2i(bx2, by2); 2602 pDstTex->multiTexCoord(GL_TEXTURE0, bx2, by1); 2602 2603 2603 for(int i = 0; i < cSrcTex; i++) 2604 2604 { 2605 // vboxglMultiTexCoord2d(GL_TEXTURE1 + i, ((double)tx2)/mpTex[i]->texRect().width()/(width()/mpTex[i]->rect().width()), 2606 // ((double)ty1)/mpTex[i]->texRect().height()/(height()/mpTex[i]->rect().height())); 2607 mpTex[i]->multiTexCoord(GL_TEXTURE1 + i, tx2/(t0width/mpTex[i]->rect().width()), ty1/(t0height/mpTex[i]->rect().height())); 2608 2605 mpTex[i]->multiTexCoord(GL_TEXTURE0 + i, tx2/(t0width/mpTex[i]->rect().width()), ty1/(t0height/mpTex[i]->rect().height())); 2609 2606 } 2607 pDstTex->multiTexCoord(GL_TEXTURE0 + cSrcTex, bx2, by1); 2610 2608 glVertex2i(bx2, by1); 2609 2611 2610 glEnd(); 2612 2611 // ); … … 2747 2746 if(bBindDst) 2748 2747 { 2749 vboxglActiveTexture(GL_TEXTURE1);2750 mpTex[0]->bind();2751 if(fourcc() == FOURCC_YV12)2752 {2753 vboxglActiveTexture(GL_TEXTURE1+1);2754 mpTex[1]->bind();2755 vboxglActiveTexture(GL_TEXTURE1 + 2);2756 mpTex[2]->bind();2757 }2758 vboxglActiveTexture(GL_TEXTURE0);2759 pPrimary->mpTex[0]->bind();2760 bInvokeMultiTex2 = true;2761 }2762 else2763 {2764 2748 if(fourcc() == FOURCC_YV12) 2765 2749 { 2766 2750 vboxglActiveTexture(GL_TEXTURE1); 2767 2751 mpTex[1]->bind(); 2768 vboxglActiveTexture(GL_TEXTURE1 +1);2752 vboxglActiveTexture(GL_TEXTURE1+1); 2769 2753 mpTex[2]->bind(); 2754 2755 vboxglActiveTexture(GL_TEXTURE1+2); 2756 } 2757 else 2758 { 2759 vboxglActiveTexture(GL_TEXTURE1); 2760 } 2761 pPrimary->mpTex[0]->bind(); 2762 2763 vboxglActiveTexture(GL_TEXTURE0); 2764 mpTex[0]->bind(); 2765 bInvokeMultiTex2 = true; 2766 } 2767 else 2768 { 2769 if(fourcc() == FOURCC_YV12) 2770 { 2771 vboxglActiveTexture(GL_TEXTURE1); 2772 mpTex[1]->bind(); 2770 2773 vboxglActiveTexture(GL_TEXTURE0); 2771 2774 } … … 2783 2786 { 2784 2787 doMultiTex2FB(&mVisibleTargRect, pPrimary->mpTex[0], &mVisibleSrcRect, 2785 (fourcc() == FOURCC_YV12) ? 3: 1);2788 (fourcc() == FOURCC_YV12) ? 2 : 1); 2786 2789 } 2787 2790 else … … 2789 2792 if(fourcc() == FOURCC_YV12) 2790 2793 { 2791 doMultiTex2FB(&mVisibleTargRect, &mVisibleSrcRect, 3);2794 doMultiTex2FB(&mVisibleTargRect, &mVisibleSrcRect, 2); 2792 2795 } 2793 2796 else
Note:
See TracChangeset
for help on using the changeset viewer.