SwiftShader: Technology Overview

Download SwiftShader TransGaming’s SwiftShader Software GPU Toolkit provides developers and systems providers with an ultra-flexible high-performance software 3D renderer that supports multi-core rendering and is suitable for a wide variety of applications. SwiftShader based rendering engines are able to execute complex vertex and pixel shaders, offering a consistent set of features and quality level regardless of hardware graphics capabilities. Using a SwiftShader based solution allows developers to broaden their market penetration to include users who do not have optimal hardware specifications. SwiftShader is also a great tool for systems developers and integrators, allowing them to add advanced 3D graphics capabilities to mobile devices, virtualized environments, or server-based systems.

3DMark06 running using the SwiftShader DirectX® 9.0c Shader Model 3.0 Demo3DMark06 running using the SwiftShader DirectX® 9.0c Shader Model 3.0 DemoAt the developer level, SwiftShader presents familiar graphics APIs in the form of drop-in shared or static libraries. These libraries provide the same APIs that applications are already written to, providing binary compatible with existing applications. Many applications can use SwiftShader by simply dropping a shared library into the same directory as the application.

While the SwiftShader Demo is available as a Microsoft Windows® DLL providing DirectX® 9.0c Shader Model 3.0 level features, the SwiftShader Software GPU Toolkit has an extremely modular architecture. New front-end APIs, back-end code generation systems, and support for various OS platforms can easily be added. SwiftShader can also be integrated more deeply, serving as a software engine for rich multimedia platforms, for example, or as a device driver in an embedded system. Using a SwiftShader based renderer with a custom API interface, applications could even create new features which are not available through industry standard APIs, to achieve greater performance or to create never seen before effects. SwiftShader provides limitless opportunities for developers to explore the potential of software rendering.

In addition to Direct3D® 9.0c Shader Model 3.0 / OpenGL® ES 2.0 level shader support, SwiftShader based renderers can also include a wide range of other features required by today's applications and games. These include high quality anti-aliasing, anisotropic texture sampling, vertex texture fetch, instancing, shadow buffers, and all other features expected from hardware devices in this class. Despite the extensive feature list, SwiftShader based renderers are able to perform at speeds previously possible only with dedicated hardware.

SwiftShader’s core component, the renderer, coordinates the actual rendering processes. It consists of four major sub-components: data management, state management, command processing, and code generation. Data management converts graphics data such as textures and vertices into formats that are faster to process by the CPU, providing full data abstraction to the API layer. This layer greatly facilitates supporting both the common and more exotic data types applications may use. As a result, SwiftShader supports more data formats than any dedicated graphics chip. Furthermore, the data management system supports asynchronous updates, maximizing the concurrency on multi-core processors.

SwiftShader’s state management layer manages graphics pipeline state information, supporting fixed function pipelines, shader-based pipelines, or both, as required. The relationships between changing sets of graphics state are carefully analyzed and optimized so that no unnecessary operations are performed. The state management layer also allows for caching of already generated and compiled graphics processing routines, so that when the same state is encountered again it doesn’t have to be regenerated.

The SwiftShader command processor breaks the rendering tasks into sub-tasks, and schedules them for execution onto as many threads as the processor supports. It coordinates with the data manager to allow independent subtasks to execute concurrently, while minimizing the amount of memory used for intermediate results and pending tasks.

The renderer’s code generation component is the key to SwiftShader’s unprecedented performance. Unlike traditional software renderers, which have a limited number of static processing routines, SwiftShader generates new processing routines dynamically at run-time. The code generator is responsible for translating the graphics state into processing routines that perform exactly the operations required by this state. SwiftShader supports two intermediate representations: SwiftAsm and Reactor. SwiftAsm instructions correspond directly to x86 instructions, while Reactor is a powerful high-level language built on top of the LLVM compiler infrastructure.

Architecture of the SwiftShader Software GPU Toolkit Architecture of the SwiftShader Software GPU ToolkitSwiftAsm code undergoes register allocation and basic dead code elimination in-place during the code generation phase, so synthesizing the actual binary code is a direct translation, making SwiftAsm extremely fast and compact. SwiftAsm also allows for hand-tuned use of the latest instruction set extensions. Aside from x86 and x64, SwiftAsm can also operate in an emulation mode, in which each instruction is implemented as C++ code, allowing fast prototyping on any platform with a C++ compiler.

Reactor code is compiled into executable functions by the LLVM compiler infrastructure in a Just-In-Time fashion. This powerful and highly modular compiler offers sophisticated support for vector operations and state of the art optimization passes. While requiring additional time for optimization, Reactor/LLVM generated routines may run significantly faster - in particular the generated intermediate code for complex Shader Model 3.0 shaders contain many optimization opportunities which are handled very efficiently by LLVM. Finally, the Reactor/LLVM sub-system allows support for additional CPU back-ends for non-x86 hardware.

TransGaming’s SwiftShader Software GPU Toolkit offers your application the infinite flexibility of software, providing the exact feature set you require, and customizable to your precise needs. SwiftShader is available now for commercial licensing for applications, operating systems, device drivers, and embedded systems. For more information or to obtain pricing for your particular usage, please contact us.