Changeset 48348 in vbox for trunk/src/VBox
- Timestamp:
- Sep 6, 2013 10:22:11 AM (11 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/include/cr_blitter.h
r48291 r48348 32 32 typedef struct CR_GLSL_CACHE 33 33 { 34 float glVersion;34 int iGlVersion; 35 35 GLuint uNoAlpha2DProg; 36 36 GLuint uNoAlpha2DRectProg; … … 41 41 { 42 42 memset(pCache, 0, sizeof (*pCache)); 43 pCache->glVersion = 0.0;44 43 pCache->pDispatch = pDispatch; 45 44 } -
trunk/src/VBox/GuestHost/OpenGL/include/cr_string.h
r20374 r48348 37 37 DECLEXPORT(void) crWordsToString( char *string, int nstring, void *data, int ndata ); 38 38 39 #define CR_GLVERSION_OFFSET_MAJOR (24) 40 #define CR_GLVERSION_OFFSET_MINOR (16) 41 #define CR_GLVERSION_OFFSET_BUILD (0) 42 43 #define CR_GLVERSION_MAX_MAJOR (0x7f) 44 #define CR_GLVERSION_MAX_MINOR (0xff) 45 #define CR_GLVERSION_MAX_BUILD (0xffff) 46 47 #define CR_GLVERSION_MASK_MAJOR (CR_GLVERSION_MAX_MAJOR << CR_GLVERSION_OFFSET_MAJOR) 48 #define CR_GLVERSION_MASK_MINOR (CR_GLVERSION_MAX_MINOR << CR_GLVERSION_OFFSET_MINOR) 49 #define CR_GLVERSION_MASK_BUILD (CR_GLVERSION_MAX_BUILD << CR_GLVERSION_OFFSET_BUILD) 50 51 #define CR_GLVERSION_COMPOSE_EL(_val, _type) (((_val) << CR_GLVERSION_OFFSET_##_type) & CR_GLVERSION_MASK_##_type) 52 53 #define CR_GLVERSION_COMPOSE(_maj, _min, _build) (CR_GLVERSION_COMPOSE_EL((_maj), MAJOR) \ 54 + CR_GLVERSION_COMPOSE_EL((_min), MINOR) \ 55 + CR_GLVERSION_COMPOSE_EL((_build), BUILD)) 56 57 #define CR_GLVERSION_GET_EL(_val, _type) (((_val) & CR_GLVERSION_MASK_##_type) >> CR_GLVERSION_OFFSET_##_type) 58 #define CR_GLVERSION_GET_MAJOR(_val) CR_GLVERSION_GET_EL((_val), MAJOR) 59 #define CR_GLVERSION_GET_MINOR(_val) CR_GLVERSION_GET_EL((_val), MINOR) 60 #define CR_GLVERSION_GET_BUILD(_val) CR_GLVERSION_GET_EL((_val), BUILD) 61 62 DECLEXPORT(int) crStrParseGlVersion(const char * ver); 39 63 RT_C_DECLS_END 40 64 -
trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp
r48341 r48348 823 823 VBOXBLITTERDECL(bool) CrGlslIsSupported(CR_GLSL_CACHE *pCache) 824 824 { 825 if (pCache-> glVersion == 0.)825 if (pCache->iGlVersion == 0) 826 826 { 827 827 const char * pszStr = (const char*)pCache->pDispatch->GetString(GL_VERSION); 828 pCache->glVersion = crStrToFloat(pszStr); 829 if (pCache->glVersion == 0.) 830 { 831 crWarning("pCache->glVersion is null!"); 832 } 833 } 834 835 if (pCache->glVersion >= 2.0) 828 pCache->iGlVersion = crStrParseGlVersion(pszStr); 829 if (pCache->iGlVersion <= 0) 830 { 831 crWarning("crStrParseGlVersion returned %d", pCache->iGlVersion); 832 pCache->iGlVersion = -1; 833 } 834 } 835 836 if (pCache->iGlVersion >= CR_GLVERSION_COMPOSE(2, 0, 0)) 836 837 return true; 838 839 crWarning("GLSL unsuported, gl version %d", pCache->iGlVersion); 837 840 838 841 /* @todo: we could also check for GL_ARB_shader_objects and GL_ARB_fragment_shader, … … 865 868 } 866 869 867 if (pCache-> glVersion >= 2.1)870 if (pCache->iGlVersion >= CR_GLVERSION_COMPOSE(2, 1, 0)) 868 871 { 869 872 if (enmTexTarget == GL_TEXTURE_2D) … … 875 878 return NULL; 876 879 } 877 else if (pCache-> glVersion >= 2.0)880 else if (pCache->iGlVersion >= CR_GLVERSION_COMPOSE(2, 0, 0)) 878 881 { 879 882 if (enmTexTarget == GL_TEXTURE_2D) … … 932 935 #endif 933 936 { 934 Assert(0);935 937 crWarning("compile FAILURE:\n-------------------\n%s\n--------\n", pBuf); 936 938 rc = VERR_NOT_SUPPORTED; … … 967 969 #endif 968 970 { 969 Assert(0);970 971 crWarning("link FAILURE:\n-------------------\n%s\n--------\n", pBuf); 971 972 rc = VERR_NOT_SUPPORTED; -
trunk/src/VBox/GuestHost/OpenGL/util/string.c
r15532 r48348 7 7 #include "cr_mem.h" 8 8 #include "cr_string.h" 9 #include "cr_error.h" 9 10 10 11 #include <string.h> … … 409 410 return c >= '0' && c <= '9'; 410 411 } 412 413 414 static int crStrParseGlSubver(const char * ver, const char ** pNext, bool bSpacePrefixAllowed) 415 { 416 const char * initVer = ver; 417 int val = 0; 418 419 for(;;++ver) 420 { 421 if(*ver >= '0' && *ver <= '9') 422 { 423 if(!val) 424 { 425 if(*ver == '0') 426 continue; 427 } 428 else 429 { 430 val *= 10; 431 } 432 val += *ver - '0'; 433 } 434 else if(*ver == '.') 435 { 436 *pNext = ver+1; 437 break; 438 } 439 else if(*ver == '\0') 440 { 441 *pNext = NULL; 442 break; 443 } 444 else if(*ver == ' ' || *ver == '\t' || *ver == 0x0d || *ver == 0x0a) 445 { 446 if(bSpacePrefixAllowed) 447 { 448 if(!val) 449 { 450 continue; 451 } 452 } 453 454 /* treat this as the end of version string */ 455 *pNext = NULL; 456 break; 457 } 458 else 459 { 460 crWarning("error parsing version %s", initVer); 461 val = -1; 462 break; 463 } 464 } 465 466 return val; 467 } 468 469 int crStrParseGlVersion(const char * ver) 470 { 471 const char * initVer = ver; 472 int tmp; 473 int iVer = crStrParseGlSubver(ver, &ver, true); 474 if(iVer <= 0) 475 { 476 crWarning("parsing major version returned %d, '%s'", iVer, initVer); 477 return iVer; 478 } 479 480 if (iVer > CR_GLVERSION_MAX_MAJOR) 481 { 482 crWarning("major version %d is bigger than the max supported %#x, this is somewhat not expected, failing", iVer, CR_GLVERSION_MAX_MAJOR); 483 return -1; 484 } 485 486 iVer <<= CR_GLVERSION_OFFSET_MAJOR; 487 if(!ver) 488 { 489 crDebug("no minor version supplied"); 490 goto done; 491 } 492 493 tmp = crStrParseGlSubver(ver, &ver, false); 494 if (tmp < 0) 495 { 496 crWarning("parsing minor version failed, '%s'", initVer); 497 return -1; 498 } 499 500 if (tmp > CR_GLVERSION_MAX_MINOR) 501 { 502 crWarning("minor version %d is bigger than the max supported %#x, this is somewhat not expected, failing", iVer, CR_GLVERSION_MAX_MAJOR); 503 return -1; 504 } 505 506 iVer |= tmp << CR_GLVERSION_OFFSET_MINOR; 507 508 if (!ver) 509 { 510 crDebug("no build version supplied"); 511 goto done; 512 } 513 514 tmp = crStrParseGlSubver(ver, &ver, false); 515 if (tmp < 0) 516 { 517 crWarning("parsing build version failed, '%s', using 0", initVer); 518 tmp = 0; 519 } 520 521 if (tmp > CR_GLVERSION_MAX_BUILD) 522 { 523 crWarning("build version %d is bigger than the max supported, using max supported val %#x", tmp, CR_GLVERSION_MAX_BUILD); 524 tmp = CR_GLVERSION_MAX_MAJOR; 525 } 526 527 iVer |= tmp << CR_GLVERSION_OFFSET_BUILD; 528 529 done: 530 crDebug("returning version %#x for string '%s'", iVer, initVer); 531 532 return iVer; 533 } -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m
r48325 r48348 1425 1425 Assert(WinInfo.height = m_RootRect.size.height); 1426 1426 1427 CrBltMuralSetCurrent(m_pBlitter, NULL);1427 /*CrBltMuralSetCurrent(m_pBlitter, NULL);*/ 1428 1428 1429 1429 CrBltMuralSetCurrent(m_pBlitter, &WinInfo);
Note:
See TracChangeset
for help on using the changeset viewer.