am 90d4ce08: Merge "opengles emulator: support glEGLImageTargetRenderbufferStorageOES"
* commit '90d4ce080c9f6683989e5bb8d66e07960fd29afc': opengles emulator: support glEGLImageTargetRenderbufferStorageOES
This commit is contained in:
@@ -197,6 +197,27 @@ bool ColorBuffer::bindToTexture()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ColorBuffer::bindToRenderbuffer()
|
||||
{
|
||||
if (m_eglImage) {
|
||||
RenderThreadInfo *tInfo = getRenderThreadInfo();
|
||||
if (tInfo->currContext.Ptr()) {
|
||||
#ifdef WITH_GLES2
|
||||
if (tInfo->currContext->isGL2()) {
|
||||
s_gl2.glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER_OES, m_eglImage);
|
||||
}
|
||||
else {
|
||||
s_gl.glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER_OES, m_eglImage);
|
||||
}
|
||||
#else
|
||||
s_gl.glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER_OES, m_eglImage);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ColorBuffer::bind_fbo()
|
||||
{
|
||||
if (m_fbo) {
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
bool blitFromPbuffer(EGLSurface p_pbufSurface);
|
||||
bool post();
|
||||
bool bindToTexture();
|
||||
bool bindToRenderbuffer();
|
||||
|
||||
private:
|
||||
ColorBuffer();
|
||||
|
||||
@@ -508,6 +508,19 @@ bool FrameBuffer::bindColorBufferToTexture(HandleType p_colorbuffer)
|
||||
return (*c).second->bindToTexture();
|
||||
}
|
||||
|
||||
bool FrameBuffer::bindColorBufferToRenderbuffer(HandleType p_colorbuffer)
|
||||
{
|
||||
android::Mutex::Autolock mutex(m_lock);
|
||||
|
||||
ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) );
|
||||
if (c == m_colorbuffers.end()) {
|
||||
// bad colorbuffer handle
|
||||
return false;
|
||||
}
|
||||
|
||||
return (*c).second->bindToRenderbuffer();
|
||||
}
|
||||
|
||||
bool FrameBuffer::bindContext(HandleType p_context,
|
||||
HandleType p_drawSurface,
|
||||
HandleType p_readSurface)
|
||||
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
bool setWindowSurfaceColorBuffer(HandleType p_surface, HandleType p_colorbuffer);
|
||||
bool flushWindowSurfaceColorBuffer(HandleType p_surface);
|
||||
bool bindColorBufferToTexture(HandleType p_colorbuffer);
|
||||
bool bindColorBufferToRenderbuffer(HandleType p_colorbuffer);
|
||||
bool updateColorBuffer(HandleType p_colorbuffer,
|
||||
int x, int y, int width, int height,
|
||||
GLenum format, GLenum type, void *pixels);
|
||||
|
||||
@@ -282,6 +282,16 @@ static void rcBindTexture(uint32_t colorBuffer)
|
||||
fb->bindColorBufferToTexture(colorBuffer);
|
||||
}
|
||||
|
||||
static void rcBindRenderbuffer(uint32_t colorBuffer)
|
||||
{
|
||||
FrameBuffer *fb = FrameBuffer::getFB();
|
||||
if (!fb) {
|
||||
return;
|
||||
}
|
||||
|
||||
fb->bindColorBufferToRenderbuffer(colorBuffer);
|
||||
}
|
||||
|
||||
static EGLint rcColorBufferCacheFlush(uint32_t colorBuffer,
|
||||
EGLint postCount, int forRead)
|
||||
{
|
||||
@@ -333,6 +343,7 @@ void initRenderControlContext(renderControl_decoder_context_t *dec)
|
||||
dec->set_rcFBPost(rcFBPost);
|
||||
dec->set_rcFBSetSwapInterval(rcFBSetSwapInterval);
|
||||
dec->set_rcBindTexture(rcBindTexture);
|
||||
dec->set_rcBindRenderbuffer(rcBindRenderbuffer);
|
||||
dec->set_rcColorBufferCacheFlush(rcColorBufferCacheFlush);
|
||||
dec->set_rcReadColorBuffer(rcReadColorBuffer);
|
||||
dec->set_rcUpdateColorBuffer(rcUpdateColorBuffer);
|
||||
|
||||
@@ -34,7 +34,7 @@ static EGLClient_glesInterface * s_gl = NULL;
|
||||
//GL extensions
|
||||
void glEGLImageTargetTexture2DOES(void * self, GLenum target, GLeglImageOES image)
|
||||
{
|
||||
DBG("glEGLImageTargetTexture2DOES");
|
||||
DBG("glEGLImageTargetTexture2DOES v1 image=0x%x", image);
|
||||
//TODO: check error - we don't have a way to set gl error
|
||||
android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
|
||||
|
||||
@@ -52,6 +52,26 @@ void glEGLImageTargetTexture2DOES(void * self, GLenum target, GLeglImageOES imag
|
||||
return;
|
||||
}
|
||||
|
||||
void glEGLImageTargetRenderbufferStorageOES(void *self, GLenum target, GLeglImageOES image)
|
||||
{
|
||||
DBG("glEGLImageTargetRenderbufferStorageOES v1 image=0x%x", image);
|
||||
//TODO: check error - we don't have a way to set gl error
|
||||
android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
|
||||
|
||||
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DEFINE_AND_VALIDATE_HOST_CONNECTION();
|
||||
rcEnc->rcBindRenderbuffer(rcEnc, ((cb_handle_t *)(native_buffer->handle))->hostHandle);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void * getProcAddress(const char * procname)
|
||||
{
|
||||
// search in GL function table
|
||||
@@ -80,6 +100,7 @@ void init()
|
||||
{
|
||||
GET_CONTEXT;
|
||||
ctx->set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES);
|
||||
ctx->set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES);
|
||||
ctx->set_glGetString(my_glGetString);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ static EGLClient_glesInterface * s_gl = NULL;
|
||||
//GL extensions
|
||||
void glEGLImageTargetTexture2DOES(void * self, GLenum target, GLeglImageOES image)
|
||||
{
|
||||
DBG("glEGLImageTargetTexture2DOES");
|
||||
DBG("glEGLImageTargetTexture2DOES v2 img=0x%x\n", image);
|
||||
//TODO: check error - we don't have a way to set gl error
|
||||
android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
|
||||
|
||||
@@ -53,6 +53,26 @@ void glEGLImageTargetTexture2DOES(void * self, GLenum target, GLeglImageOES imag
|
||||
return;
|
||||
}
|
||||
|
||||
void glEGLImageTargetRenderbufferStorageOES(void *self, GLenum target, GLeglImageOES image)
|
||||
{
|
||||
DBG("glEGLImageTargetRenderbufferStorageOES v2 image=0x%x\n", image);
|
||||
//TODO: check error - we don't have a way to set gl error
|
||||
android_native_buffer_t* native_buffer = (android_native_buffer_t*)image;
|
||||
|
||||
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (native_buffer->common.version != sizeof(android_native_buffer_t)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DEFINE_AND_VALIDATE_HOST_CONNECTION();
|
||||
rcEnc->rcBindRenderbuffer(rcEnc, ((cb_handle_t *)(native_buffer->handle))->hostHandle);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void * getProcAddress(const char * procname)
|
||||
{
|
||||
// search in GL function table
|
||||
@@ -81,6 +101,7 @@ void init()
|
||||
{
|
||||
GET_CONTEXT;
|
||||
ctx->set_glEGLImageTargetTexture2DOES(glEGLImageTargetTexture2DOES);
|
||||
ctx->set_glEGLImageTargetRenderbufferStorageOES(glEGLImageTargetRenderbufferStorageOES);
|
||||
ctx->set_glGetString(my_glGetString);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ LOCAL_ADDITIONAL_DEPENDENCIES := \
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
eglDisplay.cpp \
|
||||
egl.cpp
|
||||
egl.cpp \
|
||||
ClientAPIExts.cpp
|
||||
|
||||
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
|
||||
157
tools/emulator/opengl/system/egl/ClientAPIExts.cpp
Normal file
157
tools/emulator/opengl/system/egl/ClientAPIExts.cpp
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "ClientAPIExts.h"
|
||||
#include "ThreadInfo.h"
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include "eglContext.h"
|
||||
|
||||
namespace ClientAPIExts
|
||||
{
|
||||
|
||||
//
|
||||
// define function pointer type for each extention function
|
||||
// typename has the form __egl_{funcname}_t
|
||||
//
|
||||
#define FUNC_TYPE(fname) __egl_ ## fname ## _t
|
||||
#define API_ENTRY(fname,params,args) \
|
||||
typedef void (GL_APIENTRY *FUNC_TYPE(fname)) params;
|
||||
|
||||
#define API_ENTRY_RET(rtype,fname,params,args) \
|
||||
typedef rtype (GL_APIENTRY *FUNC_TYPE(fname)) params;
|
||||
|
||||
#include "ClientAPIExts.in"
|
||||
#undef API_ENTRY
|
||||
#undef API_ENTRY_RET
|
||||
|
||||
/////
|
||||
// Define static table to store the function value for each
|
||||
// client API. functions pointers will get initialized through
|
||||
// ClientAPIExts::initClientFuncs function after each client API has been
|
||||
// loaded.
|
||||
/////
|
||||
#define API_ENTRY(fname,params,args) \
|
||||
FUNC_TYPE(fname) fname;
|
||||
|
||||
#define API_ENTRY_RET(rtype,fname,params,args) \
|
||||
API_ENTRY(fname,params,args)
|
||||
|
||||
static struct _ext_table
|
||||
{
|
||||
#include "ClientAPIExts.in"
|
||||
} s_client_extensions[2];
|
||||
|
||||
#undef API_ENTRY
|
||||
#undef API_ENTRY_RET
|
||||
|
||||
//
|
||||
// This function initialized each entry in the s_client_extensions
|
||||
// struct at the givven index using the givven client interface
|
||||
//
|
||||
void initClientFuncs(const EGLClient_glesInterface *iface, int idx)
|
||||
{
|
||||
#define API_ENTRY(fname,params,args) \
|
||||
s_client_extensions[idx].fname = \
|
||||
(FUNC_TYPE(fname))iface->getProcAddress(#fname);
|
||||
|
||||
#define API_ENTRY_RET(rtype,fname,params,args) \
|
||||
API_ENTRY(fname,params,args)
|
||||
|
||||
//
|
||||
// reset all func pointers to NULL
|
||||
//
|
||||
memset(&s_client_extensions[idx], 0, sizeof(struct _ext_table));
|
||||
|
||||
//
|
||||
// And now query the GLES library for each proc address
|
||||
//
|
||||
#include "ClientAPIExts.in"
|
||||
#undef API_ENTRY
|
||||
#undef API_ENTRY_RET
|
||||
}
|
||||
|
||||
//
|
||||
// Define implementation for each extension function which checks
|
||||
// the current context version and calls to the correct client API
|
||||
// function.
|
||||
//
|
||||
#define API_ENTRY(fname,params,args) \
|
||||
static void _egl_ ## fname params \
|
||||
{ \
|
||||
EGLThreadInfo* thread = getEGLThreadInfo(); \
|
||||
if (!thread->currentContext) { \
|
||||
return; \
|
||||
} \
|
||||
int idx = (int)thread->currentContext->version - 1; \
|
||||
if (!s_client_extensions[idx].fname) { \
|
||||
return; \
|
||||
} \
|
||||
(*s_client_extensions[idx].fname) args; \
|
||||
}
|
||||
|
||||
#define API_ENTRY_RET(rtype,fname,params,args) \
|
||||
static rtype _egl_ ## fname params \
|
||||
{ \
|
||||
EGLThreadInfo* thread = getEGLThreadInfo(); \
|
||||
if (!thread->currentContext) { \
|
||||
return (rtype)0; \
|
||||
} \
|
||||
int idx = (int)thread->currentContext->version - 1; \
|
||||
if (!s_client_extensions[idx].fname) { \
|
||||
return (rtype)0; \
|
||||
} \
|
||||
return (*s_client_extensions[idx].fname) args; \
|
||||
}
|
||||
|
||||
#include "ClientAPIExts.in"
|
||||
#undef API_ENTRY
|
||||
#undef API_ENTRY_RET
|
||||
|
||||
//
|
||||
// Define a table to map function names to the local _egl_ version of
|
||||
// the extension function, to be used in eglGetProcAddress.
|
||||
//
|
||||
#define API_ENTRY(fname,params,args) \
|
||||
{ #fname, (void*)_egl_ ## fname},
|
||||
#define API_ENTRY_RET(rtype,fname,params,args) \
|
||||
API_ENTRY(fname,params,args)
|
||||
|
||||
static struct _client_ext_funcs {
|
||||
const char *fname;
|
||||
void* proc;
|
||||
} s_client_ext_funcs[] = {
|
||||
#include "ClientAPIExts.in"
|
||||
};
|
||||
static const int numExtFuncs = sizeof(s_client_ext_funcs) /
|
||||
sizeof(s_client_ext_funcs[0]);
|
||||
|
||||
#undef API_ENTRY
|
||||
#undef API_ENTRY_RET
|
||||
|
||||
//
|
||||
// returns the __egl_ version of the givven extension function name.
|
||||
//
|
||||
void* getProcAddress(const char *fname)
|
||||
{
|
||||
for (int i=0; i<numExtFuncs; i++) {
|
||||
if (!strcmp(fname, s_client_ext_funcs[i].fname)) {
|
||||
return s_client_ext_funcs[i].proc;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} // of namespace ClientAPIExts
|
||||
29
tools/emulator/opengl/system/egl/ClientAPIExts.h
Normal file
29
tools/emulator/opengl/system/egl/ClientAPIExts.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef _CLIENT_APIS_EXTS_H
|
||||
#define _CLIENT_APIS_EXTS_H
|
||||
|
||||
#include "EGLClientIface.h"
|
||||
|
||||
namespace ClientAPIExts
|
||||
{
|
||||
|
||||
void initClientFuncs(const EGLClient_glesInterface *iface, int idx);
|
||||
void* getProcAddress(const char *fname);
|
||||
|
||||
} // of namespace ClientAPIExts
|
||||
|
||||
#endif
|
||||
201
tools/emulator/opengl/system/egl/ClientAPIExts.in
Normal file
201
tools/emulator/opengl/system/egl/ClientAPIExts.in
Normal file
@@ -0,0 +1,201 @@
|
||||
//
|
||||
// Each extension function should have one of the following
|
||||
// macro definitions:
|
||||
// API_ENTRY(funcname, paramlist, arglist)
|
||||
// -or- (in case funciton has return value)
|
||||
// API_ENTRY_RET(return_type,funcname, paramlist, arglist)
|
||||
//
|
||||
API_ENTRY(glEGLImageTargetTexture2DOES,
|
||||
(GLenum target, GLeglImageOES image),
|
||||
(target, image))
|
||||
|
||||
API_ENTRY(glEGLImageTargetRenderbufferStorageOES,
|
||||
(GLenum target, GLeglImageOES image),
|
||||
(target, image))
|
||||
|
||||
API_ENTRY(glBlendEquationSeparateOES,
|
||||
(GLenum modeRGB, GLenum modeAlpha),
|
||||
(modeRGB, modeAlpha))
|
||||
|
||||
API_ENTRY(glBlendFuncSeparateOES,
|
||||
(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha),
|
||||
(srcRGB, dstRGB, srcAlpha, dstAlpha))
|
||||
|
||||
API_ENTRY(glBlendEquationOES,
|
||||
(GLenum mode),
|
||||
(mode))
|
||||
|
||||
API_ENTRY(glCurrentPaletteMatrixOES,
|
||||
(GLuint matrixpaletteindex),
|
||||
(matrixpaletteindex))
|
||||
|
||||
API_ENTRY(glLoadPaletteFromModelViewMatrixOES,
|
||||
(void),
|
||||
())
|
||||
|
||||
API_ENTRY(glMatrixIndexPointerOES,
|
||||
(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer),
|
||||
(size, type, stride, pointer))
|
||||
|
||||
API_ENTRY(glWeightPointerOES,
|
||||
(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer),
|
||||
(size, type, stride, pointer))
|
||||
|
||||
API_ENTRY(glDepthRangefOES,
|
||||
(GLclampf zNear, GLclampf zFar),
|
||||
(zNear, zFar))
|
||||
|
||||
API_ENTRY(glFrustumfOES,
|
||||
(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar),
|
||||
(left, right, bottom, top, zNear, zFar))
|
||||
|
||||
API_ENTRY(glOrthofOES,
|
||||
(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar),
|
||||
(left, right, bottom, top, zNear, zFar))
|
||||
|
||||
API_ENTRY(glClipPlanefOES,
|
||||
(GLenum plane, const GLfloat *equation),
|
||||
(plane, equation))
|
||||
|
||||
API_ENTRY(glGetClipPlanefOES,
|
||||
(GLenum pname, GLfloat * eqn),
|
||||
(pname, eqn))
|
||||
|
||||
API_ENTRY(glClearDepthfOES,
|
||||
(GLclampf depth),
|
||||
(depth))
|
||||
|
||||
API_ENTRY(glPointSizePointerOES,
|
||||
(GLenum type, GLsizei stride, const GLvoid *pointer),
|
||||
(type, stride, pointer))
|
||||
|
||||
API_ENTRY(glTexGenfOES,
|
||||
(GLenum coord, GLenum pname, GLfloat param),
|
||||
(coord, pname, param))
|
||||
|
||||
API_ENTRY(glTexGenfvOES,
|
||||
(GLenum coord, GLenum pname, const GLfloat *params),
|
||||
(coord, pname, params))
|
||||
|
||||
API_ENTRY(glTexGeniOES,
|
||||
(GLenum coord, GLenum pname, GLint param),
|
||||
(coord, pname, param))
|
||||
|
||||
API_ENTRY(glTexGenivOES,
|
||||
(GLenum coord, GLenum pname, const GLint *params),
|
||||
(coord, pname, params))
|
||||
|
||||
API_ENTRY(glTexGenxOES,
|
||||
(GLenum coord, GLenum pname, GLfixed param),
|
||||
(coord, pname, param))
|
||||
|
||||
API_ENTRY(glTexGenxvOES,
|
||||
(GLenum coord, GLenum pname, const GLfixed *params),
|
||||
(coord, pname, params))
|
||||
|
||||
API_ENTRY(glGetTexGenfvOES,
|
||||
(GLenum coord, GLenum pname, GLfloat *params),
|
||||
(coord, pname, params))
|
||||
|
||||
API_ENTRY(glGetTexGenivOES,
|
||||
(GLenum coord, GLenum pname, GLint *params),
|
||||
(coord, pname, params))
|
||||
|
||||
API_ENTRY(glGetTexGenxvOES,
|
||||
(GLenum coord, GLenum pname, GLfixed *params),
|
||||
(coord, pname, params))
|
||||
|
||||
API_ENTRY_RET(GLboolean,
|
||||
glIsRenderbufferOES,
|
||||
(GLuint renderbuffer),
|
||||
(renderbuffer))
|
||||
|
||||
API_ENTRY(glBindRenderbufferOES,
|
||||
(GLenum target, GLuint renderbuffer),
|
||||
(target, renderbuffer))
|
||||
|
||||
API_ENTRY(glDeleteRenderbuffersOES,
|
||||
(GLsizei n, const GLuint* renderbuffers),
|
||||
(n, renderbuffers))
|
||||
|
||||
API_ENTRY(glGenRenderbuffersOES,
|
||||
(GLsizei n, GLuint* renderbuffers),
|
||||
(n, renderbuffers))
|
||||
|
||||
API_ENTRY(glRenderbufferStorageOES,
|
||||
(GLenum target, GLenum internalformat, GLsizei width, GLsizei height),
|
||||
(target, internalformat, width, height))
|
||||
|
||||
API_ENTRY(glGetRenderbufferParameterivOES,
|
||||
(GLenum target, GLenum pname, GLint* params),
|
||||
(target, pname, params))
|
||||
|
||||
API_ENTRY_RET(GLboolean,
|
||||
glIsFramebufferOES,
|
||||
(GLuint framebuffer),
|
||||
(framebuffer))
|
||||
|
||||
API_ENTRY(glBindFramebufferOES,
|
||||
(GLenum target, GLuint framebuffer),
|
||||
(target, framebuffer))
|
||||
|
||||
API_ENTRY(glDeleteFramebuffersOES,
|
||||
(GLsizei n, const GLuint* framebuffers),
|
||||
(n, framebuffers))
|
||||
|
||||
API_ENTRY(glGenFramebuffersOES,
|
||||
(GLsizei n, GLuint* framebuffers),
|
||||
(n, framebuffers))
|
||||
|
||||
API_ENTRY_RET(GLenum,
|
||||
glCheckFramebufferStatusOES,
|
||||
(GLenum target),
|
||||
(target))
|
||||
|
||||
API_ENTRY(glFramebufferTexture2DOES,
|
||||
(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level),
|
||||
(target, attachment, textarget, texture, level))
|
||||
|
||||
API_ENTRY(glFramebufferRenderbufferOES,
|
||||
(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer),
|
||||
(target, attachment, renderbuffertarget, renderbuffer))
|
||||
|
||||
API_ENTRY(glGetFramebufferAttachmentParameterivOES,
|
||||
(GLenum target, GLenum attachment, GLenum pname, GLint* params),
|
||||
(target, attachment, pname, params))
|
||||
|
||||
API_ENTRY(glGenerateMipmapOES,
|
||||
(GLenum target),
|
||||
(target))
|
||||
|
||||
API_ENTRY(glDrawTexsOES,
|
||||
(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height),
|
||||
(x, y, z, width, height))
|
||||
|
||||
API_ENTRY(glDrawTexiOES,
|
||||
(GLint x, GLint y, GLint z, GLint width, GLint height),
|
||||
(x, y, z, width, height))
|
||||
|
||||
API_ENTRY(glDrawTexfOES,
|
||||
(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height),
|
||||
(x, y, z, width, height))
|
||||
|
||||
API_ENTRY(glDrawTexxOES,
|
||||
(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height),
|
||||
(x, y, z, width, height))
|
||||
|
||||
API_ENTRY(glDrawTexsvOES,
|
||||
(const GLshort *coords),
|
||||
(coords))
|
||||
|
||||
API_ENTRY(glDrawTexivOES,
|
||||
(const GLint *coords),
|
||||
(coords))
|
||||
|
||||
API_ENTRY(glDrawTexfvOES,
|
||||
(const GLfloat *coords),
|
||||
(coords))
|
||||
|
||||
API_ENTRY(glDrawTexxvOES,
|
||||
(const GLfixed *coords),
|
||||
(coords))
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "gralloc_cb.h"
|
||||
#include "GLClientState.h"
|
||||
#include "GLSharedGroup.h"
|
||||
#include "eglContext.h"
|
||||
#include "ClientAPIExts.h"
|
||||
|
||||
#include "GLEncoder.h"
|
||||
#ifdef WITH_GLES2
|
||||
@@ -129,38 +131,6 @@ const char * eglStrError(EGLint err)
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//EGLContext_t
|
||||
|
||||
struct EGLContext_t {
|
||||
|
||||
enum {
|
||||
IS_CURRENT = 0x00010000,
|
||||
NEVER_CURRENT = 0x00020000
|
||||
};
|
||||
|
||||
EGLContext_t(EGLDisplay dpy, EGLConfig config, EGLContext_t* shareCtx);
|
||||
~EGLContext_t();
|
||||
uint32_t flags;
|
||||
EGLDisplay dpy;
|
||||
EGLConfig config;
|
||||
EGLSurface read;
|
||||
EGLSurface draw;
|
||||
EGLContext_t * shareCtx;
|
||||
EGLint version;
|
||||
uint32_t rcContext;
|
||||
const char* versionString;
|
||||
const char* vendorString;
|
||||
const char* rendererString;
|
||||
const char* extensionString;
|
||||
|
||||
GLClientState * getClientState(){ return clientState; }
|
||||
GLSharedGroupPtr getSharedGroup(){ return sharedGroup; }
|
||||
private:
|
||||
GLClientState * clientState;
|
||||
GLSharedGroupPtr sharedGroup;
|
||||
};
|
||||
|
||||
EGLContext_t::EGLContext_t(EGLDisplay dpy, EGLConfig config, EGLContext_t* shareCtx) :
|
||||
dpy(dpy),
|
||||
config(config),
|
||||
@@ -601,19 +571,8 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
|
||||
}
|
||||
}
|
||||
|
||||
// look in gles
|
||||
void *proc = s_display.gles_iface()->getProcAddress( procname );
|
||||
if (proc != NULL) {
|
||||
return (__eglMustCastToProperFunctionPointerType)proc;
|
||||
}
|
||||
|
||||
// look in gles2
|
||||
if (s_display.gles2_iface() != NULL) {
|
||||
proc = s_display.gles2_iface()->getProcAddress( procname );
|
||||
if (proc != NULL) {
|
||||
return (__eglMustCastToProperFunctionPointerType)proc;
|
||||
}
|
||||
}
|
||||
// look in gles client api's extensions table
|
||||
return (__eglMustCastToProperFunctionPointerType)ClientAPIExts::getProcAddress(procname);
|
||||
|
||||
// Fail - function not found.
|
||||
return NULL;
|
||||
@@ -1073,12 +1032,14 @@ EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLC
|
||||
if (!hostCon->gl2Encoder()->isInitialized()) {
|
||||
s_display.gles2_iface()->init();
|
||||
hostCon->gl2Encoder()->setInitialized();
|
||||
ClientAPIExts::initClientFuncs(s_display.gles2_iface(), 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!hostCon->glEncoder()->isInitialized()) {
|
||||
s_display.gles_iface()->init();
|
||||
hostCon->glEncoder()->setInitialized();
|
||||
ClientAPIExts::initClientFuncs(s_display.gles_iface(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1217,7 +1178,6 @@ EGLBoolean eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface)
|
||||
EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
|
||||
{
|
||||
VALIDATE_DISPLAY_INIT(dpy, EGL_NO_IMAGE_KHR);
|
||||
|
||||
if (ctx != EGL_NO_CONTEXT) {
|
||||
setErrorReturn(EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
|
||||
}
|
||||
@@ -1253,7 +1213,6 @@ EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EG
|
||||
EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
|
||||
{
|
||||
VALIDATE_DISPLAY_INIT(dpy, EGL_FALSE);
|
||||
|
||||
android_native_buffer_t* native_buffer = (android_native_buffer_t*)img;
|
||||
|
||||
if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC)
|
||||
|
||||
51
tools/emulator/opengl/system/egl/eglContext.h
Normal file
51
tools/emulator/opengl/system/egl/eglContext.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef _EGL_CONTEXT_H
|
||||
#define _EGL_CONTEXT_H
|
||||
|
||||
#include "GLClientState.h"
|
||||
#include "GLSharedGroup.h"
|
||||
|
||||
struct EGLContext_t {
|
||||
|
||||
enum {
|
||||
IS_CURRENT = 0x00010000,
|
||||
NEVER_CURRENT = 0x00020000
|
||||
};
|
||||
|
||||
EGLContext_t(EGLDisplay dpy, EGLConfig config, EGLContext_t* shareCtx);
|
||||
~EGLContext_t();
|
||||
uint32_t flags;
|
||||
EGLDisplay dpy;
|
||||
EGLConfig config;
|
||||
EGLSurface read;
|
||||
EGLSurface draw;
|
||||
EGLContext_t * shareCtx;
|
||||
EGLint version;
|
||||
uint32_t rcContext;
|
||||
const char* versionString;
|
||||
const char* vendorString;
|
||||
const char* rendererString;
|
||||
const char* extensionString;
|
||||
|
||||
GLClientState * getClientState(){ return clientState; }
|
||||
GLSharedGroupPtr getSharedGroup(){ return sharedGroup; }
|
||||
private:
|
||||
GLClientState * clientState;
|
||||
GLSharedGroupPtr sharedGroup;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -18,6 +18,7 @@ GL_ENTRY(EGLint, rcMakeCurrent, uint32_t context, uint32_t drawSurf, uint32_t re
|
||||
GL_ENTRY(void, rcFBPost, uint32_t colorBuffer)
|
||||
GL_ENTRY(void, rcFBSetSwapInterval, EGLint interval)
|
||||
GL_ENTRY(void, rcBindTexture, uint32_t colorBuffer)
|
||||
GL_ENTRY(void, rcBindRenderbuffer, uint32_t colorBuffer)
|
||||
GL_ENTRY(EGLint, rcColorBufferCacheFlush, uint32_t colorbuffer, EGLint postCount,int forRead)
|
||||
GL_ENTRY(void, rcReadColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels)
|
||||
GL_ENTRY(int, rcUpdateColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels)
|
||||
|
||||
Reference in New Issue
Block a user