Browse Source

Updated makefiles.

Branimir Karadžić 9 năm trước cách đây
mục cha
commit
861a63bf2e

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 12 - 3
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
 # 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:
 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

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 14
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
 # License: http://www.opensource.org/licenses/BSD-2-Clause
 #
 #
 
 
@@ -9,22 +9,10 @@ BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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:
 rebuild:
 	@make -s --no-print-directory TARGET=0 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=1 clean all
 	@make -s --no-print-directory TARGET=2 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=3 clean all
 	@make -s --no-print-directory TARGET=4 clean all
 	@make -s --no-print-directory TARGET=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 12
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
 # License: http://www.opensource.org/licenses/BSD-2-Clause
 #
 #
 
 
@@ -9,20 +9,10 @@ BUILD_DIR=../../.build
 
 
 include $(BGFX_DIR)/scripts/shader.mk
 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:
 rebuild:
 	@make -s --no-print-directory TARGET=0 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=1 clean all
 	@make -s --no-print-directory TARGET=2 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=3 clean all
 	@make -s --no-print-directory TARGET=4 clean all
 	@make -s --no-print-directory TARGET=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 12 - 3
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
 # 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:
 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

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 2 - 1
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
 # 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=2 clean all
 	@make -s --no-print-directory TARGET=3 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=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 1 - 1
examples/28-wireframe/fs_wf_mesh.sc

@@ -66,7 +66,7 @@ void main()
 		float thickness = u_wfThickness;
 		float thickness = u_wfThickness;
 
 
 		vec3 fw = abs(dFdx(v_bc)) + abs(dFdy(v_bc));
 		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.
 		float edge = min(min(val.x, val.y), val.z); // Gets to 0.0 when close to edges.
 
 
 		vec3 edgeCol = mix(col, wfColor, wfOpacity);
 		vec3 edgeCol = mix(col, wfColor, wfOpacity);

+ 1 - 0
examples/28-wireframe/makefile

@@ -15,3 +15,4 @@ rebuild:
 	@make -s --no-print-directory TARGET=2 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=3 clean all
 	@make -s --no-print-directory TARGET=4 clean all
 	@make -s --no-print-directory TARGET=4 clean all
+	@make -s --no-print-directory TARGET=5 clean all

+ 0 - 22
examples/makefile

@@ -34,25 +34,3 @@ rebuild:
 	@make -s --no-print-directory rebuild -C common/font
 	@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/imgui
 	@make -s --no-print-directory rebuild -C common/nanovg
 	@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

BIN
examples/runtime/shaders/dx11/fs_wf_mesh.bin


BIN
examples/runtime/shaders/dx9/fs_wf_mesh.bin


+ 7 - 0
src/bgfx_shader.sh

@@ -39,6 +39,13 @@
 #	define bvec4 bool4
 #	define bvec4 bool4
 
 
 #	if BGFX_SHADER_LANGUAGE_HLSL > 3
 #	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
 struct BgfxSampler2D
 {
 {
 	SamplerState m_sampler;
 	SamplerState m_sampler;