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 | d698f77 | 2012-10-25 13:22:00 +0000 | [diff] [blame^] | 11 | GrGLEffect::GrGLEffect(const GrProgramStageFactory& 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 | d698f77 | 2012-10-25 13:22:00 +0000 | [diff] [blame^] | 20 | void GrGLEffect::setData(const GrGLUniformManager&, const GrEffect&) { |
tomhudson@google.com | 168e634 | 2012-04-18 17:49:20 +0000 | [diff] [blame] | 21 | } |
| 22 | |
bsalomon@google.com | d698f77 | 2012-10-25 13:22:00 +0000 | [diff] [blame^] | 23 | GrGLEffect::StageKey GrGLEffect::GenTextureKey(const GrEffect& effect, |
twiz@google.com | a5e65ec | 2012-08-02 15:15:16 +0000 | [diff] [blame] | 24 | const GrGLCaps& caps) { |
| 25 | StageKey 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 | 6d003d1 | 2012-09-11 15:45:20 +0000 | [diff] [blame] | 28 | StageKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) << index; |
| 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 | } |