blob: 5e0875b71cbbdc0ab3ed81b9a3983d51218581c2 [file] [log] [blame]
tomhudson@google.com168e6342012-04-18 17:49:20 +00001/*
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.comd698f772012-10-25 13:22:00 +00009#include "GrGLEffect.h"
tomhudson@google.com168e6342012-04-18 17:49:20 +000010
bsalomon@google.com396e61f2012-10-25 19:00:29 +000011GrGLEffect::GrGLEffect(const GrBackendEffectFactory& factory)
bsalomon@google.com289efe02012-05-21 20:57:59 +000012 : fFactory(factory) {
bsalomon@google.comd8b5fac2012-11-01 17:02:46 +000013
14 fRequiresTextureMatrix = true;
bsalomon@google.com289efe02012-05-21 20:57:59 +000015}
16
bsalomon@google.comd698f772012-10-25 13:22:00 +000017GrGLEffect::~GrGLEffect() {
bsalomon@google.com8e124a22012-04-25 17:48:49 +000018}
19
20///////////////////////////////////////////////////////////////////////////////
21
bsalomon@google.com28a15fb2012-10-26 17:53:18 +000022void GrGLEffect::setData(const GrGLUniformManager&, const GrEffectStage&) {
tomhudson@google.com168e6342012-04-18 17:49:20 +000023}
24
bsalomon@google.com46fba0d2012-10-25 21:42:05 +000025GrGLEffect::EffectKey GrGLEffect::GenTextureKey(const GrEffect& effect,
bsalomon@google.com28a15fb2012-10-26 17:53:18 +000026 const GrGLCaps& caps) {
bsalomon@google.com46fba0d2012-10-25 21:42:05 +000027 EffectKey key = 0;
bsalomon@google.com021fc732012-10-25 12:47:42 +000028 for (int index = 0; index < effect.numTextures(); ++index) {
29 const GrTextureAccess& access = effect.textureAccess(index);
bsalomon@google.com46fba0d2012-10-25 21:42:05 +000030 EffectKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) << index;
bsalomon@google.com6d003d12012-09-11 15:45:20 +000031 GrAssert(0 == (value & key)); // keys for each access ought not to overlap
32 key |= value;
twiz@google.coma5e65ec2012-08-02 15:15:16 +000033 }
34 return key;
35}