hi,
i would like to get your comments on the following ideas:
for a 3D renderer with a very flexible API (OpenGL|ES like) i have the problem of creating fast rasterization code. optimal scanline rendering code would have a fixed feature set (say: texturing + gouraud, but no fog and blending). the way i currently solve this problem is to use a python script that creates all kinds of combinations for compile-time function creation. at the moment this means 735 scanline functions, which results in roughly 1MB code size (say a 1MB DLL). by adding more features the code size would grow enormously (e.g. code size would double by adding another independent feature).
obviously an application will only use a very small number of these functions at runtime. so i thought about how to solve this issue at run-time. two solutions came into my mind:
1st: using a PPC native compiler to create necessary code at runtime and dynamically link it to the application.
2nd: self modifying code. write one scanline function that can do all the features. at runtime for each feature combination a copy of this generic function is created and jump-operations are added to skip features that should not be executed.
any comments on these ideas (or other completely different proposals)?
thx,
DANIEL
i would like to get your comments on the following ideas:
for a 3D renderer with a very flexible API (OpenGL|ES like) i have the problem of creating fast rasterization code. optimal scanline rendering code would have a fixed feature set (say: texturing + gouraud, but no fog and blending). the way i currently solve this problem is to use a python script that creates all kinds of combinations for compile-time function creation. at the moment this means 735 scanline functions, which results in roughly 1MB code size (say a 1MB DLL). by adding more features the code size would grow enormously (e.g. code size would double by adding another independent feature).
obviously an application will only use a very small number of these functions at runtime. so i thought about how to solve this issue at run-time. two solutions came into my mind:
1st: using a PPC native compiler to create necessary code at runtime and dynamically link it to the application.
2nd: self modifying code. write one scanline function that can do all the features. at runtime for each feature combination a copy of this generic function is created and jump-operations are added to skip features that should not be executed.
any comments on these ideas (or other completely different proposals)?
thx,
DANIEL