1//
2// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// RenderbufferProxySet.h: Defines the gl::RenderbufferProxySet, a class for
8// maintaining a Texture's weak references to the Renderbuffers that represent it.
9
10#ifndef LIBGLESV2_RENDERBUFFERPROXYSET_H_
11#define LIBGLESV2_RENDERBUFFERPROXYSET_H_
12
13#include <map>
14
15namespace gl
16{
17class FramebufferAttachment;
18
19class RenderbufferProxySet
20{
21  public:
22    void addRef(const FramebufferAttachment *proxy);
23    void release(const FramebufferAttachment *proxy);
24
25    void add(unsigned int mipLevel, unsigned int layer, FramebufferAttachment *renderBuffer);
26    FramebufferAttachment *get(unsigned int mipLevel, unsigned int layer) const;
27
28  private:
29    struct RenderbufferKey
30    {
31        unsigned int mipLevel;
32        unsigned int layer;
33
34        bool operator<(const RenderbufferKey &other) const;
35    };
36
37    typedef std::map<RenderbufferKey, FramebufferAttachment*> BufferMap;
38    BufferMap mBufferMap;
39
40    typedef std::map<const FramebufferAttachment*, unsigned int> RefCountMap;
41    RefCountMap mRefCountMap;
42};
43
44}
45
46#endif // LIBGLESV2_RENDERBUFFERPROXYSET_H_
47