Bug 1048668 - WebGL2 - Implement CopyBufferSubData.; r=jgilbert

--HG--
extra : source : b4c58b9519fc35c634d2a912f3900605ccc081a3
This commit is contained in:
Dan Glastonbury 2014-05-27 20:13:09 +10:00
Родитель cbc918194a
Коммит e3cdc514c4
5 изменённых файлов: 46 добавлений и 1 удалений

Просмотреть файл

@ -16,7 +16,8 @@ void
WebGL2Context::CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset,
GLintptr writeOffset, GLsizeiptr size)
{
MOZ_CRASH("Not Implemented.");
MakeContextCurrent();
gl->fCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
}
void

Просмотреть файл

@ -77,6 +77,7 @@ static const char *sExtensionNames[] = {
"GL_ARB_ES2_compatibility",
"GL_ARB_ES3_compatibility",
"GL_ARB_color_buffer_float",
"GL_ARB_copy_buffer",
"GL_ARB_depth_texture",
"GL_ARB_draw_buffers",
"GL_ARB_draw_instanced",
@ -1029,6 +1030,20 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
}
}
if (IsSupported(GLFeature::copy_buffer)) {
SymLoadStruct copyBufferSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fCopyBufferSubData, { "CopyBufferSubData", nullptr } },
END_SYMBOLS
};
if (!LoadSymbols(copyBufferSymbols, trygl, prefix)) {
NS_ERROR("GL supports copy_buffer without supplying its function.");
MarkUnsupported(GLFeature::copy_buffer);
ClearSymbols(copyBufferSymbols);
}
}
if (IsSupported(GLFeature::draw_buffers)) {
SymLoadStruct coreSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffers", nullptr } },

Просмотреть файл

@ -81,6 +81,7 @@ MOZ_BEGIN_ENUM_CLASS(GLFeature)
bind_buffer_offset,
blend_minmax,
clear_buffers,
copy_buffer,
depth_texture,
draw_buffers,
draw_instanced,
@ -347,6 +348,7 @@ public:
ARB_ES2_compatibility,
ARB_ES3_compatibility,
ARB_color_buffer_float,
ARB_copy_buffer,
ARB_depth_texture,
ARB_draw_buffers,
ARB_draw_instanced,
@ -2664,6 +2666,18 @@ public:
AFTER_GL_CALL;
}
// Core GL & Extension ARB_copy_buffer
public:
void fCopyBufferSubData(GLenum readtarget, GLenum writetarget,
GLintptr readoffset, GLintptr writeoffset,
GLsizeiptr size)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fCopyBufferSubData);
mSymbols.fCopyBufferSubData(readtarget, writetarget, readoffset, writeoffset, size);
AFTER_GL_CALL;
}
// -----------------------------------------------------------------------------
// Constructor

Просмотреть файл

@ -80,6 +80,15 @@ static const FeatureInfo sFeatureInfoArr[] = {
GLContext::Extensions_End
}
},
{
"copy_buffer",
310, // OpenGL version
300, // OpenGL ES version
GLContext::ARB_copy_buffer,
{
GLContext::Extensions_End
}
},
{
"depth_texture",
200, // OpenGL version

Просмотреть файл

@ -420,6 +420,12 @@ struct GLContextSymbols
typedef realGLboolean (GLAPIENTRY * PFNGLUNMAPBUFFER) (GLenum target);
PFNGLUNMAPBUFFER fUnmapBuffer;
// ARB_copy_buffer / OpenGL 3.1 / OpenGL ES 3.0
typedef void (GLAPIENTRY * PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size);
PFNGLCOPYBUFFERSUBDATAPROC fCopyBufferSubData;
typedef GLenum (GLAPIENTRY * PFNGLGETGRAPHICSRESETSTATUS) (void);
PFNGLGETGRAPHICSRESETSTATUS fGetGraphicsResetStatus;