Checkpoint towards core profile support.
1) Stop calling glDisable for removed state 2) Use new GLSL names for texture sampling functions. Review URL: https://codereview.chromium.org/12330181 git-svn-id: http://skia.googlecode.com/svn/trunk@7908 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
6177e6999d
commit
2b1b8c083b
@ -38,6 +38,7 @@ void GrGLCaps::reset() {
|
||||
fTwoFormatLimit = false;
|
||||
fFragCoordsConventionSupport = false;
|
||||
fUseNonVBOVertexAndIndexDynamicData = false;
|
||||
fIsCoreProfile = false;
|
||||
}
|
||||
|
||||
GrGLCaps::GrGLCaps(const GrGLCaps& caps) {
|
||||
@ -69,6 +70,7 @@ GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) {
|
||||
fTwoFormatLimit = caps.fTwoFormatLimit;
|
||||
fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport;
|
||||
fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicData;
|
||||
fIsCoreProfile = caps.fIsCoreProfile;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -176,6 +178,12 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
|
||||
(kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxInfo.vendor())) {
|
||||
fUseNonVBOVertexAndIndexDynamicData = true;
|
||||
}
|
||||
|
||||
if (kDesktop_GrGLBinding == binding && version >= GR_GL_VER(3, 2)) {
|
||||
GrGLint profileMask;
|
||||
GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask);
|
||||
fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT);
|
||||
}
|
||||
|
||||
this->initFSAASupport(ctxInfo, gli);
|
||||
this->initStencilFormats(ctxInfo);
|
||||
|
@ -228,6 +228,8 @@ public:
|
||||
bool readPixelsSupported(const GrGLInterface* intf,
|
||||
GrGLenum format,
|
||||
GrGLenum type) const;
|
||||
|
||||
bool isCoreProfile() const { return fIsCoreProfile; }
|
||||
|
||||
private:
|
||||
/**
|
||||
@ -303,6 +305,7 @@ private:
|
||||
bool fTwoFormatLimit : 1;
|
||||
bool fFragCoordsConventionSupport : 1;
|
||||
bool fUseNonVBOVertexAndIndexDynamicData : 1;
|
||||
bool fIsCoreProfile : 1;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -24,12 +24,12 @@ typedef GrGLUniformManager::UniformHandle UniformHandle;
|
||||
|
||||
namespace {
|
||||
|
||||
inline const char* sample_function_name(GrSLType type) {
|
||||
inline const char* sample_function_name(GrSLType type, GrGLSLGeneration glslGen) {
|
||||
if (kVec2f_GrSLType == type) {
|
||||
return "texture2D";
|
||||
return glslGen >= k130_GrGLSLGeneration ? "texture" : "texture2D";
|
||||
} else {
|
||||
GrAssert(kVec3f_GrSLType == type);
|
||||
return "texture2DProj";
|
||||
return glslGen >= k130_GrGLSLGeneration ? "textureProj" : "texture2DProj";
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ void GrGLShaderBuilder::appendTextureLookup(SkString* out,
|
||||
GrAssert(NULL != coordName);
|
||||
|
||||
out->appendf("%s(%s, %s)",
|
||||
sample_function_name(varyingType),
|
||||
sample_function_name(varyingType, fCtxInfo.glslGeneration()),
|
||||
this->getUniformCStr(sampler.fSamplerUniform),
|
||||
coordName);
|
||||
append_swizzle(out, *sampler.textureAccess(), fCtxInfo.caps());
|
||||
|
@ -414,15 +414,17 @@ void GrGpuGL::onResetContext() {
|
||||
|
||||
if (kDesktop_GrGLBinding == this->glBinding()) {
|
||||
// Desktop-only state that we never change
|
||||
GL_CALL(Disable(GR_GL_POINT_SMOOTH));
|
||||
GL_CALL(Disable(GR_GL_LINE_SMOOTH));
|
||||
GL_CALL(Disable(GR_GL_POLYGON_SMOOTH));
|
||||
GL_CALL(Disable(GR_GL_POLYGON_STIPPLE));
|
||||
GL_CALL(Disable(GR_GL_COLOR_LOGIC_OP));
|
||||
if (!this->glCaps().isCoreProfile()) {
|
||||
GL_CALL(Disable(GR_GL_POINT_SMOOTH));
|
||||
GL_CALL(Disable(GR_GL_LINE_SMOOTH));
|
||||
GL_CALL(Disable(GR_GL_POLYGON_SMOOTH));
|
||||
GL_CALL(Disable(GR_GL_POLYGON_STIPPLE));
|
||||
GL_CALL(Disable(GR_GL_COLOR_LOGIC_OP));
|
||||
GL_CALL(Disable(GR_GL_INDEX_LOGIC_OP));
|
||||
}
|
||||
if (this->glCaps().imagingSupport()) {
|
||||
GL_CALL(Disable(GR_GL_COLOR_TABLE));
|
||||
}
|
||||
GL_CALL(Disable(GR_GL_INDEX_LOGIC_OP));
|
||||
GL_CALL(Disable(GR_GL_POLYGON_OFFSET_FILL));
|
||||
// Since ES doesn't support glPointSize at all we always use the VS to
|
||||
// set the point size
|
||||
|
Loading…
Reference in New Issue
Block a user