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

Side by Side Diff: src/gpu/gl/builders/GrGLProgramBuilder.cpp

Issue 1459323004: Revert of Initial version of external_oes texture support and unit test (Closed) Base URL: https://skia.googlesource.com/skia.git@target
Patch Set: Created 5 years, 1 month 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/angle/SkANGLEGLContext.cpp ('k') | src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp » ('j') | 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 2014 Google Inc. 2 * Copyright 2014 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 "GrGLProgramBuilder.h" 8 #include "GrGLProgramBuilder.h"
9 9
10 #include "GrAutoLocaleSetter.h" 10 #include "GrAutoLocaleSetter.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 312 }
313 313
314 void GrGLProgramBuilder::verify(const GrXferProcessor& xp) { 314 void GrGLProgramBuilder::verify(const GrXferProcessor& xp) {
315 SkASSERT(fFS.hasReadDstColor() == xp.willReadDstColor()); 315 SkASSERT(fFS.hasReadDstColor() == xp.willReadDstColor());
316 } 316 }
317 317
318 void GrGLProgramBuilder::verify(const GrFragmentProcessor& fp) { 318 void GrGLProgramBuilder::verify(const GrFragmentProcessor& fp) {
319 SkASSERT(fFS.hasReadFragmentPosition() == fp.willReadFragmentPosition()); 319 SkASSERT(fFS.hasReadFragmentPosition() == fp.willReadFragmentPosition());
320 } 320 }
321 321
322 static GrSLType get_sampler_type(const GrTextureAccess& access) {
323 GrGLTexture* glTexture = static_cast<GrGLTexture*>(access.getTexture());
324 if (glTexture->target() == GR_GL_TEXTURE_EXTERNAL) {
325 return kSamplerExternal_GrSLType;
326 } else {
327 SkASSERT(glTexture->target() == GR_GL_TEXTURE_2D);
328 return kSampler2D_GrSLType;
329 }
330 }
331
332 template <class Proc> 322 template <class Proc>
333 void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor, 323 void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor,
334 GrGLSLTextureSampler::TextureSamplerArray* outSamplers, 324 GrGLSLTextureSampler::TextureSamplerArray* outSamplers,
335 GrGLInstalledProc<Proc>* ip) { 325 GrGLInstalledProc<Proc>* ip) {
336 SkDEBUGCODE(ip->fSamplersIdx = fSamplerUniforms.count();) 326 SkDEBUGCODE(ip->fSamplersIdx = fSamplerUniforms.count();)
337 int numTextures = processor.numTextures(); 327 int numTextures = processor.numTextures();
338 UniformHandle* localSamplerUniforms = fSamplerUniforms.push_back_n(numTextur es); 328 UniformHandle* localSamplerUniforms = fSamplerUniforms.push_back_n(numTextur es);
339 SkString name; 329 SkString name;
340 for (int t = 0; t < numTextures; ++t) { 330 for (int t = 0; t < numTextures; ++t) {
341 name.printf("Sampler%d", t); 331 name.printf("Sampler%d", t);
342 GrSLType samplerType = get_sampler_type(processor.textureAccess(t));
343 localSamplerUniforms[t] = this->addUniform(GrGLProgramBuilder::kFragment _Visibility, 332 localSamplerUniforms[t] = this->addUniform(GrGLProgramBuilder::kFragment _Visibility,
344 samplerType, kDefault_GrSLPre cision, 333 kSampler2D_GrSLType, kDefault _GrSLPrecision,
345 name.c_str()); 334 name.c_str());
346 SkNEW_APPEND_TO_TARRAY(outSamplers, GrGLSLTextureSampler, 335 SkNEW_APPEND_TO_TARRAY(outSamplers, GrGLSLTextureSampler,
347 (localSamplerUniforms[t], processor.textureAccess (t))); 336 (localSamplerUniforms[t], processor.textureAccess (t)));
348 if (kSamplerExternal_GrSLType == samplerType) {
349 const char* externalFeatureString = this->glslCaps()->externalTextur eExtensionString();
350 // We shouldn't ever create a GrGLTexture that requires external sam pler type
351 SkASSERT(externalFeatureString);
352 fFS.addFeature(1 << GrGLSLFragmentShaderBuilder::kExternalTexture_GL SLPrivateFeature,
353 externalFeatureString);
354 }
355 } 337 }
356 } 338 }
357 339
358 bool GrGLProgramBuilder::compileAndAttachShaders(GrGLSLShaderBuilder& shader, 340 bool GrGLProgramBuilder::compileAndAttachShaders(GrGLSLShaderBuilder& shader,
359 GrGLuint programId, 341 GrGLuint programId,
360 GrGLenum type, 342 GrGLenum type,
361 SkTDArray<GrGLuint>* shaderIds) { 343 SkTDArray<GrGLuint>* shaderIds) {
362 GrGLGpu* gpu = this->gpu(); 344 GrGLGpu* gpu = this->gpu();
363 GrGLuint shaderId = GrGLCompileAndAttachShader(gpu->glContext(), 345 GrGLuint shaderId = GrGLCompileAndAttachShader(gpu->glContext(),
364 programId, 346 programId,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 } 511 }
530 512
531 //////////////////////////////////////////////////////////////////////////////// /////////////////// 513 //////////////////////////////////////////////////////////////////////////////// ///////////////////
532 514
533 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { 515 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() {
534 int numProcs = fProcs.count(); 516 int numProcs = fProcs.count();
535 for (int i = 0; i < numProcs; ++i) { 517 for (int i = 0; i < numProcs; ++i) {
536 delete fProcs[i]; 518 delete fProcs[i];
537 } 519 }
538 } 520 }
OLDNEW
« no previous file with comments | « src/gpu/gl/angle/SkANGLEGLContext.cpp ('k') | src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698