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 private: 44 DISALLOW_COPY_AND_ASSIGN(ShaderExecutable); 45 46 std::vector<uint8_t> mFunctionBuffer; 47 }; 48 49 class UniformStorage 50 { 51 public: 52 UniformStorage(size_t initialSize) 53 : mSize(initialSize) 54 { 55 } 56 57 virtual ~UniformStorage() {} 58 59 size_t size() const { return mSize; } 60 61 private: 62 size_t mSize; 63 }; 64 65 } 66 67 #endif // LIBGLESV2_RENDERER_SHADEREXECUTABLE9_H_ 68