aboutsummaryrefslogtreecommitdiffstats
path: root/emulator
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2014-09-17 19:12:24 +0200
committerbohu <bohu@google.com>2014-11-25 12:30:46 -0800
commita3afda277fd2624c648739e0273f569fd093fd22 (patch)
tree1dbe72227caae72860806436be234ca6f2ad8902 /emulator
parenta7b283d26fd9c83d5a07c4576c8f8915d7f6382b (diff)
downloadsdk-a3afda277fd2624c648739e0273f569fd093fd22.zip
sdk-a3afda277fd2624c648739e0273f569fd093fd22.tar.gz
sdk-a3afda277fd2624c648739e0273f569fd093fd22.tar.bz2
emulator/opengl/emgen: Fix debug output of floating point values.
When calling printf() with a "%f", the value passed must be a double, not a float, which means we can't just pass a 32-bit value in the stack and assume printf() will cast it to a float properly. This results in bogus values printed whenever a GLfloat is used in a function signature, due to invalid stack offsets used by the printf(). Fix the problem by using Unpack<>() template. Change-Id: I282d9c07af68457f32af477435e5dc1999267d39
Diffstat (limited to 'emulator')
-rw-r--r--emulator/opengl/host/tools/emugen/ApiGen.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/emulator/opengl/host/tools/emugen/ApiGen.cpp b/emulator/opengl/host/tools/emugen/ApiGen.cpp
index a92ad39..78c15e4 100644
--- a/emulator/opengl/host/tools/emugen/ApiGen.cpp
+++ b/emulator/opengl/host/tools/emugen/ApiGen.cpp
@@ -854,19 +854,14 @@ int ApiGen::genDecoderImpl(const std::string &filename)
}
if (!v->isPointer()) {
- if (pass == PASS_FunctionCall) {
+ if (pass == PASS_FunctionCall ||
+ pass == PASS_DebugPrint) {
fprintf(fp,
"Unpack<%s,uint%d_t>(ptr + %s)",
v->type()->name().c_str(),
v->type()->bytes() * 8,
varoffset.c_str());
}
- if (pass == PASS_DebugPrint) {
- fprintf(fp,
- "*(uint%d_t *)(ptr + %s)",
- v->type()->bytes() * 8,
- varoffset.c_str());
- }
varoffset += " + " + toString(v->type()->bytes());
continue;
}