18377

Cross-Compiling Shading Languages

Lukas Hermanns
Technische Universitat Darmstadt
Technische Universitat Darmstadt, 2017

@MastersThesis{lhermanns2017masterthesis,

   title={Cross-Compiling Shading Languages},

   author={Lukas Hermanns},

   school={Technische Universit{"a}t Darmstadt},

   address={Darmstadt},

   year={2017},

   month={October},

   keywords={shader, compiler, shading language, cross platform}

}

Download Download (PDF)   View View   Source Source   

2763

views

Shading languages are the major class of programming languages for a modern mainstream Graphics Processing Unit (GPU). The programs of those languages are called "Shaders" as they were originally used to describe shading characteristics for computer graphics applications. To make use of GPU accelerated shaders a sophisticated rendering Application Programming Interface (API) is required and the available rendering APIs at the present time are OpenGL, Direct3D, Vulkan, and Metal. While Direct3D and Metal are only supported on a limited set of platforms, OpenGL and Vulkan are for the most part platform independent. On the one hand, Direct3D is the leading rendering API for many real-time graphics applications, especially in the video game industry. But on the other hand, OpenGL and Vulkan are the prevalent rendering APIs on mobile devices, especially for Android with the largest market share. Each rendering API has its own shading language which are very similar to each other but varying enough to make it difficult for developers to write a single shader to be used across multiple APIs. However, since the enormous appearance of mobile devices many graphics systems are reliant on being platform independent. Therefore, several rendering technologies must be provided as back ends. The naive approach is to write all shaders multiple times, i.e. once for each shading language which is errorprone, highly redundant, and difficult to maintain. This thesis investigates different approaches to automatically transform shaders from one high-level language into another, so called "cross-compilation" (sometimes also referred to as "trans-compilation"). High-level to high-level translation is reviewed as well as algorithms with an Intermediate Representation (IR) such as Standard Portable Intermediate Representation (SPIR-V). We are focusing the two most prevalent shading languages, which are firstly OpenGL Shading Language (GLSL) and secondly DirectX High Level Shading Language (HLSL), while Metal Shading Language (MSL) is only briefly examined. The benefits and failings of state-of-the-art approaches are clearly separated and a novel algorithm for generic shader cross-compilation is presented.
No votes yet.
Please wait...

* * *

* * *

HGPU group © 2010-2024 hgpu.org

All rights belong to the respective authors

Contact us: