diff --git a/doc/docs.md b/doc/docs.md index 767c13b9df..bdcc7abe2f 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -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 diff --git a/examples/sokol/02_cubes_glsl/cube_glsl.v b/examples/sokol/02_cubes_glsl/cube_glsl.v index d6e9889d3a..23a79e9cff 100644 --- a/examples/sokol/02_cubes_glsl/cube_glsl.v +++ b/examples/sokol/02_cubes_glsl/cube_glsl.v @@ -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 diff --git a/examples/sokol/03_march_tracing_glsl/rt_glsl.v b/examples/sokol/03_march_tracing_glsl/rt_glsl.v index 34fe7ec69d..420545ac17 100644 --- a/examples/sokol/03_march_tracing_glsl/rt_glsl.v +++ b/examples/sokol/03_march_tracing_glsl/rt_glsl.v @@ -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 diff --git a/examples/sokol/04_multi_shader_glsl/rt_glsl.v b/examples/sokol/04_multi_shader_glsl/rt_glsl.v index 055be77574..640c07c0cf 100644 --- a/examples/sokol/04_multi_shader_glsl/rt_glsl.v +++ b/examples/sokol/04_multi_shader_glsl/rt_glsl.v @@ -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 diff --git a/examples/sokol/05_instancing_glsl/rt_glsl.v b/examples/sokol/05_instancing_glsl/rt_glsl.v index 4994f7e56e..65837e6977 100644 --- a/examples/sokol/05_instancing_glsl/rt_glsl.v +++ b/examples/sokol/05_instancing_glsl/rt_glsl.v @@ -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 /****************************************************************************** diff --git a/examples/sokol/06_obj_viewer/show_obj.v b/examples/sokol/06_obj_viewer/show_obj.v index e2e0be390f..1ac59aeca7 100644 --- a/examples/sokol/06_obj_viewer/show_obj.v +++ b/examples/sokol/06_obj_viewer/show_obj.v @@ -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