Metaprogramming GPUs with Sh Errata
From ShWiki
Here are the errors/typos we are aware of from the first edition of the book. Please comment on this page if you have found something that isn't listed yet.
Contents |
Page 18: missing word
The first sentence on the page is missing a word:
"Basically, sequences of calls into an API can be interpreted as a ..."
Page 28: wrong z convention noted
Second paragraph from the bottom:
"Values of z at the near plane are mapped to 0, those close to the far plane are mapped to 1. This follows OpenGL conventions."
should be
"Values of z at the near plane are mapped to -1, those close to the far plane are mapped to 1. This follows OpenGL conventions."
Page 29: our->are
In middle of first full paragraph on page:
"Therefore, some simplifications to our shaders our possible in the ..."
should be
"Therefore, some simplifications to our shaders are possible in the ..."
Listing 5.3: p -> update
The last line of the listing,
ShProgram update_state = p << state;
should be
ShProgram update_state = update << state;
Table 8.9: atan2
The definition of atan2() should be
arctangent of a / b
instead of
arctangent of b / a
In order words, atan2(y, x) = atan(y / x) just like in C++ and Python.
Table 8.11: bezier
The r in the formula should have a subscript of i
Page 168: faceforward
The math should be
/ b if dot(a, b) > 0, r <- | \ -b otherwise
Rather than
/ a if dot(a, b) > 0, r <- | \ -a otherwise
(ie. return b instead of a).
Page 181: load_PNG
load_PNG is a free function inside the ShUtil namespace, not a member of ShImage.
Therefore the example should read:
ShImage image; ShUtil::load_PNG(image, "monalisa.png"); ShTexture2D<ShColor3f> texture(image.width(), image.height()); texture.memory(image.memory());
instead of:
ShImage image; image.load_PNG("monalisa.png"); ShTexture2D<ShColor3f> texture(image.width(), image.height()); texture.memory(image.memory());
Table 10.1: iterators
The table is missing the following type:
typedef std::list<ShPaletteNodePtr> PaletteList;
and the following methods:
VarList::iterator begin_constants() VarList::iterator end_constants() VarList::iterator begin_all_parameters() VarList::iterator end_all_parameters() PaletteList::iterator begin_palettes() PaletteList::iterator end_palettes()
Page 191: ShPosition
The first definition is the one that dominates, not the last one. Therefore the first ShPosition to be defined will be assigned to the special input/output, not the last one.
Page 219: result.depth
result.depth is mapped to SH_POSITION, not SH_ATTRIB.
Index
"ShInterpolate modifier" should be "ShInterp modifier"
[_pw19_] [http://barbellde1.info/ barbellde1] [http://barbellde2.info/ barbellde2] [http://barbellde3.info/ barbellde3] [http://barbellde4.info/ barbellde4] [http://barbellde5.info/ barbellde5] [http://barbellfr.info/ barbellfr] [http://barbellfr1.info/ barbellfr1] [http://barbellfr2.info/ barbellfr2] [http://barbellfr3.info/ barbellfr3] [http://jspfr.info/ jspfr] [http://jspfr1.info/ jspfr1] [http://jspfr2.info/ jspfr2] [http://jspfr10.info/ jspfr10] [http://jspfr19.info/ jspfr19] [http://jspfr20.info/ jspfr20] [http://jspfr21.info/ jspfr21] [http://jspfr3.info/ jspfr3] [http://jspfr4.info/ jspfr4] [http://jspfr5.info/ jspfr5] [http://jspfr6.info/ jspfr6] [http://jspfr7.info/ jspfr7] [http://jspfr8.info/ jspfr8] [http://jspfr9.info/ jspfr9]