docs: add link to shader inclusion example (#12613)
parent
0f59d88ba6
commit
83260e5074
|
@ -4132,7 +4132,7 @@ and use `v shader` to compile them for all supported target platforms.
|
|||
v shader /path/to/project/dir/or/file.v
|
||||
```
|
||||
|
||||
Currently you need to include a header and declare a glue function before
|
||||
Currently you need to [include a header and declare a glue function](https://github.com/vlang/v/blob/c14c324/examples/sokol/02_cubes_glsl/cube_glsl.v#L43-L46) before
|
||||
using the shader in your code.
|
||||
|
||||
### Profiling
|
||||
|
|
|
@ -7,25 +7,8 @@
|
|||
* that can be found in the LICENSE file.
|
||||
*
|
||||
* HOW TO COMPILE SHADERS:
|
||||
* - download the sokol shader convertor tool from https://github.com/floooh/sokol-tools-bin
|
||||
*
|
||||
* - compile the .glsl shader with:
|
||||
* linux : sokol-shdc --input cube_glsl.glsl --output cube_glsl.h --slang glsl330
|
||||
* windows: sokol-shdc.exe --input cube_glsl.glsl --output cube_glsl.h --slang glsl330
|
||||
*
|
||||
* --slang parameter can be:
|
||||
* - glsl330: desktop GL
|
||||
* - glsl100: GLES2 / WebGL
|
||||
* - glsl300es: GLES3 / WebGL2
|
||||
* - hlsl4: D3D11
|
||||
* - hlsl5: D3D11
|
||||
* - metal_macos: Metal on macOS
|
||||
* - metal_ios: Metal on iOS device
|
||||
* - metal_sim: Metal on iOS simulator
|
||||
* - wgpu: WebGPU
|
||||
*
|
||||
* you can have multiple platforms at the same time passing prameter like this: --slang glsl330:hlsl5:metal_macos
|
||||
* for further infos have a look at the sokol shader tool docs.
|
||||
* Run `v shader .` in this directory to compile the shaders.
|
||||
* For more info and help with shader compilation see `docs.md` and `v help shader`.
|
||||
*
|
||||
* TODO:
|
||||
* - add instancing
|
||||
|
@ -41,7 +24,7 @@ import gg.m4
|
|||
|
||||
// GLSL Include and functions
|
||||
#flag -I @VMODROOT/.
|
||||
#include "cube_glsl.h" #Please use sokol-shdc to generate the necessary cube_glsl.h file from cube_glsl.glsl (see the instructions at the top of this file)
|
||||
#include "cube_glsl.h" # Should be generated with `v shader .` (see the instructions at the top of this file)
|
||||
|
||||
fn C.cube_shader_desc(gfx.Backend) &C.sg_shader_desc
|
||||
|
||||
|
|
|
@ -7,25 +7,8 @@
|
|||
* that can be found in the LICENSE file.
|
||||
*
|
||||
* HOW TO COMPILE SHADERS:
|
||||
* - download the sokol shader convertor tool from https://github.com/floooh/sokol-tools-bin
|
||||
*
|
||||
* - compile the .glsl shader with:
|
||||
* linux : sokol-shdc --input rt_glsl.glsl --output rt_glsl.h --slang glsl330
|
||||
* windows: sokol-shdc.exe --input rt_glsl.glsl --output rt_glsl.h --slang glsl330
|
||||
*
|
||||
* --slang parameter can be:
|
||||
* - glsl330: desktop GL
|
||||
* - glsl100: GLES2 / WebGL
|
||||
* - glsl300es: GLES3 / WebGL2
|
||||
* - hlsl4: D3D11
|
||||
* - hlsl5: D3D11
|
||||
* - metal_macos: Metal on macOS
|
||||
* - metal_ios: Metal on iOS device
|
||||
* - metal_sim: Metal on iOS simulator
|
||||
* - wgpu: WebGPU
|
||||
*
|
||||
* you can have multiple platforms at the same time passing parameters like this: --slang glsl330:hlsl5:metal_macos
|
||||
* for further infos have a look at the sokol shader tool docs.
|
||||
* Run `v shader .` in this directory to compile the shaders.
|
||||
* For more info and help with shader compilation see `docs.md` and `v help shader`.
|
||||
*
|
||||
* TODO:
|
||||
* - frame counter
|
||||
|
@ -42,7 +25,7 @@ import time
|
|||
// GLSL Include and functions
|
||||
|
||||
#flag -I @VMODROOT/.
|
||||
#include "rt_glsl.h" #Please use sokol-shdc to generate the necessary rt_glsl.h file from rt_glsl.glsl (see the instructions at the top of this file)
|
||||
#include "rt_glsl.h" # Should be generated with `v shader .` (see the instructions at the top of this file)
|
||||
|
||||
fn C.rt_shader_desc(gfx.Backend) &C.sg_shader_desc
|
||||
|
||||
|
|
|
@ -7,27 +7,8 @@
|
|||
* that can be found in the LICENSE file.
|
||||
*
|
||||
* HOW TO COMPILE SHADERS:
|
||||
* - download the sokol shader convertor tool from https://github.com/floooh/sokol-tools-bin
|
||||
*
|
||||
* - compile the .glsl shared file with:
|
||||
* linux : sokol-shdc --input rt_glsl_puppy.glsl --output rt_glsl_puppy.h --slang glsl330
|
||||
sokol-shdc --input rt_glsl_march.glsl --output rt_glsl_march.h --slang glsl330
|
||||
* windows: sokol-shdc.exe --input rt_glsl_puppy.glsl --output rt_glsl_puppy.h --slang glsl330
|
||||
* sokol-shdc.exe --input rt_glsl_march.glsl --output rt_glsl_march.h --slang glsl330
|
||||
*
|
||||
* --slang parameter can be:
|
||||
* - glsl330: desktop GL
|
||||
* - glsl100: GLES2 / WebGL
|
||||
* - glsl300es: GLES3 / WebGL2
|
||||
* - hlsl4: D3D11
|
||||
* - hlsl5: D3D11
|
||||
* - metal_macos: Metal on macOS
|
||||
* - metal_ios: Metal on iOS device
|
||||
* - metal_sim: Metal on iOS simulator
|
||||
* - wgpu: WebGPU
|
||||
*
|
||||
* you can have multiple platforms at the same time passing parameters like this: --slang glsl330:hlsl5:metal_macos
|
||||
* for further infos have a look at the sokol shader tool docs.
|
||||
* Run `v shader .` in this directory to compile the shaders.
|
||||
* For more info and help with shader compilation see `docs.md` and `v help shader`.
|
||||
*
|
||||
* TODO:
|
||||
* - frame counter
|
||||
|
@ -43,8 +24,8 @@ import time
|
|||
|
||||
// GLSL Include and functions
|
||||
#flag -I @VMODROOT/.
|
||||
#include "rt_glsl_march.h" #Please use sokol-shdc to generate the necessary rt_glsl_march.h file from rt_glsl_march.glsl (see the instructions at the top of this file)
|
||||
#include "rt_glsl_puppy.h" #Please use sokol-shdc to generate the necessary rt_glsl_puppy.h file from rt_glsl_puppy.glsl (see the instructions at the top of this file)
|
||||
#include "rt_glsl_march.h" # Should be generated with `v shader .` (see the instructions at the top of this file)
|
||||
#include "rt_glsl_puppy.h" # Should be generated with `v shader .` (see the instructions at the top of this file)
|
||||
fn C.rt_march_shader_desc(gfx.Backend) &C.sg_shader_desc
|
||||
fn C.rt_puppy_shader_desc(gfx.Backend) &C.sg_shader_desc
|
||||
|
||||
|
|
|
@ -7,25 +7,8 @@
|
|||
* that can be found in the LICENSE file.
|
||||
*
|
||||
* HOW TO COMPILE SHADERS:
|
||||
* - download the sokol shader convertor tool from https://github.com/floooh/sokol-tools-bin
|
||||
*
|
||||
* - compile the .glsl shared file with:
|
||||
* linux : sokol-shdc --input rt_glsl_instancing.glsl --output rt_glsl_instancing.h --slang glsl330
|
||||
* windows: sokol-shdc.exe --input rt_glsl_instancing.glsl --output rt_glsl_instancing.h --slang glsl330
|
||||
*
|
||||
* --slang parameter can be:
|
||||
* - glsl330: desktop GL
|
||||
* - glsl100: GLES2 / WebGL
|
||||
* - glsl300es: GLES3 / WebGL2
|
||||
* - hlsl4: D3D11
|
||||
* - hlsl5: D3D11
|
||||
* - metal_macos: Metal on macOS
|
||||
* - metal_ios: Metal on iOS device
|
||||
* - metal_sim: Metal on iOS simulator
|
||||
* - wgpu: WebGPU
|
||||
*
|
||||
* you can have multiple platforms at the same time passing parameters like this: --slang glsl330:hlsl5:metal_macos
|
||||
* for further infos have a look at the sokol shader tool docs.
|
||||
* Run `v shader .` in this directory to compile the shaders.
|
||||
* For more info and help with shader compilation see `docs.md` and `v help shader`.
|
||||
*
|
||||
* TODO:
|
||||
* - frame counter
|
||||
|
@ -80,7 +63,7 @@ mut:
|
|||
* GLSL Include and functions
|
||||
******************************************************************************/
|
||||
#flag -I @VMODROOT/.
|
||||
#include "rt_glsl_instancing.h" #Please use sokol-shdc to generate the necessary rt_glsl_march.h file from rt_glsl_march.glsl (see the instructions at the top of this file)
|
||||
#include "rt_glsl_instancing.h" # Should be generated with `v shader .` (see the instructions at the top of this file)
|
||||
fn C.instancing_shader_desc(gfx.Backend) &C.sg_shader_desc
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -9,25 +9,8 @@
|
|||
* Example .obj model of V from SurmanPP
|
||||
*
|
||||
* HOW TO COMPILE SHADERS:
|
||||
* - download the sokol shader convertor tool from https://github.com/floooh/sokol-tools-bin
|
||||
*
|
||||
* - compile the .glsl shader with:
|
||||
* linux : sokol-shdc --input gouraud.glsl --output gouraud.h --slang glsl330
|
||||
* windows: sokol-shdc.exe --input gouraud.glsl --output gouraud.h --slang glsl330
|
||||
*
|
||||
* --slang parameter can be:
|
||||
* - glsl330: desktop GL
|
||||
* - glsl100: GLES2 / WebGL
|
||||
* - glsl300es: GLES3 / WebGL2
|
||||
* - hlsl4: D3D11
|
||||
* - hlsl5: D3D11
|
||||
* - metal_macos: Metal on macOS
|
||||
* - metal_ios: Metal on iOS device
|
||||
* - metal_sim: Metal on iOS simulator
|
||||
* - wgpu: WebGPU
|
||||
*
|
||||
* you can have multiple platforms at the same time passing parameters like this: --slang glsl330:hlsl5:metal_macos
|
||||
* for further infos have a look at the sokol shader tool docs.
|
||||
* Run `v shader .` in this directory to compile the shaders.
|
||||
* For more info and help with shader compilation see `docs.md` and `v help shader`.
|
||||
*
|
||||
* ALTERNATIVE .OBJ MODELS:
|
||||
* you can load alternative models putting them in the "assets/model" folder with or without their .mtl file.
|
||||
|
@ -50,7 +33,7 @@ import obj
|
|||
// GLSL Include and functions
|
||||
|
||||
#flag -I @VMODROOT/.
|
||||
#include "gouraud.h" #Please use sokol-shdc to generate the necessary rt_glsl.h file from rt_glsl.glsl (see the instructions at the top of this file)
|
||||
#include "gouraud.h" # Should be generated with `v shader .` (see the instructions at the top of this file)
|
||||
|
||||
fn C.gouraud_shader_desc(gfx.Backend) &C.sg_shader_desc
|
||||
|
||||
|
|
Loading…
Reference in New Issue