Pass the Renderer to the Context at construction time
TRAC #22000
Signed-off-by: Daniel Koch
Author: Shannon Woods
git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1402 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libEGL/Display.cpp b/src/libEGL/Display.cpp
index c544035..672491c 100644
--- a/src/libEGL/Display.cpp
+++ b/src/libEGL/Display.cpp
@@ -383,7 +383,7 @@
return NULL;
}
- gl::Context *context = glCreateContext(shareContext, notifyResets, robustAccess);
+ gl::Context *context = glCreateContext(shareContext, mRenderer, notifyResets, robustAccess);
mContextSet.insert(context);
return context;
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index abf928b..3e7f6cf 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -36,10 +36,13 @@
namespace gl
{
-Context::Context(const gl::Context *shareContext, bool notifyResets, bool robustAccess)
+Context::Context(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess)
{
ASSERT(robustAccess == false); // Unimplemented
+ ASSERT(dynamic_cast<rx::Renderer9*>(renderer) != NULL); // D3D9_REPLACE
+ mRenderer = static_cast<rx::Renderer9*>(renderer);
+
mDisplay = NULL;
mDevice = NULL;
@@ -4373,9 +4376,9 @@
extern "C"
{
-gl::Context *glCreateContext(const gl::Context *shareContext, bool notifyResets, bool robustAccess)
+gl::Context *glCreateContext(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess)
{
- return new gl::Context(shareContext, notifyResets, robustAccess);
+ return new gl::Context(shareContext, renderer, notifyResets, robustAccess);
}
void glDestroyContext(gl::Context *context)
diff --git a/src/libGLESv2/Context.h b/src/libGLESv2/Context.h
index 106e702..19cbd44 100644
--- a/src/libGLESv2/Context.h
+++ b/src/libGLESv2/Context.h
@@ -278,7 +278,7 @@
class Context
{
public:
- Context(const gl::Context *shareContext, bool notifyResets, bool robustAccess);
+ Context(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
~Context();
diff --git a/src/libGLESv2/main.h b/src/libGLESv2/main.h
index 448d625..d56bbb3 100644
--- a/src/libGLESv2/main.h
+++ b/src/libGLESv2/main.h
@@ -48,7 +48,7 @@
extern "C"
{
// Exported functions for use by EGL
-gl::Context *glCreateContext(const gl::Context *shareContext, bool notifyResets, bool robustAccess);
+gl::Context *glCreateContext(const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
void glDestroyContext(gl::Context *context);
void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
gl::Context *glGetCurrentContext();