Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 433603002: FBFetch refactor + arm support (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment cleanup Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLShaderBuilder.cpp
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index 8d1e66be7c0e69ec7c3de2b1d05bc582f9f74519..74ef1b430e60d5ba988185a228cbd955030d7908 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -114,8 +114,7 @@ bool GrGLShaderBuilder::genProgram(const GrEffectStage* colorStages[],
///////////////////////////////////////////////////////////////////////////
// emit code to read the dst copy texture, if necessary
- if (kNoDstRead_DstReadKey != header.fDstReadKey &&
- GrGLCaps::kNone_FBFetchType == fGpu->glCaps().fbFetchType()) {
+ if (kNoDstRead_DstReadKey != header.fDstReadKey && !fGpu->glCaps().fbFetchSupport()) {
bool topDown = SkToBool(kTopLeftOrigin_DstReadKeyBit & header.fDstReadKey);
const char* dstCopyTopLeftName;
const char* dstCopyCoordScaleName;
@@ -280,37 +279,6 @@ bool GrGLShaderBuilder::enableFeature(GLSLFeature feature) {
}
}
-bool GrGLShaderBuilder::enablePrivateFeature(GLSLPrivateFeature feature) {
- switch (feature) {
- case kFragCoordConventions_GLSLPrivateFeature:
- if (!fGpu->glCaps().fragCoordConventionsSupport()) {
- return false;
- }
- if (fGpu->glslGeneration() < k150_GrGLSLGeneration) {
- this->addFSFeature(1 << kFragCoordConventions_GLSLPrivateFeature,
- "GL_ARB_fragment_coord_conventions");
- }
- return true;
- case kEXTShaderFramebufferFetch_GLSLPrivateFeature:
- if (GrGLCaps::kEXT_FBFetchType != fGpu->glCaps().fbFetchType()) {
- return false;
- }
- this->addFSFeature(1 << kEXTShaderFramebufferFetch_GLSLPrivateFeature,
- "GL_EXT_shader_framebuffer_fetch");
- return true;
- case kNVShaderFramebufferFetch_GLSLPrivateFeature:
- if (GrGLCaps::kNV_FBFetchType != fGpu->glCaps().fbFetchType()) {
- return false;
- }
- this->addFSFeature(1 << kNVShaderFramebufferFetch_GLSLPrivateFeature,
- "GL_NV_shader_framebuffer_fetch");
- return true;
- default:
- SkFAIL("Unexpected GLSLPrivateFeature requested.");
- return false;
- }
-}
-
void GrGLShaderBuilder::addFSFeature(uint32_t featureBit, const char* extensionName) {
if (!(featureBit & fFSFeaturesAddedMask)) {
fFSExtensions.appendf("#extension %s: require\n", extensionName);
@@ -342,14 +310,11 @@ const char* GrGLShaderBuilder::dstColor() {
return "";
}
}
- static const char kFBFetchColorName[] = "gl_LastFragData[0]";
- GrGLCaps::FBFetchType fetchType = fGpu->glCaps().fbFetchType();
- if (GrGLCaps::kEXT_FBFetchType == fetchType) {
- SkAssertResult(this->enablePrivateFeature(kEXTShaderFramebufferFetch_GLSLPrivateFeature));
- return kFBFetchColorName;
- } else if (GrGLCaps::kNV_FBFetchType == fetchType) {
- SkAssertResult(this->enablePrivateFeature(kNVShaderFramebufferFetch_GLSLPrivateFeature));
- return kFBFetchColorName;
+
+ if (fGpu->glCaps().fbFetchSupport()) {
+ this->addFSFeature(1 << (kLastGLSLPrivateFeature + 1),
+ fGpu->glCaps().fbFetchExtensionString());
+ return fGpu->glCaps().fbFetchColorName();
} else if (fOutput.fUniformHandles.fDstCopySamplerUni.isValid()) {
return kDstCopyColorName;
} else {
@@ -389,7 +354,7 @@ void GrGLShaderBuilder::fsAppendTextureLookupAndModulate(
GrGLShaderBuilder::DstReadKey GrGLShaderBuilder::KeyForDstRead(const GrTexture* dstCopy,
const GrGLCaps& caps) {
uint32_t key = kYesDstRead_DstReadKeyBit;
- if (GrGLCaps::kNone_FBFetchType != caps.fbFetchType()) {
+ if (caps.fbFetchSupport()) {
return key;
}
SkASSERT(NULL != dstCopy);
@@ -500,7 +465,10 @@ const char* GrGLShaderBuilder::fragmentPosition() {
return "gl_FragCoord";
} else if (fGpu->glCaps().fragCoordConventionsSupport()) {
if (!fSetupFragPosition) {
- SkAssertResult(this->enablePrivateFeature(kFragCoordConventions_GLSLPrivateFeature));
+ if (fGpu->glslGeneration() < k150_GrGLSLGeneration) {
+ this->addFSFeature(1 << kFragCoordConventions_GLSLPrivateFeature,
+ "GL_ARB_fragment_coord_conventions");
+ }
fFSInputs.push_back().set(kVec4f_GrSLType,
GrGLShaderVar::kIn_TypeModifier,
"gl_FragCoord",
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698