当前位置: 首页>>代码示例>>C++>>正文


C++ GrGLExtensions类代码示例

本文整理汇总了C++中GrGLExtensions的典型用法代码示例。如果您正苦于以下问题:C++ GrGLExtensions类的具体用法?C++ GrGLExtensions怎么用?C++ GrGLExtensions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GrGLExtensions类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GrGLCreateNativeInterface

const GrGLInterface* GrGLCreateNativeInterface() {

    GrGLGetStringiProc getStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi");

    const char* verStr = reinterpret_cast<const char*>(glGetString(GR_GL_VERSION));
    GrGLVersion version = GrGLGetVersionFromString(verStr);
    GrGLStandard standard = GrGLGetStandardInUseFromString(verStr);

    GrGLExtensions extensions;
    if (!extensions.init(standard, glGetString, getStringi, glGetIntegerv)) {
        return NULL;
    }

    GrGLInterface* interface = NULL;
    if (kGLES_GrGLStandard == standard) {
        interface = create_es_interface(version, &extensions);
    } else if (kGL_GrGLStandard == standard) {
        interface = create_desktop_interface(version, extensions);
    }

    if (NULL != interface) {
        interface->fExtensions.swap(&extensions);
    }

    return interface;
}
开发者ID:llluiop,项目名称:skia,代码行数:26,代码来源:GrGLCreateNativeInterface_android.cpp

示例2: GrGLCreateNativeInterface

const GrGLInterface* GrGLCreateNativeInterface() {

    GrGLGetStringiProc getStringi = (GrGLGetStringiProc) eglGetProcAddress("glGetStringi");

    const char* verStr = reinterpret_cast<const char*>(glGetString(GR_GL_VERSION));
    GrGLVersion version = GrGLGetVersionFromString(verStr);
    GrGLBinding binding = GrGLGetBindingInUseFromString(verStr);

    GrGLExtensions extensions;
    if (!extensions.init(binding, glGetString, getStringi, glGetIntegerv)) {
        return NULL;
    }

    if (kES_GrGLBinding == binding) {
        return create_es_interface(version, extensions);
    } else if (kDesktop_GrGLBinding == binding) {
        return create_desktop_interface(version, extensions);
    } else {
        return NULL;
    }
}
开发者ID:CriGio,项目名称:platform_external_skia,代码行数:21,代码来源:GrGLCreateNativeInterface_android.cpp

示例3: GrGLAssembleGLInterface

const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
    GET_PROC_LOCAL(GetString);
    GET_PROC_LOCAL(GetStringi);
    GET_PROC_LOCAL(GetIntegerv);

    // GetStringi may be nullptr depending on the GL version.
    if (nullptr == GetString || nullptr == GetIntegerv) {
        return nullptr;
    }

    const char* versionString = (const char*) GetString(GR_GL_VERSION);
    GrGLVersion glVer = GrGLGetVersionFromString(versionString);

    if (glVer < GR_GL_VER(1,5) || GR_GL_INVALID_VER == glVer) {
        // We must have array and element_array buffer objects.
        return nullptr;
    }

    GrEGLQueryStringProc queryString;
    GrEGLDisplay display;
    get_egl_query_and_display(&queryString, &display, ctx, get);
    GrGLExtensions extensions;
    if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString,
                         display)) {
        return nullptr;
    }

    GrGLInterface* interface = new GrGLInterface();
    GrGLInterface::Functions* functions = &interface->fFunctions;

    GET_PROC(ActiveTexture);
    GET_PROC(AttachShader);
    GET_PROC(BindAttribLocation);
    GET_PROC(BindBuffer);
    if (glVer >= GR_GL_VER(3,0)) {
        GET_PROC(BindFragDataLocation);
    }
    GET_PROC(BeginQuery);
    GET_PROC(BindTexture);

    if (extensions.has("GL_KHR_blend_equation_advanced")) {
        GET_PROC_SUFFIX(BlendBarrier, KHR);
    } else if (extensions.has("GL_NV_blend_equation_advanced")) {
        GET_PROC_SUFFIX(BlendBarrier, NV);
    }

    if (glVer >= GR_GL_VER(1,4) ||
        extensions.has("GL_ARB_imaging")) {
        GET_PROC(BlendColor);
    } else if (extensions.has("GL_EXT_blend_color")) {
        GET_PROC_SUFFIX(BlendColor, EXT);
    }

    if (glVer >= GR_GL_VER(1,4) ||
        extensions.has("GL_ARB_imaging")) {
        GET_PROC(BlendEquation);
    } else if (extensions.has("GL_EXT_blend_subtract")) {
        GET_PROC_SUFFIX(BlendEquation, EXT);
    }

    GET_PROC(BlendFunc);
    GET_PROC(BufferData);
    GET_PROC(BufferSubData);
    GET_PROC(Clear);
    GET_PROC(ClearColor);
    GET_PROC(ClearStencil);
    GET_PROC(ColorMask);
    GET_PROC(CompileShader);
    GET_PROC(CompressedTexImage2D);
    GET_PROC(CompressedTexSubImage2D);
    GET_PROC(CopyTexSubImage2D);
    GET_PROC(CreateProgram);
    GET_PROC(CreateShader);
    GET_PROC(CullFace);
    GET_PROC(DeleteBuffers);
    GET_PROC(DeleteProgram);
    GET_PROC(DeleteQueries);
    GET_PROC(DeleteShader);
    GET_PROC(DeleteTextures);
    GET_PROC(DepthMask);
    GET_PROC(Disable);
    GET_PROC(DisableVertexAttribArray);
    GET_PROC(DrawArrays);
    GET_PROC(DrawBuffer);
    GET_PROC(DrawBuffers);
    GET_PROC(DrawElements);

    if (glVer >= GR_GL_VER(3,1) || extensions.has("GL_ARB_draw_instanced") ||
        extensions.has("GL_EXT_draw_instanced")) {
        GET_PROC(DrawArraysInstanced);
        GET_PROC(DrawElementsInstanced);
    }

    if (glVer >= GR_GL_VER(4,0)) {
        // We don't use ARB_draw_indirect because it does not support a base instance.
        GET_PROC(DrawArraysIndirect);
        GET_PROC(DrawElementsIndirect);
    }

    GET_PROC(Enable);
//.........这里部分代码省略.........
开发者ID:kekekeks,项目名称:skia,代码行数:101,代码来源:GrGLAssembleInterface.cpp

示例4: GrGLAssembleGLESInterface

const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
    GET_PROC_LOCAL(GetString);
    if (nullptr == GetString) {
        return nullptr;
    }

    const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
    GrGLVersion version = GrGLGetVersionFromString(verStr);

    if (version < GR_GL_VER(2,0)) {
        return nullptr;
    }

    GET_PROC_LOCAL(GetIntegerv);
    GET_PROC_LOCAL(GetStringi);
    GrEGLQueryStringProc queryString;
    GrEGLDisplay display;
    get_egl_query_and_display(&queryString, &display, ctx, get);
    GrGLExtensions extensions;
    if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString,
                         display)) {
        return nullptr;
    }

    GrGLInterface* interface = new GrGLInterface;
    GrGLInterface::Functions* functions = &interface->fFunctions;

    GET_PROC(ActiveTexture);
    GET_PROC(AttachShader);
    GET_PROC(BindAttribLocation);
    GET_PROC(BindBuffer);
    GET_PROC(BindTexture);
    GET_PROC_SUFFIX(BindVertexArray, OES);

    if (version >= GR_GL_VER(3,0) && extensions.has("GL_EXT_blend_func_extended")) {
        GET_PROC_SUFFIX(BindFragDataLocation, EXT);
        GET_PROC_SUFFIX(BindFragDataLocationIndexed, EXT);
    }

    if (extensions.has("GL_KHR_blend_equation_advanced")) {
        GET_PROC_SUFFIX(BlendBarrier, KHR);
    } else if (extensions.has("GL_NV_blend_equation_advanced")) {
        GET_PROC_SUFFIX(BlendBarrier, NV);
    }

    GET_PROC(BlendColor);
    GET_PROC(BlendEquation);
    GET_PROC(BlendFunc);
    GET_PROC(BufferData);
    GET_PROC(BufferSubData);
    GET_PROC(Clear);
    GET_PROC(ClearColor);
    GET_PROC(ClearStencil);
    GET_PROC(ColorMask);
    GET_PROC(CompileShader);
    GET_PROC(CompressedTexImage2D);
    GET_PROC(CompressedTexSubImage2D);
    GET_PROC(CopyTexSubImage2D);
    GET_PROC(CreateProgram);
    GET_PROC(CreateShader);
    GET_PROC(CullFace);
    GET_PROC(DeleteBuffers);
    GET_PROC(DeleteProgram);
    GET_PROC(DeleteShader);
    GET_PROC(DeleteTextures);
    GET_PROC_SUFFIX(DeleteVertexArrays, OES);
    GET_PROC(DepthMask);
    GET_PROC(Disable);
    GET_PROC(DisableVertexAttribArray);
    GET_PROC(DrawArrays);

    if (version >= GR_GL_VER(3,0)) {
        GET_PROC(DrawArraysInstanced);
        GET_PROC(DrawElementsInstanced);
    } else if (extensions.has("GL_EXT_draw_instanced")) {
        GET_PROC_SUFFIX(DrawArraysInstanced, EXT);
        GET_PROC_SUFFIX(DrawElementsInstanced, EXT);
    }

    if (version >= GR_GL_VER(3,1)) {
        GET_PROC(DrawArraysIndirect);
        GET_PROC(DrawElementsIndirect);
    }

    GET_PROC(DrawElements);
    GET_PROC(Enable);
    GET_PROC(EnableVertexAttribArray);
    GET_PROC(Finish);
    GET_PROC(Flush);
    GET_PROC(FrontFace);
    GET_PROC(GenBuffers);
    GET_PROC(GenerateMipmap);
    GET_PROC(GenTextures);
    GET_PROC_SUFFIX(GenVertexArrays, OES);
    GET_PROC(GetBufferParameteriv);
    GET_PROC(GetError);
    GET_PROC(GetIntegerv);
    GET_PROC(GetProgramInfoLog);
    GET_PROC(GetProgramiv);
    GET_PROC(GetShaderInfoLog);
//.........这里部分代码省略.........
开发者ID:kekekeks,项目名称:skia,代码行数:101,代码来源:GrGLAssembleInterface.cpp

示例5: GrGLCreateNativeInterface

const GrGLInterface* GrGLCreateNativeInterface() {
    if (NULL != glXGetCurrentContext()) {

        const char* versionString = (const char*) glGetString(GL_VERSION);
        GrGLVersion glVer = GrGLGetVersionFromString(versionString);

        // This may or may not succeed depending on the gl version.
        GrGLGetStringiProc glGetStringi =
            (GrGLGetStringiProc) glXGetProcAddress(reinterpret_cast<const GLubyte*>("glGetStringi"));

        GrGLExtensions extensions;
        if (!extensions.init(kDesktop_GrGLBinding, glGetString, glGetStringi, glGetIntegerv)) {
            return NULL;
        }

        if (glVer < GR_GL_VER(1,5)) {
            // We must have array and element_array buffer objects.
            return NULL;
        }

        GrGLInterface* interface = new GrGLInterface();

        interface->fActiveTexture = glActiveTexture;
        GR_GL_GET_PROC(AttachShader);
        GR_GL_GET_PROC(BindAttribLocation);
        GR_GL_GET_PROC(BindBuffer);
        GR_GL_GET_PROC(BindFragDataLocation);
        GR_GL_GET_PROC(BeginQuery);
        interface->fBindTexture = glBindTexture;
        interface->fBlendFunc = glBlendFunc;

        if (glVer >= GR_GL_VER(1,4) ||
            extensions.has("GL_ARB_imaging") ||
            extensions.has("GL_EXT_blend_color")) {
            GR_GL_GET_PROC(BlendColor);
        }

        GR_GL_GET_PROC(BufferData);
        GR_GL_GET_PROC(BufferSubData);
        interface->fClear = glClear;
        interface->fClearColor = glClearColor;
        interface->fClearStencil = glClearStencil;
        interface->fColorMask = glColorMask;
        GR_GL_GET_PROC(CompileShader);
        interface->fCompressedTexImage2D = glCompressedTexImage2D;
        interface->fCopyTexSubImage2D = glCopyTexSubImage2D;
        GR_GL_GET_PROC(CreateProgram);
        GR_GL_GET_PROC(CreateShader);
        interface->fCullFace = glCullFace;
        GR_GL_GET_PROC(DeleteBuffers);
        GR_GL_GET_PROC(DeleteProgram);
        GR_GL_GET_PROC(DeleteQueries);
        GR_GL_GET_PROC(DeleteShader);
        interface->fDeleteTextures = glDeleteTextures;
        interface->fDepthMask = glDepthMask;
        interface->fDisable = glDisable;
        GR_GL_GET_PROC(DisableVertexAttribArray);
        interface->fDrawArrays = glDrawArrays;
        interface->fDrawBuffer = glDrawBuffer;
        GR_GL_GET_PROC(DrawBuffers);
        interface->fDrawElements = glDrawElements;
        interface->fEnable = glEnable;
        GR_GL_GET_PROC(EnableVertexAttribArray);
        GR_GL_GET_PROC(EndQuery);
        interface->fFinish = glFinish;
        interface->fFlush = glFlush;
        interface->fFrontFace = glFrontFace;
        GR_GL_GET_PROC(GenBuffers);
        GR_GL_GET_PROC(GetBufferParameteriv);
        interface->fGetError = glGetError;
        interface->fGetIntegerv = glGetIntegerv;
        GR_GL_GET_PROC(GetQueryObjectiv);
        GR_GL_GET_PROC(GetQueryObjectuiv);
        if (glVer >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) {
            GR_GL_GET_PROC(GetQueryObjecti64v);
            GR_GL_GET_PROC(GetQueryObjectui64v);
            GR_GL_GET_PROC(QueryCounter);
        } else if (extensions.has("GL_EXT_timer_query")) {
            GR_GL_GET_PROC_SUFFIX(GetQueryObjecti64v, EXT);
            GR_GL_GET_PROC_SUFFIX(GetQueryObjectui64v, EXT);
        }
        GR_GL_GET_PROC(GetQueryiv);
        GR_GL_GET_PROC(GetProgramInfoLog);
        GR_GL_GET_PROC(GetProgramiv);
        GR_GL_GET_PROC(GetShaderInfoLog);
        GR_GL_GET_PROC(GetShaderiv);
        interface->fGetString = glGetString;
        GR_GL_GET_PROC(GetStringi);
        interface->fGetTexLevelParameteriv = glGetTexLevelParameteriv;
        GR_GL_GET_PROC(GenQueries);
        interface->fGenTextures = glGenTextures;
        GR_GL_GET_PROC(GetUniformLocation);
        interface->fLineWidth = glLineWidth;
        GR_GL_GET_PROC(LinkProgram);
        GR_GL_GET_PROC(MapBuffer);
        interface->fPixelStorei = glPixelStorei;
        interface->fReadBuffer = glReadBuffer;
        interface->fReadPixels = glReadPixels;
        if (extensions.has("GL_NV_framebuffer_multisample_coverage")) {
            GR_GL_GET_PROC_SUFFIX(RenderbufferStorageMultisampleCoverage, NV);
//.........这里部分代码省略.........
开发者ID:Frankie-666,项目名称:color-emoji.skia,代码行数:101,代码来源:GrGLCreateNativeInterface_unix.cpp

示例6: GrGLAssembleGLInterface

const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
    GET_PROC_LOCAL(GetString);
    GET_PROC_LOCAL(GetStringi);
    GET_PROC_LOCAL(GetIntegerv);

    // GetStringi may be NULL depending on the GL version.
    if (NULL == GetString || NULL == GetIntegerv) {
        return NULL;
    }

    const char* versionString = (const char*) GetString(GR_GL_VERSION);
    GrGLVersion glVer = GrGLGetVersionFromString(versionString);

    if (glVer < GR_GL_VER(1,5) || GR_GL_INVALID_VER == glVer) {
        // We must have array and element_array buffer objects.
        return NULL;
    }

    GrGLExtensions extensions;
    if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv)) {
        return NULL;
    }

    GrGLInterface* interface = SkNEW(GrGLInterface());
    GrGLInterface::Functions* functions = &interface->fFunctions;

    GET_PROC(ActiveTexture);
    GET_PROC(AttachShader);
    GET_PROC(BindAttribLocation);
    GET_PROC(BindBuffer);
    if (glVer >= GR_GL_VER(3,0)) {
        GET_PROC(BindFragDataLocation);
    }
    GET_PROC(BeginQuery);
    GET_PROC(BindTexture);
    GET_PROC(BlendFunc);

    if (glVer >= GR_GL_VER(1,4) ||
        extensions.has("GL_ARB_imaging") ||
        extensions.has("GL_EXT_blend_color")) {
        GET_PROC(BlendColor);
    }

    GET_PROC(BufferData);
    GET_PROC(BufferSubData);
    GET_PROC(Clear);
    GET_PROC(ClearColor);
    GET_PROC(ClearStencil);
    GET_PROC(ColorMask);
    GET_PROC(CompileShader);
    GET_PROC(CompressedTexImage2D);
    GET_PROC(CompressedTexSubImage2D);
    GET_PROC(CopyTexSubImage2D);
    GET_PROC(CreateProgram);
    GET_PROC(CreateShader);
    GET_PROC(CullFace);
    GET_PROC(DeleteBuffers);
    GET_PROC(DeleteProgram);
    GET_PROC(DeleteQueries);
    GET_PROC(DeleteShader);
    GET_PROC(DeleteTextures);
    GET_PROC(DepthMask);
    GET_PROC(Disable);
    GET_PROC(DisableVertexAttribArray);
    GET_PROC(DrawArrays);
    GET_PROC(DrawBuffer);
    GET_PROC(DrawBuffers);
    GET_PROC(DrawElements);
    GET_PROC(Enable);
    GET_PROC(EnableVertexAttribArray);
    GET_PROC(EndQuery);
    GET_PROC(Finish);
    GET_PROC(Flush);
    GET_PROC(FrontFace);
    GET_PROC(GenBuffers);
    GET_PROC(GenerateMipmap);
    GET_PROC(GetBufferParameteriv);
    GET_PROC(GetError);
    GET_PROC(GetIntegerv);
    GET_PROC(GetQueryObjectiv);
    GET_PROC(GetQueryObjectuiv);
    if (glVer >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) {
        GET_PROC(GetQueryObjecti64v);
        GET_PROC(GetQueryObjectui64v);
        GET_PROC(QueryCounter);
    } else if (extensions.has("GL_EXT_timer_query")) {
        GET_PROC_SUFFIX(GetQueryObjecti64v, EXT);
        GET_PROC_SUFFIX(GetQueryObjectui64v, EXT);
    }
    GET_PROC(GetQueryiv);
    GET_PROC(GetProgramInfoLog);
    GET_PROC(GetProgramiv);
    GET_PROC(GetShaderInfoLog);
    GET_PROC(GetShaderiv);
    GET_PROC(GetString);
    GET_PROC(GetStringi);
    GET_PROC(GetTexLevelParameteriv);
    GET_PROC(GenQueries);
    GET_PROC(GenTextures);
    GET_PROC(GetUniformLocation);
//.........这里部分代码省略.........
开发者ID:DXGL,项目名称:skia,代码行数:101,代码来源:GrGLAssembleInterface.cpp

示例7: GrGLAssembleGLESInterface

const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
    GET_PROC_LOCAL(GetString);
    if (NULL == GetString) {
        return NULL;
    }

    const char* verStr = reinterpret_cast<const char*>(GetString(GR_GL_VERSION));
    GrGLVersion version = GrGLGetVersionFromString(verStr);

    if (version < GR_GL_VER(2,0)) {
        return NULL;
    }

    GET_PROC_LOCAL(GetIntegerv);
    GET_PROC_LOCAL(GetStringi);
    GrGLExtensions extensions;
    if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv)) {
        return NULL;
    }

    GrGLInterface* interface = SkNEW(GrGLInterface);
    GrGLInterface::Functions* functions = &interface->fFunctions;

    GET_PROC(ActiveTexture);
    GET_PROC(AttachShader);
    GET_PROC(BindAttribLocation);
    GET_PROC(BindBuffer);
    GET_PROC(BindTexture);
    GET_PROC_SUFFIX(BindVertexArray, OES);
    GET_PROC(BlendColor);
    GET_PROC(BlendFunc);
    GET_PROC(BufferData);
    GET_PROC(BufferSubData);
    GET_PROC(Clear);
    GET_PROC(ClearColor);
    GET_PROC(ClearStencil);
    GET_PROC(ColorMask);
    GET_PROC(CompileShader);
    GET_PROC(CompressedTexImage2D);
    GET_PROC(CompressedTexSubImage2D);
    GET_PROC(CopyTexSubImage2D);
    GET_PROC(CreateProgram);
    GET_PROC(CreateShader);
    GET_PROC(CullFace);
    GET_PROC(DeleteBuffers);
    GET_PROC(DeleteProgram);
    GET_PROC(DeleteShader);
    GET_PROC(DeleteTextures);
    GET_PROC_SUFFIX(DeleteVertexArrays, OES);
    GET_PROC(DepthMask);
    GET_PROC(Disable);
    GET_PROC(DisableVertexAttribArray);
    GET_PROC(DrawArrays);
    GET_PROC(DrawElements);
    GET_PROC(Enable);
    GET_PROC(EnableVertexAttribArray);
    GET_PROC(Finish);
    GET_PROC(Flush);
    GET_PROC(FrontFace);
    GET_PROC(GenBuffers);
    GET_PROC(GenerateMipmap);
    GET_PROC(GenTextures);
    GET_PROC_SUFFIX(GenVertexArrays, OES);
    GET_PROC(GetBufferParameteriv);
    GET_PROC(GetError);
    GET_PROC(GetIntegerv);
    GET_PROC(GetProgramInfoLog);
    GET_PROC(GetProgramiv);
    GET_PROC(GetShaderInfoLog);
    GET_PROC(GetShaderiv);
    GET_PROC(GetString);
    GET_PROC(GetStringi);
    GET_PROC(GetUniformLocation);
    GET_PROC(LineWidth);
    GET_PROC(LinkProgram);
    GET_PROC(PixelStorei);
    GET_PROC(ReadPixels);
    GET_PROC(Scissor);
    GET_PROC(ShaderSource);
    GET_PROC(StencilFunc);
    GET_PROC(StencilFuncSeparate);
    GET_PROC(StencilMask);
    GET_PROC(StencilMaskSeparate);
    GET_PROC(StencilOp);
    GET_PROC(StencilOpSeparate);
    GET_PROC(TexImage2D);
    GET_PROC(TexParameteri);
    GET_PROC(TexParameteriv);
    GET_PROC(TexSubImage2D);

    if (version >= GR_GL_VER(3,0)) {
        GET_PROC(TexStorage2D);
    } else {
        GET_PROC_SUFFIX(TexStorage2D, EXT);
    }

    GET_PROC_SUFFIX(DiscardFramebuffer, EXT);
    GET_PROC(Uniform1f);
    GET_PROC(Uniform1i);
    GET_PROC(Uniform1fv);
//.........这里部分代码省略.........
开发者ID:DXGL,项目名称:skia,代码行数:101,代码来源:GrGLAssembleInterface.cpp

示例8: GrGLCreateMesaInterface

const GrGLInterface* GrGLCreateMesaInterface() {
    if (NULL != OSMesaGetCurrentContext()) {

        GrGLGetStringProc getString = (GrGLGetStringProc) OSMesaGetProcAddress("glGetString");
        GrGLGetStringiProc getStringi = (GrGLGetStringiProc) OSMesaGetProcAddress("glGetStringi");
        GrGLGetIntegervProc getIntegerv =
            (GrGLGetIntegervProc) OSMesaGetProcAddress("glGetIntegerv");

        GrGLExtensions extensions;
        if (!extensions.init(kDesktop_GrGLBinding, getString, getStringi, getIntegerv)) {
            return NULL;
        }

        const char* versionString = (const char*) getString(GL_VERSION);
        GrGLVersion glVer = GrGLGetVersionFromString(versionString);

        if (glVer < GR_GL_VER(1,5)) {
            // We must have array and element_array buffer objects.
            return NULL;
        }
        GrGLInterface* interface = new GrGLInterface();

        GR_GL_GET_PROC(ActiveTexture);
        GR_GL_GET_PROC(BeginQuery);
        GR_GL_GET_PROC(AttachShader);
        GR_GL_GET_PROC(BindAttribLocation);
        GR_GL_GET_PROC(BindBuffer);
        GR_GL_GET_PROC(BindFragDataLocation);
        GR_GL_GET_PROC(BindTexture);
        GR_GL_GET_PROC(BlendFunc);

        if (glVer >= GR_GL_VER(1,4) ||
            extensions.has("GL_ARB_imaging") ||
            extensions.has("GL_EXT_blend_color")) {
            GR_GL_GET_PROC(BlendColor);
        }

        GR_GL_GET_PROC(BufferData);
        GR_GL_GET_PROC(BufferSubData);
        GR_GL_GET_PROC(Clear);
        GR_GL_GET_PROC(ClearColor);
        GR_GL_GET_PROC(ClearStencil);
        GR_GL_GET_PROC(ColorMask);
        GR_GL_GET_PROC(CompileShader);
        GR_GL_GET_PROC(CompressedTexImage2D);
        GR_GL_GET_PROC(CopyTexSubImage2D);
        GR_GL_GET_PROC(CreateProgram);
        GR_GL_GET_PROC(CreateShader);
        GR_GL_GET_PROC(CullFace);
        GR_GL_GET_PROC(DeleteBuffers);
        GR_GL_GET_PROC(DeleteProgram);
        GR_GL_GET_PROC(DeleteQueries);
        GR_GL_GET_PROC(DeleteShader);
        GR_GL_GET_PROC(DeleteTextures);
        GR_GL_GET_PROC(DepthMask);
        GR_GL_GET_PROC(Disable);
        GR_GL_GET_PROC(DisableVertexAttribArray);
        GR_GL_GET_PROC(DrawArrays);
        GR_GL_GET_PROC(DrawBuffer);
        GR_GL_GET_PROC(DrawBuffers);
        GR_GL_GET_PROC(DrawElements);
        GR_GL_GET_PROC(Enable);
        GR_GL_GET_PROC(EnableVertexAttribArray);
        GR_GL_GET_PROC(EndQuery);
        GR_GL_GET_PROC(Finish);
        GR_GL_GET_PROC(Flush);
        GR_GL_GET_PROC(FrontFace);
        GR_GL_GET_PROC(GenBuffers);
        GR_GL_GET_PROC(GenQueries);
        GR_GL_GET_PROC(GetBufferParameteriv);
        GR_GL_GET_PROC(GetError);
        GR_GL_GET_PROC(GetIntegerv);
        GR_GL_GET_PROC(GetProgramInfoLog);
        GR_GL_GET_PROC(GetProgramiv);
        if (glVer >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) {
            GR_GL_GET_PROC(GetQueryObjecti64v);
            GR_GL_GET_PROC(GetQueryObjectui64v)
            GR_GL_GET_PROC(QueryCounter);
        } else if (extensions.has("GL_EXT_timer_query")) {
            GR_GL_GET_PROC_SUFFIX(GetQueryObjecti64v, EXT);
            GR_GL_GET_PROC_SUFFIX(GetQueryObjectui64v, EXT);
        }
        GR_GL_GET_PROC(GetQueryObjectiv);
        GR_GL_GET_PROC(GetQueryObjectuiv);
        GR_GL_GET_PROC(GetQueryiv);
        GR_GL_GET_PROC(GetShaderInfoLog);
        GR_GL_GET_PROC(GetShaderiv);
        GR_GL_GET_PROC(GetString);
        GR_GL_GET_PROC(GetStringi);
        GR_GL_GET_PROC(GetTexLevelParameteriv);
        GR_GL_GET_PROC(GenTextures);
        GR_GL_GET_PROC(GetUniformLocation);
        GR_GL_GET_PROC(LineWidth);
        GR_GL_GET_PROC(LinkProgram);
        GR_GL_GET_PROC(MapBuffer);
        GR_GL_GET_PROC(PixelStorei);
        GR_GL_GET_PROC(ReadBuffer);
        GR_GL_GET_PROC(ReadPixels);
        GR_GL_GET_PROC(Scissor);
        GR_GL_GET_PROC(ShaderSource);
//.........这里部分代码省略.........
开发者ID:Frankie-666,项目名称:color-emoji.skia,代码行数:101,代码来源:GrGLCreateMesaInterface.cpp

示例9: GrGLCreateNativeInterface

const GrGLInterface* GrGLCreateNativeInterface() {
    static SkAutoTUnref<GrGLInterface> glInterface;
    if (!glInterface.get()) {
        GrGLExtensions extensions;
        if (!extensions.init(kES2_GrGLBinding, glGetString, NULL, glGetIntegerv)) {
            return NULL;
        }
        GrGLInterface* interface = new GrGLInterface;
        glInterface.reset(interface);
        interface->fBindingsExported = kES2_GrGLBinding;
        interface->fActiveTexture = glActiveTexture;
        interface->fAttachShader = glAttachShader;
        interface->fBindAttribLocation = glBindAttribLocation;
        interface->fBindBuffer = glBindBuffer;
        interface->fBindTexture = glBindTexture;
        interface->fBindVertexArray = glBindVertexArrayOES;
        interface->fBlendColor = glBlendColor;
        interface->fBlendFunc = glBlendFunc;
        interface->fBufferData = glBufferData;
        interface->fBufferSubData = glBufferSubData;
        interface->fClear = glClear;
        interface->fClearColor = glClearColor;
        interface->fClearStencil = glClearStencil;
        interface->fColorMask = glColorMask;
        interface->fCompileShader = glCompileShader;
        interface->fCompressedTexImage2D = glCompressedTexImage2D;
        interface->fCopyTexSubImage2D = glCopyTexSubImage2D;
        interface->fCreateProgram = glCreateProgram;
        interface->fCreateShader = glCreateShader;
        interface->fCullFace = glCullFace;
        interface->fDeleteBuffers = glDeleteBuffers;
        interface->fDeleteProgram = glDeleteProgram;
        interface->fDeleteShader = glDeleteShader;
        interface->fDeleteTextures = glDeleteTextures;
        interface->fDeleteVertexArrays = glDeleteVertexArraysOES;
        interface->fDepthMask = glDepthMask;
        interface->fDisable = glDisable;
        interface->fDisableVertexAttribArray = glDisableVertexAttribArray;
        interface->fDrawArrays = glDrawArrays;
        interface->fDrawElements = glDrawElements;
        interface->fEnable = glEnable;
        interface->fEnableVertexAttribArray = glEnableVertexAttribArray;
        interface->fFinish = glFinish;
        interface->fFlush = glFlush;
        interface->fFrontFace = glFrontFace;
        interface->fGenBuffers = glGenBuffers;
        interface->fGenerateMipmap = glGenerateMipmap;
        interface->fGenTextures = glGenTextures;
        interface->fGenVertexArrays = glGenVertexArraysOES;
        interface->fGetBufferParameteriv = glGetBufferParameteriv;
        interface->fGetError = glGetError;
        interface->fGetIntegerv = glGetIntegerv;
        interface->fGetProgramInfoLog = glGetProgramInfoLog;
        interface->fGetProgramiv = glGetProgramiv;
        interface->fGetShaderInfoLog = glGetShaderInfoLog;
        interface->fGetShaderiv = glGetShaderiv;
        interface->fGetString = glGetString;
        interface->fGetUniformLocation = glGetUniformLocation;
        interface->fLineWidth = glLineWidth;
        interface->fLinkProgram = glLinkProgram;
        interface->fPixelStorei = glPixelStorei;
        interface->fReadPixels = glReadPixels;
        interface->fScissor = glScissor;
#if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE
        interface->fShaderSource = (GrGLShaderSourceProc) glShaderSource;
#else
        interface->fShaderSource = glShaderSource;
#endif
        interface->fStencilFunc = glStencilFunc;
        interface->fStencilFuncSeparate = glStencilFuncSeparate;
        interface->fStencilMask = glStencilMask;
        interface->fStencilMaskSeparate = glStencilMaskSeparate;
        interface->fStencilOp = glStencilOp;
        interface->fStencilOpSeparate = glStencilOpSeparate;
        interface->fTexImage2D = glTexImage2D;
        interface->fTexParameteri = glTexParameteri;
        interface->fTexParameteriv = glTexParameteriv;
        interface->fTexSubImage2D = glTexSubImage2D;
#if GL_ARB_texture_storage
        interface->fTexStorage2D = glTexStorage2D;
#elif GL_EXT_texture_storage
        interface->fTexStorage2D = glTexStorage2DEXT;
#else
        interface->fTexStorage2D = (GrGLTexStorage2DProc) eglGetProcAddress("glTexStorage2DEXT");
#endif
#if GL_EXT_discard_framebuffer
        interface->fDiscardFramebuffer = glDiscardFramebufferEXT;
#endif
        interface->fUniform1f = glUniform1f;
        interface->fUniform1i = glUniform1i;
        interface->fUniform1fv = glUniform1fv;
        interface->fUniform1iv = glUniform1iv;
        interface->fUniform2f = glUniform2f;
        interface->fUniform2i = glUniform2i;
        interface->fUniform2fv = glUniform2fv;
        interface->fUniform2iv = glUniform2iv;
        interface->fUniform3f = glUniform3f;
        interface->fUniform3i = glUniform3i;
        interface->fUniform3fv = glUniform3fv;
        interface->fUniform3iv = glUniform3iv;
//.........这里部分代码省略.........
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_skia_src,代码行数:101,代码来源:GrGLCreateNativeInterface_android.cpp

示例10: CreateGrGLInterfaceFromGLContext

static GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context)
{
    SetStaticGLContext(context);

    GrGLInterface* i = new GrGLInterface();
    i->fCallback = EnsureGLContext;
    i->fCallbackData = 0; // must be later initialized to be a valid DrawTargetSkia* pointer

    context->MakeCurrent();

    // We support both desktop GL and GLES2
    if (context->IsGLES()) {
        i->fStandard = kGLES_GrGLStandard;
    } else {
        i->fStandard = kGL_GrGLStandard;
    }

    GrGLExtensions extensions;
    if (!extensions.init(i->fStandard, glGetString_mozilla, NULL, glGetIntegerv_mozilla)) {
        delete i;
        return nullptr;
    }

    i->fExtensions.swap(&extensions);

    // Core GL functions required by Ganesh
    i->fFunctions.fActiveTexture = glActiveTexture_mozilla;
    i->fFunctions.fAttachShader = glAttachShader_mozilla;
    i->fFunctions.fBindAttribLocation = glBindAttribLocation_mozilla;
    i->fFunctions.fBindBuffer = glBindBuffer_mozilla;
    i->fFunctions.fBindFramebuffer = glBindFramebuffer_mozilla;
    i->fFunctions.fBindRenderbuffer = glBindRenderbuffer_mozilla;
    i->fFunctions.fBindTexture = glBindTexture_mozilla;
    i->fFunctions.fBlendFunc = glBlendFunc_mozilla;
    i->fFunctions.fBlendColor = glBlendColor_mozilla;
    i->fFunctions.fBufferData = glBufferData_mozilla;
    i->fFunctions.fBufferSubData = glBufferSubData_mozilla;
    i->fFunctions.fCheckFramebufferStatus = glCheckFramebufferStatus_mozilla;
    i->fFunctions.fClear = glClear_mozilla;
    i->fFunctions.fClearColor = glClearColor_mozilla;
    i->fFunctions.fClearStencil = glClearStencil_mozilla;
    i->fFunctions.fColorMask = glColorMask_mozilla;
    i->fFunctions.fCompileShader = glCompileShader_mozilla;
    i->fFunctions.fCopyTexSubImage2D = glCopyTexSubImage2D_mozilla;
    i->fFunctions.fCreateProgram = glCreateProgram_mozilla;
    i->fFunctions.fCreateShader = glCreateShader_mozilla;
    i->fFunctions.fCullFace = glCullFace_mozilla;
    i->fFunctions.fDeleteBuffers = glDeleteBuffers_mozilla;
    i->fFunctions.fDeleteFramebuffers = glDeleteFramebuffers_mozilla;
    i->fFunctions.fDeleteProgram = glDeleteProgram_mozilla;
    i->fFunctions.fDeleteRenderbuffers = glDeleteRenderbuffers_mozilla;
    i->fFunctions.fDeleteShader = glDeleteShader_mozilla;
    i->fFunctions.fDeleteTextures = glDeleteTextures_mozilla;
    i->fFunctions.fDepthMask = glDepthMask_mozilla;
    i->fFunctions.fDisable = glDisable_mozilla;
    i->fFunctions.fDisableVertexAttribArray = glDisableVertexAttribArray_mozilla;
    i->fFunctions.fDrawArrays = glDrawArrays_mozilla;
    i->fFunctions.fDrawElements = glDrawElements_mozilla;
    i->fFunctions.fEnable = glEnable_mozilla;
    i->fFunctions.fEnableVertexAttribArray = glEnableVertexAttribArray_mozilla;
    i->fFunctions.fFinish = glFinish_mozilla;
    i->fFunctions.fFlush = glFlush_mozilla;
    i->fFunctions.fFramebufferRenderbuffer = glFramebufferRenderbuffer_mozilla;
    i->fFunctions.fFramebufferTexture2D = glFramebufferTexture2D_mozilla;
    i->fFunctions.fFrontFace = glFrontFace_mozilla;
    i->fFunctions.fGenBuffers = glGenBuffers_mozilla;
    i->fFunctions.fGenFramebuffers = glGenFramebuffers_mozilla;
    i->fFunctions.fGenRenderbuffers = glGenRenderbuffers_mozilla;
    i->fFunctions.fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameteriv_mozilla;
    i->fFunctions.fGenTextures = glGenTextures_mozilla;
    i->fFunctions.fGenerateMipmap = glGenerateMipmap_mozilla;
    i->fFunctions.fGetBufferParameteriv = glGetBufferParameteriv_mozilla;
    i->fFunctions.fGetError = glGetError_mozilla;
    i->fFunctions.fGetIntegerv = glGetIntegerv_mozilla;
    i->fFunctions.fGetProgramInfoLog = glGetProgramInfoLog_mozilla;
    i->fFunctions.fGetProgramiv = glGetProgramiv_mozilla;
    i->fFunctions.fGetRenderbufferParameteriv = glGetRenderbufferParameteriv_mozilla;
    i->fFunctions.fGetShaderInfoLog = glGetShaderInfoLog_mozilla;
    i->fFunctions.fGetShaderiv = glGetShaderiv_mozilla;
    i->fFunctions.fGetString = glGetString_mozilla;
    i->fFunctions.fGetUniformLocation = glGetUniformLocation_mozilla;
    i->fFunctions.fLineWidth = glLineWidth_mozilla;
    i->fFunctions.fLinkProgram = glLinkProgram_mozilla;
    i->fFunctions.fPixelStorei = glPixelStorei_mozilla;
    i->fFunctions.fReadPixels = glReadPixels_mozilla;
    i->fFunctions.fRenderbufferStorage = glRenderbufferStorage_mozilla;
    i->fFunctions.fScissor = glScissor_mozilla;
    i->fFunctions.fShaderSource = glShaderSource_mozilla;
    i->fFunctions.fStencilFunc = glStencilFunc_mozilla;
    i->fFunctions.fStencilMask = glStencilMask_mozilla;
    i->fFunctions.fStencilOp = glStencilOp_mozilla;
    i->fFunctions.fTexImage2D = glTexImage2D_mozilla;
    i->fFunctions.fTexParameteri = glTexParameteri_mozilla;
    i->fFunctions.fTexParameteriv = glTexParameteriv_mozilla;
    i->fFunctions.fTexSubImage2D = glTexSubImage2D_mozilla;
    i->fFunctions.fUniform1f = glUniform1f_mozilla;
    i->fFunctions.fUniform1i = glUniform1i_mozilla;
    i->fFunctions.fUniform1fv = glUniform1fv_mozilla;
    i->fFunctions.fUniform1iv = glUniform1iv_mozilla;
    i->fFunctions.fUniform2f = glUniform2f_mozilla;
//.........这里部分代码省略.........
开发者ID:Jar-win,项目名称:Waterfox,代码行数:101,代码来源:SkiaGLGlue.cpp

示例11: GR_STATIC_ASSERT

bool GrGLInterface::validate(GrGLBinding binding) const {

    // kNone must be 0 so that the check we're about to do can never succeed if
    // binding == kNone.
    GR_STATIC_ASSERT(kNone_GrGLBinding == 0);

    if (0 == (binding & fBindingsExported)) {
        return false;
    }

    GrGLExtensions extensions;
    if (!extensions.init(binding, this)) {
        return false;
    }

    // functions that are always required
    if (NULL == fActiveTexture ||
        NULL == fAttachShader ||
        NULL == fBindAttribLocation ||
        NULL == fBindBuffer ||
        NULL == fBindTexture ||
        NULL == fBlendFunc ||
        NULL == fBlendColor ||      // -> GL >= 1.4, ES >= 2.0 or extension
        NULL == fBufferData ||
        NULL == fBufferSubData ||
        NULL == fClear ||
        NULL == fClearColor ||
        NULL == fClearStencil ||
        NULL == fColorMask ||
        NULL == fCompileShader ||
        NULL == fCopyTexSubImage2D ||
        NULL == fCreateProgram ||
        NULL == fCreateShader ||
        NULL == fCullFace ||
        NULL == fDeleteBuffers ||
        NULL == fDeleteProgram ||
        NULL == fDeleteShader ||
        NULL == fDeleteTextures ||
        NULL == fDepthMask ||
        NULL == fDisable ||
        NULL == fDisableVertexAttribArray ||
        NULL == fDrawArrays ||
        NULL == fDrawElements ||
        NULL == fEnable ||
        NULL == fEnableVertexAttribArray ||
        NULL == fFrontFace ||
        NULL == fGenBuffers ||
        NULL == fGenTextures ||
        NULL == fGetBufferParameteriv ||
        NULL == fGetError ||
        NULL == fGetIntegerv ||
        NULL == fGetProgramInfoLog ||
        NULL == fGetProgramiv ||
        NULL == fGetShaderInfoLog ||
        NULL == fGetShaderiv ||
        NULL == fGetString ||
        NULL == fGetUniformLocation ||
        NULL == fLinkProgram ||
        NULL == fPixelStorei ||
        NULL == fReadPixels ||
        NULL == fScissor ||
        NULL == fShaderSource ||
        NULL == fStencilFunc ||
        NULL == fStencilMask ||
        NULL == fStencilOp ||
        NULL == fTexImage2D ||
        NULL == fTexParameteri ||
        NULL == fTexParameteriv ||
        NULL == fTexSubImage2D ||
        NULL == fUniform1f ||
        NULL == fUniform1i ||
        NULL == fUniform1fv ||
        NULL == fUniform1iv ||
        NULL == fUniform2f ||
        NULL == fUniform2i ||
        NULL == fUniform2fv ||
        NULL == fUniform2iv ||
        NULL == fUniform3f ||
        NULL == fUniform3i ||
        NULL == fUniform3fv ||
        NULL == fUniform3iv ||
        NULL == fUniform4f ||
        NULL == fUniform4i ||
        NULL == fUniform4fv ||
        NULL == fUniform4iv ||
        NULL == fUniformMatrix2fv ||
        NULL == fUniformMatrix3fv ||
        NULL == fUniformMatrix4fv ||
        NULL == fUseProgram ||
        NULL == fVertexAttrib4fv ||
        NULL == fVertexAttribPointer ||
        NULL == fViewport ||
        NULL == fBindFramebuffer ||
        NULL == fBindRenderbuffer ||
        NULL == fCheckFramebufferStatus ||
        NULL == fDeleteFramebuffers ||
        NULL == fDeleteRenderbuffers ||
        NULL == fFinish ||
        NULL == fFlush ||
        NULL == fFramebufferRenderbuffer ||
//.........这里部分代码省略.........
开发者ID:JoKaWare,项目名称:GViews,代码行数:101,代码来源:GrGLInterface.cpp


注:本文中的GrGLExtensions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。