blob: 0bbf1f7ccbfb45a7c9c2b04b47e5a73252bb3715 [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) {
13}
14
bsalomon@google.comd698f772012-10-25 13:22:00 +000015GrGLEffect::~GrGLEffect() {
bsalomon@google.com8e124a22012-04-25 17:48:49 +000016}
17
18///////////////////////////////////////////////////////////////////////////////
19
bsalomon@google.com28a15fb2012-10-26 17:53:18 +000020void GrGLEffect::setData(const GrGLUniformManager&, const GrEffectStage&) {
tomhudson@google.com168e6342012-04-18 17:49:20 +000021}
22
bsalomon@google.com46fba0d2012-10-25 21:42:05 +000023GrGLEffect::EffectKey GrGLEffect::GenTextureKey(const GrEffect& effect,
bsalomon@google.com28a15fb2012-10-26 17:53:18 +000024 const GrGLCaps& caps) {
bsalomon@google.com46fba0d2012-10-25 21:42:05 +000025 EffectKey key = 0;
bsalomon@google.com021fc732012-10-25 12:47:42 +000026 for (int index = 0; index < effect.numTextures(); ++index) {
27 const GrTextureAccess& access = effect.textureAccess(index);
bsalomon@google.com46fba0d2012-10-25 21:42:05 +000028 EffectKey value = GrGLShaderBuilder::KeyForTextureAccess(access, caps) << index;
bsalomon@google.com6d003d12012-09-11 15:45:20 +000029 GrAssert(0 == (value & key)); // keys for each access ought not to overlap
30 key |= value;
twiz@google.coma5e65ec2012-08-02 15:15:16 +000031 }
32 return key;
33}