]> git.tdb.fi Git - gldbg.git/commitdiff
Fix things for 64-bit systems master
authorMikko Rasa <tdb@tdb.fi>
Sun, 26 Aug 2012 08:58:18 +0000 (11:58 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 26 Aug 2012 08:58:18 +0000 (11:58 +0300)
Makefile
flavors/gl/gl.io
flavors/gl/source/glstate.cpp
flavors/gl/source/glstate.h
flavors/gl/source/inspector.cpp
source/commandinterpreter.cpp
source/gldump.c
source/glprint.c
source/glprint.funcs.t

index 99486f9f63188d8abdd2e5721106e59e96e07212..ca938f26fd46ba1bcabfa46c3737f97267cdead3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -73,6 +73,7 @@ DEPS_all := $(call deps,$(SOURCES_all) $(TEMPLATES))
 $(OBJECTS_gldbg): CXXFLAGS += $(shell pkg-config --cflags $(PACKAGES_gldbg))
 gldbg: LIBS += $(shell pkg-config --libs $(PACKAGES_gldbg)) -lreadline -lrt
 gldump gldbg: LIBS += ./libgldbg.a
+$(OBJECTS_glwrap): CFLAGS += -fPIC
 glwrap.so: LDFLAGS += -s
 glwrap.so: LIBS += -ldl
 
index b4bc0a5629f80bae535ef8775f543d95a4076e03..f7ab981b1fe72db7febc892e712addd96167916c 100644 (file)
@@ -9,8 +9,8 @@ int, int, %i
 uint, int, %u
 unsigned int, int, %u
 sizei, int, %i
-intptr, int, %i
-sizeiptr, int, %i
+intptr, int, %i, (int)
+sizeiptr, int, %i, (int)
 handle, int, %i
 int64, long long, %lli
 uint64, long long, %llu
index fc355c7972aceb2a9b2f7e174eefe070b7766219..9bfe7b5a525c898076a4f0d24624fd53bcefd44f 100644 (file)
@@ -442,7 +442,7 @@ void GlState::glBindBufferBase(void *user_data, GLenum target, unsigned index, u
                glBindBufferRange(user_data, target, index, id, 0, buffer->size);
 }
 
-void GlState::glBindBufferRange(void *user_data, GLenum target, unsigned index, unsigned id, int offset, int size)
+void GlState::glBindBufferRange(void *user_data, GLenum target, unsigned index, unsigned id, ptrdiff_t offset, ptrdiff_t size)
 {
        GlState *self = reinterpret_cast<GlState *>(user_data);
        if(BufferBindingState *binding = self->get_buffer_binding(target, index))
@@ -453,13 +453,13 @@ void GlState::glBindBufferRange(void *user_data, GLenum target, unsigned index,
        }
 }
 
-void GlState::glBufferData(void *user_data, GLenum target, int size, const void *data, GLenum usage)
+void GlState::glBufferData(void *user_data, GLenum target, ptrdiff_t size, const void *data, GLenum usage)
 {
        if(BufferState *buf = reinterpret_cast<GlState *>(user_data)->get_current_buffer(target))
                buf->set_data(size, data, usage);
 }
 
-void GlState::glBufferSubData(void *user_data, GLenum target, int offset, int size, const void *data)
+void GlState::glBufferSubData(void *user_data, GLenum target, ptrdiff_t offset, ptrdiff_t size, const void *data)
 {
        if(BufferState *buf = reinterpret_cast<GlState *>(user_data)->get_current_buffer(target))
                buf->set_sub_data(offset, size, data);
index ae16deb0399cd85fbd69ca79471b15a36f14d168..8cba1d25b142ec022afdb94f8416d91db82e2fec 100644 (file)
@@ -123,9 +123,9 @@ private:
 
        static void glBindBuffer(void *, GLenum, unsigned);
        static void glBindBufferBase(void *, GLenum, unsigned, unsigned);
-       static void glBindBufferRange(void *, GLenum, unsigned, unsigned, int, int);
-       static void glBufferData(void *, GLenum, int, const void *, GLenum);
-       static void glBufferSubData(void *, GLenum, int, int, const void *);
+       static void glBindBufferRange(void *, GLenum, unsigned, unsigned, ptrdiff_t, ptrdiff_t);
+       static void glBufferData(void *, GLenum, ptrdiff_t, const void *, GLenum);
+       static void glBufferSubData(void *, GLenum, ptrdiff_t, ptrdiff_t, const void *);
        static void glDeleteBuffers(void *, int, const unsigned *);
 
 public:
index b641b05d0381a19a10afe4c4b853cab86a5a39a0..5db0d3d4b1b6971532c8e1528ab06cd31bdb2a3d 100644 (file)
@@ -189,12 +189,12 @@ void Inspector::cmd_texture(const string &args)
        if(args.empty())
        {
                const map<unsigned, TextureState> &textures = state.get_textures();
-               printf("%d texture objects:\n", textures.size());
+               printf("%lu texture objects:\n", textures.size());
                for(map<unsigned, TextureState>::const_iterator i = textures.begin(); i!=textures.end(); ++i)
                {
                        const TextureState &tex = i->second;
                        string descr = tex.describe();
-                       printf("  %d: %s, %d images\n", i->first, descr.c_str(), tex.images.size());
+                       printf("  %d: %s, %lu images\n", i->first, descr.c_str(), tex.images.size());
                }
        }
        else
@@ -246,7 +246,7 @@ void Inspector::cmd_buffer(const string &args)
        if(args.empty())
        {
                const GlState::BufferMap &buffers = state.get_buffers();
-               printf("%d buffers:\n", buffers.size());
+               printf("%lu buffers:\n", buffers.size());
                for(GlState::BufferMap::const_iterator i=buffers.begin(); i!=buffers.end(); ++i)
                {
                        string descr = i->second.describe();
@@ -389,7 +389,7 @@ void Inspector::cmd_shader(const string &args)
        if(args.empty())
        {
                const GlState::ShaderMap &shaders = state.get_shaders();
-               printf("%d shader objects:\n", shaders.size());
+               printf("%lu shader objects:\n", shaders.size());
                for(GlState::ShaderMap::const_iterator i=shaders.begin(); i!=shaders.end(); ++i)
                {
                        string descr = i->second.describe();
@@ -432,7 +432,7 @@ void Inspector::cmd_program(const std::string &args)
        if(args.empty())
        {
                const GlState::ProgramMap &programs = state.get_programs();
-               printf("%d program objects:\n", programs.size());
+               printf("%lu program objects:\n", programs.size());
                for(GlState::ProgramMap::const_iterator i=programs.begin(); i!=programs.end(); ++i)
                {
                        string descr = i->second.describe();
index b8a10a99d03cb0f30a4048c4754f370d42f09f8b..3227d40c42788164f4f0066468a5cc654e27135f 100644 (file)
@@ -61,7 +61,7 @@ CommandInterpreter::~CommandInterpreter()
 
 void CommandInterpreter::execute(const string &cmd)
 {
-       unsigned space = cmd.find(' ');
+       string::size_type space = cmd.find(' ');
        string name = cmd.substr(0, space);
        CommandMap::const_iterator i = commands.lower_bound(name);
        if(i==commands.end() || i->first.compare(0, name.size(), name))
index 2b4c20b4002a17c85605a93b06c9d5a67ad4a03a..ab79c39675a805c46fdd512954b21936f2028cb4 100644 (file)
@@ -40,7 +40,8 @@ int main(int argc, char **argv)
                ret = gldecoder_decode(dec, ptr, end-ptr);
                if(ret<0)
                {
-                       fprintf(stderr, "Decode error with %d bytes left\n", end-ptr);
+                       int bytes_left = end-ptr;
+                       fprintf(stderr, "Decode error with %d bytes left\n", bytes_left);
                        break;
                }
                ptr += ret;
index 01883e8e4786271bbea68edb9ac2d82fad33de7f..21f7fe5c65e962bf16ffad4ecfee42de3d149653 100644 (file)
@@ -100,9 +100,14 @@ static const char *print_array(const char *fmt, const void *data, unsigned elem_
                        *ptr++ = ' ';
                }
                memcpy(&element, (const char *)data+i*elem_size, elem_size);
-               if(type>='e' && type<='g' && elem_size==sizeof(float))
-                       *(double *)&element = *(float *)&element;
-               len = snprintf(ptr, buf_size, fmt, element);
+               if(type>='e' && type<='g')
+               {
+                       if(elem_size==sizeof(float))
+                               *(double *)&element = *(float *)&element;
+                       len = snprintf(ptr, buf_size, fmt, *(double *)&element);
+               }
+               else
+                       len = snprintf(ptr, buf_size, fmt, element);
                ptr += len;
                buf_size -= len;
        }
index 047c9fae0ac380fc8796bd59e04d54901f24bc8e..111748e91e3f546c9e189bd70f74971d5f5134a6 100644 (file)
@@ -38,7 +38,10 @@ for p in params+[ret]:
                        elif p.type=="TextureComponentCount":
                                w(', print_internal_format(%s)', p.name)
                        elif len(p.io)>=3 and p.io[2]:
-                               w(', %s(%s, "%s")', p.io[2], p.name, p.type)
+                               if p.io[2][0]=='(':
+                                       w(', %s%s', p.io[2], p.name)
+                               else:
+                                       w(', %s(%s, "%s")', p.io[2], p.name, p.type)
                        else:
                                w(', %s', p.name)
                elif p.kind=="reference" and not p.io: