tomhudson@google.com | 168e634 | 2012-04-18 17:49:20 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "GrGLSL.h" |
bsalomon@google.com | d698f77 | 2012-10-25 13:22:00 +0000 | [diff] [blame] | 9 | #include "GrGLEffect.h" |
tomhudson@google.com | 168e634 | 2012-04-18 17:49:20 +0000 | [diff] [blame] | 10 | |
bsalomon@google.com | 396e61f | 2012-10-25 19:00:29 +0000 | [diff] [blame] | 11 | GrGLEffect::GrGLEffect(const GrBackendEffectFactory& factory) |
bsalomon@google.com | 289efe0 | 2012-05-21 20:57:59 +0000 | [diff] [blame] | 12 | : fFactory(factory) { |
| 13 | } |
| 14 | |
bsalomon@google.com | d698f77 | 2012-10-25 13:22:00 +0000 | [diff] [blame] | 15 | GrGLEffect::~GrGLEffect() { |
bsalomon@google.com | 8e124a2 | 2012-04-25 17:48:49 +0000 | [diff] [blame] | 16 | } |
| 17 | |
| 18 | /////////////////////////////////////////////////////////////////////////////// |
| 19 | |
bsalomon@google.com | 28a15fb | 2012-10-26 17:53:18 +0000 | [diff] [blame^] | 20 | void GrGLEffect::setData(const GrGLUniformManager&, const GrEffectStage&) { |
tomhudson@google.com | 168e634 | 2012-04-18 17:49:20 +0000 | [diff] [blame] | 21 | } |
| 22 | |
bsalomon@google.com | 46fba0d | 2012-10-25 21:42:05 +0000 | [diff] [blame] | 23 | GrGLEffect::EffectKey GrGLEffect::GenTextureKey(const GrEffect& effect, |
bsalomon@google.com | 28a15fb | 2012-10-26 17:53:18 +0000 | [diff] [blame^] | 24 | const GrGLCaps& caps) { |
bsalomon@google.com | 46fba0d | 2012-10-25 21:42:05 +0000 | [diff] [blame] | 25 | EffectKey key = 0; |
bsalomon@google.com | 021fc73 | 2012-10-25 12:47:42 +0000 | [diff] [blame] | 26 | for (int index = 0; index < effect.numTextures(); ++index) { |
| 27 | const GrTextureAccess& access = effect.textureAccess(index); |
bsalomon@google.com | 46fba0d | 2012-10-25 21:42:05 +0000 | [diff] [blame] | 28 | EffectKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) << index; |
bsalomon@google.com | 6d003d1 | 2012-09-11 15:45:20 +0000 | [diff] [blame] | 29 | GrAssert(0 == (value & key)); // keys for each access ought not to overlap |
| 30 | key |= value; |
twiz@google.com | a5e65ec | 2012-08-02 15:15:16 +0000 | [diff] [blame] | 31 | } |
| 32 | return key; |
| 33 | } |