From e60d5532aa0e281f0f86afb089df8ef085284016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 1 Mar 2016 20:31:01 -0800 Subject: [PATCH] Cleanup. --- examples/17-drawstress/makefile | 15 +++------------ src/shader_dx9bc.cpp | 6 +++++- src/shader_dx9bc.h | 2 +- src/shader_spirv.cpp | 6 +++++- src/shader_spirv.h | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/examples/17-drawstress/makefile b/examples/17-drawstress/makefile index e6278cb66..13b0215ee 100644 --- a/examples/17-drawstress/makefile +++ b/examples/17-drawstress/makefile @@ -1,18 +1,9 @@ # -# Copyright 2011-2016 Branimir Karadzic. All rights reserved. +# Copyright 2011-2015 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # -BGFX_DIR=../.. -RUNTIME_DIR=$(BGFX_DIR)/examples/runtime -BUILD_DIR=../../.build - -include $(BGFX_DIR)/scripts/shader.mk +include ../../../scripts/shader-embeded.mk 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 + @make -s --no-print-directory clean all diff --git a/src/shader_dx9bc.cpp b/src/shader_dx9bc.cpp index 071a9e270..b98231216 100644 --- a/src/shader_dx9bc.cpp +++ b/src/shader_dx9bc.cpp @@ -712,7 +712,11 @@ namespace bgfx uint32_t size = read(&reader, instruction); BX_CHECK(size/4 == instruction.length, "read %d, expected %d", size/4, instruction.length); BX_UNUSED(size); - _fn(token * sizeof(uint32_t), instruction, _userData); + bool cont = _fn(token * sizeof(uint32_t), instruction, _userData); + if (!cont) + { + return; + } token += instruction.length; } diff --git a/src/shader_dx9bc.h b/src/shader_dx9bc.h index d7b6b381d..1b0215f0b 100644 --- a/src/shader_dx9bc.h +++ b/src/shader_dx9bc.h @@ -247,7 +247,7 @@ namespace bgfx int32_t read(bx::ReaderSeekerI* _reader, Dx9bc& _dx9bc); int32_t write(bx::WriterSeekerI* _writer, const Dx9bc& _dx9bc); - typedef void (*Dx9bcParseFn)(uint32_t _offset, const Dx9bcInstruction& _instruction, void* _userData); + typedef bool (*Dx9bcParseFn)(uint32_t _offset, const Dx9bcInstruction& _instruction, void* _userData); void parse(const Dx9bcShader& _src, Dx9bcParseFn _fn, void* _userData); typedef void (*Dx9bcFilterFn)(Dx9bcInstruction& _instruction, void* _userData); diff --git a/src/shader_spirv.cpp b/src/shader_spirv.cpp index 63a8b0aa1..1f7033620 100644 --- a/src/shader_spirv.cpp +++ b/src/shader_spirv.cpp @@ -723,7 +723,11 @@ namespace bgfx ); BX_UNUSED(size); - _fn(token * sizeof(uint32_t), instruction, _userData); + bool cont = _fn(token * sizeof(uint32_t), instruction, _userData); + if (!cont) + { + return; + } token += instruction.length; } diff --git a/src/shader_spirv.h b/src/shader_spirv.h index 73577e770..c54ee5d5b 100644 --- a/src/shader_spirv.h +++ b/src/shader_spirv.h @@ -491,7 +491,7 @@ namespace bgfx int32_t read(bx::ReaderSeekerI* _reader, SpirvShader& _shader); int32_t write(bx::WriterI* _writer, const SpirvShader& _shader); - typedef void (*SpirvParseFn)(uint32_t _offset, const SpirvInstruction& _instruction, void* _userData); + typedef bool (*SpirvParseFn)(uint32_t _offset, const SpirvInstruction& _instruction, void* _userData); void parse(const SpirvShader& _src, SpirvParseFn _fn, void* _userData); typedef void (*SpirvFilterFn)(SpirvInstruction& _instruction, void* _userData);