Home | History | Annotate | Download | only in renderer
      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 namespace rx
     17 {
     18 
     19 class ShaderExecutable
     20 {
     21   public:
     22     ShaderExecutable(const void *function, size_t length) : mLength(length)
     23     {
     24         mFunction = new char[length];
     25         memcpy(mFunction, function, length);
     26     }
     27 
     28     virtual ~ShaderExecutable()
     29     {
     30         delete[] mFunction;
     31     }
     32 
     33     void *getFunction() const
     34     {
     35         return mFunction;
     36     }
     37 
     38     size_t getLength() const
     39     {
     40         return mLength;
     41     }
     42 
     43   private:
     44     DISALLOW_COPY_AND_ASSIGN(ShaderExecutable);
     45 
     46     void *mFunction;
     47     const size_t mLength;
     48 };
     49 
     50 class UniformStorage
     51 {
     52   public:
     53     UniformStorage(size_t initialSize)
     54         : mSize(initialSize)
     55     {
     56     }
     57 
     58     virtual ~UniformStorage() {}
     59 
     60     size_t size() const { return mSize; }
     61 
     62   private:
     63     size_t mSize;
     64 };
     65 
     66 }
     67 
     68 #endif // LIBGLESV2_RENDERER_SHADEREXECUTABLE9_H_
     69