X-Git-Url: http://git.tdb.fi/?p=gldbg.git;a=blobdiff_plain;f=flavors%2Fgl%2Fsource%2Finspector.cpp;h=87adf17f5f593918f1ce005b9ef39028576ca99f;hp=912214db825e95a27dbad401e6d16de8361835a6;hb=76324b7394d25ba654e938eb33ee985532df7cc6;hpb=e7d4e2a75e75ff1a152912f0c19fb72ed63e81bc diff --git a/flavors/gl/source/inspector.cpp b/flavors/gl/source/inspector.cpp index 912214d..87adf17 100644 --- a/flavors/gl/source/inspector.cpp +++ b/flavors/gl/source/inspector.cpp @@ -130,7 +130,41 @@ void Inspector::cmd_buffer(const string &args) IO::print("Buffer %d:\n", id); IO::print(" Size: %d bytes\n", buf.size); IO::print(" Usage: %s\n", describe_enum(buf.usage, "")); - if(buf.content.stride) + if(buf.content.arrays.size()==1 && buf.content.arrays.front().kind==GL_ELEMENT_ARRAY_BUFFER) + { + const BufferContent::Array &array = buf.content.arrays.front(); + IO::print(" Arrays:\n"); + IO::print(" 0: Element indices, 1 %s\n", describe_enum(array.type, "DataType")); + + IO::print(" Data:\n"); + unsigned width = 1+buf.content.stride*2; + string fmt = format(" %%%du", width); + unsigned n_elems = buf.size/buf.content.stride; + string line; + const char *ptr = buf.data; + for(unsigned i=0; i(ptr)+i)); + else if(array.type==GL_UNSIGNED_SHORT) + line += format(fmt, *(reinterpret_cast(ptr)+i)); + else if(array.type==GL_UNSIGNED_INT) + line += format(fmt, *(reinterpret_cast(ptr)+i)); + + if(line.size()+1+width>79) + { + IO::print("%s\n", line); + line.clear(); + } + } + + if(!line.empty()) + IO::print("%s\n", line); + } + else if(buf.content.stride) { IO::print(" Stride: %d bytes\n", buf.content.stride);