| 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) { |
| bsalomon@google.com | d8b5fac | 2012-11-01 17:02:46 +0000 | [diff] [blame] | 13 | |
| 14 | fRequiresTextureMatrix = true; |
| bsalomon@google.com | 289efe0 | 2012-05-21 20:57:59 +0000 | [diff] [blame] | 15 | } |
| 16 | |
| bsalomon@google.com | d698f77 | 2012-10-25 13:22:00 +0000 | [diff] [blame] | 17 | GrGLEffect::~GrGLEffect() { |
| bsalomon@google.com | 8e124a2 | 2012-04-25 17:48:49 +0000 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | /////////////////////////////////////////////////////////////////////////////// |
| 21 | |
| bsalomon@google.com | 28a15fb | 2012-10-26 17:53:18 +0000 | [diff] [blame] | 22 | void GrGLEffect::setData(const GrGLUniformManager&, const GrEffectStage&) { |
| tomhudson@google.com | 168e634 | 2012-04-18 17:49:20 +0000 | [diff] [blame] | 23 | } |
| 24 | |
| bsalomon@google.com | 46fba0d | 2012-10-25 21:42:05 +0000 | [diff] [blame] | 25 | GrGLEffect::EffectKey GrGLEffect::GenTextureKey(const GrEffect& effect, |
| bsalomon@google.com | 28a15fb | 2012-10-26 17:53:18 +0000 | [diff] [blame] | 26 | const GrGLCaps& caps) { |
| bsalomon@google.com | 46fba0d | 2012-10-25 21:42:05 +0000 | [diff] [blame] | 27 | EffectKey key = 0; |
| bsalomon@google.com | 021fc73 | 2012-10-25 12:47:42 +0000 | [diff] [blame] | 28 | for (int index = 0; index < effect.numTextures(); ++index) { |
| 29 | const GrTextureAccess& access = effect.textureAccess(index); |
| bsalomon@google.com | 46fba0d | 2012-10-25 21:42:05 +0000 | [diff] [blame] | 30 | EffectKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) << index; |
| bsalomon@google.com | 6d003d1 | 2012-09-11 15:45:20 +0000 | [diff] [blame] | 31 | GrAssert(0 == (value & key)); // keys for each access ought not to overlap |
| 32 | key |= value; |
| twiz@google.com | a5e65ec | 2012-08-02 15:15:16 +0000 | [diff] [blame] | 33 | } |
| 34 | return key; |
| 35 | } |