]> git.tdb.fi Git - gldbg.git/blobdiff - flavors/gl/source/glstate.h
Query implementation limits on process startup
[gldbg.git] / flavors / gl / source / glstate.h
index ab5ab050a87e51f30e55fc8e577e6cb6b6c3ca72..11191955e93383839fc837cc7ac7597f06b64128 100644 (file)
@@ -29,9 +29,6 @@ struct Vector4
 /**
 Tracks OpenGL state based on the command stream.  This class is essentially a
 (partial) OpenGL implementation in itself.
-
-XXX Should determine the number of texture units the target implementation
-actually supports.
 */
 class GlState
 {
@@ -44,12 +41,12 @@ public:
 private:
        GlDecoder *decoder;
        Vector4 color;
-       Vector4 texcoord[8];
+       std::vector<Vector4> texcoord;
        Vector3 normal;
        unsigned active_tex;
        unsigned client_active_tex;
        TextureMap textures;
-       TexUnitState texunits[8];
+       std::vector<TexUnitState> texunits;
        BufferMap buffers;
        BufferState *array_buffer;
        BufferState *element_buffer;
@@ -58,8 +55,8 @@ private:
        ArrayState vertex_array;
        ArrayState normal_array;
        ArrayState color_array;
-       ArrayState texcoord_arrays[8];
-       std::map<unsigned, ArrayState> attrib_arrays;
+       std::vector<ArrayState> texcoord_arrays;
+       std::vector<ArrayState> attrib_arrays;
        ShaderMap shaders;
        ProgramMap programs;
 
@@ -69,6 +66,14 @@ public:
 
        int decode(const char *, unsigned);
 
+private:
+       static void glGetIntegerv(void *, GLenum, int *);
+
+public:
+       unsigned get_max_texture_units() const { return texunits.size(); }
+       unsigned get_max_vertex_attribs() const { return attrib_arrays.size(); }
+       unsigned get_max_uniform_buffer_bindings() const { return uniform_bind_points.size(); }
+
 private:
        bool &get_boolean_state(GLenum);
        static void glEnableClientState(void *, GLenum);
@@ -89,8 +94,6 @@ public:
        const Vector3 &get_normal() const { return normal; }
 
 private:
-       ArrayState &get_attrib_array(unsigned);
-
        static void glVertexPointer(void *, int, GLenum, int, const void *);
        static void glNormalPointer(void *, GLenum, int, const void *);
        static void glColorPointer(void *, int, GLenum, int, const void *);