Merge pull request #762 from trzecieu/patch-1

Syntax coloring for C++ snippets in README.md
This commit is contained in:
Hans-Kristian Arntzen 2018-11-19 10:13:06 +01:00 committed by GitHub
commit 7611dc0967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,7 @@ For more in-depth documentation than what's provided in this README, please have
To perform reflection and convert to other shader languages you can use the SPIRV-Cross API.
For example:
```
```c++
#include "spirv_glsl.hpp"
#include <vector>
#include <utility>
@ -150,7 +150,7 @@ Likely cause: If this SPIR-V was created from glslang HLSL, make sure the entry
HLSL relies on semantics in order to effectively link together shader stages. In the SPIR-V generated by glslang, the transformation from HLSL to GLSL ends up looking like
```
```c++
struct VSOutput {
// SV_Position is rerouted to gl_Position
float4 position : SV_Position;
@ -190,7 +190,7 @@ This is not supported in legacy GL/GLES targets, so to support this, varying str
This is done automatically, but the API user might need to be aware that this is happening in order to support all cases.
Modern GLES code like this:
```
```c++
struct Output {
vec4 a;
vec2 b;
@ -199,7 +199,7 @@ out Output vout;
```
Is transformed into:
```
```c++
struct Output {
vec4 a;
vec2 b;
@ -216,7 +216,7 @@ API users might want to ensure that both the struct names and member names match
Another thing you need to remember is when using samplers and textures in HLSL these are separable, and not directly compatible with GLSL. If you need to use this with desktop GL/GLES, you need to call `Compiler::build_combined_image_samplers` first before calling `Compiler::compile`, or you will get an exception.
```
```c++
// From main.cpp
// Builds a mapping for all combinations of images and samplers.
compiler->build_combined_image_samplers();