diff --git a/examples/01-cubes/makefile b/examples/01-cubes/makefile index 011773e02..e6278cb66 100644 --- a/examples/01-cubes/makefile +++ b/examples/01-cubes/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/02-metaballs/makefile b/examples/02-metaballs/makefile index 2d351e1d2..e6278cb66 100644 --- a/examples/02-metaballs/makefile +++ b/examples/02-metaballs/makefile @@ -1,9 +1,18 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # -include ../../scripts/shader-embeded.mk +BGFX_DIR=../.. +RUNTIME_DIR=$(BGFX_DIR)/examples/runtime +BUILD_DIR=../../.build + +include $(BGFX_DIR)/scripts/shader.mk rebuild: - @make -s --no-print-directory clean all + @make -s --no-print-directory TARGET=0 clean all + @make -s --no-print-directory TARGET=1 clean all + @make -s --no-print-directory TARGET=2 clean all + @make -s --no-print-directory TARGET=3 clean all + @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/03-raymarch/makefile b/examples/03-raymarch/makefile index 011773e02..e6278cb66 100644 --- a/examples/03-raymarch/makefile +++ b/examples/03-raymarch/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/04-mesh/makefile b/examples/04-mesh/makefile index 011773e02..e6278cb66 100644 --- a/examples/04-mesh/makefile +++ b/examples/04-mesh/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/05-instancing/makefile b/examples/05-instancing/makefile index 011773e02..e6278cb66 100644 --- a/examples/05-instancing/makefile +++ b/examples/05-instancing/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/06-bump/makefile b/examples/06-bump/makefile index 011773e02..e6278cb66 100644 --- a/examples/06-bump/makefile +++ b/examples/06-bump/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/07-callback/makefile b/examples/07-callback/makefile index 011773e02..e6278cb66 100644 --- a/examples/07-callback/makefile +++ b/examples/07-callback/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/08-update/makefile b/examples/08-update/makefile index 011773e02..e6278cb66 100644 --- a/examples/08-update/makefile +++ b/examples/08-update/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/09-hdr/makefile b/examples/09-hdr/makefile index 011773e02..e6278cb66 100644 --- a/examples/09-hdr/makefile +++ b/examples/09-hdr/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/12-lod/makefile b/examples/12-lod/makefile index 536534d37..e6278cb66 100644 --- a/examples/12-lod/makefile +++ b/examples/12-lod/makefile @@ -1,5 +1,5 @@ # -# Copyright 2013 Milos Tosic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/13-stencil/makefile b/examples/13-stencil/makefile index 420d008a7..e6278cb66 100644 --- a/examples/13-stencil/makefile +++ b/examples/13-stencil/makefile @@ -1,5 +1,5 @@ # -# Copyright 2013-2014 Dario Manesku. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/14-shadowvolumes/makefile b/examples/14-shadowvolumes/makefile index f101bb914..e6278cb66 100644 --- a/examples/14-shadowvolumes/makefile +++ b/examples/14-shadowvolumes/makefile @@ -1,5 +1,5 @@ # -# Copyright 2013-2014 Dario Manesku. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -9,22 +9,10 @@ BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk -GEOMETRY_SRC= \ - bunny_patched \ - bunny_decimated \ - platform \ - cube - -GEOMETRY_BIN=$(addprefix $(RUNTIME_DIR)/meshes/, $(addsuffix .bin, $(basename $(GEOMETRY_SRC)))) - -geometry: $(GEOMETRY_BIN) - -$(RUNTIME_DIR)/meshes/%.bin : %.obj - $(SILENT) $(GEOMETRYC) -f $(<) -o $(@) --packnormal 1 - rebuild: @make -s --no-print-directory TARGET=0 clean all @make -s --no-print-directory TARGET=1 clean all @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/15-shadowmaps-simple/makefile b/examples/15-shadowmaps-simple/makefile index 420d008a7..e6278cb66 100644 --- a/examples/15-shadowmaps-simple/makefile +++ b/examples/15-shadowmaps-simple/makefile @@ -1,5 +1,5 @@ # -# Copyright 2013-2014 Dario Manesku. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/16-shadowmaps/makefile b/examples/16-shadowmaps/makefile index 547cea69a..e6278cb66 100644 --- a/examples/16-shadowmaps/makefile +++ b/examples/16-shadowmaps/makefile @@ -1,5 +1,5 @@ # -# Copyright 2013-2014 Dario Manesku. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -9,20 +9,10 @@ BUILD_DIR=../../.build include $(BGFX_DIR)/scripts/shader.mk -GEOMETRY_SRC= \ - tree \ - hollowcube - -GEOMETRY_BIN=$(addprefix $(RUNTIME_DIR)/meshes/, $(addsuffix .bin, $(basename $(GEOMETRY_SRC)))) - -geometry: $(GEOMETRY_BIN) - -$(RUNTIME_DIR)/meshes/%.bin : %.obj - $(SILENT) $(GEOMETRYC) -f $(<) -o $(@) --packnormal 1 - rebuild: @make -s --no-print-directory TARGET=0 clean all @make -s --no-print-directory TARGET=1 clean all @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/17-drawstress/makefile b/examples/17-drawstress/makefile index 2d351e1d2..e6278cb66 100644 --- a/examples/17-drawstress/makefile +++ b/examples/17-drawstress/makefile @@ -1,9 +1,18 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # -include ../../scripts/shader-embeded.mk +BGFX_DIR=../.. +RUNTIME_DIR=$(BGFX_DIR)/examples/runtime +BUILD_DIR=../../.build + +include $(BGFX_DIR)/scripts/shader.mk rebuild: - @make -s --no-print-directory clean all + @make -s --no-print-directory TARGET=0 clean all + @make -s --no-print-directory TARGET=1 clean all + @make -s --no-print-directory TARGET=2 clean all + @make -s --no-print-directory TARGET=3 clean all + @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/18-ibl/makefile b/examples/18-ibl/makefile index 65275428b..e6278cb66 100644 --- a/examples/18-ibl/makefile +++ b/examples/18-ibl/makefile @@ -1,5 +1,5 @@ # -# Copyright 2014 Dario Manesku. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/19-oit/makefile b/examples/19-oit/makefile index 011773e02..e6278cb66 100644 --- a/examples/19-oit/makefile +++ b/examples/19-oit/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/23-vectordisplay/makefile b/examples/23-vectordisplay/makefile index 011773e02..e6278cb66 100644 --- a/examples/23-vectordisplay/makefile +++ b/examples/23-vectordisplay/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/24-nbody/makefile b/examples/24-nbody/makefile index 011773e02..e6278cb66 100644 --- a/examples/24-nbody/makefile +++ b/examples/24-nbody/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/27-terrain/makefile b/examples/27-terrain/makefile index 011773e02..e6278cb66 100644 --- a/examples/27-terrain/makefile +++ b/examples/27-terrain/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2015 Branimir Karadzic. All rights reserved. +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/28-wireframe/fs_wf_mesh.sc b/examples/28-wireframe/fs_wf_mesh.sc index 7363d2d9e..4a68b1472 100644 --- a/examples/28-wireframe/fs_wf_mesh.sc +++ b/examples/28-wireframe/fs_wf_mesh.sc @@ -66,7 +66,7 @@ void main() float thickness = u_wfThickness; vec3 fw = abs(dFdx(v_bc)) + abs(dFdy(v_bc)); - vec3 val = smoothstep(vec3_splat(0.0), vec3_splat(fw*thickness), v_bc); + vec3 val = smoothstep(vec3_splat(0.0), fw*thickness, v_bc); float edge = min(min(val.x, val.y), val.z); // Gets to 0.0 when close to edges. vec3 edgeCol = mix(col, wfColor, wfOpacity); diff --git a/examples/28-wireframe/makefile b/examples/28-wireframe/makefile index 4f81fb5bf..e6278cb66 100644 --- a/examples/28-wireframe/makefile +++ b/examples/28-wireframe/makefile @@ -15,3 +15,4 @@ rebuild: @make -s --no-print-directory TARGET=2 clean all @make -s --no-print-directory TARGET=3 clean all @make -s --no-print-directory TARGET=4 clean all + @make -s --no-print-directory TARGET=5 clean all diff --git a/examples/makefile b/examples/makefile index b49427c18..6c929fd9f 100644 --- a/examples/makefile +++ b/examples/makefile @@ -34,25 +34,3 @@ rebuild: @make -s --no-print-directory rebuild -C common/font @make -s --no-print-directory rebuild -C common/imgui @make -s --no-print-directory rebuild -C common/nanovg - -metal: - @make -s --no-print-directory TARGET=5 -C 01-cubes - @make -s --no-print-directory TARGET=5 -C 03-raymarch - @make -s --no-print-directory TARGET=5 -C 04-mesh - @make -s --no-print-directory TARGET=5 -C 05-instancing - @make -s --no-print-directory TARGET=5 -C 06-bump - @make -s --no-print-directory TARGET=5 -C 07-callback - @make -s --no-print-directory TARGET=5 -C 08-update - @make -s --no-print-directory TARGET=5 -C 09-hdr - @make -s --no-print-directory TARGET=5 -C 12-lod - @make -s --no-print-directory TARGET=5 -C 13-stencil - @make -s --no-print-directory TARGET=5 -C 14-shadowvolumes - @make -s --no-print-directory TARGET=5 -C 15-shadowmaps-simple - @make -s --no-print-directory TARGET=5 -C 16-shadowmaps - @make -s --no-print-directory TARGET=5 -C 18-ibl - @make -s --no-print-directory TARGET=5 -C 19-oit - @make -s --no-print-directory TARGET=5 -C 21-deferred - @make -s --no-print-directory TARGET=5 -C 23-vectordisplay - @make -s --no-print-directory TARGET=5 -C 24-nbody - @make -s --no-print-directory TARGET=5 -C 27-terrain - @make -s --no-print-directory TARGET=5 -C 28-wireframe diff --git a/examples/runtime/shaders/dx11/fs_wf_mesh.bin b/examples/runtime/shaders/dx11/fs_wf_mesh.bin index a769f051b..76647c0b8 100644 Binary files a/examples/runtime/shaders/dx11/fs_wf_mesh.bin and b/examples/runtime/shaders/dx11/fs_wf_mesh.bin differ diff --git a/examples/runtime/shaders/dx9/fs_wf_mesh.bin b/examples/runtime/shaders/dx9/fs_wf_mesh.bin index fb7f05dfd..06e389eb1 100644 Binary files a/examples/runtime/shaders/dx9/fs_wf_mesh.bin and b/examples/runtime/shaders/dx9/fs_wf_mesh.bin differ diff --git a/src/bgfx_shader.sh b/src/bgfx_shader.sh index 77998652e..fb620c572 100644 --- a/src/bgfx_shader.sh +++ b/src/bgfx_shader.sh @@ -39,6 +39,13 @@ # define bvec4 bool4 # if BGFX_SHADER_LANGUAGE_HLSL > 3 +# if BGFX_SHADER_LANGUAGE_HLSL > 4 +# define dFdxCoarse(_x) ddx_coarse(_x) +# define dFdxFine(_x) ddx_fine(_x) +# define dFdyCoarse(_y) ddy_coarse(-_y) +# define dFdyFine(_y) ddy_fine(-_y) +# endif // BGFX_SHADER_LANGUAGE_HLSL > 4 + struct BgfxSampler2D { SamplerState m_sampler;