f1a96d74fb2b879bec3a54f8e1ba380184cbae4d
[platform/framework/web/crosswalk.git] / src / third_party / angle / src / libGLESv2 / renderer / ShaderExecutable.h
1 //
2 // Copyright (c) 2012 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 // ShaderExecutable.h: Defines a renderer-agnostic class to contain shader
8 // executable implementation details.
9
10 #ifndef LIBGLESV2_RENDERER_SHADEREXECUTABLE_H_
11 #define LIBGLESV2_RENDERER_SHADEREXECUTABLE_H_
12
13 #include "common/angleutils.h"
14 #include "common/debug.h"
15
16 #include <vector>
17 #include <cstdint>
18
19 namespace rx
20 {
21
22 class ShaderExecutable
23 {
24   public:
25     ShaderExecutable(const void *function, size_t length)
26         : mFunctionBuffer(length)
27     {
28         memcpy(mFunctionBuffer.data(), function, length);
29     }
30
31     virtual ~ShaderExecutable() {}
32
33     const uint8_t *getFunction() const
34     {
35         return mFunctionBuffer.data();
36     }
37
38     size_t getLength() const
39     {
40         return mFunctionBuffer.size();
41     }
42
43     const std::string &getDebugInfo() const
44     {
45         return mDebugInfo;
46     }
47
48     void appendDebugInfo(const std::string &info)
49     {
50         mDebugInfo += info;
51     }
52
53   private:
54     DISALLOW_COPY_AND_ASSIGN(ShaderExecutable);
55
56     std::vector<uint8_t> mFunctionBuffer;
57     std::string mDebugInfo;
58 };
59
60 class UniformStorage
61 {
62   public:
63     UniformStorage(size_t initialSize)
64         : mSize(initialSize)
65     {
66     }
67
68     virtual ~UniformStorage() {}
69
70     size_t size() const { return mSize; }
71
72   private:
73     size_t mSize;
74 };
75
76 }
77
78 #endif // LIBGLESV2_RENDERER_SHADEREXECUTABLE_H_