gfx_ctx_proc_t egl_get_proc_address(const char *symbol) { gfx_ctx_proc_t ret; void *sym__ = NULL; retro_assert(sizeof(void*) == sizeof(void (*)(void))); sym__ = (void*)eglGetProcAddress(symbol); memcpy(&ret, &sym__, sizeof(void*)); return ret; }
static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { const ANGLEAssembleContext& context = *reinterpret_cast<const ANGLEAssembleContext*>(ctx); GrGLFuncPtr proc = (GrGLFuncPtr) GetProcAddress(context.fGL, name); if (proc) { return proc; } proc = (GrGLFuncPtr) GetProcAddress(context.fEGL, name); if (proc) { return proc; } return eglGetProcAddress(name); }
QFunctionPointer QQnxGLContext::getProcAddress(const QByteArray &procName) { qGLContextDebug() << Q_FUNC_INFO; // Set current rendering API EGLBoolean eglResult = eglBindAPI(EGL_OPENGL_ES_API); if (eglResult != EGL_TRUE) qFatal("QQNX: failed to set EGL API, err=%d", eglGetError()); // Lookup EGL extension function pointer return static_cast<QFunctionPointer>(eglGetProcAddress(procName.constData())); }
static GrGLFuncPtr angle_get_gl_proc(void* ctx, const char name[]) { const Libs* libs = reinterpret_cast<const Libs*>(ctx); GrGLFuncPtr proc = (GrGLFuncPtr) GetProcedureAddress(libs->fGLLib, name); if (proc) { return proc; } proc = (GrGLFuncPtr) GetProcedureAddress(libs->fEGLLib, name); if (proc) { return proc; } return eglGetProcAddress(name); }
static gfx_ctx_proc_t gfx_ctx_qnx_get_proc_address(const char *symbol) { gfx_ctx_proc_t ret; void *sym__; rarch_assert(sizeof(void*) == sizeof(void (*)(void))); sym__ = eglGetProcAddress(symbol); memcpy(&ret, &sym__, sizeof(void*)); return ret; }
bool Extensions3DOpenGLES::supportsExtension(const String& name) { if (m_availableExtensions.contains(name)) { if (!m_supportsOESvertexArrayObject && name == "GL_OES_vertex_array_object") { m_glBindVertexArrayOES = reinterpret_cast<PFNGLBINDVERTEXARRAYOESPROC>(eglGetProcAddress("glBindVertexArrayOES")); m_glGenVertexArraysOES = reinterpret_cast<PFNGLGENVERTEXARRAYSOESPROC>(eglGetProcAddress("glGenVertexArraysOES")); m_glDeleteVertexArraysOES = reinterpret_cast<PFNGLDELETEVERTEXARRAYSOESPROC>(eglGetProcAddress("glDeleteVertexArraysOES")); m_glIsVertexArrayOES = reinterpret_cast<PFNGLISVERTEXARRAYOESPROC>(eglGetProcAddress("glIsVertexArrayOES")); m_supportsOESvertexArrayObject = true; } else if (!m_supportsIMGMultisampledRenderToTexture && name == "GL_IMG_multisampled_render_to_texture") { m_glFramebufferTexture2DMultisampleIMG = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG>(eglGetProcAddress("glFramebufferTexture2DMultisampleIMG")); m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG")); m_supportsIMGMultisampledRenderToTexture = true; } else if (!m_glGetGraphicsResetStatusEXT && name == "GL_EXT_robustness") { m_glGetGraphicsResetStatusEXT = reinterpret_cast<PFNGLGETGRAPHICSRESETSTATUSEXTPROC>(eglGetProcAddress("glGetGraphicsResetStatusEXT")); m_glReadnPixelsEXT = reinterpret_cast<PFNGLREADNPIXELSEXTPROC>(eglGetProcAddress("glReadnPixelsEXT")); m_glGetnUniformfvEXT = reinterpret_cast<PFNGLGETNUNIFORMFVEXTPROC>(eglGetProcAddress("glGetnUniformfvEXT")); m_glGetnUniformivEXT = reinterpret_cast<PFNGLGETNUNIFORMIVEXTPROC>(eglGetProcAddress("glGetnUniformivEXT")); } else if (!m_supportsANGLEinstancedArrays && name == "GL_ANGLE_instanced_arrays") { m_glVertexAttribDivisorANGLE = reinterpret_cast<PFNGLVERTEXATTRIBDIVISORANGLEPROC>(eglGetProcAddress("glVertexAttribDivisorANGLE")); m_glDrawArraysInstancedANGLE = reinterpret_cast<PFNGLDRAWARRAYSINSTANCEDANGLEPROC >(eglGetProcAddress("glDrawArraysInstancedANGLE")); m_glDrawElementsInstancedANGLE = reinterpret_cast<PFNGLDRAWELEMENTSINSTANCEDANGLEPROC >(eglGetProcAddress("glDrawElementsInstancedANGLE")); m_supportsANGLEinstancedArrays = true; } else if (name == "GL_EXT_draw_buffers") { // FIXME: implement the support. return false; } return true; } return false; }
void glResolveFunctions(OpenGLPlatformInterface platformInterface) { const bool haveArbRobustness = hasGLExtension(QByteArrayLiteral("GL_ARB_robustness")); const bool haveExtRobustness = hasGLExtension(QByteArrayLiteral("GL_EXT_robustness")); bool robustContext = false; if (GLPlatform::instance()->isGLES()) { if (haveExtRobustness) { GLint value = 0; glGetIntegerv(GL_CONTEXT_ROBUST_ACCESS_EXT, &value); robustContext = (value != 0); } } else { if (haveArbRobustness) { if (hasGLVersion(3, 0)) { GLint value = 0; glGetIntegerv(GL_CONTEXT_FLAGS, &value); if (value & GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB) { robustContext = true; } } else { robustContext = true; } } } if (robustContext && haveArbRobustness) { // See http://www.opengl.org/registry/specs/ARB/robustness.txt GL_RESOLVE_WITH_EXT(glGetGraphicsResetStatus, glGetGraphicsResetStatusARB); GL_RESOLVE_WITH_EXT(glReadnPixels, glReadnPixelsARB); GL_RESOLVE_WITH_EXT(glGetnUniformfv, glGetnUniformfvARB); } else if (robustContext && haveExtRobustness) { // See http://www.khronos.org/registry/gles/extensions/EXT/EXT_robustness.txt glGetGraphicsResetStatus = (glGetGraphicsResetStatus_func) eglGetProcAddress("glGetGraphicsResetStatusEXT"); glReadnPixels = (glReadnPixels_func) eglGetProcAddress("glReadnPixelsEXT"); glGetnUniformfv = (glGetnUniformfv_func) eglGetProcAddress("glGetnUniformfvEXT"); } else { glGetGraphicsResetStatus = KWin::GetGraphicsResetStatus; glReadnPixels = KWin::ReadnPixels; glGetnUniformfv = KWin::GetnUniformfv; } }
//-------------------------------------------------------------------------------------- // Name: CSample() // Desc: Constructor //-------------------------------------------------------------------------------------- CSample::CSample( const CHAR* strName ) : CFrmApplication( strName ), m_cube_indices(sizeof(g_cube_indices) / sizeof(g_cube_indices[0])), m_cube_lines( m_cube_indices / 2) { m_fCurrentTime = 0.0f; m_fStartTime = FrmGetTime(); m_is_frozen = FALSE; m_bRotationOn = TRUE; m_MultiSampleShaderProgram = NULL; m_pLogoTexture = NULL; m_OpenGLESVersion = GLES3; m_currentTextureIndex = 0; #ifdef __ANDROID__ fp_glProgramUniformMatrix4fv = (PFNGLGENPROGRAMUNIFORMMATRIX4FVOESPROC) eglGetProcAddress("glProgramUniformMatrix4fv"); fp_glTexStorage2DMultisample = (PFNGLTEXSTORAGE2DMULTISAMPLEOESPROC) eglGetProcAddress("glTexStorage2DMultisample"); #endif }
/*-------------------------------------------------------------------*//*! * \brief Destroy a sync object and free memory associated with it * \ingroup api * \param dpy Identifier of the display which owns the sync object * \param sync Sync object handle. * \return EGL_TRUE if deletion was successful and EGL_FALSE otherwise * \error EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay; * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized; * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy> * \note If any eglClientWaitSyncKHR commands are blocking on <sync> when * eglDestroySyncKHR is called, they will be woken up, as if <sync> were signaled. * If no errors are generated, <sync> will no longer be the handle of a valid sync object. *//*-------------------------------------------------------------------*/ EGLBoolean eglDestroySyncKHR( EGLDisplay dpy, EGLSyncKHR sync ) { PFNEGLDESTROYSYNCKHRPROC destroyPointer = (PFNEGLDESTROYSYNCKHRPROC) eglGetProcAddress("eglDestroySyncKHR"); if (destroyPointer == NULL) { return EGL_FALSE; } else { return destroyPointer(dpy, sync); } }
static void init(void) { typedef void (*proc)(); #if 1 /* test code */ proc p = eglGetProcAddress("glMapBufferOES"); assert(p); #endif glClearColor(0.0, 0.0, 0.0, 0.0); // glClearDepth(1.0f); create_shaders(); }
static GLFWglproc getProcAddress(const char* procname) { _GLFWwindow* window = _glfwPlatformGetCurrentContext(); if (window->context.egl.client) { GLFWglproc proc = (GLFWglproc) _glfw_dlsym(window->context.egl.client, procname); if (proc) return proc; } return eglGetProcAddress(procname); }
void *extgl_GetProcAddress(const char *name) { void *t = eglGetProcAddress(name); if ( t == NULL ) { t = dlsym(lib_gl_handle, name); if ( t == NULL ) printfDebug("Could not locate symbol %s\n", name); } //if ( t != NULL ) //printfDebug("Located symbol %s\n", name); return t; }
static void *get_proc_address(const GLubyte *name) { void *p = eglGetProcAddress(name); // EGL 1.4 (supported by the RPI firmware) does not necessarily return // function pointers for core functions. if (!p) { void *h = dlopen("/opt/vc/lib/libGLESv2.so", RTLD_LAZY); if (h) { p = dlsym(h, name); dlclose(h); } } return p; }
static Bool app_init_exts(struct app_data *data) { const char *exts; exts = eglQueryString(data->dpy, EGL_EXTENSIONS); data->eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR"); data->eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR"); if (!exts || !strstr(exts, "EGL_KHR_image_pixmap") || !data->eglCreateImageKHR || !data->eglDestroyImageKHR) { printf("EGL does not support EGL_KHR_image_pixmap\n"); return False; } data->target = 0; exts = (const char *) glGetString(GL_EXTENSIONS); data->glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) eglGetProcAddress("glEGLImageTargetTexture2DOES"); if (exts && data->glEGLImageTargetTexture2DOES) { if (strstr(exts, "GL_OES_EGL_image")) data->target = GL_TEXTURE_2D; #ifdef GL_OES_EGL_image_external /* prefer external texture */ if (strstr(exts, "GL_OES_EGL_image_external")) data->target = GL_TEXTURE_EXTERNAL_OES; #endif } if (!data->target) { printf("OpenGL ES does not support sampling from an EGLImage\n"); return False; } return True; }
/////////////////////////////////////////////////////////////////////////////////////////////////// // Loads, compiles, and links the shader and then saves the binary code to a file void compile_program_binary( GLuint shader_program, const char* BINARY_FILENAME) { // load the program void* buffer = NULL; GLint bin_size = -1; GLenum bin_format = -1; // get the length of the binary code to be retrieved glGetProgramiv(shader_program, GL_PROGRAM_BINARY_LENGTH_OES, &bin_size); switch (bin_size) { case GL_INVALID_ENUM: fprintf(stderr, "glGetProgramiv: GL_INVALID_ENUM\n"); return; case GL_INVALID_VALUE: fprintf(stderr, "glGetProgramiv: GL_INVALID_VALUE\n"); return; case GL_INVALID_OPERATION: fprintf(stderr, "glGetProgramiv: GL_INVALID_OPERATION\n"); return; } printf("Binary program length: %d bytes\n", bin_size); // retrieve binary code & code format buffer = malloc(bin_size); GLsizei bytesWritten; myglGetProgramBinaryOES = (PFNGLGETPROGRAMBINARYOESPROC)eglGetProcAddress("glGetProgramBinaryOES"); if (!myglGetProgramBinaryOES) { fprintf(stderr, "Can not get glGetProgramBinaryOES function"); exit(EXIT_FAILURE); } myglGetProgramBinaryOES (shader_program, bin_size, &bytesWritten, &bin_format, buffer); // write binary code to file FILE *bShFile = fopen(BINARY_FILENAME, "wb"); if (!bShFile) { fprintf(stderr, "Error: cant write compiled shader to file: %s\n", BINARY_FILENAME); } size_t bytes = fwrite(buffer, bytesWritten, 1, bShFile); printf ("Wrote %d bytes to %s. Binary format: 0x%x\n", bytesWritten, BINARY_FILENAME, bin_format); fclose(bShFile); free(buffer); }
static CoglFuncPtr _cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, const char *name) { void *ptr; ptr = eglGetProcAddress (name); /* eglGetProcAddress doesn't support fetching core API so we need to get that separately with GModule */ if (ptr == NULL) g_module_symbol (renderer->libgl_module, name, &ptr); return ptr; }
/*-------------------------------------------------------------------*//*! * \brief Signals or unsignals the reusable sync object. * \ingroup api * \param dpy Identifier of the display which owns the sync object. * \param sync Sync object handle. * \param mode Status of the sync object. There are two possible states: * EGL_SIGNALED_KHR and EGL_UNSIGNALED_KHR. * \return EGL_TRUE if an operation was successful and EGL_FALSE otherwise. * \note The error code returned from eglSignalSyncImpl() will be generated *//*-------------------------------------------------------------------*/ EGLBoolean eglSignalSyncKHR( EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode ) { PFNEGLSIGNALSYNCKHRPROC signalPointer = (PFNEGLSIGNALSYNCKHRPROC) eglGetProcAddress("eglSignalSyncKHR"); if (signalPointer == NULL) { return EGL_FALSE; } else { return signalPointer(dpy, sync, mode); } }
/*-------------------------------------------------------------------*//*! * \brief Create a sync object for the specified display. * \ingroup api * \param dpy Identifier of the display which will own the sync object * \param type Type of the sync object. EGL_SYNC_REUSABLE_KHR is only supported * \param attrib_list Attribute-value list specifying attributes of the sync * object, terminated by an attribute entry EGL_NONE * \return Handle for the created sync object if successful, EGL_NO_SYNC_KHR otherwise * \error EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay; * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized; * EGL_BAD_ATTRIBUTE if <attrib_list> is neither NULL nor empty (containing only EGL_NONE) or * if <type> is not a supported type of sync object; * EGL_BAD_ALLOC if the memory allocation related to sync object is not successful * \note If <type> is EGL_SYNC_REUSABLE_KHR, a reusable sync object is created. * In this case <attrib_list> must be NULL or empty (containing only EGL_NONE). * *//*-------------------------------------------------------------------*/ EGLSyncKHR eglCreateSyncKHR( EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list ) { PFNEGLCREATESYNCKHRPROC createPointer = (PFNEGLCREATESYNCKHRPROC) eglGetProcAddress("eglCreateSyncKHR"); if (createPointer == NULL) { return EGL_NO_SYNC_KHR; } else { return createPointer(dpy, condition, attrib_list); } }
static void *get_proc_address(const GLubyte *name) { void *p = eglGetProcAddress(name); // It looks like eglGetProcAddress() should work even for builtin // functions, but it doesn't work at least with RPI/Broadcom crap. // (EGL 1.4, which current RPI firmware pretends to support, definitely // is required to return non-extension functions.) if (!p) { void *h = dlopen("/opt/vc/lib/libGLESv2.so", RTLD_LAZY); if (h) { p = dlsym(h, name); dlclose(h); } } return p; }
/*-------------------------------------------------------------------*//*! * \brief Query an attribute of the sync object * \ingroup api * \param dpy Identifier of the display which owns the sync object * \param sync Sync object handle. * \param attribute An attribute to be retrieved. * \param value Pointer to the value for the requested attribute which will be filled on function return. * \return EGL_TRUE if an operation was successful and EGL_FALSE otherwise * \error EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay; * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized; * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy> or if <value> is not * a valid pointer; EGL_BAD_ATTRIBUTE if <attribute> does not lie within expected range; * EGL_BAD_MATCH if <attribute> is not supported for the type of sync object passed in <sync> *//*-------------------------------------------------------------------*/ EGLBoolean eglGetSyncAttribKHR( EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value ) { PFNEGLGETSYNCATTRIBKHRPROC getAttribPointer = (PFNEGLGETSYNCATTRIBKHRPROC) eglGetProcAddress("eglGetSyncAttribKHR"); if (getAttribPointer == NULL) { return EGL_FALSE; } else { return getAttribPointer(dpy, sync, attribute, value); } }
/*-------------------------------------------------------------------*//*! * \brief Blocks the calling thread until the specified sync object * is signaled, or until <timeout> nanoseconds have passed. * \ingroup api * \param dpy Identifier of the display which owns the sync object. * \param sync Sync object handle. * \param flags If the EGL_FLUSH_COMMANDS_BIT_KHR bit is set in <flags> * and <sync> is unsignaled when the function is called, then the equivalent * of Flush() will be performed for the current API context. * \param timeout The thread will be unblocked when <timeout> is expired. * If the <timeout> is to zero, the function just test the current status * of the sync object. If the <timeout> is set to EGL_FOREVER_KHR, then the * function does not time out. For all other values, <timeout> is adjusted to * the closest value which may be substantially longer than one nanosecond. * \return EGL_CONDITION_SATISFIED if <sync> was signaled before * the timeout expired, which includes the case when <sync> was already * signaled when eglClientWaitSyncKHR was called; EGL_TIMEOUT_EXPIRED_KHR if the * specified timeout period expired before <sync> was signaled; * EGL_FALSE if an error occurs. * \error EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay; * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized; * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy> or * if <flags> does not equal to 0 or EGL_SYNC_FLUSH_COMMAND_BIT_KHR * Note\ More than one eglClientWaitSyncKHR may be outstanding on the same <sync> at any given time. * When there are multiple threads blocked on the same <sync> and the sync object is signaled, * all such threads are released, but the order in which they are released is not defined. * If a sync object is destroyed while an eglClientWaitSyncKHR is blocking on that object, * eglClientWaitSyncKHR will unblock and return immediately, just as if the sync object * had been signaled prior to being destroyed. *//*-------------------------------------------------------------------*/ EGLint eglClientWaitSyncKHR( EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout ) { PFNEGLCLIENTWAITSYNCKHRPROC clientWaitPointer = (PFNEGLCLIENTWAITSYNCKHRPROC) eglGetProcAddress("eglClientWaitSyncKHR"); if (clientWaitPointer == NULL) { return EGL_FALSE; } else { return clientWaitPointer(dpy, sync, flags, timeout); } }
static cg_func_ptr_t _cg_winsys_renderer_get_proc_address( cg_renderer_t *renderer, const char *name, bool in_core) { void *ptr = NULL; if (!in_core) ptr = eglGetProcAddress(name); /* eglGetProcAddress doesn't support fetching core API so we need to get that separately with c_module_t */ if (ptr == NULL) c_module_symbol(renderer->libgl_module, name, &ptr); return ptr; }
static void* get_proc_address(void* ctx, const gchar* name) { GdkDisplay* display = gdk_display_get_default(); #ifdef GDK_WINDOWING_WAYLAND if (GDK_IS_WAYLAND_DISPLAY(display)) return eglGetProcAddress(name); #endif #ifdef GDK_WINDOWING_X11 if (GDK_IS_X11_DISPLAY(display)) return (void*)(intptr_t) glXGetProcAddressARB((const GLubyte*) name); #endif g_return_val_if_reached(NULL); }
void LoadFunction(const char *name, void **func) { #ifdef USE_GLES3 *func = (void*)eglGetProcAddress(name); if (*func == NULL) { // Fall back to trying dlsym if (self) // Just in case dlopen fails *func = dlsym(self, name); if (*func == NULL) { ERROR_LOG(VIDEO, "Couldn't load function %s", name); exit(0); } } #endif }
void *GL2Decoder::s_getProc(const char *name, void *userData) { GL2Decoder *ctx = (GL2Decoder *) userData; if (ctx == NULL || ctx->m_GL2library == NULL) { return NULL; } void *func = NULL; #ifdef USE_EGL_GETPROCADDRESS func = (void *) eglGetProcAddress(name); #endif if (func == NULL) { func = (void *) ctx->m_GL2library->findSymbol(name); } return func; }
void* SkANGLEGLContext::GetD3DEGLDisplay(void* nativeDisplay, bool useGLBackend) { PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT; eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress("eglGetPlatformDisplayEXT"); if (!eglGetPlatformDisplayEXT) { return eglGetDisplay(static_cast<EGLNativeDisplayType>(nativeDisplay)); } EGLDisplay display = EGL_NO_DISPLAY; if (useGLBackend) { // Try for an ANGLE D3D11 context, fall back to D3D9. EGLint attribs[3] = { EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE, EGL_NONE }; display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, nativeDisplay, attribs); } else { // Try for an ANGLE D3D11 context, fall back to D3D9, and finally GL. EGLint attribs[3][3] = { { EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_NONE }, { EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE, EGL_NONE }, { EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE, EGL_NONE } }; for (int i = 0; i < 3 && display == EGL_NO_DISPLAY; ++i) { display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, nativeDisplay, attribs[i]); } } return display; }
void CEglTest_LocalTestStep_EndpointApiExposure::ProcAddressL(const char *aProcName) { //Convert the 8bit string to a 16 bit descriptor for logging. //None of the function names are longer than 128 chars. TBuf<128> procName; procName.Copy(TPtrC8((TText8*)aProcName)); //Attempt to get the function pointer. We are expecting to fail since we are outside wserv. if(eglGetProcAddress(aProcName) != NULL) { ERR_PRINTF2(_L("Incorrect result for funcPtr: %S"), &procName); User::Leave(KErrUnknown); } else { INFO_PRINTF2(_L("Correct result for funcPtr: %S"), &procName); } }
RenderTexture::RenderTexture(int width, int height, int sample_count, GLenum target) : Texture(new GLTexture(target)), target_(target), width_(width), height_(height), sample_count_(sample_count), back_color_{0, 0, 0}, use_stencil_(0), renderTexture_gl_render_buffer_(new GLRenderBuffer()), renderTexture_gl_frame_buffer_(new GLFrameBuffer()) { initialize(width, height); if (target_ == GL_TEXTURE_2D_ARRAY) { PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC glFramebufferTextureMultisampleMultiviewOVR = (PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) eglGetProcAddress( "glFramebufferTextureMultisampleMultiviewOVR"); glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindTexture(target_, gl_texture_->id()); glTexImage3D(target, 0, GL_RGBA8, width, height, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); glBindTexture(target_, 0); createArrayTexture(frameBufferDepthTextureId, width_, height_, GL_DEPTH_COMPONENT16); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, renderTexture_gl_frame_buffer_->id()); glFramebufferTextureMultisampleMultiviewOVR(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, gl_texture_->id(), 0, sample_count_, 0, 2); glFramebufferTextureMultisampleMultiviewOVR(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, frameBufferDepthTextureId, 0, sample_count_, 0, 2); } else { glBindTexture(target_, gl_texture_->id()); glTexImage2D(target_, 0, GL_RGBA, width_, height_, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); glBindTexture(target_, 0); glBindRenderbuffer(GL_RENDERBUFFER, renderTexture_gl_render_buffer_->id()); MSAA::glRenderbufferStorageMultisampleIMG(GL_RENDERBUFFER, sample_count, GL_DEPTH_COMPONENT16, width, height); glBindRenderbuffer(GL_RENDERBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, renderTexture_gl_frame_buffer_->id()); MSAA::glFramebufferTexture2DMultisample(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target_, gl_texture_->id(), 0, sample_count); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, renderTexture_gl_render_buffer_->id()); } }
void piglit_init(int argc, char **argv) { GLuint tex; piglit_require_extension("GL_OES_draw_texture"); piglit_glDrawTexiOES = (PFNGLDRAWTEXIOESPROC) eglGetProcAddress("glDrawTexiOES"); if (!piglit_glDrawTexiOES) piglit_report_result(PIGLIT_FAIL); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); tex = piglit_rgbw_texture(GL_RGBA, TEXTURE_SIZE, TEXTURE_SIZE, GL_FALSE, GL_TRUE, 0); glBindTexture(GL_TEXTURE_2D, tex); glEnable(GL_TEXTURE_2D); }
virtual bool initialize() { mPostSubBufferNV = (PFNEGLPOSTSUBBUFFERNVPROC)eglGetProcAddress("eglPostSubBufferNV"); if (!mPostSubBufferNV) { std::cerr << "Could not load eglPostSubBufferNV."; return false; } const std::string vs = SHADER_SOURCE ( uniform mat4 u_mvpMatrix; attribute vec4 a_position; attribute vec2 a_texcoord; varying vec2 v_texcoord; void main() { gl_Position = u_mvpMatrix * a_position; v_texcoord = a_texcoord; }