Changeset 48291 in vbox for trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp
- Timestamp:
- Sep 5, 2013 7:25:47 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp
r48275 r48291 841 841 #define CR_GLSL_STR_V_120 "#version 120\n" 842 842 #define CR_GLSL_STR_EXT_TR "#extension GL_ARB_texture_rectangle : enable\n" 843 #define CR_GLSL_STR_ TEX2D "texture2D"844 #define CR_GLSL_STR_ TEX2DRECT "texture2DRect"843 #define CR_GLSL_STR_2D "2D" 844 #define CR_GLSL_STR_2DRECT "2DRect" 845 845 846 846 #define CR_GLSL_PATTERN_FS_NOALPHA(_ver, _ext, _tex) \ 847 847 _ver \ 848 848 _ext \ 849 "uniform sampler" _tex " sampler0;\n" \ 849 850 "void main()\n" \ 850 851 "{\n" \ 851 852 "vec2 srcCoord = vec2(gl_TexCoord[0]);\n" \ 852 "gl_FragData[0].xyz = ( " _tex "(0, srcCoord).xyz);\n" \853 "gl_FragData[0].xyz = (texture" _tex "(sampler0, srcCoord).xyz);\n" \ 853 854 "gl_FragData[0].w = 1.0;\n" \ 854 855 "}\n" … … 865 866 { 866 867 if (enmTexTarget == GL_TEXTURE_2D) 867 return CR_GLSL_PATTERN_FS_NOALPHA(CR_GLSL_STR_V_120, "", CR_GLSL_STR_ TEX2D);868 return CR_GLSL_PATTERN_FS_NOALPHA(CR_GLSL_STR_V_120, "", CR_GLSL_STR_2D); 868 869 else if (enmTexTarget == GL_TEXTURE_RECTANGLE_ARB) 869 return CR_GLSL_PATTERN_FS_NOALPHA(CR_GLSL_STR_V_120, CR_GLSL_STR_EXT_TR, CR_GLSL_STR_ TEX2DRECT);870 return CR_GLSL_PATTERN_FS_NOALPHA(CR_GLSL_STR_V_120, CR_GLSL_STR_EXT_TR, CR_GLSL_STR_2DRECT); 870 871 871 872 crWarning("invalid enmTexTarget %#x", enmTexTarget); … … 875 876 { 876 877 if (enmTexTarget == GL_TEXTURE_2D) 877 return CR_GLSL_PATTERN_FS_NOALPHA("", "", CR_GLSL_STR_ TEX2D);878 return CR_GLSL_PATTERN_FS_NOALPHA("", "", CR_GLSL_STR_2D); 878 879 else if (enmTexTarget == GL_TEXTURE_RECTANGLE_ARB) 879 return CR_GLSL_PATTERN_FS_NOALPHA("", CR_GLSL_STR_EXT_TR, CR_GLSL_STR_ TEX2DRECT);880 return CR_GLSL_PATTERN_FS_NOALPHA("", CR_GLSL_STR_EXT_TR, CR_GLSL_STR_2DRECT); 880 881 881 882 crWarning("invalid enmTexTarget %#x", enmTexTarget); … … 901 902 GLchar * pBuf = NULL; 902 903 GLuint uiProgram = 0; 904 GLint iUniform = -1; 903 905 GLuint uiShader = pCache->pDispatch->CreateShader(GL_FRAGMENT_SHADER); 904 906 if (!uiShader) … … 924 926 #ifdef DEBUG_misha 925 927 if (compiled) 926 crDebug("compile success:\n-------------------\n% d\n--------\n", pBuf);928 crDebug("compile success:\n-------------------\n%s\n--------\n", pBuf); 927 929 else 928 930 #endif 929 931 { 930 crWarning("compile FAILURE:\n-------------------\n%d\n--------\n", pBuf); 932 Assert(0); 933 crWarning("compile FAILURE:\n-------------------\n%s\n--------\n", pBuf); 931 934 rc = VERR_NOT_SUPPORTED; 932 935 goto end; … … 958 961 #ifdef DEBUG_misha 959 962 if (linked) 960 crDebug("link success:\n-------------------\n% d\n--------\n", pBuf);963 crDebug("link success:\n-------------------\n%s\n--------\n", pBuf); 961 964 else 962 965 #endif 963 966 { 964 crWarning("link FAILURE:\n-------------------\n%d\n--------\n", pBuf); 967 Assert(0); 968 crWarning("link FAILURE:\n-------------------\n%s\n--------\n", pBuf); 965 969 rc = VERR_NOT_SUPPORTED; 966 970 goto end; … … 969 973 970 974 Assert(linked); 975 976 iUniform = pCache->pDispatch->GetUniformLocation(uiProgram, "sampler0"); 977 if (iUniform == -1) 978 { 979 crWarning("GetUniformLocation failed for sampler0"); 980 } 981 else 982 { 983 pCache->pDispatch->Uniform1i(iUniform, 0); 984 } 971 985 972 986 *puiProgram = uiProgram; … … 1088 1102 } 1089 1103 1090 VBOXBLITTERDECL(bool) CrGlslNeedsCleanup( CR_GLSL_CACHE *pCache)1104 VBOXBLITTERDECL(bool) CrGlslNeedsCleanup(const CR_GLSL_CACHE *pCache) 1091 1105 { 1092 1106 return pCache->uNoAlpha2DProg || pCache->uNoAlpha2DRectProg;
Note:
See TracChangeset
for help on using the changeset viewer.