$(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
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
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))
}
}
-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);
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:
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
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();
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();
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();
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))
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;
*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;
}
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: