Bug 711592 - Update ANGLE to r924 - no review

Upstream is at http://code.google.com/p/angleproject/
This commit is contained in:
Benoit Jacob 2011-12-18 18:20:45 -05:00
parent 4b952c4d60
commit 1b69af79f6
22 changed files with 819 additions and 237 deletions

View File

@ -1,6 +1,6 @@
This is the ANGLE project, from http://code.google.com/p/angleproject/
Current revision: r901
Current revision: r924
== Applied local patches ==

View File

@ -1,5 +1,5 @@
# HG changeset patch
# Parent 8540788b2b719f35fe3991b913d3b696f98de730
# Parent 2cefa41bd95ba8875964dde3829559fd70b8101d
diff --git a/gfx/angle/src/libGLESv2/Texture.cpp b/gfx/angle/src/libGLESv2/Texture.cpp
--- a/gfx/angle/src/libGLESv2/Texture.cpp
+++ b/gfx/angle/src/libGLESv2/Texture.cpp

View File

@ -1,26 +1,5 @@
# HG changeset patch
# Parent 099e4d30cde1424e15dd9a72fb4b2589754ceaa0
diff --git a/gfx/angle/README.mozilla b/gfx/angle/README.mozilla
--- a/gfx/angle/README.mozilla
+++ b/gfx/angle/README.mozilla
@@ -2,16 +2,17 @@ This is the ANGLE project, from http://c
Current revision: r885
== Applied local patches ==
In this order:
angle-renaming-debug.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
+ angle-limit-identifiers-to-250-chars.patch - see bug 675625
In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.
== How to update this ANGLE copy ==
1. Unapply patches
2. Apply diff with new ANGLE version
3. Reapply patches.
# Parent 60ae9443af647dc56c76bf9c7a5958f2ff176fb8
diff --git a/gfx/angle/src/compiler/preprocessor/length_limits.h b/gfx/angle/src/compiler/preprocessor/length_limits.h
--- a/gfx/angle/src/compiler/preprocessor/length_limits.h
+++ b/gfx/angle/src/compiler/preprocessor/length_limits.h

View File

@ -1,9 +1,10 @@
# HG changeset patch
# Parent b6f65ca6027d397ca50783d7164a6a8fa59eef4c
# Parent 7e7cd80ef724c094b88ed8bb35f3af0ce9a9cfee
diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
--- a/gfx/angle/Makefile.in
+++ b/gfx/angle/Makefile.in
@@ -73,17 +73,17 @@ CPPSRCS = \
@@ -75,17 +75,17 @@ CPPSRCS = \
parseConst.cpp \
ParseHelper.cpp \
PoolAlloc.cpp \
@ -22,6 +23,51 @@ diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
BuiltInFunctionEmulator.cpp \
$(NULL)
diff --git a/gfx/angle/angle-renaming-debug.patch b/gfx/angle/angle-renaming-debug.patch
--- a/gfx/angle/angle-renaming-debug.patch
+++ b/gfx/angle/angle-renaming-debug.patch
@@ -1,14 +1,14 @@
# HG changeset patch
-# Parent b6f65ca6027d397ca50783d7164a6a8fa59eef4c
+# Parent 1879d857ef07dc5797704516caea99b231d7590a
diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
--- a/gfx/angle/Makefile.in
+++ b/gfx/angle/Makefile.in
-@@ -73,17 +73,17 @@ CPPSRCS = \
+@@ -75,17 +75,17 @@ CPPSRCS = \
parseConst.cpp \
ParseHelper.cpp \
PoolAlloc.cpp \
QualifierAlive.cpp \
RemoveTree.cpp \
ShaderLang.cpp \
SymbolTable.cpp \
VariableInfo.cpp \
@@ -163,22 +163,22 @@ diff --git a/gfx/angle/src/compiler/prep
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "compiler/debug.h"
+#include "compiler/compilerdebug.h"
#include "compiler/preprocessor/slglobals.h"
+ #include "../../../../../memory/mozalloc/mozalloc.h"
+
#undef malloc
#undef realloc
#undef free
- ///////////////////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////// String table: //////////////////////////////////////
diff --git a/gfx/angle/src/compiler/preprocessor/tokens.c b/gfx/angle/src/compiler/preprocessor/tokens.c
--- a/gfx/angle/src/compiler/preprocessor/tokens.c
+++ b/gfx/angle/src/compiler/preprocessor/tokens.c
@@ -45,17 +45,17 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILI
// tokens.c
//
#include <stdlib.h>
diff --git a/gfx/angle/src/compiler/OutputGLSLBase.cpp b/gfx/angle/src/compiler/OutputGLSLBase.cpp
--- a/gfx/angle/src/compiler/OutputGLSLBase.cpp
+++ b/gfx/angle/src/compiler/OutputGLSLBase.cpp

View File

@ -1,9 +1,10 @@
# HG changeset patch
# Parent 31d1c6ebb61eb118868ca924769a2fa3a50d54ef
# Parent bc7188c29ec5b942046c0589ce959d7985f7ad6e
diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
--- a/gfx/angle/Makefile.in
+++ b/gfx/angle/Makefile.in
@@ -127,16 +127,18 @@ CSRCS = \
@@ -129,16 +129,18 @@ CSRCS = \
$(NULL)
DEFINES += -DANGLE_USE_NSPR -DANGLE_BUILD -DCOMPILER_IMPLEMENTATION
@ -22,27 +23,75 @@ diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
libs::
expand "$(MOZ_D3DX9_CAB)" -F:$(MOZ_D3DX9_DLL) "$(DIST)/bin"
expand "$(MOZ_D3DCOMPILER_CAB)" -F:$(MOZ_D3DCOMPILER_DLL) "$(DIST)/bin"
diff --git a/gfx/angle/README.mozilla b/gfx/angle/README.mozilla
--- a/gfx/angle/README.mozilla
+++ b/gfx/angle/README.mozilla
@@ -3,16 +3,17 @@ This is the ANGLE project, from http://c
Current revision: r885
== Applied local patches ==
In this order:
angle-renaming-debug.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
angle-limit-identifiers-to-250-chars.patch - see bug 675625
+ angle-use-xmalloc.patch - see bug 680840. Can drop this patch whenever the new preprocessor lands.
In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.
== How to update this ANGLE copy ==
1. Unapply patches
2. Apply diff with new ANGLE version
3. Reapply patches.
diff --git a/gfx/angle/angle-use-xmalloc.patch b/gfx/angle/angle-use-xmalloc.patch
--- a/gfx/angle/angle-use-xmalloc.patch
+++ b/gfx/angle/angle-use-xmalloc.patch
@@ -1,14 +1,14 @@
# HG changeset patch
-# Parent 31d1c6ebb61eb118868ca924769a2fa3a50d54ef
+# Parent 6a1ee30b3a60564c165795ecf79e9c2081ee80ab
diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in
--- a/gfx/angle/Makefile.in
+++ b/gfx/angle/Makefile.in
-@@ -127,16 +127,18 @@ CSRCS = \
+@@ -129,16 +129,18 @@ CSRCS = \
$(NULL)
DEFINES += -DANGLE_USE_NSPR -DANGLE_BUILD -DCOMPILER_IMPLEMENTATION
#these defines are from ANGLE's build_angle.gyp
DEFINES += -DANGLE_DISABLE_TRACE
DEFINES += -DANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL0
@@ -17,47 +17,26 @@ diff --git a/gfx/angle/Makefile.in b/gfx
ifdef MOZ_ANGLE
# libEGL depends on (links against!) libGLESv2!
DIRS = src/libGLESv2 src/libEGL
libs::
expand "$(MOZ_D3DX9_CAB)" -F:$(MOZ_D3DX9_DLL) "$(DIST)/bin"
expand "$(MOZ_D3DCOMPILER_CAB)" -F:$(MOZ_D3DCOMPILER_DLL) "$(DIST)/bin"
-diff --git a/gfx/angle/README.mozilla b/gfx/angle/README.mozilla
---- a/gfx/angle/README.mozilla
-+++ b/gfx/angle/README.mozilla
-@@ -3,16 +3,17 @@ This is the ANGLE project, from http://c
- Current revision: r885
-
- == Applied local patches ==
-
- In this order:
- angle-renaming-debug.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
- angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
- angle-limit-identifiers-to-250-chars.patch - see bug 675625
-+ angle-use-xmalloc.patch - see bug 680840. Can drop this patch whenever the new preprocessor lands.
-
- In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.
-
- == How to update this ANGLE copy ==
-
- 1. Unapply patches
- 2. Apply diff with new ANGLE version
- 3. Reapply patches.
diff --git a/gfx/angle/src/compiler/preprocessor/atom.c b/gfx/angle/src/compiler/preprocessor/atom.c
--- a/gfx/angle/src/compiler/preprocessor/atom.c
+++ b/gfx/angle/src/compiler/preprocessor/atom.c
@@ -48,16 +48,18 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILI
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
- #include "compiler/compilerdebug.h"
+ #include "compiler/debug.h"
#include "compiler/preprocessor/slglobals.h"
+#include "../../../../../memory/mozalloc/mozalloc.h"
+
#undef malloc
#undef realloc
#undef free
diff --git a/gfx/angle/src/compiler/preprocessor/atom.c b/gfx/angle/src/compiler/preprocessor/atom.c
--- a/gfx/angle/src/compiler/preprocessor/atom.c
+++ b/gfx/angle/src/compiler/preprocessor/atom.c

View File

@ -159,6 +159,14 @@
'gles2_book/TextureWrap/TextureWrap.c',
],
},
{
'target_name': 'post_sub_buffer',
'type': 'executable',
'dependencies': ['es_util'],
'sources': [
'gles2_book/PostSubBuffer/PostSubBuffer.c',
],
},
],
}],
],

View File

@ -22,10 +22,16 @@
#include <stdlib.h>
#include <GLES2/gl2.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "esUtil.h"
#include "esUtil_win.h"
///
// Extensions
//
PFNEGLPOSTSUBBUFFERNVPROC eglPostSubBufferNV;
///
@ -35,7 +41,7 @@
//
EGLBoolean CreateEGLContext ( EGLNativeWindowType hWnd, EGLDisplay* eglDisplay,
EGLContext* eglContext, EGLSurface* eglSurface,
EGLint attribList[])
EGLint* configAttribList, EGLint* surfaceAttribList)
{
EGLint numConfigs;
EGLint majorVersion;
@ -45,7 +51,7 @@ EGLBoolean CreateEGLContext ( EGLNativeWindowType hWnd, EGLDisplay* eglDisplay,
EGLSurface surface;
EGLConfig config;
EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE };
// Get Display
display = eglGetDisplay(GetDC(hWnd));
if ( display == EGL_NO_DISPLAY )
@ -59,6 +65,9 @@ EGLBoolean CreateEGLContext ( EGLNativeWindowType hWnd, EGLDisplay* eglDisplay,
return EGL_FALSE;
}
// Bind to extensions
eglPostSubBufferNV = (PFNEGLPOSTSUBBUFFERNVPROC) eglGetProcAddress("eglPostSubBufferNV");
// Get configs
if ( !eglGetConfigs(display, NULL, 0, &numConfigs) )
{
@ -66,13 +75,13 @@ EGLBoolean CreateEGLContext ( EGLNativeWindowType hWnd, EGLDisplay* eglDisplay,
}
// Choose config
if ( !eglChooseConfig(display, attribList, &config, 1, &numConfigs) )
if ( !eglChooseConfig(display, configAttribList, &config, 1, &numConfigs) )
{
return EGL_FALSE;
}
// Create a surface
surface = eglCreateWindowSurface(display, config, (EGLNativeWindowType)hWnd, NULL);
surface = eglCreateWindowSurface(display, config, (EGLNativeWindowType)hWnd, surfaceAttribList);
if ( surface == EGL_NO_SURFACE )
{
return EGL_FALSE;
@ -128,10 +137,11 @@ void ESUTIL_API esInitContext ( ESContext *esContext )
// ES_WINDOW_DEPTH - specifies that a depth buffer should be created
// ES_WINDOW_STENCIL - specifies that a stencil buffer should be created
// ES_WINDOW_MULTISAMPLE - specifies that a multi-sample buffer should be created
// ES_WINDOW_POST_SUB_BUFFER_SUPPORTED - specifies that EGL_POST_SUB_BUFFER_NV is supported.
//
GLboolean ESUTIL_API esCreateWindow ( ESContext *esContext, LPCTSTR title, GLint width, GLint height, GLuint flags )
{
EGLint attribList[] =
EGLint configAttribList[] =
{
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
@ -142,6 +152,11 @@ GLboolean ESUTIL_API esCreateWindow ( ESContext *esContext, LPCTSTR title, GLint
EGL_SAMPLE_BUFFERS, (flags & ES_WINDOW_MULTISAMPLE) ? 1 : 0,
EGL_NONE
};
EGLint surfaceAttribList[] =
{
EGL_POST_SUB_BUFFER_SUPPORTED_NV, flags & (ES_WINDOW_POST_SUB_BUFFER_SUPPORTED) ? EGL_TRUE : EGL_FALSE,
EGL_NONE, EGL_NONE
};
if ( esContext == NULL )
{
@ -161,7 +176,8 @@ GLboolean ESUTIL_API esCreateWindow ( ESContext *esContext, LPCTSTR title, GLint
&esContext->eglDisplay,
&esContext->eglContext,
&esContext->eglSurface,
attribList) )
configAttribList,
surfaceAttribList ) )
{
return GL_FALSE;
}

View File

@ -22,6 +22,7 @@
//
#include <GLES2/gl2.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#ifdef __cplusplus
@ -44,9 +45,10 @@ extern "C" {
#define ES_WINDOW_DEPTH 2
/// esCreateWindow flag - stencil buffer
#define ES_WINDOW_STENCIL 4
/// esCreateWindow flat - multi-sample buffer
/// esCreateWindow flag - multi-sample buffer
#define ES_WINDOW_MULTISAMPLE 8
/// esCreateWindow flag - EGL_POST_SUB_BUFFER_NV supported.
#define ES_WINDOW_POST_SUB_BUFFER_SUPPORTED 16
///
// Types
@ -87,6 +89,13 @@ typedef struct
} ESContext;
///
// Extensions
//
extern PFNEGLPOSTSUBBUFFERNVPROC eglPostSubBufferNV;
///
// Public Functions
//
@ -110,6 +119,7 @@ void ESUTIL_API esInitContext ( ESContext *esContext );
/// ES_WINDOW_DEPTH - specifies that a depth buffer should be created
/// ES_WINDOW_STENCIL - specifies that a stencil buffer should be created
/// ES_WINDOW_MULTISAMPLE - specifies that a multi-sample buffer should be created
/// ES_WINDOW_POST_SUB_BUFFER_SUPPORTED - specifies that EGL_POST_SUB_BUFFER_NV is supported.
/// \return GL_TRUE if window creation is succesful, GL_FALSE otherwise
GLboolean ESUTIL_API esCreateWindow ( ESContext *esContext, LPCTSTR title, GLint width, GLint height, GLuint flags );

View File

@ -0,0 +1,204 @@
// Based on a sample from:
//
// Book: OpenGL(R) ES 2.0 Programming Guide
// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
// ISBN-10: 0321502795
// ISBN-13: 9780321502797
// Publisher: Addison-Wesley Professional
// URLs: http://safari.informit.com/9780321563835
// http://www.opengles-book.com
//
// PostSubBuffer.c
//
// This is a simple example that draws a rotating cube in perspective
// using a vertex shader to transform the object, posting only a subrectangle
// to the window surface.
//
#include <stdlib.h>
#include "esUtil.h"
#define WINDOW_WIDTH 320
#define WINDOW_HEIGHT 240
typedef struct
{
// Handle to a program object
GLuint programObject;
// Attribute locations
GLint positionLoc;
// Uniform locations
GLint mvpLoc;
// Vertex daata
GLfloat *vertices;
GLushort *indices;
int numIndices;
// Rotation angle
GLfloat angle;
// MVP matrix
ESMatrix mvpMatrix;
} UserData;
///
// Initialize the shader and program object
//
int Init ( ESContext *esContext )
{
UserData *userData = esContext->userData;
GLbyte vShaderStr[] =
"uniform mat4 u_mvpMatrix; \n"
"attribute vec4 a_position; \n"
"void main() \n"
"{ \n"
" gl_Position = u_mvpMatrix * a_position; \n"
"} \n";
GLbyte fShaderStr[] =
"precision mediump float; \n"
"void main() \n"
"{ \n"
" gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); \n"
"} \n";
// Load the shaders and get a linked program object
userData->programObject = esLoadProgram ( vShaderStr, fShaderStr );
// Get the attribute locations
userData->positionLoc = glGetAttribLocation ( userData->programObject, "a_position" );
// Get the uniform locations
userData->mvpLoc = glGetUniformLocation( userData->programObject, "u_mvpMatrix" );
// Generate the vertex data
userData->numIndices = esGenCube( 1.0, &userData->vertices,
NULL, NULL, &userData->indices );
// Starting rotation angle for the cube
userData->angle = 45.0f;
// Clear the whole window surface.
glClearColor ( 0.0f, 0.0f, 1.0f, 0.0f );
glClear ( GL_COLOR_BUFFER_BIT );
eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f );
return TRUE;
}
///
// Update MVP matrix based on time
//
void Update ( ESContext *esContext, float deltaTime )
{
UserData *userData = (UserData*) esContext->userData;
ESMatrix perspective;
ESMatrix modelview;
float aspect;
// Compute a rotation angle based on time to rotate the cube
userData->angle += ( deltaTime * 40.0f );
if( userData->angle >= 360.0f )
userData->angle -= 360.0f;
// Compute the window aspect ratio
aspect = (GLfloat) esContext->width / (GLfloat) esContext->height;
// Generate a perspective matrix with a 60 degree FOV
esMatrixLoadIdentity( &perspective );
esPerspective( &perspective, 60.0f, aspect, 1.0f, 20.0f );
// Generate a model view matrix to rotate/translate the cube
esMatrixLoadIdentity( &modelview );
// Translate away from the viewer
esTranslate( &modelview, 0.0, 0.0, -2.0 );
// Rotate the cube
esRotate( &modelview, userData->angle, 1.0, 0.0, 1.0 );
// Compute the final MVP by multiplying the
// modevleiw and perspective matrices together
esMatrixMultiply( &userData->mvpMatrix, &modelview, &perspective );
}
///
// Draw a triangle using the shader pair created in Init()
//
void Draw ( ESContext *esContext )
{
UserData *userData = esContext->userData;
// Set the viewport
glViewport ( 0, 0, esContext->width, esContext->height );
// Clear the color buffer
glClear ( GL_COLOR_BUFFER_BIT );
// Use the program object
glUseProgram ( userData->programObject );
// Load the vertex position
glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
GL_FALSE, 3 * sizeof(GLfloat), userData->vertices );
glEnableVertexAttribArray ( userData->positionLoc );
// Load the MVP matrix
glUniformMatrix4fv( userData->mvpLoc, 1, GL_FALSE, (GLfloat*) &userData->mvpMatrix.m[0][0] );
// Draw the cube
glDrawElements ( GL_TRIANGLES, userData->numIndices, GL_UNSIGNED_SHORT, userData->indices );
eglPostSubBufferNV ( esContext->eglDisplay, esContext->eglSurface, 60, 60, WINDOW_WIDTH - 120, WINDOW_HEIGHT - 120 );
}
///
// Cleanup
//
void ShutDown ( ESContext *esContext )
{
UserData *userData = esContext->userData;
if ( userData->vertices != NULL )
{
free ( userData->vertices );
}
if ( userData->indices != NULL )
{
free ( userData->indices );
}
// Delete program object
glDeleteProgram ( userData->programObject );
}
int main ( int argc, char *argv[] )
{
ESContext esContext;
UserData userData;
esInitContext ( &esContext );
esContext.userData = &userData;
esCreateWindow ( &esContext, TEXT("Simple Vertex Shader"), WINDOW_WIDTH, WINDOW_HEIGHT, ES_WINDOW_RGB | ES_WINDOW_POST_SUB_BUFFER_SUPPORTED );
if ( !Init ( &esContext ) )
return 0;
esRegisterDrawFunc ( &esContext, Draw );
esRegisterUpdateFunc ( &esContext, Update );
esMainLoop ( &esContext );
ShutDown ( &esContext );
}

View File

@ -74,6 +74,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essl_to_hlsl", "translator\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "translator_common", "..\src\compiler\translator_common.vcproj", "{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PostSubBuffer", "gles2_book\PostSubBuffer\PostSubBuffer.vcproj", "{667CE95F-5DD8-4495-8C18-5CA8A175B12D}"
ProjectSection(ProjectDependencies) = postProject
{47C93F52-AB4E-4FF9-8D4F-B38CD60A183F} = {47C93F52-AB4E-4FF9-8D4F-B38CD60A183F}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -140,6 +145,10 @@ Global
{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Debug|Win32.Build.0 = Debug|Win32
{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|Win32.ActiveCfg = Release|Win32
{5B3A6DB8-1E7E-40D7-92B9-DA8AAE619FAD}.Release|Win32.Build.0 = Release|Win32
{667CE95F-5DD8-4495-8C18-5CA8A175B12D}.Debug|Win32.ActiveCfg = Debug|Win32
{667CE95F-5DD8-4495-8C18-5CA8A175B12D}.Debug|Win32.Build.0 = Debug|Win32
{667CE95F-5DD8-4495-8C18-5CA8A175B12D}.Release|Win32.ActiveCfg = Release|Win32
{667CE95F-5DD8-4495-8C18-5CA8A175B12D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,7 +1,7 @@
#define MAJOR_VERSION 1
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 901
#define BUILD_REVISION 924
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)

View File

@ -333,12 +333,12 @@ void BuiltInFunctionEmulator::OutputEmulatedFunctionDefinition(
out << "// BEGIN: Generated code for built-in function emulation\n\n";
if (withPrecision) {
out << "#if defined(GL_FRAGMENT_PRECISION_HIGH)\n"
<< "#define webgl_emulation_precision highp\n"
<< "#define webgl_emu_precision highp\n"
<< "#else\n"
<< "#define webgl_emulation_precision mediump\n"
<< "#define webgl_emu_precision mediump\n"
<< "#endif\n\n";
} else {
out << "#define webgl_emulation_precision\n\n";
out << "#define webgl_emu_precision\n\n";
}
for (size_t i = 0; i < mFunctions.size(); ++i) {
out << mFunctionSource[mFunctions[i]] << "\n\n";

View File

@ -447,13 +447,21 @@ bool Display::createDevice()
ASSERT(SUCCEEDED(result));
}
initializeDevice();
return true;
}
// do any one-time device initialization
// NOTE: this is also needed after a device lost/reset
// to reset the scene status and ensure the default states are reset.
void Display::initializeDevice()
{
// Permanent non-default states
mDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
mDevice->SetRenderState(D3DRS_LASTPIXEL, FALSE);
mSceneStarted = false;
return true;
}
bool Display::resetDevice()
@ -497,12 +505,16 @@ bool Display::resetDevice()
return error(EGL_BAD_ALLOC, false);
}
// reset device defaults
initializeDevice();
return true;
}
EGLSurface Display::createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList)
{
const Config *configuration = mConfigSet.get(config);
EGLint postSubBufferSupported = EGL_FALSE;
if (attribList)
{
@ -521,6 +533,9 @@ EGLSurface Display::createWindowSurface(HWND window, EGLConfig config, const EGL
return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
}
break;
case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
postSubBufferSupported = attribList[1];
break;
case EGL_VG_COLORSPACE:
return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
case EGL_VG_ALPHA_FORMAT:
@ -544,7 +559,7 @@ EGLSurface Display::createWindowSurface(HWND window, EGLConfig config, const EGL
return EGL_NO_SURFACE;
}
Surface *surface = new Surface(this, configuration, window);
Surface *surface = new Surface(this, configuration, window, postSubBufferSupported);
if (!surface->initialize())
{
@ -1039,7 +1054,8 @@ void Display::initExtensionString()
mExtensionString += "EGL_EXT_create_context_robustness ";
// ANGLE-specific extensions
if (isd3d9ex) {
if (isd3d9ex)
{
mExtensionString += "EGL_ANGLE_d3d_share_handle_client_buffer ";
}
@ -1047,13 +1063,16 @@ void Display::initExtensionString()
if (swiftShader)
{
mExtensionString += "EGL_ANGLE_software_display ";
mExtensionString += "EGL_ANGLE_software_display ";
}
if (isd3d9ex) {
if (isd3d9ex)
{
mExtensionString += "EGL_ANGLE_surface_d3d_texture_2d_share_handle ";
}
mExtensionString += "EGL_NV_post_sub_buffer";
std::string::size_type end = mExtensionString.find_last_not_of(' ');
if (end != std::string::npos)
{

View File

@ -122,6 +122,7 @@ class Display
bool mDeviceLost;
bool createDevice();
void initializeDevice();
bool resetDevice();
void initExtensionString();

View File

@ -39,8 +39,8 @@ int getComparableOSVersion()
}
}
Surface::Surface(Display *display, const Config *config, HWND window)
: mDisplay(display), mConfig(config), mWindow(window)
Surface::Surface(Display *display, const Config *config, HWND window, EGLint postSubBufferSupported)
: mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported)
{
mSwapChain = NULL;
mDepthStencil = NULL;
@ -61,7 +61,7 @@ Surface::Surface(Display *display, const Config *config, HWND window)
}
Surface::Surface(Display *display, const Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureType)
: mDisplay(display), mWindow(NULL), mConfig(config), mShareHandle(shareHandle), mWidth(width), mHeight(height)
: mDisplay(display), mWindow(NULL), mConfig(config), mShareHandle(shareHandle), mWidth(width), mHeight(height), mPostSubBufferSupported(EGL_FALSE)
{
mSwapChain = NULL;
mDepthStencil = NULL;
@ -174,6 +174,13 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
return false;
}
IDirect3DSurface9* preservedRenderTarget = NULL;
if (mPostSubBufferSupported && mRenderTarget)
{
preservedRenderTarget = mRenderTarget;
preservedRenderTarget->AddRef();
}
// Evict all non-render target textures to system memory and release all resources
// before reallocating them to free up as much video memory as possible.
device->EvictManagedResources();
@ -212,6 +219,12 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
useFlipEx = false;
}
// D3DSWAPEFFECT_FLIPEX does not preserve the back buffer.
if (mPostSubBufferSupported)
{
useFlipEx = false;
}
presentParameters.AutoDepthStencilFormat = mConfig->mDepthStencilFormat;
// We set BackBufferCount = 1 even when we use D3DSWAPEFFECT_FLIPEX.
// We do this because DirectX docs are a bit vague whether to set this to 1
@ -230,7 +243,7 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
if(useFlipEx)
presentParameters.SwapEffect = D3DSWAPEFFECT_FLIPEX;
else
presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
presentParameters.SwapEffect = mPostSubBufferSupported ? D3DSWAPEFFECT_COPY : D3DSWAPEFFECT_DISCARD;
presentParameters.Windowed = TRUE;
presentParameters.BackBufferWidth = backbufferWidth;
presentParameters.BackBufferHeight = backbufferHeight;
@ -255,6 +268,13 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
ERR("Could not create additional swap chains or offscreen surfaces: %08lX", result);
release();
if (preservedRenderTarget)
{
preservedRenderTarget->Release();
preservedRenderTarget = NULL;
}
if(isDeviceLostError(result))
{
mDisplay->notifyDeviceLost();
@ -266,6 +286,44 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
}
}
if (mWindow)
{
mSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &mRenderTarget);
if (!preservedRenderTarget)
{
InvalidateRect(mWindow, NULL, FALSE);
}
}
else
{
mOffscreenTexture->GetSurfaceLevel(0, &mRenderTarget);
}
if (preservedRenderTarget)
{
RECT rect =
{
0, 0,
mWidth, mHeight
};
if (rect.right > static_cast<LONG>(presentParameters.BackBufferWidth))
{
rect.right = presentParameters.BackBufferWidth;
}
if (rect.bottom > static_cast<LONG>(presentParameters.BackBufferHeight))
{
rect.bottom = presentParameters.BackBufferHeight;
}
mDisplay->endScene();
device->StretchRect(preservedRenderTarget, &rect, mRenderTarget, &rect, D3DTEXF_NONE);
preservedRenderTarget->Release();
preservedRenderTarget = NULL;
}
if (mConfig->mDepthStencilFormat != D3DFMT_UNKNOWN)
{
result = device->CreateDepthStencilSurface(presentParameters.BackBufferWidth, presentParameters.BackBufferHeight,
@ -282,13 +340,6 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
return error(EGL_BAD_ALLOC, false);
}
if (mWindow) {
mSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &mRenderTarget);
InvalidateRect(mWindow, NULL, FALSE);
} else {
mOffscreenTexture->GetSurfaceLevel(0, &mRenderTarget);
}
mWidth = presentParameters.BackBufferWidth;
mHeight = presentParameters.BackBufferHeight;
@ -441,6 +492,64 @@ bool Surface::swap()
return true;
}
bool Surface::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
{
if (x < 0 || y < 0 || width < 0 || height < 0)
{
return error(EGL_BAD_PARAMETER, false);
}
if (!mPostSubBufferSupported)
{
// Spec is not clear about how this should be handled.
return true;
}
if (mSwapChain)
{
mDisplay->endScene();
RECT rect =
{
x, mHeight - y - height,
x + width, mHeight - y
};
if (rect.right > mWidth)
{
rect.right = mWidth;
}
if (rect.bottom > mHeight)
{
rect.bottom = mHeight;
}
if (rect.left == rect.right || rect.top == rect.bottom)
{
return true;
}
HRESULT result = mSwapChain->Present(&rect, &rect, NULL, NULL, 0);
if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
{
return error(EGL_BAD_ALLOC, false);
}
if (result == D3DERR_DEVICELOST || result == D3DERR_DEVICEHUNG || result == D3DERR_DEVICEREMOVED)
{
return error(EGL_CONTEXT_LOST, false);
}
ASSERT(SUCCEEDED(result));
checkForOutOfDateSwapChain();
}
return true;
}
EGLint Surface::getWidth() const
{
return mWidth;
@ -451,6 +560,11 @@ EGLint Surface::getHeight() const
return mHeight;
}
EGLint Surface::isPostSubBufferSupported() const
{
return mPostSubBufferSupported;
}
IDirect3DSurface9 *Surface::getRenderTarget()
{
if (mRenderTarget)

View File

@ -30,7 +30,7 @@ class Config;
class Surface
{
public:
Surface(Display *display, const egl::Config *config, HWND window);
Surface(Display *display, const egl::Config *config, HWND window, EGLint postSubBufferSupported);
Surface(Display *display, const egl::Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget);
~Surface();
@ -41,10 +41,13 @@ class Surface
HWND getWindowHandle();
bool swap();
bool postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height);
virtual EGLint getWidth() const;
virtual EGLint getHeight() const;
virtual EGLint isPostSubBufferSupported() const;
virtual IDirect3DSurface9 *getRenderTarget();
virtual IDirect3DSurface9 *getDepthStencil();
virtual IDirect3DTexture9 *getOffscreenTexture();
@ -96,6 +99,8 @@ private:
// EGLenum vgAlphaFormat; // Alpha format for OpenVG
// EGLenum vgColorSpace; // Color space for OpenVG
EGLint mSwapInterval;
EGLint mPostSubBufferSupported;
DWORD mPresentInterval;
bool mPresentIntervalDirty;
gl::Texture2D *mTexture;

View File

@ -488,6 +488,9 @@ EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint
case EGL_WIDTH:
*value = eglSurface->getWidth();
break;
case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
*value = eglSurface->isPostSubBufferSupported();
break;
default:
return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
}
@ -1166,6 +1169,43 @@ EGLBoolean __stdcall eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativ
return EGL_FALSE;
}
EGLBoolean __stdcall eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint x = %d, EGLint y = %d, EGLint width = %d, EGLint height = %d)", dpy, surface, x, y, width, height);
try
{
egl::Display *display = static_cast<egl::Display*>(dpy);
egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
if (!validateSurface(display, eglSurface))
{
return EGL_FALSE;
}
if (display->isDeviceLost())
{
return error(EGL_CONTEXT_LOST, EGL_FALSE);
}
if (surface == EGL_NO_SURFACE)
{
return error(EGL_BAD_SURFACE, EGL_FALSE);
}
if (eglSurface->postSubBuffer(x, y, width, height))
{
return success(EGL_TRUE);
}
}
catch(std::bad_alloc&)
{
return error(EGL_BAD_ALLOC, EGL_FALSE);
}
return EGL_FALSE;
}
__eglMustCastToProperFunctionPointerType __stdcall eglGetProcAddress(const char *procname)
{
EVENT("(const char *procname = \"%s\")", procname);
@ -1181,6 +1221,7 @@ __eglMustCastToProperFunctionPointerType __stdcall eglGetProcAddress(const char
static const Extension eglExtensions[] =
{
{"eglQuerySurfacePointerANGLE", (__eglMustCastToProperFunctionPointerType)eglQuerySurfacePointerANGLE},
{"eglPostSubBufferNV", (__eglMustCastToProperFunctionPointerType)eglPostSubBufferNV},
{"", NULL},
};

View File

@ -1668,15 +1668,11 @@ bool Context::applyRenderTarget(bool ignoreViewport)
return error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
}
IDirect3DSurface9 *renderTarget = NULL;
IDirect3DSurface9 *depthStencil = NULL;
bool renderTargetChanged = false;
unsigned int renderTargetSerial = framebufferObject->getRenderTargetSerial();
if (renderTargetSerial != mAppliedRenderTargetSerial)
{
renderTarget = framebufferObject->getRenderTarget();
IDirect3DSurface9 *renderTarget = framebufferObject->getRenderTarget();
if (!renderTarget)
{
return false; // Context must be lost
@ -1685,8 +1681,10 @@ bool Context::applyRenderTarget(bool ignoreViewport)
mAppliedRenderTargetSerial = renderTargetSerial;
mScissorStateDirty = true; // Scissor area must be clamped to render target's size-- this is different for different render targets.
renderTargetChanged = true;
renderTarget->Release();
}
IDirect3DSurface9 *depthStencil = NULL;
unsigned int depthbufferSerial = 0;
unsigned int stencilbufferSerial = 0;
if (framebufferObject->getDepthbufferType() != GL_NONE)
@ -1724,17 +1722,14 @@ bool Context::applyRenderTarget(bool ignoreViewport)
if (!mRenderTargetDescInitialized || renderTargetChanged)
{
IDirect3DSurface9 *renderTarget = framebufferObject->getRenderTarget();
if (!renderTarget)
{
renderTarget = framebufferObject->getRenderTarget();
if (!renderTarget)
{
return false; // Context must be lost
}
return false; // Context must be lost
}
renderTarget->GetDesc(&mRenderTargetDesc);
mRenderTargetDescInitialized = true;
renderTarget->Release();
}
D3DVIEWPORT9 viewport;
@ -2248,7 +2243,6 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
}
IDirect3DSurface9 *renderTarget = framebuffer->getRenderTarget();
if (!renderTarget)
{
return; // Context must be lost, return silently
@ -2260,6 +2254,7 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
{
UNIMPLEMENTED(); // FIXME: Requires resolve using StretchRect into non-multisampled render target
renderTarget->Release();
return error(GL_OUT_OF_MEMORY);
}
@ -2292,6 +2287,8 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
}
result = mDevice->GetRenderTargetData(renderTarget, systemSurface);
renderTarget->Release();
renderTarget = NULL;
if (FAILED(result))
{
@ -2600,7 +2597,6 @@ void Context::clear(GLbitfield mask)
int stencil = mState.stencilClearValue & 0x000000FF;
IDirect3DSurface9 *renderTarget = framebufferObject->getRenderTarget();
if (!renderTarget)
{
return; // Context must be lost, return silently
@ -2608,6 +2604,8 @@ void Context::clear(GLbitfield mask)
D3DSURFACE_DESC desc;
renderTarget->GetDesc(&desc);
renderTarget->Release();
renderTarget = NULL;
bool alphaUnmasked = (dx2es::GetAlphaSize(desc.Format) == 0) || mState.colorMaskAlpha;
@ -2870,6 +2868,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const void *
// Implements glFlush when block is false, glFinish when block is true
void Context::sync(bool block)
{
egl::Display *display = getDisplay();
IDirect3DQuery9 *eventQuery = NULL;
HRESULT result;
@ -2902,6 +2901,13 @@ void Context::sync(bool block)
{
// Keep polling, but allow other threads to do something useful first
Sleep(0);
// explicitly check for device loss
// some drivers seem to return S_FALSE even if the device is lost
// instead of D3DERR_DEVICELOST like they should
if (display->testDeviceLost())
{
result = D3DERR_DEVICELOST;
}
}
}
while(block && result == S_FALSE);
@ -3791,8 +3797,14 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
if (blitRenderTarget)
{
HRESULT result = mDevice->StretchRect(readFramebuffer->getRenderTarget(), &sourceTrimmedRect,
drawFramebuffer->getRenderTarget(), &destTrimmedRect, D3DTEXF_NONE);
IDirect3DSurface9* readRenderTarget = readFramebuffer->getRenderTarget();
IDirect3DSurface9* drawRenderTarget = drawFramebuffer->getRenderTarget();
HRESULT result = mDevice->StretchRect(readRenderTarget, &sourceTrimmedRect,
drawRenderTarget, &destTrimmedRect, D3DTEXF_NONE);
readRenderTarget->Release();
drawRenderTarget->Release();
if (FAILED(result))
{

View File

@ -35,6 +35,50 @@ namespace gl
{
unsigned int TextureStorage::mCurrentTextureSerial = 1;
static D3DFORMAT ConvertTextureFormatType(GLenum format, GLenum type)
{
if (format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ||
format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
{
return D3DFMT_DXT1;
}
else if (format == GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE)
{
return D3DFMT_DXT3;
}
else if (format == GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE)
{
return D3DFMT_DXT5;
}
else if (type == GL_FLOAT)
{
return D3DFMT_A32B32G32R32F;
}
else if (type == GL_HALF_FLOAT_OES)
{
return D3DFMT_A16B16G16R16F;
}
else if (type == GL_UNSIGNED_BYTE)
{
if (format == GL_LUMINANCE && getContext()->supportsLuminanceTextures())
{
return D3DFMT_L8;
}
else if (format == GL_LUMINANCE_ALPHA && getContext()->supportsLuminanceAlphaTextures())
{
return D3DFMT_A8L8;
}
else if (format == GL_RGB)
{
return D3DFMT_X8R8G8B8;
}
return D3DFMT_A8R8G8B8;
}
return D3DFMT_A8R8G8B8;
}
Image::Image()
{
mWidth = 0;
@ -45,7 +89,9 @@ Image::Image()
mSurface = NULL;
mDirty = false;
mManaged = false;
mD3DPool = D3DPOOL_SYSTEMMEM;
mD3DFormat = D3DFMT_UNKNOWN;
}
Image::~Image()
@ -68,6 +114,8 @@ bool Image::redefine(GLenum format, GLsizei width, GLsizei height, GLenum type,
mHeight = height;
mFormat = format;
mType = type;
// compute the d3d format that will be used
mD3DFormat = ConvertTextureFormatType(mFormat, mType);
if (mSurface)
{
@ -90,6 +138,7 @@ void Image::createSurface()
IDirect3DTexture9 *newTexture = NULL;
IDirect3DSurface9 *newSurface = NULL;
const D3DPOOL poolToUse = D3DPOOL_SYSTEMMEM;
if (mWidth != 0 && mHeight != 0)
{
@ -114,7 +163,7 @@ void Image::createSurface()
}
HRESULT result = getDevice()->CreateTexture(requestWidth, requestHeight, levelToFetch + 1, NULL, getD3DFormat(),
D3DPOOL_SYSTEMMEM, &newTexture, NULL);
poolToUse, &newTexture, NULL);
if (FAILED(result))
{
@ -129,6 +178,7 @@ void Image::createSurface()
mSurface = newSurface;
mDirty = false;
mD3DPool = poolToUse;
}
HRESULT Image::lock(D3DLOCKED_RECT *lockedRect, const RECT *rect)
@ -181,46 +231,11 @@ bool Image::isRenderable() const
D3DFORMAT Image::getD3DFormat() const
{
if (mFormat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ||
mFormat == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
{
return D3DFMT_DXT1;
}
else if (mFormat == GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE)
{
return D3DFMT_DXT3;
}
else if (mFormat == GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE)
{
return D3DFMT_DXT5;
}
else if (mType == GL_FLOAT)
{
return D3DFMT_A32B32G32R32F;
}
else if (mType == GL_HALF_FLOAT_OES)
{
return D3DFMT_A16B16G16R16F;
}
else if (mType == GL_UNSIGNED_BYTE)
{
if (mFormat == GL_LUMINANCE && getContext()->supportsLuminanceTextures())
{
return D3DFMT_L8;
}
else if (mFormat == GL_LUMINANCE_ALPHA && getContext()->supportsLuminanceAlphaTextures())
{
return D3DFMT_A8L8;
}
else if (mFormat == GL_RGB)
{
return D3DFMT_X8R8G8B8;
}
// this should only happen if the image hasn't been redefined first
// which would be a bug by the caller
ASSERT(mD3DFormat != D3DFMT_UNKNOWN);
return D3DFMT_A8R8G8B8;
}
return D3DFMT_A8R8G8B8;
return mD3DFormat;
}
IDirect3DSurface9 *Image::getSurface()
@ -238,8 +253,12 @@ void Image::setManagedSurface(IDirect3DSurface9 *surface)
mSurface->Release();
}
D3DSURFACE_DESC desc;
surface->GetDesc(&desc);
ASSERT(desc.Pool == D3DPOOL_MANAGED);
mSurface = surface;
mManaged = true;
mD3DPool = desc.Pool;
}
void Image::updateSurface(IDirect3DSurface9 *destSurface, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
@ -250,13 +269,14 @@ void Image::updateSurface(IDirect3DSurface9 *destSurface, GLint xoffset, GLint y
{
RECT rect = transformPixelRect(xoffset, yoffset, width, height, mHeight);
if (mManaged)
if (mD3DPool == D3DPOOL_MANAGED)
{
HRESULT result = D3DXLoadSurfaceFromSurface(destSurface, NULL, &rect, sourceSurface, NULL, &rect, D3DX_FILTER_BOX, 0);
ASSERT(SUCCEEDED(result));
}
else
{
// UpdateSurface: source must be SYSTEMMEM, dest must be DEFAULT pools
POINT point = {rect.left, rect.top};
HRESULT result = getDevice()->UpdateSurface(sourceSurface, &rect, destSurface, &point);
ASSERT(SUCCEEDED(result));
@ -1249,7 +1269,9 @@ void Image::copy(GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
}
TextureStorage::TextureStorage(bool renderable)
: mRenderable(renderable), mManaged(getDisplay()->getBufferPool(renderable) == D3DPOOL_MANAGED), mTextureSerial(issueTextureSerial())
: mRenderable(renderable),
mD3DPool(getDisplay()->getTexturePool(renderable)),
mTextureSerial(issueTextureSerial())
{
}
@ -1264,7 +1286,12 @@ bool TextureStorage::isRenderable() const
bool TextureStorage::isManaged() const
{
return mManaged;
return (mD3DPool == D3DPOOL_MANAGED);
}
D3DPOOL TextureStorage::getPool() const
{
return mD3DPool;
}
unsigned int TextureStorage::getTextureSerial() const
@ -1647,11 +1674,10 @@ TextureStorage2D::TextureStorage2D(IDirect3DTexture9 *surfaceTexture) : TextureS
TextureStorage2D::TextureStorage2D(int levels, D3DFORMAT format, int width, int height, bool renderable) : TextureStorage(renderable), mRenderTargetSerial(RenderbufferStorage::issueSerial())
{
egl::Display *display = getDisplay();
IDirect3DDevice9 *device = display->getDevice();
IDirect3DDevice9 *device = getDevice();
mTexture = NULL;
HRESULT result = device->CreateTexture(width, height, levels, renderable ? D3DUSAGE_RENDERTARGET : 0, format, display->getTexturePool(renderable), &mTexture, NULL);
HRESULT result = device->CreateTexture(width, height, levels, renderable ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
if (FAILED(result))
{
@ -1662,7 +1688,10 @@ TextureStorage2D::TextureStorage2D(int levels, D3DFORMAT format, int width, int
TextureStorage2D::~TextureStorage2D()
{
mTexture->Release();
if (mTexture)
{
mTexture->Release();
}
}
IDirect3DSurface9 *TextureStorage2D::getSurfaceLevel(int level)
@ -1690,7 +1719,7 @@ unsigned int TextureStorage2D::getRenderTargetSerial(GLenum target) const
Texture2D::Texture2D(GLuint id) : Texture(id)
{
mTexture = NULL;
mTexStorage = NULL;
mSurface = NULL;
}
@ -1698,8 +1727,8 @@ Texture2D::~Texture2D()
{
mColorbufferProxy.set(NULL);
delete mTexture;
mTexture = NULL;
delete mTexStorage;
mTexStorage = NULL;
if (mSurface)
{
@ -1750,15 +1779,15 @@ void Texture2D::redefineImage(GLint level, GLenum format, GLsizei width, GLsizei
bool redefined = mImageArray[level].redefine(format, width, height, type, false);
if (mTexture && redefined)
if (mTexStorage && redefined)
{
for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
{
mImageArray[i].markDirty();
}
delete mTexture;
mTexture = NULL;
delete mTexStorage;
mTexStorage = NULL;
mDirtyImages = true;
}
}
@ -1791,8 +1820,8 @@ void Texture2D::bindTexImage(egl::Surface *surface)
mImageArray[0].redefine(format, surface->getWidth(), surface->getHeight(), GL_UNSIGNED_BYTE, true);
delete mTexture;
mTexture = new TextureStorage2D(surface->getOffscreenTexture());
delete mTexStorage;
mTexStorage = new TextureStorage2D(surface->getOffscreenTexture());
mDirtyImages = true;
mSurface = surface;
@ -1806,10 +1835,10 @@ void Texture2D::releaseTexImage()
mSurface->setBoundTexture(NULL);
mSurface = NULL;
if (mTexture)
if (mTexStorage)
{
delete mTexture;
mTexture = NULL;
delete mTexStorage;
mTexStorage = NULL;
}
for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
@ -1832,7 +1861,7 @@ void Texture2D::commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei wi
if (level < levelCount())
{
IDirect3DSurface9 *destLevel = mTexture->getSurfaceLevel(level);
IDirect3DSurface9 *destLevel = mTexStorage->getSurfaceLevel(level);
if (destLevel)
{
@ -1880,7 +1909,7 @@ void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei
}
else
{
if (!mTexture || !mTexture->isRenderable())
if (!mTexStorage || !mTexStorage->isRenderable())
{
convertToRenderTarget();
}
@ -1897,7 +1926,7 @@ void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei
GLint destYOffset = transformPixelYOffset(0, height, mImageArray[level].getHeight());
IDirect3DSurface9 *dest = mTexture->getSurfaceLevel(level);
IDirect3DSurface9 *dest = mTexStorage->getSurfaceLevel(level);
if (dest)
{
@ -1925,14 +1954,14 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo
return error(GL_OUT_OF_MEMORY);
}
if (!mImageArray[level].isRenderable() || (!mTexture && !isSamplerComplete()))
if (!mImageArray[level].isRenderable() || (!mTexStorage && !isSamplerComplete()))
{
mImageArray[level].copy(xoffset, yoffset, x, y, width, height, renderTarget);
mDirtyImages = true;
}
else
{
if (!mTexture || !mTexture->isRenderable())
if (!mTexStorage || !mTexStorage->isRenderable())
{
convertToRenderTarget();
}
@ -1949,7 +1978,7 @@ void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yo
GLint destYOffset = transformPixelYOffset(yoffset, height, mImageArray[level].getHeight());
IDirect3DSurface9 *dest = mTexture->getSurfaceLevel(level);
IDirect3DSurface9 *dest = mTexStorage->getSurfaceLevel(level);
if (dest)
{
@ -1966,9 +1995,11 @@ void Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GL
{
GLenum format = gl::ExtractFormat(internalformat);
GLenum type = gl::ExtractType(internalformat);
D3DFORMAT d3dfmt = ConvertTextureFormatType(format, type);
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
delete mTexture;
mTexture = new TextureStorage2D(levels, mImageArray[0].getD3DFormat(), width, height, mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
delete mTexStorage;
mTexStorage = new TextureStorage2D(levels, d3dfmt, width, height, renderable);
mImmutable = true;
for (int level = 0; level < levels; level++)
@ -1982,6 +2013,17 @@ void Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GL
{
mImageArray[level].redefine(GL_NONE, 0, 0, GL_UNSIGNED_BYTE, true);
}
if (mTexStorage->isManaged())
{
int levels = levelCount();
for (int level = 0; level < levels; level++)
{
IDirect3DSurface9 *surface = mTexStorage->getSurfaceLevel(level);
mImageArray[level].setManagedSurface(surface);
}
}
}
// Tests for 2D texture sampling completeness. [OpenGL ES 2.0.24] section 3.8.2 page 85.
@ -2102,7 +2144,7 @@ bool Texture2D::isCompressed() const
IDirect3DBaseTexture9 *Texture2D::getBaseTexture() const
{
return mTexture ? mTexture->getBaseTexture() : NULL;
return mTexStorage ? mTexStorage->getBaseTexture() : NULL;
}
// Constructs a Direct3D 9 texture resource from the texture images
@ -2112,18 +2154,18 @@ void Texture2D::createTexture()
GLsizei height = mImageArray[0].getHeight();
GLint levels = creationLevels(width, height);
D3DFORMAT format = mImageArray[0].getD3DFormat();
bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
delete mTexture;
mTexture = new TextureStorage2D(levels, format, width, height, renderable);
delete mTexStorage;
mTexStorage = new TextureStorage2D(levels, format, width, height, renderable);
if (mTexture->isManaged())
if (mTexStorage->isManaged())
{
int levels = levelCount();
for (int level = 0; level < levels; level++)
{
IDirect3DSurface9 *surface = mTexture->getSurfaceLevel(level);
IDirect3DSurface9 *surface = mTexStorage->getSurfaceLevel(level);
mImageArray[level].setManagedSurface(surface);
}
}
@ -2148,7 +2190,7 @@ void Texture2D::updateTexture()
void Texture2D::convertToRenderTarget()
{
TextureStorage2D *newTexture = NULL;
TextureStorage2D *newTexStorage = NULL;
if (mImageArray[0].getWidth() != 0 && mImageArray[0].getHeight() != 0)
{
@ -2157,19 +2199,19 @@ void Texture2D::convertToRenderTarget()
GLint levels = creationLevels(width, height);
D3DFORMAT format = mImageArray[0].getD3DFormat();
newTexture = new TextureStorage2D(levels, format, width, height, true);
newTexStorage = new TextureStorage2D(levels, format, width, height, true);
if (mTexture != NULL)
if (mTexStorage != NULL)
{
int levels = levelCount();
for (int i = 0; i < levels; i++)
{
IDirect3DSurface9 *source = mTexture->getSurfaceLevel(i);
IDirect3DSurface9 *dest = newTexture->getSurfaceLevel(i);
IDirect3DSurface9 *source = mTexStorage->getSurfaceLevel(i);
IDirect3DSurface9 *dest = newTexStorage->getSurfaceLevel(i);
if (!copyToRenderTarget(dest, source, mTexture->isManaged()))
if (!copyToRenderTarget(dest, source, mTexStorage->isManaged()))
{
delete newTexture;
delete newTexStorage;
source->Release();
dest->Release();
return error(GL_OUT_OF_MEMORY);
@ -2181,8 +2223,8 @@ void Texture2D::convertToRenderTarget()
}
}
delete mTexture;
mTexture = newTexture;
delete mTexStorage;
mTexStorage = newTexStorage;
mDirtyImages = true;
}
@ -2207,12 +2249,12 @@ void Texture2D::generateMipmaps()
mImageArray[0].getType());
}
if (mTexture && mTexture->isRenderable())
if (mTexStorage && mTexStorage->isRenderable())
{
for (unsigned int i = 1; i <= q; i++)
{
IDirect3DSurface9 *upper = mTexture->getSurfaceLevel(i - 1);
IDirect3DSurface9 *lower = mTexture->getSurfaceLevel(i);
IDirect3DSurface9 *upper = mTexStorage->getSurfaceLevel(i - 1);
IDirect3DSurface9 *lower = mTexStorage->getSurfaceLevel(i);
if (upper != NULL && lower != NULL)
{
@ -2263,33 +2305,32 @@ IDirect3DSurface9 *Texture2D::getRenderTarget(GLenum target)
{
ASSERT(target == GL_TEXTURE_2D);
if (!mTexture || !mTexture->isRenderable())
if (!mTexStorage || !mTexStorage->isRenderable())
{
convertToRenderTarget();
}
if (mTexture == NULL)
if (mTexStorage == NULL)
{
return NULL;
}
updateTexture();
return mTexture->getSurfaceLevel(0);
return mTexStorage->getSurfaceLevel(0);
}
TextureStorage *Texture2D::getStorage() const
{
return mTexture;
return mTexStorage;
}
TextureStorageCubeMap::TextureStorageCubeMap(int levels, D3DFORMAT format, int size, bool renderable) : TextureStorage(renderable), mFirstRenderTargetSerial(RenderbufferStorage::issueCubeSerials())
{
egl::Display *display = getDisplay();
IDirect3DDevice9 *device = display->getDevice();
IDirect3DDevice9 *device = getDevice();
mTexture = NULL;
HRESULT result = device->CreateCubeTexture(size, levels, renderable ? D3DUSAGE_RENDERTARGET : 0, format, display->getTexturePool(renderable), &mTexture, NULL);
HRESULT result = device->CreateCubeTexture(size, levels, renderable ? D3DUSAGE_RENDERTARGET : 0, format, getPool(), &mTexture, NULL);
if (FAILED(result))
{
@ -2300,7 +2341,10 @@ TextureStorageCubeMap::TextureStorageCubeMap(int levels, D3DFORMAT format, int s
TextureStorageCubeMap::~TextureStorageCubeMap()
{
mTexture->Release();
if (mTexture)
{
mTexture->Release();
}
}
IDirect3DSurface9 *TextureStorageCubeMap::getCubeMapSurface(GLenum faceTarget, int level)
@ -2328,7 +2372,7 @@ unsigned int TextureStorageCubeMap::getRenderTargetSerial(GLenum target) const
TextureCubeMap::TextureCubeMap(GLuint id) : Texture(id)
{
mTexture = NULL;
mTexStorage = NULL;
}
TextureCubeMap::~TextureCubeMap()
@ -2338,8 +2382,8 @@ TextureCubeMap::~TextureCubeMap()
mFaceProxies[i].set(NULL);
}
delete mTexture;
mTexture = NULL;
delete mTexStorage;
mTexStorage = NULL;
}
GLenum TextureCubeMap::getTarget() const
@ -2421,7 +2465,7 @@ void TextureCubeMap::commitRect(int face, GLint level, GLint xoffset, GLint yoff
if (level < levelCount())
{
IDirect3DSurface9 *destLevel = mTexture->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level);
IDirect3DSurface9 *destLevel = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level);
ASSERT(destLevel != NULL);
if (destLevel != NULL)
@ -2577,7 +2621,7 @@ bool TextureCubeMap::isCompressed() const
IDirect3DBaseTexture9 *TextureCubeMap::getBaseTexture() const
{
return mTexture ? mTexture->getBaseTexture() : NULL;
return mTexStorage ? mTexStorage->getBaseTexture() : NULL;
}
// Constructs a Direct3D 9 texture resource from the texture images, or returns an existing one
@ -2586,12 +2630,12 @@ void TextureCubeMap::createTexture()
GLsizei size = mImageArray[0][0].getWidth();
GLint levels = creationLevels(size, 0);
D3DFORMAT format = mImageArray[0][0].getD3DFormat();
bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
delete mTexture;
mTexture = new TextureStorageCubeMap(levels, format, size, renderable);
delete mTexStorage;
mTexStorage = new TextureStorageCubeMap(levels, format, size, renderable);
if (mTexture->isManaged())
if (mTexStorage->isManaged())
{
int levels = levelCount();
@ -2599,12 +2643,12 @@ void TextureCubeMap::createTexture()
{
for (int level = 0; level < levels; level++)
{
IDirect3DSurface9 *surface = mTexture->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level);
IDirect3DSurface9 *surface = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level);
mImageArray[face][level].setManagedSurface(surface);
}
}
}
mDirtyImages = true;
}
@ -2627,7 +2671,7 @@ void TextureCubeMap::updateTexture()
void TextureCubeMap::convertToRenderTarget()
{
TextureStorageCubeMap *newTexture = NULL;
TextureStorageCubeMap *newTexStorage = NULL;
if (mImageArray[0][0].getWidth() != 0)
{
@ -2635,9 +2679,9 @@ void TextureCubeMap::convertToRenderTarget()
GLint levels = creationLevels(size, 0);
D3DFORMAT format = mImageArray[0][0].getD3DFormat();
newTexture = new TextureStorageCubeMap(levels, format, size, true);
newTexStorage = new TextureStorageCubeMap(levels, format, size, true);
if (mTexture != NULL)
if (mTexStorage != NULL)
{
egl::Display *display = getDisplay();
IDirect3DDevice9 *device = display->getDevice();
@ -2647,12 +2691,12 @@ void TextureCubeMap::convertToRenderTarget()
{
for (int i = 0; i < levels; i++)
{
IDirect3DSurface9 *source = mTexture->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i);
IDirect3DSurface9 *dest = newTexture->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i);
IDirect3DSurface9 *source = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i);
IDirect3DSurface9 *dest = newTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i);
if (!copyToRenderTarget(dest, source, mTexture->isManaged()))
if (!copyToRenderTarget(dest, source, mTexStorage->isManaged()))
{
delete newTexture;
delete newTexStorage;
source->Release();
dest->Release();
return error(GL_OUT_OF_MEMORY);
@ -2665,8 +2709,8 @@ void TextureCubeMap::convertToRenderTarget()
}
}
delete mTexture;
mTexture = newTexture;
delete mTexStorage;
mTexStorage = newTexStorage;
mDirtyImages = true;
}
@ -2693,7 +2737,7 @@ void TextureCubeMap::redefineImage(int face, GLint level, GLenum format, GLsizei
{
bool redefined = mImageArray[face][level].redefine(format, width, height, type, false);
if (mTexture && redefined)
if (mTexStorage && redefined)
{
for (int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
{
@ -2703,8 +2747,8 @@ void TextureCubeMap::redefineImage(int face, GLint level, GLenum format, GLsizei
}
}
delete mTexture;
mTexture = NULL;
delete mTexStorage;
mTexStorage = NULL;
mDirtyImages = true;
}
@ -2730,7 +2774,7 @@ void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint
}
else
{
if (!mTexture || !mTexture->isRenderable())
if (!mTexStorage || !mTexStorage->isRenderable())
{
convertToRenderTarget();
}
@ -2749,7 +2793,7 @@ void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum format, GLint
GLint destYOffset = transformPixelYOffset(0, height, mImageArray[faceindex][level].getWidth());
IDirect3DSurface9 *dest = mTexture->getCubeMapSurface(target, level);
IDirect3DSurface9 *dest = mTexStorage->getCubeMapSurface(target, level);
if (dest)
{
@ -2781,14 +2825,14 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi
unsigned int faceindex = faceIndex(target);
if (!mImageArray[faceindex][level].isRenderable() || (!mTexture && !isSamplerComplete()))
if (!mImageArray[faceindex][level].isRenderable() || (!mTexStorage && !isSamplerComplete()))
{
mImageArray[faceindex][level].copy(0, 0, x, y, width, height, renderTarget);
mDirtyImages = true;
}
else
{
if (!mTexture || !mTexture->isRenderable())
if (!mTexStorage || !mTexStorage->isRenderable())
{
convertToRenderTarget();
}
@ -2805,7 +2849,7 @@ void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLi
GLint destYOffset = transformPixelYOffset(yoffset, height, mImageArray[faceindex][level].getWidth());
IDirect3DSurface9 *dest = mTexture->getCubeMapSurface(target, level);
IDirect3DSurface9 *dest = mTexStorage->getCubeMapSurface(target, level);
if (dest)
{
@ -2822,12 +2866,14 @@ void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size
{
GLenum format = gl::ExtractFormat(internalformat);
GLenum type = gl::ExtractType(internalformat);
D3DFORMAT d3dfmt = ConvertTextureFormatType(format, type);
const bool renderable = (mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
delete mTexture;
mTexture = new TextureStorageCubeMap(levels, mImageArray[0][0].getD3DFormat(), size, mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
delete mTexStorage;
mTexStorage = new TextureStorageCubeMap(levels, d3dfmt, size, renderable);
mImmutable = true;
for (int level = 0; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
for (int level = 0; level < levels; level++)
{
for (int face = 0; face < 6; face++)
{
@ -2843,6 +2889,20 @@ void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size
mImageArray[face][level].redefine(GL_NONE, 0, 0, GL_UNSIGNED_BYTE, true);
}
}
if (mTexStorage->isManaged())
{
int levels = levelCount();
for (int face = 0; face < 6; face++)
{
for (int level = 0; level < levels; level++)
{
IDirect3DSurface9 *surface = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level);
mImageArray[face][level].setManagedSurface(surface);
}
}
}
}
void TextureCubeMap::generateMipmaps()
@ -2873,14 +2933,14 @@ void TextureCubeMap::generateMipmaps()
}
}
if (mTexture && mTexture->isRenderable())
if (mTexStorage && mTexStorage->isRenderable())
{
for (unsigned int f = 0; f < 6; f++)
{
for (unsigned int i = 1; i <= q; i++)
{
IDirect3DSurface9 *upper = mTexture->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i-1);
IDirect3DSurface9 *lower = mTexture->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i);
IDirect3DSurface9 *upper = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i-1);
IDirect3DSurface9 *lower = mTexStorage->getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i);
if (upper != NULL && lower != NULL)
{
@ -2937,24 +2997,24 @@ IDirect3DSurface9 *TextureCubeMap::getRenderTarget(GLenum target)
{
ASSERT(IsCubemapTextureTarget(target));
if (!mTexture || !mTexture->isRenderable())
if (!mTexStorage || !mTexStorage->isRenderable())
{
convertToRenderTarget();
}
if (mTexture == NULL)
if (mTexStorage == NULL)
{
return NULL;
}
updateTexture();
return mTexture->getCubeMapSurface(target, 0);
return mTexStorage->getCubeMapSurface(target, 0);
}
TextureStorage *TextureCubeMap::getStorage() const
{
return mTexture;
return mTexStorage;
}
}

View File

@ -134,7 +134,9 @@ class Image
GLenum mType;
bool mDirty;
bool mManaged;
D3DPOOL mD3DPool; // can only be D3DPOOL_SYSTEMMEM or D3DPOOL_MANAGED since it needs to be lockable.
D3DFORMAT mD3DFormat;
IDirect3DSurface9 *mSurface;
};
@ -148,6 +150,7 @@ class TextureStorage
bool isRenderable() const;
bool isManaged() const;
D3DPOOL getPool() const;
unsigned int getTextureSerial() const;
virtual unsigned int getRenderTargetSerial(GLenum target) const = 0;
@ -155,7 +158,7 @@ class TextureStorage
DISALLOW_COPY_AND_ASSIGN(TextureStorage);
const bool mRenderable;
const bool mManaged;
const D3DPOOL mD3DPool;
const unsigned int mTextureSerial;
static unsigned int issueTextureSerial();
@ -317,7 +320,7 @@ class Texture2D : public Texture
Image mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
TextureStorage2D *mTexture;
TextureStorage2D *mTexStorage;
egl::Surface *mSurface;
BindingPointer<Renderbuffer> mColorbufferProxy;
@ -400,7 +403,7 @@ class TextureCubeMap : public Texture
Image mImageArray[6][IMPLEMENTATION_MAX_TEXTURE_LEVELS];
TextureStorageCubeMap *mTexture;
TextureStorageCubeMap *mTexStorage;
BindingPointer<Renderbuffer> mFaceProxies[6];
};

View File

@ -2707,10 +2707,7 @@ GLenum __stdcall glGetError(void)
if (context)
{
if (context->isContextLost())
return GL_OUT_OF_MEMORY;
else
return context->getError();
return context->getError();
}
return GL_NO_ERROR;

View File

@ -98,9 +98,18 @@ Context *getNonLostContext()
{
Context *context = getContext();
if (context && !context->isContextLost())
return context;
if (context)
{
if (context->isContextLost())
{
error(GL_OUT_OF_MEMORY);
return NULL;
}
else
{
return context;
}
}
return NULL;
}