Changeset 27396 in vbox
- Timestamp:
- Mar 16, 2010 12:43:40 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 58858
- Location:
- trunk/src/VBox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_getstring.c
r24269 r27396 97 97 return GetExtensions(); 98 98 case GL_VERSION: 99 #if def WINDOWS99 #if 0 && defined(WINDOWS) 100 100 if (packspuRunningUnderWine()) 101 101 { -
trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_pixel.c
r27091 r27396 130 130 && internalformat!=GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 131 131 && internalformat!=GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 132 # ifdef CR_EXT_texture_sRGB 133 && internalformat!=GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 134 && internalformat!=GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 135 && internalformat!=GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 136 && internalformat!=GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 137 # endif 132 138 #endif 133 139 ) -
trunk/src/VBox/GuestHost/OpenGL/include/cr_extstring.h
r27091 r27396 209 209 #endif 210 210 #ifdef CR_ARB_fragment_shader 211 "GL_ARB_fragment_shader" 211 "GL_ARB_fragment_shader " 212 #endif 213 #ifdef CR_EXT_texture_sRGB 214 "CR_EXT_texture_sRGB " 212 215 #endif 213 216 ""; -
trunk/src/VBox/GuestHost/OpenGL/include/cr_version.h
r27091 r27396 31 31 #define CR_OPENGL_VERSION_1_5 1 32 32 #define CR_OPENGL_VERSION_2_0 1 33 #define CR_OPENGL_VERSION_2_1 1 33 34 34 35 /* Version (string) of OpenGL functionality suported by Chromium */ 35 #ifdef CR_OPENGL_VERSION_2_0 36 #ifdef CR_OPENGL_VERSION_2_1 37 # define CR_OPENGL_VERSION_STRING "2.1" 38 #elif defined(CR_OPENGL_VERSION_2_0) 36 39 # define CR_OPENGL_VERSION_STRING "2.0" 37 40 #else … … 123 126 124 127 #define CR_ARB_pixel_buffer_object 1 128 #define CR_EXT_texture_sRGB 1 125 129 126 130 #endif /* CR_VERSION_H */ -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_texture.c
r25154 r27396 382 382 case GL_RGBA: 383 383 case GL_COMPRESSED_RGBA_ARB: 384 #ifdef CR_EXT_texture_sRGB 385 case GL_SRGB_ALPHA_EXT: 386 case GL_SRGB8_ALPHA8_EXT: 387 case GL_COMPRESSED_SRGB_ALPHA_EXT: 388 #endif 384 389 tl->texFormat = &_texformat_rgba8888; 385 390 break; … … 388 393 case GL_RGB: 389 394 case GL_COMPRESSED_RGB_ARB: 395 #ifdef CR_EXT_texture_sRGB 396 case GL_SRGB_EXT: 397 case GL_SRGB8_EXT: 398 case GL_COMPRESSED_SRGB_EXT: 399 #endif 390 400 tl->texFormat = &_texformat_rgb888; 391 401 break; … … 429 439 case GL_LUMINANCE16: 430 440 case GL_COMPRESSED_LUMINANCE_ARB: 441 #ifdef CR_EXT_texture_sRGB 442 case GL_SLUMINANCE_EXT: 443 case GL_SLUMINANCE8_EXT: 444 case GL_COMPRESSED_SLUMINANCE_EXT: 445 #endif 431 446 tl->texFormat = &_texformat_l8; 432 447 break; … … 441 456 case GL_LUMINANCE16_ALPHA16: 442 457 case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: 458 #ifdef CR_EXT_texture_sRGB 459 case GL_SLUMINANCE_ALPHA_EXT: 460 case GL_SLUMINANCE8_ALPHA8_EXT: 461 case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: 462 #endif 443 463 tl->texFormat = &_texformat_al88; 444 464 break; -
trunk/src/VBox/GuestHost/OpenGL/util/pixel.c
r23435 r27396 1 /* Cop yright(c) 2001, Stanford University1 /* Cop(c) 2001, Stanford University 2 2 * All rights reserved 3 3 * … … 10 10 #include "cr_version.h" 11 11 12 #if defined(WINDOWS) 13 # include <math.h> 14 # include <float.h> 15 # define isnan(x) _isnan(x) 16 #else 17 # include <cmath> 18 #endif 12 19 13 20 /** … … 116 123 case GL_LUMINANCE: 117 124 case GL_INTENSITY: 125 #ifdef CR_EXT_texture_sRGB 126 case GL_SLUMINANCE_EXT: 127 case GL_SLUMINANCE8_EXT: 128 #endif 118 129 break; 119 130 case GL_LUMINANCE_ALPHA: 131 #ifdef CR_EXT_texture_sRGB 132 case GL_SLUMINANCE_ALPHA_EXT: 133 case GL_SLUMINANCE8_ALPHA8_EXT: 134 #endif 120 135 bytes *= 2; 121 136 break; … … 124 139 case GL_BGR: 125 140 #endif 141 #ifdef CR_EXT_texture_sRGB 142 case GL_SRGB_EXT: 143 case GL_SRGB8_EXT: 144 #endif 126 145 bytes *= 3; 127 146 break; … … 133 152 case GL_BGRA: 134 153 #endif 154 #ifdef CR_EXT_texture_sRGB 155 case GL_SRGB_ALPHA_EXT: 156 case GL_SRGB8_ALPHA8_EXT: 157 #endif 135 158 bytes *= 4; 136 159 break; … … 162 185 #define FLOAT_TO_UINT(f) ((GLuint) ((f) * 4294967295.0)) 163 186 187 188 static float SRGBF_TO_RGBF(float f) 189 { 190 if (isnan(f)) return 0.f; 191 192 if (f<=0.04045f) 193 { 194 return f/12.92f; 195 } 196 else 197 { 198 return pow((f+0.055f)/1.055f, 2.4f); 199 } 200 } 201 202 static float RGBF_TO_SRGBF(float f) 203 { 204 if (isnan(f)) return 0.f; 205 if (f>1.f) return 1.f; 206 if (f<0.f) return 0.f; 207 208 if (f<0.0031308f) 209 { 210 return f*12.92f; 211 } 212 else 213 { 214 return 1.055f*pow(f, 0.41666f) - 0.055f; 215 } 216 } 164 217 165 218 #ifdef _MSC_VER … … 268 321 } 269 322 else if (srcFormat == GL_RED || srcFormat == GL_GREEN || 270 323 srcFormat == GL_BLUE || srcFormat == GL_ALPHA) { 271 324 int dst; 272 325 if (srcFormat == GL_RED) … … 321 374 } 322 375 } 323 else if (srcFormat == GL_LUMINANCE) { 376 else if (srcFormat == GL_LUMINANCE 377 #ifdef CR_EXT_texture_sRGB 378 || srcFormat == GL_SLUMINANCE_EXT 379 || srcFormat == GL_SLUMINANCE8_EXT 380 #endif 381 ) { 324 382 switch (srcType) { 325 383 case GL_BYTE: … … 427 485 } 428 486 } 429 else if (srcFormat == GL_LUMINANCE_ALPHA) { 487 else if (srcFormat == GL_LUMINANCE_ALPHA 488 #ifdef CR_EXT_texture_sRGB 489 || srcFormat == GL_SLUMINANCE_ALPHA_EXT 490 || srcFormat == GL_SLUMINANCE8_ALPHA8_EXT 491 #endif 492 ) { 430 493 switch (srcType) { 431 494 case GL_BYTE: … … 490 553 else if (srcFormat == GL_RGB 491 554 #ifdef CR_OPENGL_VERSION_1_2 492 || srcFormat == GL_BGR 555 || srcFormat == GL_BGR 556 #endif 557 #ifdef CR_EXT_texture_sRGB 558 || srcFormat == GL_SRGB_EXT 559 || srcFormat == GL_SRGB8_EXT 493 560 #endif 494 561 ) { 495 562 int r, b; 496 if (srcFormat == GL_RGB) { 563 if (srcFormat == GL_RGB 564 #ifdef CR_EXT_texture_sRGB 565 || srcFormat == GL_SRGB_EXT 566 || srcFormat == GL_SRGB8_EXT 567 #endif 568 ) { 497 569 r = 0; b = 2; 498 570 } … … 605 677 else if (srcFormat == GL_RGBA 606 678 #ifdef CR_OPENGL_VERSION_1_2 607 || srcFormat == GL_BGRA 608 #endif 609 ) { 679 || srcFormat == GL_BGRA 680 #endif 681 #ifdef CR_EXT_texture_sRGB 682 || srcFormat == GL_SRGB_ALPHA_EXT 683 || srcFormat == GL_SRGB8_ALPHA8_EXT 684 #endif 685 ) { 610 686 int r, b; 611 if (srcFormat == GL_RGB) { 687 if (srcFormat == GL_RGBA 688 #ifdef CR_EXT_texture_sRGB 689 || srcFormat == GL_SRGB_ALPHA_EXT 690 || srcFormat == GL_SRGB8_ALPHA8_EXT 691 #endif 692 ) 693 { 612 694 r = 0; b = 2; 613 695 } … … 753 835 crError("unexpected source format in get_row in pixel.c"); 754 836 } 837 838 #ifdef CR_EXT_texture_sRGB 839 if (srcFormat == GL_SRGB_EXT 840 || srcFormat == GL_SRGB8_EXT 841 || srcFormat == GL_SRGB_ALPHA_EXT 842 || srcFormat == GL_SRGB8_ALPHA8_EXT 843 || srcFormat == GL_SLUMINANCE_ALPHA_EXT 844 || srcFormat == GL_SLUMINANCE8_ALPHA8_EXT 845 || srcFormat == GL_SLUMINANCE_EXT 846 || srcFormat == GL_SLUMINANCE8_EXT 847 ) 848 { 849 for (i=0; i<width; ++i) 850 { 851 tmpRow[i*4+0] = SRGBF_TO_RGBF(tmpRow[i*4+0]); 852 tmpRow[i*4+1] = SRGBF_TO_RGBF(tmpRow[i*4+1]); 853 tmpRow[i*4+2] = SRGBF_TO_RGBF(tmpRow[i*4+2]); 854 } 855 } 856 #endif 755 857 } 756 858 757 859 758 860 static void put_row(char *dst, GLenum dstFormat, GLenum dstType, 759 GLsizei width, constGLfloat *tmpRow)861 GLsizei width, GLfloat *tmpRow) 760 862 { 761 863 GLbyte *bDst = (GLbyte *) dst; … … 769 871 int i; 770 872 873 #ifdef CR_EXT_texture_sRGB 874 if (dstFormat == GL_SRGB_EXT 875 || dstFormat == GL_SRGB8_EXT 876 || dstFormat == GL_SRGB_ALPHA_EXT 877 || dstFormat == GL_SRGB8_ALPHA8_EXT 878 || dstFormat == GL_SLUMINANCE_ALPHA_EXT 879 || dstFormat == GL_SLUMINANCE8_ALPHA8_EXT 880 || dstFormat == GL_SLUMINANCE_EXT 881 || dstFormat == GL_SLUMINANCE8_EXT 882 ) 883 { 884 for (i=0; i<width; ++i) 885 { 886 tmpRow[i*4+0] = RGBF_TO_SRGBF(tmpRow[i*4+0]); 887 tmpRow[i*4+1] = RGBF_TO_SRGBF(tmpRow[i*4+1]); 888 tmpRow[i*4+2] = RGBF_TO_SRGBF(tmpRow[i*4+2]); 889 } 890 } 891 #endif 892 771 893 if (dstFormat == GL_COLOR_INDEX || dstFormat == GL_STENCIL_INDEX) { 772 894 switch (dstType) { … … 846 968 } 847 969 else if (dstFormat == GL_RED || dstFormat == GL_GREEN || 848 dstFormat == GL_BLUE || dstFormat == GL_ALPHA || 849 dstFormat == GL_LUMINANCE || dstFormat == GL_INTENSITY) { 970 dstFormat == GL_BLUE || dstFormat == GL_ALPHA || 971 dstFormat == GL_LUMINANCE || dstFormat == GL_INTENSITY 972 #ifdef CR_EXT_texture_sRGB 973 || dstFormat == GL_SLUMINANCE_EXT 974 || dstFormat == GL_SLUMINANCE8_EXT 975 #endif 976 ) { 850 977 int index; 851 978 if (dstFormat == GL_RED) 852 979 index = 0; 853 else if (dstFormat == GL_LUMINANCE) 980 else if (dstFormat == GL_LUMINANCE 981 #ifdef CR_EXT_texture_sRGB 982 || dstFormat == GL_SLUMINANCE_EXT 983 || dstFormat == GL_SLUMINANCE8_EXT 984 #endif 985 ) 854 986 index = 0; 855 987 else if (dstFormat == GL_INTENSITY) … … 898 1030 } 899 1031 } 900 else if (dstFormat == GL_LUMINANCE_ALPHA) { 1032 else if (dstFormat == GL_LUMINANCE_ALPHA 1033 #ifdef CR_EXT_texture_sRGB 1034 || dstFormat == GL_SLUMINANCE_ALPHA_EXT 1035 || dstFormat == GL_SLUMINANCE8_ALPHA8_EXT 1036 #endif 1037 ) { 901 1038 switch (dstType) { 902 1039 case GL_BYTE: … … 954 1091 else if (dstFormat == GL_RGB 955 1092 #ifdef CR_OPENGL_VERSION_1_2 956 || dstFormat == GL_BGR 1093 || dstFormat == GL_BGR 1094 #endif 1095 #ifdef CR_EXT_texture_sRGB 1096 || dstFormat == GL_SRGB_EXT 1097 || dstFormat == GL_SRGB8_EXT 957 1098 #endif 958 1099 ) { 959 1100 int r, b; 960 if (dstFormat == GL_RGB) { 1101 if (dstFormat == GL_RGB 1102 #ifdef CR_EXT_texture_sRGB 1103 || dstFormat == GL_SRGB_EXT 1104 || dstFormat == GL_SRGB8_EXT 1105 #endif 1106 ) { 961 1107 r = 0; b = 2; 962 1108 } … … 1061 1207 else if (dstFormat == GL_RGBA 1062 1208 #ifdef CR_OPENGL_VERSION_1_2 1063 || dstFormat == GL_BGRA 1209 || dstFormat == GL_BGRA 1210 #endif 1211 #ifdef CR_EXT_texture_sRGB 1212 || dstFormat == GL_SRGB_ALPHA_EXT 1213 || dstFormat == GL_SRGB8_ALPHA8_EXT 1064 1214 #endif 1065 1215 ) { 1066 1216 int r, b; 1067 if (dstFormat == GL_RGB) { 1217 if (dstFormat == GL_RGBA 1218 #ifdef CR_EXT_texture_sRGB 1219 || dstFormat == GL_SRGB_ALPHA_EXT 1220 || dstFormat == GL_SRGB8_ALPHA8_EXT 1221 #endif 1222 ) { 1068 1223 r = 0; b = 2; 1069 1224 }
Note:
See TracChangeset
for help on using the changeset viewer.