本文整理汇总了C++中GR_GL_VER函数的典型用法代码示例。如果您正苦于以下问题:C++ GR_GL_VER函数的具体用法?C++ GR_GL_VER怎么用?C++ GR_GL_VER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GR_GL_VER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GrGpuGL
GrGpuGLShaders::GrGpuGLShaders(const GrGLContextInfo& ctxInfo)
: GrGpuGL(ctxInfo) {
// Enable supported shader-related caps
if (kDesktop_GrGLBinding == this->glBinding()) {
fCaps.fDualSourceBlendingSupport =
this->glVersion() >= GR_GL_VER(3,3) ||
this->hasExtension("GL_ARB_blend_func_extended");
fCaps.fShaderDerivativeSupport = true;
// we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS
fCaps.fGeometryShaderSupport =
this->glVersion() >= GR_GL_VER(3,2) &&
this->glslGeneration() >= k150_GrGLSLGeneration;
} else {
fCaps.fShaderDerivativeSupport =
this->hasExtension("GL_OES_standard_derivatives");
}
GR_GL_GetIntegerv(this->glInterface(),
GR_GL_MAX_VERTEX_ATTRIBS,
&fMaxVertexAttribs);
fProgramData = NULL;
fProgramCache = new ProgramCache(this->glContextInfo());
#if 0
this->programUnitTest();
#endif
}
示例2: if
void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
fMSFBOType = kNone_MSFBOType;
if (kGL_GrGLStandard != ctxInfo.standard()) {
// We prefer the EXT/IMG extension over ES3 MSAA because we've observed
// ES3 driver bugs on at least one device with a tiled GPU (N10).
if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture")) {
fMSFBOType = kES_EXT_MsToTexture_MSFBOType;
} else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture")) {
fMSFBOType = kES_IMG_MsToTexture_MSFBOType;
} else if (ctxInfo.version() >= GR_GL_VER(3,0)) {
fMSFBOType = GrGLCaps::kES_3_0_MSFBOType;
} else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) {
// chrome's extension is equivalent to the EXT msaa
// and fbo_blit extensions.
fMSFBOType = kDesktop_EXT_MSFBOType;
} else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) {
fMSFBOType = kES_Apple_MSFBOType;
}
} else {
if ((ctxInfo.version() >= GR_GL_VER(3,0)) ||
ctxInfo.hasExtension("GL_ARB_framebuffer_object")) {
fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType;
} else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") &&
ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) {
fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType;
}
}
}
示例3: GrGpuGL
GrGpuGLShaders::GrGpuGLShaders(const GrGLInterface* gl)
: GrGpuGL(gl, get_binding_in_use(gl)) {
GrGLSLGeneration glslGeneration =
GetGLSLGeneration(this->glBinding(), gl);
// Enable supported shader-releated caps
fCaps.fShaderSupport = true;
fCaps.fSupportPerVertexCoverage = true;
if (kDesktop_GrGLBinding == this->glBinding()) {
fCaps.fDualSourceBlendingSupport =
this->glVersion() >= GR_GL_VER(3,3) ||
this->hasExtension("GL_ARB_blend_func_extended");
fCaps.fShaderDerivativeSupport = true;
// we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS
fCaps.fGeometryShaderSupport =
this->glVersion() >= GR_GL_VER(3,2) &&
glslGeneration >= k150_GLSLGeneration;
} else {
fCaps.fShaderDerivativeSupport =
this->hasExtension("GL_OES_standard_derivatives");
}
GR_GL_GetIntegerv(gl, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttribs);
fProgramData = NULL;
fProgramCache = new ProgramCache(gl, glslGeneration);
#if 0
this->programUnitTest();
#endif
}
示例4: GrGLGetVersionFromString
GrGLVersion GrGLGetVersionFromString(const char* versionString) {
if (NULL == versionString) {
GrAssert(!"NULL GL version string.");
return 0;
}
int major, minor;
int n = sscanf(versionString, "%d.%d", &major, &minor);
if (2 == n) {
return GR_GL_VER(major, minor);
}
char profile[2];
n = sscanf(versionString, "OpenGL ES-%c%c %d.%d", profile, profile+1,
&major, &minor);
if (4 == n) {
return GR_GL_VER(major, minor);
}
n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor);
if (2 == n) {
return GR_GL_VER(major, minor);
}
return 0;
}
示例5: GrGLGetVersionFromString
GrGLVersion GrGLGetVersionFromString(const char* versionString) {
if (nullptr == versionString) {
SkDebugf("nullptr GL version string.");
return GR_GL_INVALID_VER;
}
int major, minor;
// check for mesa
int mesaMajor, mesaMinor;
int n = sscanf(versionString, "%d.%d Mesa %d.%d", &major, &minor, &mesaMajor, &mesaMinor);
if (4 == n) {
return GR_GL_VER(major, minor);
}
n = sscanf(versionString, "%d.%d", &major, &minor);
if (2 == n) {
return GR_GL_VER(major, minor);
}
char profile[2];
n = sscanf(versionString, "OpenGL ES-%c%c %d.%d", profile, profile+1,
&major, &minor);
if (4 == n) {
return GR_GL_VER(major, minor);
}
n = sscanf(versionString, "OpenGL ES %d.%d", &major, &minor);
if (2 == n) {
return GR_GL_VER(major, minor);
}
return GR_GL_INVALID_VER;
}
示例6: GR_GL_VER
void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) {
// Build up list of legal stencil formats (though perhaps not supported on
// the particular gpu/driver) from most preferred to least.
// these consts are in order of most preferred to least preferred
// we don't bother with GL_STENCIL_INDEX1 or GL_DEPTH32F_STENCIL8
static const StencilFormat
// internal Format stencil bits total bits packed?
gS8 = {GR_GL_STENCIL_INDEX8, 8, 8, false},
gS16 = {GR_GL_STENCIL_INDEX16, 16, 16, false},
gD24S8 = {GR_GL_DEPTH24_STENCIL8, 8, 32, true },
gS4 = {GR_GL_STENCIL_INDEX4, 4, 4, false},
// gS = {GR_GL_STENCIL_INDEX, kUnknownBitCount, kUnknownBitCount, false},
gDS = {GR_GL_DEPTH_STENCIL, kUnknownBitCount, kUnknownBitCount, true };
if (kGL_GrGLStandard == ctxInfo.standard()) {
bool supportsPackedDS =
ctxInfo.version() >= GR_GL_VER(3,0) ||
ctxInfo.hasExtension("GL_EXT_packed_depth_stencil") ||
ctxInfo.hasExtension("GL_ARB_framebuffer_object");
// S1 thru S16 formats are in GL 3.0+, EXT_FBO, and ARB_FBO since we
// require FBO support we can expect these are legal formats and don't
// check. These also all support the unsized GL_STENCIL_INDEX.
fStencilFormats.push_back() = gS8;
fStencilFormats.push_back() = gS16;
if (supportsPackedDS) {
fStencilFormats.push_back() = gD24S8;
}
fStencilFormats.push_back() = gS4;
if (supportsPackedDS) {
fStencilFormats.push_back() = gDS;
}
} else {
// ES2 has STENCIL_INDEX8 without extensions but requires extensions
// for other formats.
// ES doesn't support using the unsized format.
fStencilFormats.push_back() = gS8;
//fStencilFormats.push_back() = gS16;
if (ctxInfo.version() >= GR_GL_VER(3,0) ||
ctxInfo.hasExtension("GL_OES_packed_depth_stencil")) {
fStencilFormats.push_back() = gD24S8;
}
if (ctxInfo.hasExtension("GL_OES_stencil4")) {
fStencilFormats.push_back() = gS4;
}
}
SkASSERT(0 == fStencilVerifiedColorConfigs.count());
fStencilVerifiedColorConfigs.push_back_n(fStencilFormats.count());
}
示例7: ret
SkGLContext::GLFenceSync* SkGLContext::GLFenceSync::CreateIfSupported(const SkGLContext* ctx) {
SkAutoTDelete<GLFenceSync> ret(new GLFenceSync);
if (kGL_GrGLStandard == ctx->gl()->fStandard) {
const GrGLubyte* versionStr;
SK_GL_RET(*ctx, versionStr, GetString(GR_GL_VERSION));
GrGLVersion version = GrGLGetVersionFromString(reinterpret_cast<const char*>(versionStr));
if (version < GR_GL_VER(3,2) && !ctx->gl()->hasExtension("GL_ARB_sync")) {
return nullptr;
}
ret->fGLFenceSync = reinterpret_cast<GLFenceSyncProc>(
ctx->onPlatformGetProcAddress("glFenceSync"));
ret->fGLClientWaitSync = reinterpret_cast<GLClientWaitSyncProc>(
ctx->onPlatformGetProcAddress("glClientWaitSync"));
ret->fGLDeleteSync = reinterpret_cast<GLDeleteSyncProc>(
ctx->onPlatformGetProcAddress("glDeleteSync"));
} else {
if (!ctx->gl()->hasExtension("GL_APPLE_sync")) {
return nullptr;
}
ret->fGLFenceSync = reinterpret_cast<GLFenceSyncProc>(
ctx->onPlatformGetProcAddress("glFenceSyncAPPLE"));
ret->fGLClientWaitSync = reinterpret_cast<GLClientWaitSyncProc>(
ctx->onPlatformGetProcAddress("glClientWaitSyncAPPLE"));
ret->fGLDeleteSync = reinterpret_cast<GLDeleteSyncProc>(
ctx->onPlatformGetProcAddress("glDeleteSyncAPPLE"));
}
if (!ret->fGLFenceSync || !ret->fGLClientWaitSync || !ret->fGLDeleteSync) {
return nullptr;
}
return ret.detach();
}
示例8: createTextureRectangle
GrGLint GLTestContext::createTextureRectangle(int width, int height, GrGLenum internalFormat,
GrGLenum externalFormat, GrGLenum externalType,
GrGLvoid* data) {
if (!(kGL_GrGLStandard == fGL->fStandard && GrGLGetVersion(fGL) >= GR_GL_VER(3, 1)) &&
!fGL->fExtensions.has("GL_ARB_texture_rectangle")) {
return 0;
}
if (GrGLGetGLSLVersion(fGL) < GR_GLSL_VER(1, 40)) {
return 0;
}
GrGLuint id;
GR_GL_CALL(fGL, GenTextures(1, &id));
GR_GL_CALL(fGL, BindTexture(GR_GL_TEXTURE_RECTANGLE, id));
GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MAG_FILTER,
GR_GL_NEAREST));
GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MIN_FILTER,
GR_GL_NEAREST));
GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_S,
GR_GL_CLAMP_TO_EDGE));
GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_T,
GR_GL_CLAMP_TO_EDGE));
GR_GL_CALL(fGL, TexImage2D(GR_GL_TEXTURE_RECTANGLE, 0, internalFormat, width, height, 0,
externalFormat, externalType, data));
return id;
}
示例9: getString
bool GrGLExtensions::init(GrGLStandard standard,
GrGLGetStringProc getString,
GrGLGetStringiProc getStringi,
GrGLGetIntegervProc getIntegerv) {
fInitialized = false;
fStrings->reset();
if (NULL == getString) {
return false;
}
// glGetStringi and indexed extensions were added in version 3.0 of desktop GL and ES.
const GrGLubyte* verString = getString(GR_GL_VERSION);
GrGLVersion version = GrGLGetVersionFromString((const char*) verString);
if (GR_GL_INVALID_VER == version) {
return false;
}
bool indexed = version >= GR_GL_VER(3, 0);
if (indexed) {
if (NULL == getStringi || NULL == getIntegerv) {
return false;
}
GrGLint extensionCnt = 0;
getIntegerv(GR_GL_NUM_EXTENSIONS, &extensionCnt);
fStrings->push_back_n(extensionCnt);
for (int i = 0; i < extensionCnt; ++i) {
const char* ext = (const char*) getStringi(GR_GL_EXTENSIONS, i);
(*fStrings)[i] = ext;
}
} else {
const char* extensions = (const char*) getString(GR_GL_EXTENSIONS);
if (NULL == extensions) {
return false;
}
while (true) {
// skip over multiple spaces between extensions
while (' ' == *extensions) {
++extensions;
}
// quit once we reach the end of the string.
if ('\0' == *extensions) {
break;
}
// we found an extension
size_t length = strcspn(extensions, " ");
fStrings->push_back().set(extensions, length);
extensions += length;
}
}
if (!fStrings->empty()) {
SkTLessFunctionToFunctorAdaptor<SkString, extension_compare> cmp;
SkTQSort(&fStrings->front(), &fStrings->back(), cmp);
}
fInitialized = true;
return true;
}
示例10: SkiaGrGLInterfaceGLVersionGreaterThanOrEqualTo
extern "C" bool
SkiaGrGLInterfaceGLVersionGreaterThanOrEqualTo(SkiaGrGLInterfaceRef aGrGLInterface, int32_t major, int32_t minor) {
const GrGLubyte* versionUByte;
GR_GL_CALL_RET(static_cast<const GrGLInterface*>(aGrGLInterface), versionUByte, GetString(GR_GL_VERSION));
const char* version = reinterpret_cast<const char*>(versionUByte);
GrGLVersion glVersion = GrGLGetVersionFromString(version);
return GR_GL_INVALID_VER != glVersion && glVersion >= GR_GL_VER(major, minor);
}
示例11: GR_GL_VER
void GrGLContextInfo::reset() {
fBindingInUse = kNone_GrGLBinding;
fGLVersion = GR_GL_VER(0, 0);
fGLSLGeneration = static_cast<GrGLSLGeneration>(0);
fVendor = kOther_GrGLVendor;
fIsMesa = false;
fExtensions.reset();
fGLCaps->reset();
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_skia_src,代码行数:9,代码来源:GrGLContext.cpp
示例12: GR_GL_VER
void GrGLContextInfo::reset() {
fInterface.reset(NULL);
fGLVersion = GR_GL_VER(0, 0);
fGLSLGeneration = static_cast<GrGLSLGeneration>(0);
fVendor = kOther_GrGLVendor;
fRenderer = kOther_GrGLRenderer;
fIsMesa = false;
fIsChromium = false;
fGLCaps->reset();
}
示例13: initShaderPrecisionTable
void GrGLSLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo,
const GrGLInterface* intf) {
if (kGLES_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER(4, 1) ||
ctxInfo.hasExtension("GL_ARB_ES2_compatibility")) {
for (int s = 0; s < kGrShaderTypeCount; ++s) {
if (kGeometry_GrShaderType != s) {
GrShaderType shaderType = static_cast<GrShaderType>(s);
GrGLenum glShader = shader_type_to_gl_shader(shaderType);
PrecisionInfo* first = NULL;
fShaderPrecisionVaries = false;
for (int p = 0; p < kGrSLPrecisionCount; ++p) {
GrSLPrecision precision = static_cast<GrSLPrecision>(p);
GrGLenum glPrecision = precision_to_gl_float_type(precision);
GrGLint range[2];
GrGLint bits;
GR_GL_GetShaderPrecisionFormat(intf, glShader, glPrecision, range, &bits);
if (bits) {
fFloatPrecisions[s][p].fLogRangeLow = range[0];
fFloatPrecisions[s][p].fLogRangeHigh = range[1];
fFloatPrecisions[s][p].fBits = bits;
if (!first) {
first = &fFloatPrecisions[s][p];
}
else if (!fShaderPrecisionVaries) {
fShaderPrecisionVaries = (*first != fFloatPrecisions[s][p]);
}
}
}
}
}
}
else {
// We're on a desktop GL that doesn't have precision info. Assume they're all 32bit float.
fShaderPrecisionVaries = false;
for (int s = 0; s < kGrShaderTypeCount; ++s) {
if (kGeometry_GrShaderType != s) {
for (int p = 0; p < kGrSLPrecisionCount; ++p) {
fFloatPrecisions[s][p].fLogRangeLow = 127;
fFloatPrecisions[s][p].fLogRangeHigh = 127;
fFloatPrecisions[s][p].fBits = 23;
}
}
}
}
// GetShaderPrecisionFormat doesn't accept GL_GEOMETRY_SHADER as a shader type. Assume they're
// the same as the vertex shader. Only fragment shaders were ever allowed to omit support for
// highp. GS was added after GetShaderPrecisionFormat was added to the list of features that
// are recommended against.
if (fGeometryShaderSupport) {
for (int p = 0; p < kGrSLPrecisionCount; ++p) {
fFloatPrecisions[kGeometry_GrShaderType][p] = fFloatPrecisions[kVertex_GrShaderType][p];
}
}
}
示例14: getString
bool GrGLExtensions::init(GrGLBinding binding,
GrGLGetStringProc getString,
GrGLGetStringiProc getStringi,
GrGLGetIntegervProc getIntegerv) {
fStrings.reset();
if (NULL == getString) {
return false;
}
bool indexed = false;
if (kDesktop_GrGLBinding == binding) {
const GrGLubyte* verString = getString(GR_GL_VERSION);
if (NULL == verString) {
return false;
}
GrGLVersion version = GrGLGetVersionFromString((const char*) verString);
indexed = version >= GR_GL_VER(3, 0);
}
if (indexed) {
if (NULL == getStringi || NULL == getIntegerv) {
return false;
}
GrGLint extensionCnt = 0;
getIntegerv(GR_GL_NUM_EXTENSIONS, &extensionCnt);
fStrings.push_back_n(extensionCnt);
for (int i = 0; i < extensionCnt; ++i) {
const char* ext = (const char*) getStringi(GR_GL_EXTENSIONS, i);
fStrings[i] = ext;
}
} else {
const char* extensions = (const char*) getString(GR_GL_EXTENSIONS);
if (NULL == extensions) {
return false;
}
while (true) {
// skip over multiple spaces between extensions
while (' ' == *extensions) {
++extensions;
}
// quit once we reach the end of the string.
if ('\0' == *extensions) {
break;
}
// we found an extension
size_t length = strcspn(extensions, " ");
fStrings.push_back().set(extensions, length);
extensions += length;
}
}
if (0 != fStrings.count()) {
SkTLessFunctionToFunctorAdaptor<SkString, extension_compare> cmp;
SkTQSort(&fStrings.front(), &fStrings.back(), cmp);
}
return true;
}
示例15: getString
bool GrGLExtensions::init(GrGLStandard standard,
GrGLFunction<GrGLGetStringProc> getString,
GrGLFunction<GrGLGetStringiProc> getStringi,
GrGLFunction<GrGLGetIntegervProc> getIntegerv,
GrGLFunction<GrEGLQueryStringProc> queryString,
GrEGLDisplay eglDisplay) {
fInitialized = false;
fStrings->reset();
if (!getString) {
return false;
}
// glGetStringi and indexed extensions were added in version 3.0 of desktop GL and ES.
const GrGLubyte* verString = getString(GR_GL_VERSION);
GrGLVersion version = GrGLGetVersionFromString((const char*) verString);
if (GR_GL_INVALID_VER == version) {
return false;
}
bool indexed = version >= GR_GL_VER(3, 0);
if (indexed) {
if (!getStringi || !getIntegerv) {
return false;
}
GrGLint extensionCnt = 0;
getIntegerv(GR_GL_NUM_EXTENSIONS, &extensionCnt);
fStrings->push_back_n(extensionCnt);
for (int i = 0; i < extensionCnt; ++i) {
const char* ext = (const char*) getStringi(GR_GL_EXTENSIONS, i);
(*fStrings)[i] = ext;
}
} else {
const char* extensions = (const char*) getString(GR_GL_EXTENSIONS);
if (!extensions) {
return false;
}
eat_space_sep_strings(fStrings.get(), extensions);
}
if (queryString) {
const char* extensions = queryString(eglDisplay, GR_EGL_EXTENSIONS);
eat_space_sep_strings(fStrings.get(), extensions);
}
if (!fStrings->empty()) {
SkTLessFunctionToFunctorAdaptor<SkString, extension_compare> cmp;
SkTQSort(&fStrings->front(), &fStrings->back(), cmp);
}
fInitialized = true;
return true;
}