зеркало из https://github.com/AvaloniaUI/angle.git
Implements GetBufferParameteriv
TRAC #11720 Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/trunk@151 736b8ea6-26fd-11df-bfd4-992fa37f6226
This commit is contained in:
Родитель
34dc3e8a5e
Коммит
aa0ccbd9f0
|
@ -65,6 +65,8 @@ GLenum Buffer::bufferData(const void* data, GLsizeiptr size, GLenum usage)
|
|||
mContents.assign(newdata, newdata + size);
|
||||
}
|
||||
|
||||
mUsage = usage;
|
||||
|
||||
return copyToIdentityBuffer(0, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ class Buffer
|
|||
|
||||
void *data() { return &mContents[0]; }
|
||||
GLsizeiptr size() const { return mContents.size(); }
|
||||
GLenum usage() const { return mUsage; }
|
||||
|
||||
TranslatedVertexBuffer *identityBuffer() { return mIdentityTranslation; }
|
||||
|
||||
|
@ -43,6 +44,7 @@ class Buffer
|
|||
DISALLOW_COPY_AND_ASSIGN(Buffer);
|
||||
|
||||
std::vector<GLubyte> mContents;
|
||||
GLenum mUsage;
|
||||
|
||||
BufferBackEnd *mBackEnd;
|
||||
TranslatedVertexBuffer *mIdentityTranslation;
|
||||
|
|
|
@ -2031,7 +2031,40 @@ void __stdcall glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params
|
|||
|
||||
try
|
||||
{
|
||||
UNIMPLEMENTED(); // FIXME
|
||||
gl::Context *context = gl::getContext();
|
||||
|
||||
if (context)
|
||||
{
|
||||
gl::Buffer *buffer;
|
||||
|
||||
switch (target)
|
||||
{
|
||||
case GL_ARRAY_BUFFER:
|
||||
buffer = context->getArrayBuffer();
|
||||
break;
|
||||
case GL_ELEMENT_ARRAY_BUFFER:
|
||||
buffer = context->getElementArrayBuffer();
|
||||
break;
|
||||
default: return error(GL_INVALID_ENUM);
|
||||
}
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
// A null buffer means that "0" is bound to the requested buffer target
|
||||
return error(GL_INVALID_OPERATION);
|
||||
}
|
||||
|
||||
switch (pname)
|
||||
{
|
||||
case GL_BUFFER_USAGE:
|
||||
*params = buffer->usage();
|
||||
break;
|
||||
case GL_BUFFER_SIZE:
|
||||
*params = buffer->size();
|
||||
break;
|
||||
default: return error(GL_INVALID_ENUM);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(std::bad_alloc&)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче