Flexible Rasterizer in OpenCL
This is the source code to my bachelor's thesis "Flexible Rasterizer in OpenCL":
This project implements an essentially OpenGL 2.0-level software graphics pipeline, called OCLRaster (short for OpenCL Rasterizer), with the addition of some unique features and functionality of more recent OpenGL versions, but also the exclusion of some other features. The pipeline is written and accelerated by OpenCL C on the device side and C++ on the host side, and is capable of running on all OpenCL 1.1 desktop hardware. This includes most modern GPUs and CPUs.
Among the main goals are to provide a simple host API and an easy way to program the vertex and fragment stage, with the direct intention of being similar to a hardware graphics pipeline and API, and accordingly requiring no modification of the pipeline. Both of these should allow for a rather uncomplicated migration of OpenGL programs.
In regard to the implemented features, this software pipeline supports fully programmable depth testing and blending, which are both not possible on today’s graphics hardware, instanced rendering, scissor testing, the previously mentioned vertex and fragment stage programmability, miscellaneous buffer objects in a simplified and unified way, 2D images (hardware accelerated formats and software emulation for unsupported formats), framebuffers and multiple render targets with less restrictions than hardware pipelines, and of course rendering with perspective and orthographic projection modes. Other OpenGL 2.0-level features are however not supported. These include stencil testing (which can however be partially simulated in software by simply using an additional framebuffer attachment), anti-aliasing, 1D and 3D images, occlusion querrying and all of the now obsolete legacy draw functions and modes. The reasons for this are not of any technical nature that would prevent their implementation, but rather due to the time constraints of this thesis/project.
The thesis can be found in the "etc" folder ("oclraster_thesis.pdf":https://github.com/a2flo/oclraster/blob/master/etc/oclraster_thesis.pdf?raw=true).
Software Requirements and Important Information:
Requirements:
Build Instructions:
on Linux and FreeBSD:
on Windows/MinGW:
on OS X:
Credits:
Relevant Links and Papers:
Screenshots:
progress as of 2013/04/27, running on a GPU in OS X: programmable depth testing using a custom depth test function:
#define depth_test(incoming, current) (fmod(incoming, 0.1f) > 0.05f)
!https://dl.dropboxusercontent.com/u/1004620/oclr_programmable_depth_testing.png(programmable depth testing: fmod(incoming, 0.1f) > 0.05f)!
progress as of 2013/04/24, running on a GPU in OS X: _combined 3D and 2D GUI rendering (provided by oclrastersupport) !https://dl.dropboxusercontent.com/u/1004620/oclr_ui.png(combined 3D and 2D GUI rendering (provided by oclraster_support))!
progress as of 2013/04/18, running on a GPU in OS X: 2D/orthographic rendering !https://dl.dropboxusercontent.com/u/1004620/oclr_clock.png(2D/orthographic rendering)!
progress as of 2013/04/15, running on a GPU in OS X: render-to-texture + rendering a triangle fan !https://dl.dropboxusercontent.com/u/1004620/triangle_fan.png(render-to-texture + rendering a triangle fan)!
progress as of 2013/04/04, running on a GPU in OS X: sliced volume rendering !https://dl.dropboxusercontent.com/u/1004620/volume1.png(sliced volume rendering)! !https://dl.dropboxusercontent.com/u/1004620/volume2.png(sliced volume rendering)!
progress as of 2013/04/03, running on a GPU in OS X: render-to-texture / multi-framebuffer support !https://dl.dropboxusercontent.com/u/1004620/rtt.png(render-to-texture / multi-framebuffer support)!
progress as of 2013/03/28, running on a GPU in OS X: programmable blending and more image functionality: native and buffer images, sampling a 32-bit float noise texture, ... !https://dl.dropboxusercontent.com/u/1004620/blending1.png(programmable blending)! !https://dl.dropboxusercontent.com/u/1004620/blending2.png(programmable blending)! !https://dl.dropboxusercontent.com/u/1004620/parallax%2Bfp_noise.png(more image functionality: native and buffer images, sampling a 32-bit float noise texture, ...)!
progress as of 2013/02/21, running on a CPU in OS X and on a dual-core ARM CPU in iOS: subdivided blender monkey with parallax mapping !https://dl.dropboxusercontent.com/u/1004620/osx_blender_monkey_1.png(subdivided blender monkey with parallax mapping)! !https://dl.dropboxusercontent.com/u/1004620/osx_blender_monkey_2.png(subdivided blender monkey with parallax mapping)! note: framebuffer is upscaled by 2x and there are lots of issues with OpenCL on iOS -> defect depth testing !https://dl.dropboxusercontent.com/u/1004620/ios_blender_monkey.png(note: framebuffer is upscaled by 2x and there are lots of issues with OpenCL on iOS -> defect depth testing)!
progress as of 2013/01/19, running on a GPU in OS X and inside a Window VM on a CPU: !https://dl.dropboxusercontent.com/u/1004620/Screen%20Shot%202013-01-19%20at%2012.04.45%20PM.png(moar bunnies)! !https://dl.dropboxusercontent.com/u/1004620/Screen%20Shot%202013-01-19%20at%2012.08.39%20PM.png(bunny on windows)!
progress as of 2012/12/06, running on the CPU: !https://dl.dropboxusercontent.com/u/1004620/Screen%20Shot%202012-12-06%20at%2010.40.05%20AM.png(a bunny of course)!