emulator opengl: context version param
add version parameter when creating new context Change-Id: I3e36796dd4e582b5deda0da2aaf764ceba92a1d1
This commit is contained in:
committed by
David 'Digit' Turner
parent
0c814b227c
commit
25af30c464
@@ -88,7 +88,7 @@ int Renderer::destroySurface(RenderingThread *thread, const ClientHandle &handle
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Renderer::createContext(RenderingThread *thread, const ClientHandle &handle, ClientHandle shareCtx)
|
||||
int Renderer::createContext(RenderingThread *thread, const ClientHandle &handle, ClientHandle shareCtx, int version)
|
||||
{
|
||||
android::Mutex::Autolock(this->m_mutex);
|
||||
|
||||
@@ -104,7 +104,7 @@ int Renderer::createContext(RenderingThread *thread, const ClientHandle &handle,
|
||||
RendererContext *ctx =
|
||||
RendererContext::create(m_dpy,
|
||||
RendererSurface::getEglConfig(m_dpy, RendererSurface::CONFIG_DEPTH),
|
||||
shared);
|
||||
shared, version);
|
||||
if (ctx == NULL) {
|
||||
fprintf(stderr, "failed to create context\n");
|
||||
return -1;
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
static Renderer *instance();
|
||||
int createSurface(RenderingThread *thread, const ClientHandle & handle);
|
||||
int destroySurface(RenderingThread *thread, const ClientHandle &handle);
|
||||
int createContext(RenderingThread *thread, const ClientHandle & ctx, const ClientHandle shareCtx);
|
||||
int createContext(RenderingThread *thread, const ClientHandle & ctx, const ClientHandle shareCtx, int version);
|
||||
int destroyContext(RenderingThread *thread,const ClientHandle & ctx);
|
||||
int makeCurrent(RenderingThread *thread,
|
||||
const ClientHandle & drawSurface, const ClientHandle & readSurface, const ClientHandle & ctx);
|
||||
|
||||
@@ -17,14 +17,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
RendererContext * RendererContext::create(EGLDisplay dpy, EGLConfig config, RendererContext *shareCtx)
|
||||
RendererContext * RendererContext::create(EGLDisplay dpy, EGLConfig config, RendererContext *shareCtx, int version)
|
||||
{
|
||||
EGLContext ctx;
|
||||
EGLContext shared = shareCtx == NULL ? EGL_NO_CONTEXT : shareCtx->eglContext();
|
||||
ctx = eglCreateContext(dpy, config, shared, NULL);
|
||||
|
||||
EGLint context_attributes[] = { EGL_CONTEXT_CLIENT_VERSION, 1, EGL_NONE };
|
||||
context_attributes[1] = version;
|
||||
|
||||
ctx = eglCreateContext(dpy, config, shared, context_attributes);
|
||||
if (eglGetError() != EGL_SUCCESS) return NULL;
|
||||
|
||||
return new RendererContext(dpy, ctx);
|
||||
return new RendererContext(dpy, ctx, version);
|
||||
}
|
||||
|
||||
int RendererContext::destroy()
|
||||
|
||||
@@ -38,7 +38,7 @@ typedef std::set<PendingCropRect *> PendingCropRectSet;
|
||||
|
||||
class RendererContext : public RendererObject {
|
||||
public:
|
||||
static RendererContext *create(EGLDisplay dpy, EGLConfig config, RendererContext *shareCtx);
|
||||
static RendererContext *create(EGLDisplay dpy, EGLConfig config, RendererContext *shareCtx, int version);
|
||||
EGLContext eglContext() { return m_ctx; }
|
||||
int destroy();
|
||||
GLDecoderContextData & decoderContextData() { return m_contextData; }
|
||||
@@ -99,10 +99,12 @@ private:
|
||||
EGLDisplay m_dpy;
|
||||
EGLContext m_ctx;
|
||||
GLDecoderContextData m_contextData;
|
||||
int m_version;
|
||||
|
||||
RendererContext(EGLDisplay dpy, EGLContext ctx) :
|
||||
RendererContext(EGLDisplay dpy, EGLContext ctx, int version) :
|
||||
m_dpy(dpy),
|
||||
m_ctx(ctx)
|
||||
m_ctx(ctx),
|
||||
m_version(version)
|
||||
{
|
||||
#ifdef PVR_WAR
|
||||
m_activeTexture = 0;
|
||||
|
||||
@@ -210,10 +210,11 @@ void RenderingThread::fixTextureEnable()
|
||||
#endif
|
||||
|
||||
|
||||
int RenderingThread::s_createContext(uint32_t pid, uint32_t handle, uint32_t shareCtx)
|
||||
int RenderingThread::s_createContext(uint32_t pid, uint32_t handle, uint32_t shareCtx, int version)
|
||||
{
|
||||
return Renderer::instance()->createContext(m_tls, Renderer::ClientHandle(pid, handle),
|
||||
Renderer::ClientHandle(pid, shareCtx));
|
||||
Renderer::ClientHandle(pid, shareCtx),
|
||||
version);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
static void * s_thread(void *data);
|
||||
static __thread RenderingThread *m_tls;
|
||||
|
||||
static int s_createContext(uint32_t pid, uint32_t handle, uint32_t shareCtx);
|
||||
static int s_createContext(uint32_t pid, uint32_t handle, uint32_t shareCtx, int version);
|
||||
static int s_createSurface(uint32_t pid, uint32_t handle);
|
||||
static int s_destroySurface(uint32_t pid, uint32_t handle);
|
||||
static int s_destroyContext(uint32_t pid, uint32_t handle);
|
||||
|
||||
Reference in New Issue
Block a user