aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2014-09-25 11:53:00 -0700
committerbohu <bohu@google.com>2014-11-25 12:30:47 -0800
commitde4e8c9fa8431abc06cf6fb147beeb675dd9cef5 (patch)
tree8700cadd394380866aee5f039f51d3475a50a344
parent7d18e39ea46b467cd916d79525d6d978be7e70df (diff)
downloadsdk-de4e8c9fa8431abc06cf6fb147beeb675dd9cef5.zip
sdk-de4e8c9fa8431abc06cf6fb147beeb675dd9cef5.tar.gz
sdk-de4e8c9fa8431abc06cf6fb147beeb675dd9cef5.tar.bz2
emulator/opengl/emugen: Remove accessor functions.
This patch simplifies the generated encoders and decoders by getting rid of the accessor functions (e.g. set_glDrawElementsData) given that all fields are public and can be written to directly. Change-Id: I15f4caac95e4d5f1e24a1a5838622600c6bc3207
-rw-r--r--emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp40
-rw-r--r--emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp16
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp52
-rw-r--r--emulator/opengl/host/tools/emugen/ApiGen.cpp37
4 files changed, 66 insertions, 79 deletions
diff --git a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
index 7aa6ede..725b815 100644
--- a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
+++ b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
@@ -58,26 +58,26 @@ int GLDecoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
this->initDispatchByName(getProcFunc, getProcFuncData);
}
- set_glGetCompressedTextureFormats(s_glGetCompressedTextureFormats);
- set_glVertexPointerOffset(s_glVertexPointerOffset);
- set_glColorPointerOffset(s_glColorPointerOffset);
- set_glNormalPointerOffset(s_glNormalPointerOffset);
- set_glTexCoordPointerOffset(s_glTexCoordPointerOffset);
- set_glPointSizePointerOffset(s_glPointSizePointerOffset);
- set_glWeightPointerOffset(s_glWeightPointerOffset);
- set_glMatrixIndexPointerOffset(s_glMatrixIndexPointerOffset);
-
- set_glVertexPointerData(s_glVertexPointerData);
- set_glColorPointerData(s_glColorPointerData);
- set_glNormalPointerData(s_glNormalPointerData);
- set_glTexCoordPointerData(s_glTexCoordPointerData);
- set_glPointSizePointerData(s_glPointSizePointerData);
- set_glWeightPointerData(s_glWeightPointerData);
- set_glMatrixIndexPointerData(s_glMatrixIndexPointerData);
-
- set_glDrawElementsOffset(s_glDrawElementsOffset);
- set_glDrawElementsData(s_glDrawElementsData);
- set_glFinishRoundTrip(s_glFinishRoundTrip);
+ glGetCompressedTextureFormats = s_glGetCompressedTextureFormats;
+ glVertexPointerOffset = s_glVertexPointerOffset;
+ glColorPointerOffset = s_glColorPointerOffset;
+ glNormalPointerOffset = s_glNormalPointerOffset;
+ glTexCoordPointerOffset = s_glTexCoordPointerOffset;
+ glPointSizePointerOffset = s_glPointSizePointerOffset;
+ glWeightPointerOffset = s_glWeightPointerOffset;
+ glMatrixIndexPointerOffset = s_glMatrixIndexPointerOffset;
+
+ glVertexPointerData = s_glVertexPointerData;
+ glColorPointerData = s_glColorPointerData;
+ glNormalPointerData = s_glNormalPointerData;
+ glTexCoordPointerData = s_glTexCoordPointerData;
+ glPointSizePointerData = s_glPointSizePointerData;
+ glWeightPointerData = s_glWeightPointerData;
+ glMatrixIndexPointerData = s_glMatrixIndexPointerData;
+
+ glDrawElementsOffset = s_glDrawElementsOffset;
+ glDrawElementsData = s_glDrawElementsData;
+ glFinishRoundTrip = s_glFinishRoundTrip;
return 0;
}
diff --git a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp
index 2ef306e..712dcc7 100644
--- a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp
+++ b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp
@@ -70,14 +70,14 @@ int GL2Decoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
this->initDispatchByName(getProcFunc, getProcFuncData);
}
- set_glGetCompressedTextureFormats(s_glGetCompressedTextureFormats);
- set_glVertexAttribPointerData(s_glVertexAttribPointerData);
- set_glVertexAttribPointerOffset(s_glVertexAttribPointerOffset);
-
- set_glDrawElementsOffset(s_glDrawElementsOffset);
- set_glDrawElementsData(s_glDrawElementsData);
- set_glShaderString(s_glShaderString);
- set_glFinishRoundTrip(s_glFinishRoundTrip);
+ glGetCompressedTextureFormats = s_glGetCompressedTextureFormats;
+ glVertexAttribPointerData = s_glVertexAttribPointerData;
+ glVertexAttribPointerOffset = s_glVertexAttribPointerOffset;
+
+ glDrawElementsOffset = s_glDrawElementsOffset;
+ glDrawElementsData = s_glDrawElementsData;
+ glShaderString = s_glShaderString;
+ glFinishRoundTrip = s_glFinishRoundTrip;
return 0;
}
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp
index 83ba9c5..c7c792a 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp
@@ -341,30 +341,30 @@ static int rcUpdateColorBuffer(uint32_t colorBuffer,
void initRenderControlContext(renderControl_decoder_context_t *dec)
{
- dec->set_rcGetRendererVersion(rcGetRendererVersion);
- dec->set_rcGetEGLVersion(rcGetEGLVersion);
- dec->set_rcQueryEGLString(rcQueryEGLString);
- dec->set_rcGetGLString(rcGetGLString);
- dec->set_rcGetNumConfigs(rcGetNumConfigs);
- dec->set_rcGetConfigs(rcGetConfigs);
- dec->set_rcChooseConfig(rcChooseConfig);
- dec->set_rcGetFBParam(rcGetFBParam);
- dec->set_rcCreateContext(rcCreateContext);
- dec->set_rcDestroyContext(rcDestroyContext);
- dec->set_rcCreateWindowSurface(rcCreateWindowSurface);
- dec->set_rcDestroyWindowSurface(rcDestroyWindowSurface);
- dec->set_rcCreateColorBuffer(rcCreateColorBuffer);
- dec->set_rcOpenColorBuffer(rcOpenColorBuffer);
- dec->set_rcCloseColorBuffer(rcCloseColorBuffer);
- dec->set_rcSetWindowColorBuffer(rcSetWindowColorBuffer);
- dec->set_rcFlushWindowColorBuffer(rcFlushWindowColorBuffer);
- dec->set_rcMakeCurrent(rcMakeCurrent);
- 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);
- dec->set_rcOpenColorBuffer2(rcOpenColorBuffer2);
+ dec->rcGetRendererVersion = rcGetRendererVersion;
+ dec->rcGetEGLVersion = rcGetEGLVersion;
+ dec->rcQueryEGLString = rcQueryEGLString;
+ dec->rcGetGLString = rcGetGLString;
+ dec->rcGetNumConfigs = rcGetNumConfigs;
+ dec->rcGetConfigs = rcGetConfigs;
+ dec->rcChooseConfig = rcChooseConfig;
+ dec->rcGetFBParam = rcGetFBParam;
+ dec->rcCreateContext = rcCreateContext;
+ dec->rcDestroyContext = rcDestroyContext;
+ dec->rcCreateWindowSurface = rcCreateWindowSurface;
+ dec->rcDestroyWindowSurface = rcDestroyWindowSurface;
+ dec->rcCreateColorBuffer = rcCreateColorBuffer;
+ dec->rcOpenColorBuffer = rcOpenColorBuffer;
+ dec->rcCloseColorBuffer = rcCloseColorBuffer;
+ dec->rcSetWindowColorBuffer = rcSetWindowColorBuffer;
+ dec->rcFlushWindowColorBuffer = rcFlushWindowColorBuffer;
+ dec->rcMakeCurrent = rcMakeCurrent;
+ dec->rcFBPost = rcFBPost;
+ dec->rcFBSetSwapInterval = rcFBSetSwapInterval;
+ dec->rcBindTexture = rcBindTexture;
+ dec->rcBindRenderbuffer = rcBindRenderbuffer;
+ dec->rcColorBufferCacheFlush = rcColorBufferCacheFlush;
+ dec->rcReadColorBuffer = rcReadColorBuffer;
+ dec->rcUpdateColorBuffer = rcUpdateColorBuffer;
+ dec->rcOpenColorBuffer2 = rcOpenColorBuffer2;
}
diff --git a/emulator/opengl/host/tools/emugen/ApiGen.cpp b/emulator/opengl/host/tools/emugen/ApiGen.cpp
index bd8fabf..e7f6d0b 100644
--- a/emulator/opengl/host/tools/emugen/ApiGen.cpp
+++ b/emulator/opengl/host/tools/emugen/ApiGen.cpp
@@ -156,15 +156,6 @@ int ApiGen::genContext(const std::string & filename, SideType side)
EntryPoint *e = &at(i);
fprintf(fp, "\t%s_%s_proc_t %s;\n", e->name().c_str(), sideString(side), e->name().c_str());
}
- // accessors
- fprintf(fp, "\t//Accessors \n");
-
- for (size_t i = 0; i < size(); i++) {
- EntryPoint *e = &at(i);
- const char *n = e->name().c_str();
- const char *s = sideString(side);
- fprintf(fp, "\tvirtual %s_%s_proc_t set_%s(%s_%s_proc_t f) { %s_%s_proc_t retval = %s; %s = f; return retval;}\n", n, s, n, n, s, n, s, n, n);
- }
// virtual destructor
fprintf(fp, "\t virtual ~%s_%s_context_t() {}\n", m_basename.c_str(), sideString(side));
@@ -662,19 +653,17 @@ int ApiGen::genEncoderImpl(const std::string &filename)
for (size_t i = 0; i < n; i++) {
EntryPoint *e = &at(i);
if (e->unsupported()) {
- fprintf(fp, "\tset_%s((%s_%s_proc_t)(enc_unsupported));\n", e->name().c_str(), e->name().c_str(), sideString(CLIENT_SIDE));
+ fprintf(fp,
+ "\t%s = (%s_%s_proc_t)(enc_unsupported);\n",
+ e->name().c_str(),
+ e->name().c_str(),
+ sideString(CLIENT_SIDE));
} else {
- fprintf(fp, "\tset_%s(%s_enc);\n", e->name().c_str(), e->name().c_str());
+ fprintf(fp,
+ "\t%s = (%s_enc);\n",
+ e->name().c_str(),
+ e->name().c_str());
}
- /**
- if (e->unsupsported()) {
- fprintf(fp, "\tmemcpy((void *)(&%s), (const void *)(&enc_unsupported), sizeof(%s));\n",
- e->name().c_str(),
- e->name().c_str());
- } else {
- fprintf(fp, "\t%s = %s_enc;\n", e->name().c_str(), e->name().c_str());
- }
- **/
}
fprintf(fp, "}\n\n");
@@ -732,15 +721,13 @@ int ApiGen::genContextImpl(const std::string &filename, SideType side)
// init function;
fprintf(fp, "int %s::initDispatchByName(void *(*getProc)(const char *, void *userData), void *userData)\n{\n", classname.c_str());
- fprintf(fp, "\tvoid *ptr;\n\n");
for (size_t i = 0; i < n; i++) {
EntryPoint *e = &at(i);
- fprintf(fp, "\tptr = getProc(\"%s\", userData); set_%s((%s_%s_proc_t)ptr);\n",
- e->name().c_str(),
+ fprintf(fp, "\t%s = (%s_%s_proc_t) getProc(\"%s\", userData);\n",
e->name().c_str(),
e->name().c_str(),
- sideString(side));
-
+ sideString(side),
+ e->name().c_str());
}
fprintf(fp, "\treturn 0;\n");
fprintf(fp, "}\n\n");