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

Side by Side Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 433603002: FBFetch refactor + arm support (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gl/GrGLShaderBuilder.h" 8 #include "gl/GrGLShaderBuilder.h"
9 #include "gl/GrGLProgram.h" 9 #include "gl/GrGLProgram.h"
10 #include "gl/GrGLUniformHandle.h" 10 #include "gl/GrGLUniformHandle.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 switch (feature) { 284 switch (feature) {
285 case kFragCoordConventions_GLSLPrivateFeature: 285 case kFragCoordConventions_GLSLPrivateFeature:
286 if (!fGpu->glCaps().fragCoordConventionsSupport()) { 286 if (!fGpu->glCaps().fragCoordConventionsSupport()) {
287 return false; 287 return false;
288 } 288 }
289 if (fGpu->glslGeneration() < k150_GrGLSLGeneration) { 289 if (fGpu->glslGeneration() < k150_GrGLSLGeneration) {
290 this->addFSFeature(1 << kFragCoordConventions_GLSLPrivateFeature , 290 this->addFSFeature(1 << kFragCoordConventions_GLSLPrivateFeature ,
291 "GL_ARB_fragment_coord_conventions"); 291 "GL_ARB_fragment_coord_conventions");
292 } 292 }
293 return true; 293 return true;
294 case kEXTShaderFramebufferFetch_GLSLPrivateFeature:
295 if (GrGLCaps::kEXT_FBFetchType != fGpu->glCaps().fbFetchType()) {
296 return false;
297 }
298 this->addFSFeature(1 << kEXTShaderFramebufferFetch_GLSLPrivateFeatur e,
299 "GL_EXT_shader_framebuffer_fetch");
300 return true;
301 case kNVShaderFramebufferFetch_GLSLPrivateFeature:
302 if (GrGLCaps::kNV_FBFetchType != fGpu->glCaps().fbFetchType()) {
303 return false;
304 }
305 this->addFSFeature(1 << kNVShaderFramebufferFetch_GLSLPrivateFeature ,
306 "GL_NV_shader_framebuffer_fetch");
307 return true;
308 default: 294 default:
309 SkFAIL("Unexpected GLSLPrivateFeature requested."); 295 SkFAIL("Unexpected GLSLPrivateFeature requested.");
310 return false; 296 return false;
311 } 297 }
312 } 298 }
313 299
314 void GrGLShaderBuilder::addFSFeature(uint32_t featureBit, const char* extensionN ame) { 300 void GrGLShaderBuilder::addFSFeature(uint32_t featureBit, const char* extensionN ame) {
315 if (!(featureBit & fFSFeaturesAddedMask)) { 301 if (!(featureBit & fFSFeaturesAddedMask)) {
316 fFSExtensions.appendf("#extension %s: require\n", extensionName); 302 fFSExtensions.appendf("#extension %s: require\n", extensionName);
317 fFSFeaturesAddedMask |= featureBit; 303 fFSFeaturesAddedMask |= featureBit;
(...skipping 17 matching lines...) Expand all
335 321
336 const char* GrGLShaderBuilder::dstColor() { 322 const char* GrGLShaderBuilder::dstColor() {
337 if (fCodeStage.inStageCode()) { 323 if (fCodeStage.inStageCode()) {
338 const GrEffect* effect = fCodeStage.effectStage()->getEffect(); 324 const GrEffect* effect = fCodeStage.effectStage()->getEffect();
339 if (!effect->willReadDstColor()) { 325 if (!effect->willReadDstColor()) {
340 SkDEBUGFAIL("GrGLEffect asked for dst color but its generating GrEff ect " 326 SkDEBUGFAIL("GrGLEffect asked for dst color but its generating GrEff ect "
341 "did not request access."); 327 "did not request access.");
342 return ""; 328 return "";
343 } 329 }
344 } 330 }
345 static const char kFBFetchColorName[] = "gl_LastFragData[0]"; 331
346 GrGLCaps::FBFetchType fetchType = fGpu->glCaps().fbFetchType(); 332 if (GrGLCaps::kNone_FBFetchType != fGpu->glCaps().fbFetchType()) {
347 if (GrGLCaps::kEXT_FBFetchType == fetchType) { 333 this->addFSFeature(1 << fGpu->glCaps().fbFetchType(),
krajcevski 2014/07/30 21:50:19 Doesn't this clash with kFragCoordConventions_GLSL
348 SkAssertResult(this->enablePrivateFeature(kEXTShaderFramebufferFetch_GLS LPrivateFeature)); 334 fGpu->glCaps().fbFetchExtensionString());
349 return kFBFetchColorName; 335 return fGpu->glCaps().fbFetchColorName();
350 } else if (GrGLCaps::kNV_FBFetchType == fetchType) {
351 SkAssertResult(this->enablePrivateFeature(kNVShaderFramebufferFetch_GLSL PrivateFeature));
352 return kFBFetchColorName;
353 } else if (fOutput.fUniformHandles.fDstCopySamplerUni.isValid()) { 336 } else if (fOutput.fUniformHandles.fDstCopySamplerUni.isValid()) {
354 return kDstCopyColorName; 337 return kDstCopyColorName;
355 } else { 338 } else {
356 return ""; 339 return "";
357 } 340 }
358 } 341 }
359 342
360 void GrGLShaderBuilder::appendTextureLookup(SkString* out, 343 void GrGLShaderBuilder::appendTextureLookup(SkString* out,
361 const GrGLShaderBuilder::TextureSamp ler& sampler, 344 const GrGLShaderBuilder::TextureSamp ler& sampler,
362 const char* coordName, 345 const char* coordName,
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 1080
1098 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this, 1081 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this,
1099 effectCnt); 1082 effectCnt);
1100 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder, 1083 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder,
1101 effectStages, 1084 effectStages,
1102 effectCnt, 1085 effectCnt,
1103 keyProvider, 1086 keyProvider,
1104 inOutFSColor); 1087 inOutFSColor);
1105 return pathTexGenEffectsBuilder.finish(); 1088 return pathTexGenEffectsBuilder.finish();
1106 } 1089 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698