| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include <EGL/egl.h> | 8 #include <EGL/egl.h> |
| 9 | 9 |
| 10 #include "SkOnce.h" | 10 #include "SkOnce.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 static GetProcAddressProc gfGetProcAddress = nullptr; | 41 static GetProcAddressProc gfGetProcAddress = nullptr; |
| 42 | 42 |
| 43 static HMODULE ghLibrary = nullptr; | 43 static HMODULE ghLibrary = nullptr; |
| 44 static bool gfFunctionsLoadedSuccessfully = false; | 44 static bool gfFunctionsLoadedSuccessfully = false; |
| 45 | 45 |
| 46 static void load_command_buffer_functions() { | 46 static void load_command_buffer_functions() { |
| 47 if (!ghLibrary) { | 47 if (!ghLibrary) { |
| 48 ghLibrary = LoadLibrary("command_buffer_gles2.dll"); | 48 ghLibrary = LoadLibrary("command_buffer_gles2.dll"); |
| 49 | 49 |
| 50 if (ghLibrary) { | 50 if (ghLibrary) { |
| 51 gfGetDisplay = (GetDisplayProc)::GetProcAddress(ghLibrary, "CommandB
uffer_GetDisplay"); | 51 gfGetDisplay = (GetDisplayProc)::GetProcAddress(ghLibrary, "eglGetDi
splay"); |
| 52 gfInitialize = (InitializeProc)::GetProcAddress(ghLibrary, "CommandB
uffer_Initialize"); | 52 gfInitialize = (InitializeProc)::GetProcAddress(ghLibrary, "eglIniti
alize"); |
| 53 gfTerminate = (TerminateProc)::GetProcAddress(ghLibrary, "CommandBuf
fer_Terminate"); | 53 gfTerminate = (TerminateProc)::GetProcAddress(ghLibrary, "eglTermina
te"); |
| 54 gfChooseConfig = (ChooseConfigProc)::GetProcAddress(ghLibrary, "Comm
andBuffer_ChooseConfig"); | 54 gfChooseConfig = (ChooseConfigProc)::GetProcAddress(ghLibrary, "eglC
hooseConfig"); |
| 55 gfGetConfigAttrib = (GetConfigAttrib)::GetProcAddress(ghLibrary, "Co
mmandBuffer_GetConfigAttrib"); | 55 gfGetConfigAttrib = (GetConfigAttrib)::GetProcAddress(ghLibrary, "eg
lGetConfigAttrib"); |
| 56 gfCreateWindowSurface = (CreateWindowSurfaceProc)::GetProcAddress(gh
Library, "CommandBuffer_CreateWindowSurface"); | 56 gfCreateWindowSurface = (CreateWindowSurfaceProc)::GetProcAddress(gh
Library, "eglCreateWindowSurface"); |
| 57 gfCreatePbufferSurface = (CreatePbufferSurfaceProc)::GetProcAddress(
ghLibrary, "CommandBuffer_CreatePbufferSurface"); | 57 gfCreatePbufferSurface = (CreatePbufferSurfaceProc)::GetProcAddress(
ghLibrary, "eglCreatePbufferSurface"); |
| 58 gfDestroySurface = (DestroySurfaceProc)::GetProcAddress(ghLibrary, "
CommandBuffer_DestroySurface"); | 58 gfDestroySurface = (DestroySurfaceProc)::GetProcAddress(ghLibrary, "
eglDestroySurface"); |
| 59 gfCreateContext = (CreateContextProc)::GetProcAddress(ghLibrary, "Co
mmandBuffer_CreateContext"); | 59 gfCreateContext = (CreateContextProc)::GetProcAddress(ghLibrary, "eg
lCreateContext"); |
| 60 gfDestroyContext = (DestroyContextProc)::GetProcAddress(ghLibrary, "
CommandBuffer_DestroyContext"); | 60 gfDestroyContext = (DestroyContextProc)::GetProcAddress(ghLibrary, "
eglDestroyContext"); |
| 61 gfMakeCurrent = (MakeCurrentProc)::GetProcAddress(ghLibrary, "Comman
dBuffer_MakeCurrent"); | 61 gfMakeCurrent = (MakeCurrentProc)::GetProcAddress(ghLibrary, "eglMak
eCurrent"); |
| 62 gfSwapBuffers = (SwapBuffersProc)::GetProcAddress(ghLibrary, "Comman
dBuffer_SwapBuffers"); | 62 gfSwapBuffers = (SwapBuffersProc)::GetProcAddress(ghLibrary, "eglSwa
pBuffers"); |
| 63 gfGetProcAddress = (GetProcAddressProc)::GetProcAddress(ghLibrary, "
CommandBuffer_GetProcAddress"); | 63 gfGetProcAddress = (GetProcAddressProc)::GetProcAddress(ghLibrary, "
eglGetProcAddress"); |
| 64 | 64 |
| 65 gfFunctionsLoadedSuccessfully = gfGetDisplay && gfInitialize && gfTe
rminate && | 65 gfFunctionsLoadedSuccessfully = gfGetDisplay && gfInitialize && gfTe
rminate && |
| 66 gfChooseConfig && gfCreateWindowSurf
ace && | 66 gfChooseConfig && gfCreateWindowSurf
ace && |
| 67 gfCreatePbufferSurface && gfDestroyS
urface && | 67 gfCreatePbufferSurface && gfDestroyS
urface && |
| 68 gfCreateContext && gfDestroyContext
&& gfMakeCurrent && | 68 gfCreateContext && gfDestroyContext
&& gfMakeCurrent && |
| 69 gfSwapBuffers && gfGetProcAddress; | 69 gfSwapBuffers && gfGetProcAddress; |
| 70 | 70 |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 } | 73 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 gfGetConfigAttrib(fDisplay, surfaceConfig, EGL_STENCIL_SIZE, &result); | 262 gfGetConfigAttrib(fDisplay, surfaceConfig, EGL_STENCIL_SIZE, &result); |
| 263 return result; | 263 return result; |
| 264 } | 264 } |
| 265 | 265 |
| 266 int SkCommandBufferGLContext::getSampleCount() { | 266 int SkCommandBufferGLContext::getSampleCount() { |
| 267 EGLint result = 0; | 267 EGLint result = 0; |
| 268 EGLConfig surfaceConfig = static_cast<EGLConfig>(fConfig); | 268 EGLConfig surfaceConfig = static_cast<EGLConfig>(fConfig); |
| 269 gfGetConfigAttrib(fDisplay, surfaceConfig, EGL_SAMPLES, &result); | 269 gfGetConfigAttrib(fDisplay, surfaceConfig, EGL_SAMPLES, &result); |
| 270 return result; | 270 return result; |
| 271 } | 271 } |
| OLD | NEW |