[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz ./TODO gfx/libpaper/Paper.cxx
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz ./TODO gfx/libpaper/Paper.cxx |
Date: |
Wed, 02 Oct 2002 06:33:45 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 02/10/02 06:33:45
Modified files:
. : TODO
gfx/libpaper : Paper.cxx
Log message:
There seems to be an ostringstream bug in g++-3.1; using sprintf instead
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.218&tr2=1.219&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/Paper.cxx.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
Patches:
Index: gzz/TODO
diff -c gzz/TODO:1.218 gzz/TODO:1.219
*** gzz/TODO:1.218 Wed Oct 2 06:32:04 2002
--- gzz/TODO Wed Oct 2 06:33:45 2002
***************
*** 52,57 ****
--- 52,62 ----
- find out why PaperPass crashes when compiled with g++-3.1
(+ optimization). Seems to be when PaperQuad calls setUp_VP, and
in localesomething, maybe stringstream stuff?
+
+ Indeed, this seems to be a bug in ostringstream, because
+ - it does not crash if I use sprintf instead
+ - the code in Paper.cxx seems ok to me
+
jvk, tjl:
+ If performance drags,
think about using render-to-texture to speed up papers.
Index: gzz/gfx/libpaper/Paper.cxx
diff -c gzz/gfx/libpaper/Paper.cxx:1.14 gzz/gfx/libpaper/Paper.cxx:1.15
*** gzz/gfx/libpaper/Paper.cxx:1.14 Mon Sep 30 02:44:22 2002
--- gzz/gfx/libpaper/Paper.cxx Wed Oct 2 06:33:45 2002
***************
*** 45,50 ****
--- 45,52 ----
}
string TexGen::getVPCode(int unit) {
+ #if 0
+ // XXX: this code crashes when compiled with g++-3.1 -O3 -ffast-math
std::ostringstream code;
GLuint base = unit * 4 + tex_addr_base;
***************
*** 54,59 ****
--- 56,72 ----
<< "DP4 o[TEX" << unit << "].w, c[" << base + 3 << "], v[TEX0];\n";
return code.str();
+ #else
+ GLuint base = unit * 4 + tex_addr_base;
+ char str[1000];
+ sprintf(str,
+ "DP4 o[TEX%d].x, c[%u], v[TEX0];\n"
+ "DP4 o[TEX%d].y, c[%u], v[TEX0];\n"
+ "DP4 o[TEX%d].z, c[%u], v[TEX0];\n"
+ "DP4 o[TEX%d].w, c[%u], v[TEX0];\n",
+ unit, base, unit, base + 1, unit, base + 2, unit, base + 3);
+ return str;
+ #endif
}
void TexGen::setUp_explicit(LightParam * param) {
***************
*** 257,280 ****
}
void PaperPass::loadVP() {
! std::ostringstream code;
!
! code << "!!VP1.1 OPTION NV_position_invariant;\n"
! << "MOV o[COL0], v[COL0];\n"
! << "MOV o[COL1], v[COL1];\n";
int unit = 0;
for (vector<shared_ptr<TexGen> >::iterator it = texgen.begin(); it !=
texgen.end(); ++it) {
! if (it->get()) code << (*it)->getVPCode(unit);
else std::cerr << "Warning: ignoring null TexGen\n";
unit++;
}
! code << "END\n";
//std::cerr << "Creating VPCode with the source " << code.str() << "\n";
! texgenvp = VPCode(code.str().c_str());
}
void PaperPass::setUp_VP(LightParam *param) {
--- 270,292 ----
}
void PaperPass::loadVP() {
! string code =
! "!!VP1.1 OPTION NV_position_invariant;\n"
! "MOV o[COL0], v[COL0];\n"
! "MOV o[COL1], v[COL1];\n";
int unit = 0;
for (vector<shared_ptr<TexGen> >::iterator it = texgen.begin(); it !=
texgen.end(); ++it) {
! if (it->get()) code += (*it)->getVPCode(unit);
else std::cerr << "Warning: ignoring null TexGen\n";
unit++;
}
! code += "END\n";
//std::cerr << "Creating VPCode with the source " << code.str() << "\n";
! texgenvp = VPCode(code.c_str());
}
void PaperPass::setUp_VP(LightParam *param) {
- [Gzz-commits] gzz ./TODO gfx/libpaper/Paper.cxx,
Janne V. Kujala <=