aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host/tools
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 /emulator/opengl/host/tools
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
Diffstat (limited to 'emulator/opengl/host/tools')
-rw-r--r--emulator/opengl/host/tools/emugen/ApiGen.cpp37
1 files changed, 12 insertions, 25 deletions
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");