|
1 | 1 |
|
2 | | -# HLSL2GLSLConverterLib |
| 2 | +# HLSL2GLSL Converter Lib |
3 | 3 |
|
4 | 4 | Implementation of HLSL to GLSL source converter |
5 | 5 |
|
6 | 6 | DirectX and OpenGL use different shading languages, which share a lot in common, but sometimes differ substantially. |
7 | 7 | For cross-platform applications, maintaining two versions of each shader is time-consuming and error-prone. Diligent |
8 | 8 | Engine uses HLSL2GLSL Converter that allows shader authored in HLSL to be converted into GLSL source. |
9 | 9 |
|
10 | | -# Details |
| 10 | +## Details |
11 | 11 |
|
12 | 12 |
|
13 | | -## Requirements |
| 13 | +### Requirements |
14 | 14 | The converter supports HLSL5.0, all shader types (vertex, geometry, pixel, domain, hull, and compute) as well as most |
15 | 15 | of the language constructs. There are however few special requirements that must be met in order for the HLSL source |
16 | 16 | to be successfully converted to GLSL: |
@@ -89,7 +89,7 @@ DSOutput main( HS_CONSTANT_DATA_OUTPUT input, |
89 | 89 | * Geometry, Domain and Hull shaders must be defined in separate files |
90 | 90 | * GLSL allows samplers to be declared as global variables or function arguments only. It does not allow local variables of sampler type. |
91 | 91 |
|
92 | | -## Textures and samplers |
| 92 | +### Textures and samplers |
93 | 93 |
|
94 | 94 | The following rules are used to convert HLSL texture declaration into GLSL sampler: |
95 | 95 |
|
@@ -133,7 +133,7 @@ GLSL image format specification inside the special comment block: |
133 | 133 | RWTexture2D<float /* format=r32f */ > Tex2D; |
134 | 134 | ``` |
135 | 135 |
|
136 | | -## Important notes/known issues |
| 136 | +### Important notes/known issues |
137 | 137 |
|
138 | 138 | * GLSL compiler does not handle `float3` (`vec3`) structure members correctly. It is strongly suggested avoid |
139 | 139 | using this type in structure definitions |
@@ -195,7 +195,7 @@ all(p < q); // Error |
195 | 195 | - `TextureCube.SampleCmpLevelZero()` |
196 | 196 | - `TextureCubeArray.SampleCmpLevelZero()` |
197 | 197 |
|
198 | | -## Limitations |
| 198 | +### Limitations |
199 | 199 | Converter does not perform macros expansion, so usage of preprocessor directives is limited to |
200 | 200 | text block that do not need to be converted. The following are some examples that are not supported. |
201 | 201 |
|
@@ -260,40 +260,11 @@ VSOut VSTes(...) |
260 | 260 | } |
261 | 261 | ``` |
262 | 262 |
|
263 | | -# Features |
| 263 | +## Features |
264 | 264 |
|
265 | 265 | Please visit [this page](http://diligentgraphics.com/diligent-engine/shader-converter/supported-features/) |
266 | 266 | for the full list of supported language features. |
267 | 267 |
|
268 | | -# References |
| 268 | +## References |
269 | 269 |
|
270 | 270 | [HLSL to GLSL Source Converter](http://diligentgraphics.com/diligent-engine/shader-converter/) |
271 | | - |
272 | | -# Release Notes |
273 | | - |
274 | | -## 2.1 |
275 | | - |
276 | | -### New features |
277 | | - |
278 | | -* Support for structured buffers |
279 | | -* HLSL->GLSL conversion is now a two-stage process: |
280 | | - - Creating conversion stream |
281 | | - - Creating GLSL source from the stream |
282 | | -* Geometry shader support |
283 | | -* Tessellation control and tessellation evaluation shader support |
284 | | -* Support for non-void shader functions |
285 | | -* Allowing structs as input parameters for shader functions |
286 | | - |
287 | | -## 2.0 |
288 | | - |
289 | | -Reworked the API to follow D3D12 style |
290 | | - |
291 | | -## 1.0 |
292 | | - |
293 | | -Initial release |
294 | | - |
295 | | - |
296 | | - |
297 | | -**Copyright 2015-2018 Egor Yusov** |
298 | | - |
299 | | -[diligentgraphics.com](http://diligentgraphics.com) |
0 commit comments