diff options
author | 2016-03-08 11:44:52 +0100 | |
---|---|---|
committer | 2016-03-08 12:58:10 +0100 | |
commit | 6412c5e0763dc079312cd5c81cb077d0c393b2b4 (patch) | |
tree | ed41c94128216146df63c43cd8a5965897557175 | |
parent | 1f352c6af853e5cb0dc06ea6596be77db953a9fd (diff) |
Update BGFX and BX (nw)
477 files changed, 12677 insertions, 2995 deletions
diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/Changelog.md b/3rdparty/bgfx/3rdparty/glsl-optimizer/Changelog.md index ee09e0250e6..39ce18b2541 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/Changelog.md +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/Changelog.md @@ -1,6 +1,14 @@ GLSL optimizer Change Log ========================= +2016 03 +------- + +Fixed: + +* Fixed translation performance regression in loop analysis (regressed in 2015 06 fixes). + + 2015 08 ------- @@ -35,6 +43,7 @@ Fixes: ------- Goodies: + * GLES2: support EXT_draw_instanced / gl_InstanceIDEXT. * Support gl_VertexID in GLSL < 1.30 when EXT_gpu_shader4 is used. diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glsl_optimizer.cpp b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glsl_optimizer.cpp index c4e7a03cccc..e91b86a935e 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glsl_optimizer.cpp +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glsl_optimizer.cpp @@ -440,8 +440,12 @@ static bool propagate_precision(exec_list* list, bool assign_high_to_undefined) static void do_optimization_passes(exec_list* ir, bool linked, _mesa_glsl_parse_state* state, void* mem_ctx) { bool progress; + // FIXME: Shouldn't need to bound the number of passes + int passes = 0, + kMaximumPasses = 1000; do { progress = false; + ++passes; bool progress2; debug_print_ir ("Initial", ir, state, mem_ctx); if (linked) { @@ -497,7 +501,7 @@ static void do_optimization_passes(exec_list* ir, bool linked, _mesa_glsl_parse_ } delete ls; } - } while (progress); + } while (progress && passes < kMaximumPasses); if (!state->metal_target) { diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp index 9f7071d9564..f9988a31f61 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ir_print_metal_visitor.cpp @@ -1020,17 +1020,7 @@ void ir_print_metal_visitor::visit(ir_expression *ir) const bool halfCast = (arg_prec == glsl_precision_medium || arg_prec == glsl_precision_low); buffer.asprintf_append (halfCast ? "((half)1.0/(" : "(1.0/("); } else { - switch(ir->operation) { - case ir_unop_dFdy: - case ir_unop_dFdy_coarse: - case ir_unop_dFdy_fine: - buffer.asprintf_append ("%s(-", operator_glsl_strs[ir->operation]); - break; - - default: - buffer.asprintf_append ("%s(", operator_glsl_strs[ir->operation]); - break; - } + buffer.asprintf_append ("%s(", operator_glsl_strs[ir->operation]); } if (ir->operands[0]) ir->operands[0]->accept(this); diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/list.h b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/list.h index b6c32bcccaf..ae0a15cae5b 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/list.h +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/list.h @@ -163,8 +163,10 @@ exec_node_get_prev(struct exec_node *n) static inline void exec_node_remove(struct exec_node *n) { - n->next->prev = n->prev; - n->prev->next = n->next; + if (n->next) + n->next->prev = n->prev; + if (n->prev) + n->prev->next = n->next; n->next = NULL; n->prev = NULL; } diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/loop_analysis.cpp b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/loop_analysis.cpp index 240ffc7399d..b0d3e306375 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/loop_analysis.cpp +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/loop_analysis.cpp @@ -25,11 +25,10 @@ #include "loop_analysis.h" #include "ir_hierarchical_visitor.h" #include "ir_variable_refcount.h" +#include "util/hash_table.h" static bool is_loop_terminator(ir_if *ir); -static bool used_outside_loops(exec_node *head, ir_variable *var, bool first_assignment); - static bool all_expression_operands_are_loop_constant(ir_rvalue *, hash_table *); @@ -84,6 +83,8 @@ loop_state::loop_state() hash_table_pointer_compare); this->ht_non_inductors = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); + this->ht_variables = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); this->mem_ctx = ralloc_context(NULL); this->loop_found = false; } @@ -94,6 +95,7 @@ loop_state::~loop_state() hash_table_dtor(this->ht); hash_table_dtor(this->ht_inductors); hash_table_dtor(this->ht_non_inductors); + hash_table_dtor(this->ht_variables); ralloc_free(this->mem_ctx); } @@ -122,10 +124,36 @@ loop_state::get_for_inductor(const ir_variable *ir) return (loop_variable_state *) hash_table_find(this->ht_inductors, ir); } +static void *unreferenced_variable = (void *)1; +static void *assigned_variable = (void *)2; + void -loop_state::insert_non_inductor(ir_variable *var) +loop_state::insert_variable(ir_variable *var) { - // key doesn't matter, just needs to be non-NULL + // data starts as 1. If an assignment is seen, it's replaced with 2. + // this way we can mark a variable as a non-inductor if it's referenced + // other than the first assignment + hash_table_insert(this->ht_variables, unreferenced_variable, var); +} + +void +loop_state::reference_variable(ir_variable *var, bool assignment) +{ + void *ref = hash_table_find(this->ht_variables, var); + + // variable declaration was not seen or already discarded, just ignore + if (ref == NULL) + return; + + if (ref == unreferenced_variable && assignment) + { + hash_table_replace(this->ht_variables, assigned_variable, var); + return; + } + + // variable is referenced and not just in an initial assignment, + // so it cannot be an inductor + hash_table_remove(this->ht_variables, var); hash_table_insert(this->ht_non_inductors, this, var); } @@ -266,10 +294,14 @@ public: virtual ir_visitor_status visit_enter(ir_if *); virtual ir_visitor_status visit_leave(ir_if *); + void visit_general(ir_instruction *); + loop_state *loops; int if_statement_depth; + bool first_pass; + ir_assignment *current_assignment; exec_list state; @@ -277,10 +309,17 @@ public: } /* anonymous namespace */ +void loop_enter_callback(class ir_instruction *ir, void *data) +{ + ((loop_analysis *)data)->visit_general(ir); +} + loop_analysis::loop_analysis(loop_state *loops) - : loops(loops), if_statement_depth(0), current_assignment(NULL) + : loops(loops), if_statement_depth(0), current_assignment(NULL), first_pass(false) { /* empty */ + data_enter = this; + callback_enter = &loop_enter_callback; } @@ -308,16 +347,11 @@ loop_analysis::visit(ir_variable *var) if (!this->state.is_empty()) return visit_continue; - // Check if this variable is used outside a loop anywhere. If it is, it can't be a - // variable that's private to the loop, so can't be an inductor. - // This doesn't reject all possible non-inductors, notably anything declared in an - // outer loop that isn't an inductor in an inner loop, but it can eliminate some - // problem cases - if (used_outside_loops(var->next, var, false)) - { - // add to list of "non inductors" - loops->insert_non_inductor(var); - } + // In the first pass over the instructions we look at variables declared and + // examine their references to determine if they can be an inductor or not + // for the second pass + if (this->first_pass) + loops->insert_variable(var); return visit_continue; } @@ -339,10 +373,15 @@ loop_analysis::visit_enter(ir_call *) ir_visitor_status loop_analysis::visit(ir_dereference_variable *ir) { - /* If we're not somewhere inside a loop, there's nothing to do. + /* If we're not somewhere inside a loop, just check for + * non-inductors */ - if (this->state.is_empty()) + if (this->state.is_empty() || this->first_pass) + { + if (this->state.is_empty() && this->first_pass) + loops->reference_variable(ir->variable_referenced(), this->in_assignee); return visit_continue; + } bool nested = false; @@ -382,8 +421,11 @@ loop_analysis::visit_leave(ir_loop *ir) * We could perform some conservative analysis (prove there's no statically * possible assignment, etc.) but it isn't worth it for now; function * inlining will allow us to unroll loops anyway. + * + * We also skip doing any work in the first pass, where we are just identifying + * variables that cannot be inductors. */ - if (ls->contains_calls) + if (ls->contains_calls || this->first_pass) return visit_continue; foreach_in_list(ir_instruction, node, &ir->body_instructions) { @@ -591,7 +633,7 @@ loop_analysis::visit_enter(ir_assignment *ir) /* If we're not somewhere inside a loop, there's nothing to do. */ if (this->state.is_empty()) - return visit_continue_with_parent; + return visit_continue; this->current_assignment = ir; @@ -601,10 +643,8 @@ loop_analysis::visit_enter(ir_assignment *ir) ir_visitor_status loop_analysis::visit_leave(ir_assignment *ir) { - /* Since the visit_enter exits with visit_continue_with_parent for this - * case, the loop state stack should never be empty here. - */ - assert(!this->state.is_empty()); + if (this->state.is_empty()) + return visit_continue; assert(this->current_assignment == ir); this->current_assignment = NULL; @@ -612,6 +652,24 @@ loop_analysis::visit_leave(ir_assignment *ir) return visit_continue; } +void +loop_analysis::visit_general(ir_instruction *ir) +{ + /* If we're inside a loop, we can't start marking things as non-inductors + * Likewise in the second pass we've done all this work, so return early + */ + if (!this->state.is_empty() || !this->first_pass) + return; + + ir_variable_refcount_visitor refs; + ir->accept (&refs); + + struct hash_entry *referenced_var; + hash_table_foreach (refs.ht, referenced_var) { + ir_variable *var = (ir_variable *)referenced_var->key; + loops->reference_variable(var, false); + } +} class examine_rhs : public ir_hierarchical_visitor { public: @@ -733,72 +791,23 @@ is_loop_terminator(ir_if *ir) return true; } - -bool -used_outside_loops(exec_node *head, ir_variable *var, bool first_assignment) -{ - ir_variable_refcount_visitor refs; - for (exec_node* node = head; - !node->is_tail_sentinel(); - node = node->next) - { - ir_instruction *ir = (ir_instruction *) node; - if (ir->ir_type == ir_type_variable) - continue; - - // ignore the first assignment - if (!first_assignment && ir->ir_type == ir_type_assignment) - { - ir_assignment *assign = ir->as_assignment(); - ir_variable *assignee = assign->lhs->whole_variable_referenced(); - - if(assignee == var) - { - first_assignment = true; - continue; - } - } - - // we don't want to recurse into loops - if (ir->ir_type == ir_type_loop) - continue; - - // recurse only for if statements, the other case we would need to recurse is - // loops, but we are looking for uses outside of loops. - if (ir->ir_type == ir_type_if) - { - ir_if *irif = ir->as_if(); - if (used_outside_loops(irif->then_instructions.head, var, first_assignment)) - return true; - if (used_outside_loops(irif->else_instructions.head, var, first_assignment)) - return true; - - // if we didn't find in each branch with our recursion, skip - // otherwise the accept (&refs) below will recurse into loops - // and may give a false positive. - continue; - } - - // we know that we're not inside a loop as we haven't recursed inside, - // and we started outside of a loop, so any references to this variable - // mean it is used outside of any loops - ir->accept (&refs); - if (refs.find_variable_entry(var)) - { - return true; - } - } - - return false; -} - - loop_state * analyze_loop_variables(exec_list *instructions) { loop_state *loops = new loop_state; loop_analysis v(loops); + /* Do two passes over the instructions. The first pass builds a view + * of the variables declared and whether or not they're used outside + * of loops (if so, they cannot be inductors). + * + * In the second pass we apply this information to do the loop analysis + * itself. + */ + v.first_pass = true; v.run(instructions); + v.first_pass = false; + v.run(instructions); + return v.loops; } diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/loop_analysis.h b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/loop_analysis.h index 299dbcfc89b..3b6b2d011f9 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/loop_analysis.h +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/loop_analysis.h @@ -251,6 +251,8 @@ public: loop_variable_state* get_for_inductor (const ir_variable*); bool insert_inductor(loop_variable* loopvar, loop_variable_state* state, ir_loop* loop); void insert_non_inductor(ir_variable *var); + void insert_variable(ir_variable *var); + void reference_variable(ir_variable *var, bool assignment); bool loop_found; @@ -267,6 +269,7 @@ private: */ hash_table *ht_inductors; hash_table *ht_non_inductors; + hash_table *ht_variables; void *mem_ctx; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/mesa/program/prog_hash_table.c b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/mesa/program/prog_hash_table.c index 3b2152b69e2..680699b567f 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/mesa/program/prog_hash_table.c +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/mesa/program/prog_hash_table.c @@ -84,6 +84,8 @@ hash_table_ctor(unsigned num_buckets, hash_func_t hash, void hash_table_dtor(struct hash_table *ht) { + if (!ht) + return; hash_table_clear(ht); free(ht); } diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/array-const-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/array-const-outES3Metal.txt index cb270ab79c7..3021d1f2eb8 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/array-const-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/array-const-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { }; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/array-constconst-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/array-constconst-outES3Metal.txt index cb270ab79c7..3021d1f2eb8 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/array-constconst-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/array-constconst-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { }; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ast-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ast-outES3Metal.txt index 0069dadf46a..4bd58f3258f 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ast-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ast-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 gl_FragCoord [[position]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-loop-undeclaredinductor-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-loop-undeclaredinductor-outES3Metal.txt index 7961441587a..c794c125922 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-loop-undeclaredinductor-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-loop-undeclaredinductor-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { half2 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-sampler-highp-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-sampler-highp-outES3Metal.txt index 993c73706a7..424ef01645f 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-sampler-highp-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-sampler-highp-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 varUV; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-sampler-highpfull-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-sampler-highpfull-outES3Metal.txt index 504f13c2fa0..f6753627729 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-sampler-highpfull-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/bug-sampler-highpfull-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; constant float2 _xlat_mtl_const1[12] = {float2(-0.326212, -0.40581), float2(-0.840144, -0.07358), float2(-0.695914, 0.457137), float2(-0.203345, 0.620716), float2(0.96234, -0.194983), float2(0.473434, -0.480026), float2(0.519456, 0.767022), float2(0.185461, -0.893124), float2(0.507431, 0.064425), float2(0.89642, 0.412458), float2(-0.32194, -0.932615), float2(-0.791559, -0.59771)}; struct xlatMtlShaderInput { diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/builtin-vars-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/builtin-vars-outES3Metal.txt index c9a6e79087d..82058c2372d 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/builtin-vars-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/builtin-vars-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 gl_PointCoord [[point_coord]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/fragdepth-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/fragdepth-outES3Metal.txt index 4e428db7521..b3ab30301ab 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/fragdepth-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/fragdepth-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { }; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/framebuffer_fetch-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/framebuffer_fetch-outES3Metal.txt index 1d924da0d56..c2470caf352 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/framebuffer_fetch-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/framebuffer_fetch-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { half4 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/glsl120-basic-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/glsl120-basic-outES3Metal.txt index 94760a640d9..4f5521cde7d 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/glsl120-basic-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/glsl120-basic-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { }; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/intrinsics-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/intrinsics-outES3Metal.txt index ef6d9b456b7..223b512f488 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/intrinsics-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/intrinsics-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/loop-for-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/loop-for-outES3Metal.txt index 0017785998c..87ded88ac8e 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/loop-for-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/loop-for-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 xlv_uv; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/loop-forafterdiscard-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/loop-forafterdiscard-outES3Metal.txt index 171650fb84d..562cb9acb7c 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/loop-forafterdiscard-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/loop-forafterdiscard-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 xlv_uv; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/matrix-cast-types-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/matrix-cast-types-outES3Metal.txt index bb6013bd8b7..f0df5674877 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/matrix-cast-types-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/matrix-cast-types-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; inline float4x4 _xlcast_float4x4(half4x4 v) { return float4x4(float4(v[0]), float4(v[1]), float4(v[2]), float4(v[3])); } inline float3x3 _xlcast_float3x3(half3x3 v) { return float3x3(float3(v[0]), float3(v[1]), float3(v[2])); } diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/matrix-ops-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/matrix-ops-outES3Metal.txt index 458ecd3d401..1fbb32d9b16 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/matrix-ops-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/matrix-ops-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; inline float4x4 _xlinit_float4x4(float v) { return float4x4(float4(v), float4(v), float4(v), float4(v)); } inline float3x3 _xlinit_float3x3(float v) { return float3x3(float3(v), float3(v), float3(v)); } diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-mixed-array-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-mixed-array-outES3Metal.txt index 3e3ab12588e..4c9c30d5bcf 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-mixed-array-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-mixed-array-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { }; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-outES3Metal.txt index fed2b03d345..e4b3f820a94 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { }; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-unused-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-unused-outES3Metal.txt index 1f1a28a901a..a39c1b7d7af 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-unused-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/mrt-unused-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { half4 xlv_COLOR0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/opt-dead-texloadstreeshadow-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/opt-dead-texloadstreeshadow-outES3Metal.txt index 31df0dfed37..369965c5f31 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/opt-dead-texloadstreeshadow-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/opt-dead-texloadstreeshadow-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { }; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/opt-grafting-precision-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/opt-grafting-precision-outES3Metal.txt index 5c809e6093b..0d959ebe648 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/opt-grafting-precision-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/opt-grafting-precision-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { half3 normal; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/prec-expressions-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/prec-expressions-outES3Metal.txt index ddfda4d46e1..eb189493adb 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/prec-expressions-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/prec-expressions-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { }; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/prec-matrix-constr-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/prec-matrix-constr-outES3Metal.txt index 80891a9b762..3462062ac51 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/prec-matrix-constr-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/prec-matrix-constr-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { half3 inNormal; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/qualifiers-layout-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/qualifiers-layout-outES3Metal.txt index 64f92a1ed5d..5edc1f20775 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/qualifiers-layout-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/qualifiers-layout-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { }; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/sampler-precision-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/sampler-precision-outES3Metal.txt index 7d8a5f943ab..82d78249c8b 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/sampler-precision-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/sampler-precision-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 varUV; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ternary-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ternary-outES3Metal.txt index aff9cd484d4..ca234064fb3 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ternary-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ternary-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ternary-vec4-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ternary-vec4-outES3Metal.txt index 314f5f7cb75..4471023a756 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ternary-vec4-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ternary-vec4-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2DArray-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2DArray-outES3Metal.txt index f74638ff102..606d3bb3f82 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2DArray-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2DArray-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 uv; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dgrad-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dgrad-outES3Metal.txt index 3c81d626ae6..a070be52ede 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dgrad-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dgrad-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { half3 uv1; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dlod-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dlod-outES3Metal.txt index bbe17239838..e8f1746eb68 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dlod-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dlod-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 uvHi; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dshadow-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dshadow-outES3Metal.txt index 2d85a7fc869..3171b51a5a1 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dshadow-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dshadow-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less); struct xlatMtlShaderInput { diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex3D-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex3D-outES3Metal.txt index 5999947328d..91d9515cb04 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex3D-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex3D-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float3 uv; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texCubeShadow-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texCubeShadow-outES3Metal.txt index 68ec16019bd..e98663c919c 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texCubeShadow-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texCubeShadow-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less); struct xlatMtlShaderInput { diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texOffset-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texOffset-outES3Metal.txt index 2a1b68ce5c3..282db076b6e 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texOffset-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texOffset-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { half3 uv; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texProj-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texProj-outES3Metal.txt index 961349b0a26..454f41277c8 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texProj-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texProj-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less); struct xlatMtlShaderInput { diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-DirLMBasis-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-DirLMBasis-outES3Metal.txt index 88dbe7f737a..2fefeb706b1 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-DirLMBasis-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-DirLMBasis-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-LightShaftsCoord-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-LightShaftsCoord-outES3Metal.txt index 1ae45cf3f1b..a336ad7a463 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-LightShaftsCoord-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-LightShaftsCoord-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-alphabumpspec-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-alphabumpspec-outES3Metal.txt index 40f554b18a3..46530468113 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-alphabumpspec-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-alphabumpspec-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _uv0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-collectshadows-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-collectshadows-outES3Metal.txt index 39ecc369149..1d2fdeaed7e 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-collectshadows-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-collectshadows-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-outES3Metal.txt index 852c4e0d203..6fa4138a027 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-fxaa-preset3-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-prepasslight-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-prepasslight-outES3Metal.txt index 1e43ec7a3f2..57b1c341d4d 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-prepasslight-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-prepasslight-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-tonemap-usercurve-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-tonemap-usercurve-outES3Metal.txt index ccff9b03516..97b273a9011 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-tonemap-usercurve-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-tonemap-usercurve-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-treeleafloop-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-treeleafloop-outES3Metal.txt index bbec809e1f8..4a8dc6d47f1 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-treeleafloop-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-treeleafloop-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unishader-dirlm-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unishader-dirlm-outES3Metal.txt index 86355a1c017..0984cae0fe0 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unishader-dirlm-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unishader-dirlm-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unity-spot-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unity-spot-outES3Metal.txt index a488e9feccf..5a77ed42947 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unity-spot-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unity-spot-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-MobileBumpSpec-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-MobileBumpSpec-outES3Metal.txt index 469afd23c5d..4743f651c8e 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-MobileBumpSpec-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-MobileBumpSpec-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { half2 xlv_TEXCOORD0; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-SSAO24-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-SSAO24-outES3Metal.txt index de7007b9112..3e2c3d4f34f 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-SSAO24-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-SSAO24-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; constant float3 _xlat_mtl_const1[8] = {float3(0.0130572, 0.587232, -0.119337), float3(0.323078, 0.0220727, -0.418873), float3(-0.310725, -0.191367, 0.0561369), float3(-0.479646, 0.0939877, -0.580265), float3(0.139999, -0.33577, 0.559679), float3(-0.248458, 0.255532, 0.348944), float3(0.18719, -0.702764, -0.231748), float3(0.884915, 0.284208, 0.368524)}; struct xlatMtlShaderInput { diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/glsl_optimizer_tests.cpp b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/glsl_optimizer_tests.cpp index ddca5d1f288..caf87f267bb 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/glsl_optimizer_tests.cpp +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/glsl_optimizer_tests.cpp @@ -315,9 +315,9 @@ static bool CheckGLSL (bool vertex, bool gles, const std::string& testName, cons static bool CheckMetal (bool vertex, bool gles, const std::string& testName, const char* prefix, const std::string& source) { -#if !GOT_GFX +#if !GOT_GFX || !defined(__APPLE__) return true; // just assume it's ok -#endif +#else FILE* f = fopen ("metalTemp.metal", "wb"); fwrite (source.c_str(), source.size(), 1, f); @@ -333,6 +333,7 @@ static bool CheckMetal (bool vertex, bool gles, const std::string& testName, con #endif // return true; +#endif } diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/MF-GodRays-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/MF-GodRays-outES3Metal.txt index 36efe5b06e8..c52c31b97ad 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/MF-GodRays-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/MF-GodRays-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _inVertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/bug-swizzle-lhs-cast-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/bug-swizzle-lhs-cast-outES3Metal.txt index d2b15808665..1da74693be8 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/bug-swizzle-lhs-cast-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/bug-swizzle-lhs-cast-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _glesVertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/builtin-vars-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/builtin-vars-outES3Metal.txt index 3c5b6e33b38..8d3e95e4ab6 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/builtin-vars-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/builtin-vars-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float3 _inPos [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/inputs-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/inputs-outES3Metal.txt index 69cc59a3de7..f896ff66cd4 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/inputs-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/inputs-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _glesVertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-for-withvec4-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-for-withvec4-outES3Metal.txt index 8976a6750d2..fc95a3de659 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-for-withvec4-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-for-withvec4-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 dcl_Input0_POSITION0 [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-for-withvec4inductorW-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-for-withvec4inductorW-outES3Metal.txt index a6e6c9b72a8..00690e14860 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-for-withvec4inductorW-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-for-withvec4inductorW-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 in_POSITION0 [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-forlimitbreak-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-forlimitbreak-outES3Metal.txt index 4fff005a315..097f161d566 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-forlimitbreak-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-forlimitbreak-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _glesVertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-forvarious-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-forvarious-outES3Metal.txt index 6e94ee11d38..a87dcb7854b 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-forvarious-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/loops-forvarious-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _inVertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/matrix-casts-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/matrix-casts-outES3Metal.txt index 8e8bf35087f..b888c4c9825 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/matrix-casts-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/matrix-casts-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; inline float4x4 _xlcast_float4x4(half4x4 v) { return float4x4(float4(v[0]), float4(v[1]), float4(v[2]), float4(v[3])); } inline float3x3 _xlcast_float3x3(half3x3 v) { return float3x3(float3(v[0]), float3(v[1]), float3(v[2])); } diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/opt-matrix-transpose-mul-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/opt-matrix-transpose-mul-outES3Metal.txt index 98b2075bd91..78a49f1cabf 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/opt-matrix-transpose-mul-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/opt-matrix-transpose-mul-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 attrVertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/swizzle-casts-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/swizzle-casts-outES3Metal.txt index b657adeb7fe..0667465cea4 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/swizzle-casts-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/swizzle-casts-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _glesVertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/types-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/types-outES3Metal.txt index 40a4d863b38..310cef2db24 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/types-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/types-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _inVertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/uniforms-arrays-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/uniforms-arrays-outES3Metal.txt index 979ea56165e..c6557d378a7 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/uniforms-arrays-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/uniforms-arrays-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _glesVertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-NichsHybridLightVectorInsertBug-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-NichsHybridLightVectorInsertBug-outES3Metal.txt index a56f7df0793..680204bd85e 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-NichsHybridLightVectorInsertBug-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-NichsHybridLightVectorInsertBug-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _glesVertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-prepasslight-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-prepasslight-outES3Metal.txt index a6f6f5c03fb..36a8c79b23a 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-prepasslight-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-prepasslight-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _vertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-treeleaf-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-treeleaf-outES3Metal.txt index f825c2f87bd..3d9bc6f8dff 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-treeleaf-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/z-treeleaf-outES3Metal.txt @@ -1,4 +1,5 @@ #include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float4 _inVertex [[attribute(0)]]; diff --git a/3rdparty/bgfx/3rdparty/khronos/vulkan/vk_lunarg_debug_marker.h b/3rdparty/bgfx/3rdparty/khronos/vulkan/vk_lunarg_debug_marker.h new file mode 100644 index 00000000000..edff2b9eee8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/khronos/vulkan/vk_lunarg_debug_marker.h @@ -0,0 +1,98 @@ +// +// File: vk_lunarg_debug_marker.h +// +/* + * Copyright (c) 2015-2016 The Khronos Group Inc. + * Copyright (c) 2015-2016 Valve Corporation + * Copyright (c) 2015-2016 LunarG, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and/or associated documentation files (the "Materials"), to + * deal in the Materials without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Materials, and to permit persons to whom the Materials are + * furnished to do so, subject to the following conditions: + * + * The above copyright notice(s) and this permission notice shall be included in + * all copies or substantial portions of the Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE + * USE OR OTHER DEALINGS IN THE MATERIALS. + * + * Authors: + * Jon Ashburn <jon@lunarg.com> + * Courtney Goeltzenleuchter <courtney@lunarg.com> + */ + +#ifndef __VK_DEBUG_MARKER_H__ +#define __VK_DEBUG_MARKER_H__ + +#include "vulkan.h" + +#define VK_DEBUG_MARKER_EXTENSION_NUMBER 6 +#define VK_DEBUG_MARKER_EXTENSION_REVISION 1 +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/* +*************************************************************************************************** +* DebugMarker Vulkan Extension API +*************************************************************************************************** +*/ + +#define DEBUG_MARKER_EXTENSION_NAME "VK_LUNARG_DEBUG_MARKER" + +// ------------------------------------------------------------------------------------------------ +// Enumerations + +#define VK_DEBUG_MARKER_ENUM_EXTEND(type, id) \ + ((type)(VK_DEBUG_MARKER_EXTENSION_NUMBER * -1000 + (id))) + +#define VK_OBJECT_INFO_TYPE_DBG_OBJECT_TAG \ + VK_DEBUG_MARKER_ENUM_EXTEND(VkDbgObjectInfoType, 0) +#define VK_OBJECT_INFO_TYPE_DBG_OBJECT_NAME \ + VK_DEBUG_MARKER_ENUM_EXTEND(VkDbgObjectInfoType, 1) + +// ------------------------------------------------------------------------------------------------ +// API functions + +typedef void(VKAPI_PTR *PFN_vkCmdDbgMarkerBegin)(VkCommandBuffer commandBuffer, + const char *pMarker); +typedef void(VKAPI_PTR *PFN_vkCmdDbgMarkerEnd)(VkCommandBuffer commandBuffer); +typedef VkResult(VKAPI_PTR *PFN_vkDbgSetObjectTag)( + VkDevice device, VkDebugReportObjectTypeEXT objType, uint64_t object, + size_t tagSize, const void *pTag); +typedef VkResult(VKAPI_PTR *PFN_vkDbgSetObjectName)( + VkDevice device, VkDebugReportObjectTypeEXT objType, uint64_t object, + size_t nameSize, const char *pName); + +#ifndef VK_NO_PROTOTYPES + +// DebugMarker extension entrypoints +VKAPI_ATTR void VKAPI_CALL +vkCmdDbgMarkerBegin(VkCommandBuffer commandBuffer, const char *pMarker); + +VKAPI_ATTR void VKAPI_CALL vkCmdDbgMarkerEnd(VkCommandBuffer commandBuffer); + +VKAPI_ATTR VkResult VKAPI_CALL +vkDbgSetObjectTag(VkDevice device, VkDebugReportObjectTypeEXT objType, + uint64_t object, size_t tagSize, const void *pTag); + +VKAPI_ATTR VkResult VKAPI_CALL +vkDbgSetObjectName(VkDevice device, VkDebugReportObjectTypeEXT objType, + uint64_t object, size_t nameSize, const char *pName); + +#endif // VK_NO_PROTOTYPES + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // __VK_DEBUG_MARKER_H__ diff --git a/3rdparty/bgfx/3rdparty/khronos/vulkan/vk_platform.h b/3rdparty/bgfx/3rdparty/khronos/vulkan/vk_platform.h new file mode 100644 index 00000000000..a53e725a9a6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/khronos/vulkan/vk_platform.h @@ -0,0 +1,127 @@ +// +// File: vk_platform.h +// +/* +** Copyright (c) 2014-2015 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + + +#ifndef __VK_PLATFORM_H__ +#define __VK_PLATFORM_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/* +*************************************************************************************************** +* Platform-specific directives and type declarations +*************************************************************************************************** +*/ + +/* Platform-specific calling convention macros. + * + * Platforms should define these so that Vulkan clients call Vulkan commands + * with the same calling conventions that the Vulkan implementation expects. + * + * VKAPI_ATTR - Placed before the return type in function declarations. + * Useful for C++11 and GCC/Clang-style function attribute syntax. + * VKAPI_CALL - Placed after the return type in function declarations. + * Useful for MSVC-style calling convention syntax. + * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. + * + * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); + * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); + */ +#if defined(_WIN32) + // On Windows, Vulkan commands use the stdcall convention + #define VKAPI_ATTR + #define VKAPI_CALL __stdcall + #define VKAPI_PTR VKAPI_CALL +#elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) + // Android does not support Vulkan in native code using the "armeabi" ABI. + #error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bit ARM CPUs" +#elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__) + // On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling + // convention, even if the application's native code is compiled with the + // armeabi-v7a calling convention. + #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) + #define VKAPI_CALL + #define VKAPI_PTR VKAPI_ATTR +#else + // On other platforms, use the default calling convention + #define VKAPI_ATTR + #define VKAPI_CALL + #define VKAPI_PTR +#endif + +#include <stddef.h> + +#if !defined(VK_NO_STDINT_H) + #if defined(_MSC_VER) && (_MSC_VER < 1600) + typedef signed __int8 int8_t; + typedef unsigned __int8 uint8_t; + typedef signed __int16 int16_t; + typedef unsigned __int16 uint16_t; + typedef signed __int32 int32_t; + typedef unsigned __int32 uint32_t; + typedef signed __int64 int64_t; + typedef unsigned __int64 uint64_t; + #else + #include <stdint.h> + #endif +#endif // !defined(VK_NO_STDINT_H) + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +// Platform-specific headers required by platform window system extensions. +// These are enabled prior to #including "vulkan.h". The same enable then +// controls inclusion of the extension interfaces in vulkan.h. + +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#include <android/native_window.h> +#endif + +#ifdef VK_USE_PLATFORM_MIR_KHR +#include <mir_toolkit/client_types.h> +#endif + +#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#include <wayland-client.h> +#endif + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#include <windows.h> +#endif + +#ifdef VK_USE_PLATFORM_XLIB_KHR +#include <X11/Xlib.h> +#endif + +#ifdef VK_USE_PLATFORM_XCB_KHR +#include <xcb/xcb.h> +#endif + +#endif // __VK_PLATFORM_H__ diff --git a/3rdparty/bgfx/3rdparty/khronos/vulkan/vulkan.h b/3rdparty/bgfx/3rdparty/khronos/vulkan/vulkan.h new file mode 100644 index 00000000000..cd6a71ac1a9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/khronos/vulkan/vulkan.h @@ -0,0 +1,3775 @@ +#ifndef __vulkan_h_ +#define __vulkan_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2015-2016 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#define VK_VERSION_1_0 1 +#include "vk_platform.h" + +#define VK_MAKE_VERSION(major, minor, patch) \ + (((major) << 22) | ((minor) << 12) | (patch)) + +// Vulkan API version supported by this file +#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 3) + +#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22) +#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) +#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) + +#define VK_NULL_HANDLE 0 + + + +#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; + + +#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; +#else + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; +#endif + + + +typedef uint32_t VkFlags; +typedef uint32_t VkBool32; +typedef uint64_t VkDeviceSize; +typedef uint32_t VkSampleMask; + +VK_DEFINE_HANDLE(VkInstance) +VK_DEFINE_HANDLE(VkPhysicalDevice) +VK_DEFINE_HANDLE(VkDevice) +VK_DEFINE_HANDLE(VkQueue) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore) +VK_DEFINE_HANDLE(VkCommandBuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool) + +#define VK_LOD_CLAMP_NONE 1000.0f +#define VK_REMAINING_MIP_LEVELS (~0U) +#define VK_REMAINING_ARRAY_LAYERS (~0U) +#define VK_WHOLE_SIZE (~0ULL) +#define VK_ATTACHMENT_UNUSED (~0U) +#define VK_TRUE 1 +#define VK_FALSE 0 +#define VK_QUEUE_FAMILY_IGNORED (~0U) +#define VK_SUBPASS_EXTERNAL (~0U) +#define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256 +#define VK_UUID_SIZE 16 +#define VK_MAX_MEMORY_TYPES 32 +#define VK_MAX_MEMORY_HEAPS 16 +#define VK_MAX_EXTENSION_NAME_SIZE 256 +#define VK_MAX_DESCRIPTION_SIZE 256 + + +typedef enum VkPipelineCacheHeaderVersion { + VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, + VK_PIPELINE_CACHE_HEADER_VERSION_BEGIN_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE, + VK_PIPELINE_CACHE_HEADER_VERSION_END_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE, + VK_PIPELINE_CACHE_HEADER_VERSION_RANGE_SIZE = (VK_PIPELINE_CACHE_HEADER_VERSION_ONE - VK_PIPELINE_CACHE_HEADER_VERSION_ONE + 1), + VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 0x7FFFFFFF +} VkPipelineCacheHeaderVersion; + +typedef enum VkResult { + VK_SUCCESS = 0, + VK_NOT_READY = 1, + VK_TIMEOUT = 2, + VK_EVENT_SET = 3, + VK_EVENT_RESET = 4, + VK_INCOMPLETE = 5, + VK_ERROR_OUT_OF_HOST_MEMORY = -1, + VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, + VK_ERROR_INITIALIZATION_FAILED = -3, + VK_ERROR_DEVICE_LOST = -4, + VK_ERROR_MEMORY_MAP_FAILED = -5, + VK_ERROR_LAYER_NOT_PRESENT = -6, + VK_ERROR_EXTENSION_NOT_PRESENT = -7, + VK_ERROR_FEATURE_NOT_PRESENT = -8, + VK_ERROR_INCOMPATIBLE_DRIVER = -9, + VK_ERROR_TOO_MANY_OBJECTS = -10, + VK_ERROR_FORMAT_NOT_SUPPORTED = -11, + VK_ERROR_SURFACE_LOST_KHR = -1000000000, + VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, + VK_SUBOPTIMAL_KHR = 1000001003, + VK_ERROR_OUT_OF_DATE_KHR = -1000001004, + VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, + VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, + VK_RESULT_BEGIN_RANGE = VK_ERROR_FORMAT_NOT_SUPPORTED, + VK_RESULT_END_RANGE = VK_INCOMPLETE, + VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FORMAT_NOT_SUPPORTED + 1), + VK_RESULT_MAX_ENUM = 0x7FFFFFFF +} VkResult; + +typedef enum VkStructureType { + VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, + VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, + VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, + VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, + VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, + VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, + VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, + VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, + VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, + VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, + VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, + VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, + VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, + VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, + VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, + VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, + VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, + VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, + VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, + VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, + VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, + VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, + VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, + VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, + VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, + VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, + VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, + VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, + VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, + VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, + VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, + VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, + VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42, + VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45, + VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, + VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, + VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48, + VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, + VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, + VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000, + VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001, + VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR = 1000003000, + VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, + VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, + VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, + VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000, + VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000, + VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, + VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = 1000011000, + VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO, + VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO, + VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1), + VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkStructureType; + +typedef enum VkSystemAllocationScope { + VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, + VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, + VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4, + VK_SYSTEM_ALLOCATION_SCOPE_BEGIN_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_COMMAND, + VK_SYSTEM_ALLOCATION_SCOPE_END_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE, + VK_SYSTEM_ALLOCATION_SCOPE_RANGE_SIZE = (VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND + 1), + VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = 0x7FFFFFFF +} VkSystemAllocationScope; + +typedef enum VkInternalAllocationType { + VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0, + VK_INTERNAL_ALLOCATION_TYPE_BEGIN_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE, + VK_INTERNAL_ALLOCATION_TYPE_END_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE, + VK_INTERNAL_ALLOCATION_TYPE_RANGE_SIZE = (VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE - VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE + 1), + VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkInternalAllocationType; + +typedef enum VkFormat { + VK_FORMAT_UNDEFINED = 0, + VK_FORMAT_R4G4_UNORM_PACK8 = 1, + VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2, + VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3, + VK_FORMAT_R5G6B5_UNORM_PACK16 = 4, + VK_FORMAT_B5G6R5_UNORM_PACK16 = 5, + VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6, + VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7, + VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8, + VK_FORMAT_R8_UNORM = 9, + VK_FORMAT_R8_SNORM = 10, + VK_FORMAT_R8_USCALED = 11, + VK_FORMAT_R8_SSCALED = 12, + VK_FORMAT_R8_UINT = 13, + VK_FORMAT_R8_SINT = 14, + VK_FORMAT_R8_SRGB = 15, + VK_FORMAT_R8G8_UNORM = 16, + VK_FORMAT_R8G8_SNORM = 17, + VK_FORMAT_R8G8_USCALED = 18, + VK_FORMAT_R8G8_SSCALED = 19, + VK_FORMAT_R8G8_UINT = 20, + VK_FORMAT_R8G8_SINT = 21, + VK_FORMAT_R8G8_SRGB = 22, + VK_FORMAT_R8G8B8_UNORM = 23, + VK_FORMAT_R8G8B8_SNORM = 24, + VK_FORMAT_R8G8B8_USCALED = 25, + VK_FORMAT_R8G8B8_SSCALED = 26, + VK_FORMAT_R8G8B8_UINT = 27, + VK_FORMAT_R8G8B8_SINT = 28, + VK_FORMAT_R8G8B8_SRGB = 29, + VK_FORMAT_B8G8R8_UNORM = 30, + VK_FORMAT_B8G8R8_SNORM = 31, + VK_FORMAT_B8G8R8_USCALED = 32, + VK_FORMAT_B8G8R8_SSCALED = 33, + VK_FORMAT_B8G8R8_UINT = 34, + VK_FORMAT_B8G8R8_SINT = 35, + VK_FORMAT_B8G8R8_SRGB = 36, + VK_FORMAT_R8G8B8A8_UNORM = 37, + VK_FORMAT_R8G8B8A8_SNORM = 38, + VK_FORMAT_R8G8B8A8_USCALED = 39, + VK_FORMAT_R8G8B8A8_SSCALED = 40, + VK_FORMAT_R8G8B8A8_UINT = 41, + VK_FORMAT_R8G8B8A8_SINT = 42, + VK_FORMAT_R8G8B8A8_SRGB = 43, + VK_FORMAT_B8G8R8A8_UNORM = 44, + VK_FORMAT_B8G8R8A8_SNORM = 45, + VK_FORMAT_B8G8R8A8_USCALED = 46, + VK_FORMAT_B8G8R8A8_SSCALED = 47, + VK_FORMAT_B8G8R8A8_UINT = 48, + VK_FORMAT_B8G8R8A8_SINT = 49, + VK_FORMAT_B8G8R8A8_SRGB = 50, + VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51, + VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52, + VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53, + VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54, + VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55, + VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56, + VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57, + VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58, + VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59, + VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60, + VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61, + VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62, + VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63, + VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64, + VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65, + VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66, + VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67, + VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68, + VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69, + VK_FORMAT_R16_UNORM = 70, + VK_FORMAT_R16_SNORM = 71, + VK_FORMAT_R16_USCALED = 72, + VK_FORMAT_R16_SSCALED = 73, + VK_FORMAT_R16_UINT = 74, + VK_FORMAT_R16_SINT = 75, + VK_FORMAT_R16_SFLOAT = 76, + VK_FORMAT_R16G16_UNORM = 77, + VK_FORMAT_R16G16_SNORM = 78, + VK_FORMAT_R16G16_USCALED = 79, + VK_FORMAT_R16G16_SSCALED = 80, + VK_FORMAT_R16G16_UINT = 81, + VK_FORMAT_R16G16_SINT = 82, + VK_FORMAT_R16G16_SFLOAT = 83, + VK_FORMAT_R16G16B16_UNORM = 84, + VK_FORMAT_R16G16B16_SNORM = 85, + VK_FORMAT_R16G16B16_USCALED = 86, + VK_FORMAT_R16G16B16_SSCALED = 87, + VK_FORMAT_R16G16B16_UINT = 88, + VK_FORMAT_R16G16B16_SINT = 89, + VK_FORMAT_R16G16B16_SFLOAT = 90, + VK_FORMAT_R16G16B16A16_UNORM = 91, + VK_FORMAT_R16G16B16A16_SNORM = 92, + VK_FORMAT_R16G16B16A16_USCALED = 93, + VK_FORMAT_R16G16B16A16_SSCALED = 94, + VK_FORMAT_R16G16B16A16_UINT = 95, + VK_FORMAT_R16G16B16A16_SINT = 96, + VK_FORMAT_R16G16B16A16_SFLOAT = 97, + VK_FORMAT_R32_UINT = 98, + VK_FORMAT_R32_SINT = 99, + VK_FORMAT_R32_SFLOAT = 100, + VK_FORMAT_R32G32_UINT = 101, + VK_FORMAT_R32G32_SINT = 102, + VK_FORMAT_R32G32_SFLOAT = 103, + VK_FORMAT_R32G32B32_UINT = 104, + VK_FORMAT_R32G32B32_SINT = 105, + VK_FORMAT_R32G32B32_SFLOAT = 106, + VK_FORMAT_R32G32B32A32_UINT = 107, + VK_FORMAT_R32G32B32A32_SINT = 108, + VK_FORMAT_R32G32B32A32_SFLOAT = 109, + VK_FORMAT_R64_UINT = 110, + VK_FORMAT_R64_SINT = 111, + VK_FORMAT_R64_SFLOAT = 112, + VK_FORMAT_R64G64_UINT = 113, + VK_FORMAT_R64G64_SINT = 114, + VK_FORMAT_R64G64_SFLOAT = 115, + VK_FORMAT_R64G64B64_UINT = 116, + VK_FORMAT_R64G64B64_SINT = 117, + VK_FORMAT_R64G64B64_SFLOAT = 118, + VK_FORMAT_R64G64B64A64_UINT = 119, + VK_FORMAT_R64G64B64A64_SINT = 120, + VK_FORMAT_R64G64B64A64_SFLOAT = 121, + VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122, + VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123, + VK_FORMAT_D16_UNORM = 124, + VK_FORMAT_X8_D24_UNORM_PACK32 = 125, + VK_FORMAT_D32_SFLOAT = 126, + VK_FORMAT_S8_UINT = 127, + VK_FORMAT_D16_UNORM_S8_UINT = 128, + VK_FORMAT_D24_UNORM_S8_UINT = 129, + VK_FORMAT_D32_SFLOAT_S8_UINT = 130, + VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131, + VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132, + VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133, + VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134, + VK_FORMAT_BC2_UNORM_BLOCK = 135, + VK_FORMAT_BC2_SRGB_BLOCK = 136, + VK_FORMAT_BC3_UNORM_BLOCK = 137, + VK_FORMAT_BC3_SRGB_BLOCK = 138, + VK_FORMAT_BC4_UNORM_BLOCK = 139, + VK_FORMAT_BC4_SNORM_BLOCK = 140, + VK_FORMAT_BC5_UNORM_BLOCK = 141, + VK_FORMAT_BC5_SNORM_BLOCK = 142, + VK_FORMAT_BC6H_UFLOAT_BLOCK = 143, + VK_FORMAT_BC6H_SFLOAT_BLOCK = 144, + VK_FORMAT_BC7_UNORM_BLOCK = 145, + VK_FORMAT_BC7_SRGB_BLOCK = 146, + VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147, + VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148, + VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149, + VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150, + VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151, + VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152, + VK_FORMAT_EAC_R11_UNORM_BLOCK = 153, + VK_FORMAT_EAC_R11_SNORM_BLOCK = 154, + VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155, + VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156, + VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157, + VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158, + VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159, + VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160, + VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161, + VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162, + VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, + VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, + VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, + VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, + VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, + VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, + VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, + VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170, + VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171, + VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172, + VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173, + VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174, + VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175, + VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176, + VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177, + VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178, + VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179, + VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180, + VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181, + VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182, + VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183, + VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184, + VK_FORMAT_BEGIN_RANGE = VK_FORMAT_UNDEFINED, + VK_FORMAT_END_RANGE = VK_FORMAT_ASTC_12x12_SRGB_BLOCK, + VK_FORMAT_RANGE_SIZE = (VK_FORMAT_ASTC_12x12_SRGB_BLOCK - VK_FORMAT_UNDEFINED + 1), + VK_FORMAT_MAX_ENUM = 0x7FFFFFFF +} VkFormat; + +typedef enum VkImageType { + VK_IMAGE_TYPE_1D = 0, + VK_IMAGE_TYPE_2D = 1, + VK_IMAGE_TYPE_3D = 2, + VK_IMAGE_TYPE_BEGIN_RANGE = VK_IMAGE_TYPE_1D, + VK_IMAGE_TYPE_END_RANGE = VK_IMAGE_TYPE_3D, + VK_IMAGE_TYPE_RANGE_SIZE = (VK_IMAGE_TYPE_3D - VK_IMAGE_TYPE_1D + 1), + VK_IMAGE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkImageType; + +typedef enum VkImageTiling { + VK_IMAGE_TILING_OPTIMAL = 0, + VK_IMAGE_TILING_LINEAR = 1, + VK_IMAGE_TILING_BEGIN_RANGE = VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_TILING_END_RANGE = VK_IMAGE_TILING_LINEAR, + VK_IMAGE_TILING_RANGE_SIZE = (VK_IMAGE_TILING_LINEAR - VK_IMAGE_TILING_OPTIMAL + 1), + VK_IMAGE_TILING_MAX_ENUM = 0x7FFFFFFF +} VkImageTiling; + +typedef enum VkPhysicalDeviceType { + VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, + VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, + VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, + VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, + VK_PHYSICAL_DEVICE_TYPE_CPU = 4, + VK_PHYSICAL_DEVICE_TYPE_BEGIN_RANGE = VK_PHYSICAL_DEVICE_TYPE_OTHER, + VK_PHYSICAL_DEVICE_TYPE_END_RANGE = VK_PHYSICAL_DEVICE_TYPE_CPU, + VK_PHYSICAL_DEVICE_TYPE_RANGE_SIZE = (VK_PHYSICAL_DEVICE_TYPE_CPU - VK_PHYSICAL_DEVICE_TYPE_OTHER + 1), + VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkPhysicalDeviceType; + +typedef enum VkQueryType { + VK_QUERY_TYPE_OCCLUSION = 0, + VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, + VK_QUERY_TYPE_TIMESTAMP = 2, + VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION, + VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_TIMESTAMP, + VK_QUERY_TYPE_RANGE_SIZE = (VK_QUERY_TYPE_TIMESTAMP - VK_QUERY_TYPE_OCCLUSION + 1), + VK_QUERY_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkQueryType; + +typedef enum VkSharingMode { + VK_SHARING_MODE_EXCLUSIVE = 0, + VK_SHARING_MODE_CONCURRENT = 1, + VK_SHARING_MODE_BEGIN_RANGE = VK_SHARING_MODE_EXCLUSIVE, + VK_SHARING_MODE_END_RANGE = VK_SHARING_MODE_CONCURRENT, + VK_SHARING_MODE_RANGE_SIZE = (VK_SHARING_MODE_CONCURRENT - VK_SHARING_MODE_EXCLUSIVE + 1), + VK_SHARING_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSharingMode; + +typedef enum VkImageLayout { + VK_IMAGE_LAYOUT_UNDEFINED = 0, + VK_IMAGE_LAYOUT_GENERAL = 1, + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 2, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 4, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5, + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 6, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7, + VK_IMAGE_LAYOUT_PREINITIALIZED = 8, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, + VK_IMAGE_LAYOUT_BEGIN_RANGE = VK_IMAGE_LAYOUT_UNDEFINED, + VK_IMAGE_LAYOUT_END_RANGE = VK_IMAGE_LAYOUT_PREINITIALIZED, + VK_IMAGE_LAYOUT_RANGE_SIZE = (VK_IMAGE_LAYOUT_PREINITIALIZED - VK_IMAGE_LAYOUT_UNDEFINED + 1), + VK_IMAGE_LAYOUT_MAX_ENUM = 0x7FFFFFFF +} VkImageLayout; + +typedef enum VkImageViewType { + VK_IMAGE_VIEW_TYPE_1D = 0, + VK_IMAGE_VIEW_TYPE_2D = 1, + VK_IMAGE_VIEW_TYPE_3D = 2, + VK_IMAGE_VIEW_TYPE_CUBE = 3, + VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, + VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, + VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, + VK_IMAGE_VIEW_TYPE_BEGIN_RANGE = VK_IMAGE_VIEW_TYPE_1D, + VK_IMAGE_VIEW_TYPE_END_RANGE = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, + VK_IMAGE_VIEW_TYPE_RANGE_SIZE = (VK_IMAGE_VIEW_TYPE_CUBE_ARRAY - VK_IMAGE_VIEW_TYPE_1D + 1), + VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkImageViewType; + +typedef enum VkComponentSwizzle { + VK_COMPONENT_SWIZZLE_IDENTITY = 0, + VK_COMPONENT_SWIZZLE_ZERO = 1, + VK_COMPONENT_SWIZZLE_ONE = 2, + VK_COMPONENT_SWIZZLE_R = 3, + VK_COMPONENT_SWIZZLE_G = 4, + VK_COMPONENT_SWIZZLE_B = 5, + VK_COMPONENT_SWIZZLE_A = 6, + VK_COMPONENT_SWIZZLE_BEGIN_RANGE = VK_COMPONENT_SWIZZLE_IDENTITY, + VK_COMPONENT_SWIZZLE_END_RANGE = VK_COMPONENT_SWIZZLE_A, + VK_COMPONENT_SWIZZLE_RANGE_SIZE = (VK_COMPONENT_SWIZZLE_A - VK_COMPONENT_SWIZZLE_IDENTITY + 1), + VK_COMPONENT_SWIZZLE_MAX_ENUM = 0x7FFFFFFF +} VkComponentSwizzle; + +typedef enum VkVertexInputRate { + VK_VERTEX_INPUT_RATE_VERTEX = 0, + VK_VERTEX_INPUT_RATE_INSTANCE = 1, + VK_VERTEX_INPUT_RATE_BEGIN_RANGE = VK_VERTEX_INPUT_RATE_VERTEX, + VK_VERTEX_INPUT_RATE_END_RANGE = VK_VERTEX_INPUT_RATE_INSTANCE, + VK_VERTEX_INPUT_RATE_RANGE_SIZE = (VK_VERTEX_INPUT_RATE_INSTANCE - VK_VERTEX_INPUT_RATE_VERTEX + 1), + VK_VERTEX_INPUT_RATE_MAX_ENUM = 0x7FFFFFFF +} VkVertexInputRate; + +typedef enum VkPrimitiveTopology { + VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, + VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1, + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5, + VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6, + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, + VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10, + VK_PRIMITIVE_TOPOLOGY_BEGIN_RANGE = VK_PRIMITIVE_TOPOLOGY_POINT_LIST, + VK_PRIMITIVE_TOPOLOGY_END_RANGE = VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, + VK_PRIMITIVE_TOPOLOGY_RANGE_SIZE = (VK_PRIMITIVE_TOPOLOGY_PATCH_LIST - VK_PRIMITIVE_TOPOLOGY_POINT_LIST + 1), + VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7FFFFFFF +} VkPrimitiveTopology; + +typedef enum VkPolygonMode { + VK_POLYGON_MODE_FILL = 0, + VK_POLYGON_MODE_LINE = 1, + VK_POLYGON_MODE_POINT = 2, + VK_POLYGON_MODE_BEGIN_RANGE = VK_POLYGON_MODE_FILL, + VK_POLYGON_MODE_END_RANGE = VK_POLYGON_MODE_POINT, + VK_POLYGON_MODE_RANGE_SIZE = (VK_POLYGON_MODE_POINT - VK_POLYGON_MODE_FILL + 1), + VK_POLYGON_MODE_MAX_ENUM = 0x7FFFFFFF +} VkPolygonMode; + +typedef enum VkFrontFace { + VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, + VK_FRONT_FACE_CLOCKWISE = 1, + VK_FRONT_FACE_BEGIN_RANGE = VK_FRONT_FACE_COUNTER_CLOCKWISE, + VK_FRONT_FACE_END_RANGE = VK_FRONT_FACE_CLOCKWISE, + VK_FRONT_FACE_RANGE_SIZE = (VK_FRONT_FACE_CLOCKWISE - VK_FRONT_FACE_COUNTER_CLOCKWISE + 1), + VK_FRONT_FACE_MAX_ENUM = 0x7FFFFFFF +} VkFrontFace; + +typedef enum VkCompareOp { + VK_COMPARE_OP_NEVER = 0, + VK_COMPARE_OP_LESS = 1, + VK_COMPARE_OP_EQUAL = 2, + VK_COMPARE_OP_LESS_OR_EQUAL = 3, + VK_COMPARE_OP_GREATER = 4, + VK_COMPARE_OP_NOT_EQUAL = 5, + VK_COMPARE_OP_GREATER_OR_EQUAL = 6, + VK_COMPARE_OP_ALWAYS = 7, + VK_COMPARE_OP_BEGIN_RANGE = VK_COMPARE_OP_NEVER, + VK_COMPARE_OP_END_RANGE = VK_COMPARE_OP_ALWAYS, + VK_COMPARE_OP_RANGE_SIZE = (VK_COMPARE_OP_ALWAYS - VK_COMPARE_OP_NEVER + 1), + VK_COMPARE_OP_MAX_ENUM = 0x7FFFFFFF +} VkCompareOp; + +typedef enum VkStencilOp { + VK_STENCIL_OP_KEEP = 0, + VK_STENCIL_OP_ZERO = 1, + VK_STENCIL_OP_REPLACE = 2, + VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3, + VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, + VK_STENCIL_OP_INVERT = 5, + VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, + VK_STENCIL_OP_DECREMENT_AND_WRAP = 7, + VK_STENCIL_OP_BEGIN_RANGE = VK_STENCIL_OP_KEEP, + VK_STENCIL_OP_END_RANGE = VK_STENCIL_OP_DECREMENT_AND_WRAP, + VK_STENCIL_OP_RANGE_SIZE = (VK_STENCIL_OP_DECREMENT_AND_WRAP - VK_STENCIL_OP_KEEP + 1), + VK_STENCIL_OP_MAX_ENUM = 0x7FFFFFFF +} VkStencilOp; + +typedef enum VkLogicOp { + VK_LOGIC_OP_CLEAR = 0, + VK_LOGIC_OP_AND = 1, + VK_LOGIC_OP_AND_REVERSE = 2, + VK_LOGIC_OP_COPY = 3, + VK_LOGIC_OP_AND_INVERTED = 4, + VK_LOGIC_OP_NO_OP = 5, + VK_LOGIC_OP_XOR = 6, + VK_LOGIC_OP_OR = 7, + VK_LOGIC_OP_NOR = 8, + VK_LOGIC_OP_EQUIVALENT = 9, + VK_LOGIC_OP_INVERT = 10, + VK_LOGIC_OP_OR_REVERSE = 11, + VK_LOGIC_OP_COPY_INVERTED = 12, + VK_LOGIC_OP_OR_INVERTED = 13, + VK_LOGIC_OP_NAND = 14, + VK_LOGIC_OP_SET = 15, + VK_LOGIC_OP_BEGIN_RANGE = VK_LOGIC_OP_CLEAR, + VK_LOGIC_OP_END_RANGE = VK_LOGIC_OP_SET, + VK_LOGIC_OP_RANGE_SIZE = (VK_LOGIC_OP_SET - VK_LOGIC_OP_CLEAR + 1), + VK_LOGIC_OP_MAX_ENUM = 0x7FFFFFFF +} VkLogicOp; + +typedef enum VkBlendFactor { + VK_BLEND_FACTOR_ZERO = 0, + VK_BLEND_FACTOR_ONE = 1, + VK_BLEND_FACTOR_SRC_COLOR = 2, + VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3, + VK_BLEND_FACTOR_DST_COLOR = 4, + VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5, + VK_BLEND_FACTOR_SRC_ALPHA = 6, + VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7, + VK_BLEND_FACTOR_DST_ALPHA = 8, + VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9, + VK_BLEND_FACTOR_CONSTANT_COLOR = 10, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11, + VK_BLEND_FACTOR_CONSTANT_ALPHA = 12, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13, + VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14, + VK_BLEND_FACTOR_SRC1_COLOR = 15, + VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, + VK_BLEND_FACTOR_SRC1_ALPHA = 17, + VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18, + VK_BLEND_FACTOR_BEGIN_RANGE = VK_BLEND_FACTOR_ZERO, + VK_BLEND_FACTOR_END_RANGE = VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA, + VK_BLEND_FACTOR_RANGE_SIZE = (VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA - VK_BLEND_FACTOR_ZERO + 1), + VK_BLEND_FACTOR_MAX_ENUM = 0x7FFFFFFF +} VkBlendFactor; + +typedef enum VkBlendOp { + VK_BLEND_OP_ADD = 0, + VK_BLEND_OP_SUBTRACT = 1, + VK_BLEND_OP_REVERSE_SUBTRACT = 2, + VK_BLEND_OP_MIN = 3, + VK_BLEND_OP_MAX = 4, + VK_BLEND_OP_BEGIN_RANGE = VK_BLEND_OP_ADD, + VK_BLEND_OP_END_RANGE = VK_BLEND_OP_MAX, + VK_BLEND_OP_RANGE_SIZE = (VK_BLEND_OP_MAX - VK_BLEND_OP_ADD + 1), + VK_BLEND_OP_MAX_ENUM = 0x7FFFFFFF +} VkBlendOp; + +typedef enum VkDynamicState { + VK_DYNAMIC_STATE_VIEWPORT = 0, + VK_DYNAMIC_STATE_SCISSOR = 1, + VK_DYNAMIC_STATE_LINE_WIDTH = 2, + VK_DYNAMIC_STATE_DEPTH_BIAS = 3, + VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4, + VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5, + VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, + VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, + VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, + VK_DYNAMIC_STATE_BEGIN_RANGE = VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_END_RANGE = VK_DYNAMIC_STATE_STENCIL_REFERENCE, + VK_DYNAMIC_STATE_RANGE_SIZE = (VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1), + VK_DYNAMIC_STATE_MAX_ENUM = 0x7FFFFFFF +} VkDynamicState; + +typedef enum VkFilter { + VK_FILTER_NEAREST = 0, + VK_FILTER_LINEAR = 1, + VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST, + VK_FILTER_END_RANGE = VK_FILTER_LINEAR, + VK_FILTER_RANGE_SIZE = (VK_FILTER_LINEAR - VK_FILTER_NEAREST + 1), + VK_FILTER_MAX_ENUM = 0x7FFFFFFF +} VkFilter; + +typedef enum VkSamplerMipmapMode { + VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, + VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, + VK_SAMPLER_MIPMAP_MODE_BEGIN_RANGE = VK_SAMPLER_MIPMAP_MODE_NEAREST, + VK_SAMPLER_MIPMAP_MODE_END_RANGE = VK_SAMPLER_MIPMAP_MODE_LINEAR, + VK_SAMPLER_MIPMAP_MODE_RANGE_SIZE = (VK_SAMPLER_MIPMAP_MODE_LINEAR - VK_SAMPLER_MIPMAP_MODE_NEAREST + 1), + VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSamplerMipmapMode; + +typedef enum VkSamplerAddressMode { + VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, + VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, + VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, + VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT, + VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE, + VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1), + VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSamplerAddressMode; + +typedef enum VkBorderColor { + VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, + VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1, + VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, + VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, + VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, + VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, + VK_BORDER_COLOR_BEGIN_RANGE = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK, + VK_BORDER_COLOR_END_RANGE = VK_BORDER_COLOR_INT_OPAQUE_WHITE, + VK_BORDER_COLOR_RANGE_SIZE = (VK_BORDER_COLOR_INT_OPAQUE_WHITE - VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK + 1), + VK_BORDER_COLOR_MAX_ENUM = 0x7FFFFFFF +} VkBorderColor; + +typedef enum VkDescriptorType { + VK_DESCRIPTOR_TYPE_SAMPLER = 0, + VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, + VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, + VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, + VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, + VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, + VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, + VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, + VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, + VK_DESCRIPTOR_TYPE_BEGIN_RANGE = VK_DESCRIPTOR_TYPE_SAMPLER, + VK_DESCRIPTOR_TYPE_END_RANGE = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, + VK_DESCRIPTOR_TYPE_RANGE_SIZE = (VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT - VK_DESCRIPTOR_TYPE_SAMPLER + 1), + VK_DESCRIPTOR_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorType; + +typedef enum VkAttachmentLoadOp { + VK_ATTACHMENT_LOAD_OP_LOAD = 0, + VK_ATTACHMENT_LOAD_OP_CLEAR = 1, + VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, + VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE = VK_ATTACHMENT_LOAD_OP_LOAD, + VK_ATTACHMENT_LOAD_OP_END_RANGE = VK_ATTACHMENT_LOAD_OP_DONT_CARE, + VK_ATTACHMENT_LOAD_OP_RANGE_SIZE = (VK_ATTACHMENT_LOAD_OP_DONT_CARE - VK_ATTACHMENT_LOAD_OP_LOAD + 1), + VK_ATTACHMENT_LOAD_OP_MAX_ENUM = 0x7FFFFFFF +} VkAttachmentLoadOp; + +typedef enum VkAttachmentStoreOp { + VK_ATTACHMENT_STORE_OP_STORE = 0, + VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, + VK_ATTACHMENT_STORE_OP_BEGIN_RANGE = VK_ATTACHMENT_STORE_OP_STORE, + VK_ATTACHMENT_STORE_OP_END_RANGE = VK_ATTACHMENT_STORE_OP_DONT_CARE, + VK_ATTACHMENT_STORE_OP_RANGE_SIZE = (VK_ATTACHMENT_STORE_OP_DONT_CARE - VK_ATTACHMENT_STORE_OP_STORE + 1), + VK_ATTACHMENT_STORE_OP_MAX_ENUM = 0x7FFFFFFF +} VkAttachmentStoreOp; + +typedef enum VkPipelineBindPoint { + VK_PIPELINE_BIND_POINT_GRAPHICS = 0, + VK_PIPELINE_BIND_POINT_COMPUTE = 1, + VK_PIPELINE_BIND_POINT_BEGIN_RANGE = VK_PIPELINE_BIND_POINT_GRAPHICS, + VK_PIPELINE_BIND_POINT_END_RANGE = VK_PIPELINE_BIND_POINT_COMPUTE, + VK_PIPELINE_BIND_POINT_RANGE_SIZE = (VK_PIPELINE_BIND_POINT_COMPUTE - VK_PIPELINE_BIND_POINT_GRAPHICS + 1), + VK_PIPELINE_BIND_POINT_MAX_ENUM = 0x7FFFFFFF +} VkPipelineBindPoint; + +typedef enum VkCommandBufferLevel { + VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, + VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1, + VK_COMMAND_BUFFER_LEVEL_BEGIN_RANGE = VK_COMMAND_BUFFER_LEVEL_PRIMARY, + VK_COMMAND_BUFFER_LEVEL_END_RANGE = VK_COMMAND_BUFFER_LEVEL_SECONDARY, + VK_COMMAND_BUFFER_LEVEL_RANGE_SIZE = (VK_COMMAND_BUFFER_LEVEL_SECONDARY - VK_COMMAND_BUFFER_LEVEL_PRIMARY + 1), + VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = 0x7FFFFFFF +} VkCommandBufferLevel; + +typedef enum VkIndexType { + VK_INDEX_TYPE_UINT16 = 0, + VK_INDEX_TYPE_UINT32 = 1, + VK_INDEX_TYPE_BEGIN_RANGE = VK_INDEX_TYPE_UINT16, + VK_INDEX_TYPE_END_RANGE = VK_INDEX_TYPE_UINT32, + VK_INDEX_TYPE_RANGE_SIZE = (VK_INDEX_TYPE_UINT32 - VK_INDEX_TYPE_UINT16 + 1), + VK_INDEX_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkIndexType; + +typedef enum VkSubpassContents { + VK_SUBPASS_CONTENTS_INLINE = 0, + VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, + VK_SUBPASS_CONTENTS_BEGIN_RANGE = VK_SUBPASS_CONTENTS_INLINE, + VK_SUBPASS_CONTENTS_END_RANGE = VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS, + VK_SUBPASS_CONTENTS_RANGE_SIZE = (VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS - VK_SUBPASS_CONTENTS_INLINE + 1), + VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF +} VkSubpassContents; + +typedef VkFlags VkInstanceCreateFlags; + +typedef enum VkFormatFeatureFlagBits { + VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, + VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, + VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, + VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, + VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, + VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, + VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, + VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, + VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, + VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, + VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, + VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000, +} VkFormatFeatureFlagBits; +typedef VkFlags VkFormatFeatureFlags; + +typedef enum VkImageUsageFlagBits { + VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, + VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, + VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, + VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, + VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, + VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, + VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, + VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, +} VkImageUsageFlagBits; +typedef VkFlags VkImageUsageFlags; + +typedef enum VkImageCreateFlagBits { + VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, + VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, + VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, + VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, + VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, +} VkImageCreateFlagBits; +typedef VkFlags VkImageCreateFlags; + +typedef enum VkSampleCountFlagBits { + VK_SAMPLE_COUNT_1_BIT = 0x00000001, + VK_SAMPLE_COUNT_2_BIT = 0x00000002, + VK_SAMPLE_COUNT_4_BIT = 0x00000004, + VK_SAMPLE_COUNT_8_BIT = 0x00000008, + VK_SAMPLE_COUNT_16_BIT = 0x00000010, + VK_SAMPLE_COUNT_32_BIT = 0x00000020, + VK_SAMPLE_COUNT_64_BIT = 0x00000040, +} VkSampleCountFlagBits; +typedef VkFlags VkSampleCountFlags; + +typedef enum VkQueueFlagBits { + VK_QUEUE_GRAPHICS_BIT = 0x00000001, + VK_QUEUE_COMPUTE_BIT = 0x00000002, + VK_QUEUE_TRANSFER_BIT = 0x00000004, + VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, +} VkQueueFlagBits; +typedef VkFlags VkQueueFlags; + +typedef enum VkMemoryPropertyFlagBits { + VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001, + VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002, + VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004, + VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008, + VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, +} VkMemoryPropertyFlagBits; +typedef VkFlags VkMemoryPropertyFlags; + +typedef enum VkMemoryHeapFlagBits { + VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001, +} VkMemoryHeapFlagBits; +typedef VkFlags VkMemoryHeapFlags; +typedef VkFlags VkDeviceCreateFlags; +typedef VkFlags VkDeviceQueueCreateFlags; + +typedef enum VkPipelineStageFlagBits { + VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, + VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, + VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, + VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, + VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, + VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, + VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, + VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, + VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, + VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, + VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, + VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, + VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 0x00002000, + VK_PIPELINE_STAGE_HOST_BIT = 0x00004000, + VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000, +} VkPipelineStageFlagBits; +typedef VkFlags VkPipelineStageFlags; +typedef VkFlags VkMemoryMapFlags; + +typedef enum VkImageAspectFlagBits { + VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001, + VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002, + VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004, + VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008, +} VkImageAspectFlagBits; +typedef VkFlags VkImageAspectFlags; + +typedef enum VkSparseImageFormatFlagBits { + VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, + VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002, + VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, +} VkSparseImageFormatFlagBits; +typedef VkFlags VkSparseImageFormatFlags; + +typedef enum VkSparseMemoryBindFlagBits { + VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001, +} VkSparseMemoryBindFlagBits; +typedef VkFlags VkSparseMemoryBindFlags; + +typedef enum VkFenceCreateFlagBits { + VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001, +} VkFenceCreateFlagBits; +typedef VkFlags VkFenceCreateFlags; +typedef VkFlags VkSemaphoreCreateFlags; +typedef VkFlags VkEventCreateFlags; +typedef VkFlags VkQueryPoolCreateFlags; + +typedef enum VkQueryPipelineStatisticFlagBits { + VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, + VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, + VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, + VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, + VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, + VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, + VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, + VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, + VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, + VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, + VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, +} VkQueryPipelineStatisticFlagBits; +typedef VkFlags VkQueryPipelineStatisticFlags; + +typedef enum VkQueryResultFlagBits { + VK_QUERY_RESULT_64_BIT = 0x00000001, + VK_QUERY_RESULT_WAIT_BIT = 0x00000002, + VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, + VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, +} VkQueryResultFlagBits; +typedef VkFlags VkQueryResultFlags; + +typedef enum VkBufferCreateFlagBits { + VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, + VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, + VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, +} VkBufferCreateFlagBits; +typedef VkFlags VkBufferCreateFlags; + +typedef enum VkBufferUsageFlagBits { + VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, + VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, + VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, + VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, + VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, + VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, + VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, + VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, + VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, +} VkBufferUsageFlagBits; +typedef VkFlags VkBufferUsageFlags; +typedef VkFlags VkBufferViewCreateFlags; +typedef VkFlags VkImageViewCreateFlags; +typedef VkFlags VkShaderModuleCreateFlags; +typedef VkFlags VkPipelineCacheCreateFlags; + +typedef enum VkPipelineCreateFlagBits { + VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001, + VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002, + VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004, +} VkPipelineCreateFlagBits; +typedef VkFlags VkPipelineCreateFlags; +typedef VkFlags VkPipelineShaderStageCreateFlags; + +typedef enum VkShaderStageFlagBits { + VK_SHADER_STAGE_VERTEX_BIT = 0x00000001, + VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002, + VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004, + VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008, + VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, + VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020, + VK_SHADER_STAGE_ALL_GRAPHICS = 0x1F, + VK_SHADER_STAGE_ALL = 0x7FFFFFFF, +} VkShaderStageFlagBits; +typedef VkFlags VkPipelineVertexInputStateCreateFlags; +typedef VkFlags VkPipelineInputAssemblyStateCreateFlags; +typedef VkFlags VkPipelineTessellationStateCreateFlags; +typedef VkFlags VkPipelineViewportStateCreateFlags; +typedef VkFlags VkPipelineRasterizationStateCreateFlags; + +typedef enum VkCullModeFlagBits { + VK_CULL_MODE_NONE = 0, + VK_CULL_MODE_FRONT_BIT = 0x00000001, + VK_CULL_MODE_BACK_BIT = 0x00000002, + VK_CULL_MODE_FRONT_AND_BACK = 0x3, +} VkCullModeFlagBits; +typedef VkFlags VkCullModeFlags; +typedef VkFlags VkPipelineMultisampleStateCreateFlags; +typedef VkFlags VkPipelineDepthStencilStateCreateFlags; +typedef VkFlags VkPipelineColorBlendStateCreateFlags; + +typedef enum VkColorComponentFlagBits { + VK_COLOR_COMPONENT_R_BIT = 0x00000001, + VK_COLOR_COMPONENT_G_BIT = 0x00000002, + VK_COLOR_COMPONENT_B_BIT = 0x00000004, + VK_COLOR_COMPONENT_A_BIT = 0x00000008, +} VkColorComponentFlagBits; +typedef VkFlags VkColorComponentFlags; +typedef VkFlags VkPipelineDynamicStateCreateFlags; +typedef VkFlags VkPipelineLayoutCreateFlags; +typedef VkFlags VkShaderStageFlags; +typedef VkFlags VkSamplerCreateFlags; +typedef VkFlags VkDescriptorSetLayoutCreateFlags; + +typedef enum VkDescriptorPoolCreateFlagBits { + VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001, +} VkDescriptorPoolCreateFlagBits; +typedef VkFlags VkDescriptorPoolCreateFlags; +typedef VkFlags VkDescriptorPoolResetFlags; +typedef VkFlags VkFramebufferCreateFlags; +typedef VkFlags VkRenderPassCreateFlags; + +typedef enum VkAttachmentDescriptionFlagBits { + VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001, +} VkAttachmentDescriptionFlagBits; +typedef VkFlags VkAttachmentDescriptionFlags; +typedef VkFlags VkSubpassDescriptionFlags; + +typedef enum VkAccessFlagBits { + VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001, + VK_ACCESS_INDEX_READ_BIT = 0x00000002, + VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004, + VK_ACCESS_UNIFORM_READ_BIT = 0x00000008, + VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010, + VK_ACCESS_SHADER_READ_BIT = 0x00000020, + VK_ACCESS_SHADER_WRITE_BIT = 0x00000040, + VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080, + VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400, + VK_ACCESS_TRANSFER_READ_BIT = 0x00000800, + VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000, + VK_ACCESS_HOST_READ_BIT = 0x00002000, + VK_ACCESS_HOST_WRITE_BIT = 0x00004000, + VK_ACCESS_MEMORY_READ_BIT = 0x00008000, + VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000, +} VkAccessFlagBits; +typedef VkFlags VkAccessFlags; + +typedef enum VkDependencyFlagBits { + VK_DEPENDENCY_BY_REGION_BIT = 0x00000001, +} VkDependencyFlagBits; +typedef VkFlags VkDependencyFlags; + +typedef enum VkCommandPoolCreateFlagBits { + VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, + VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, +} VkCommandPoolCreateFlagBits; +typedef VkFlags VkCommandPoolCreateFlags; + +typedef enum VkCommandPoolResetFlagBits { + VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, +} VkCommandPoolResetFlagBits; +typedef VkFlags VkCommandPoolResetFlags; + +typedef enum VkCommandBufferUsageFlagBits { + VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001, + VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002, + VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004, +} VkCommandBufferUsageFlagBits; +typedef VkFlags VkCommandBufferUsageFlags; + +typedef enum VkQueryControlFlagBits { + VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001, +} VkQueryControlFlagBits; +typedef VkFlags VkQueryControlFlags; + +typedef enum VkCommandBufferResetFlagBits { + VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, +} VkCommandBufferResetFlagBits; +typedef VkFlags VkCommandBufferResetFlags; + +typedef enum VkStencilFaceFlagBits { + VK_STENCIL_FACE_FRONT_BIT = 0x00000001, + VK_STENCIL_FACE_BACK_BIT = 0x00000002, + VK_STENCIL_FRONT_AND_BACK = 0x3, +} VkStencilFaceFlagBits; +typedef VkFlags VkStencilFaceFlags; + +typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)( + void* pUserData, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); + +typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)( + void* pUserData, + void* pOriginal, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); + +typedef void (VKAPI_PTR *PFN_vkFreeFunction)( + void* pUserData, + void* pMemory); + +typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)( + void* pUserData, + size_t size, + VkInternalAllocationType allocationType, + VkSystemAllocationScope allocationScope); + +typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)( + void* pUserData, + size_t size, + VkInternalAllocationType allocationType, + VkSystemAllocationScope allocationScope); + +typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); + +typedef struct VkApplicationInfo { + VkStructureType sType; + const void* pNext; + const char* pApplicationName; + uint32_t applicationVersion; + const char* pEngineName; + uint32_t engineVersion; + uint32_t apiVersion; +} VkApplicationInfo; + +typedef struct VkInstanceCreateInfo { + VkStructureType sType; + const void* pNext; + VkInstanceCreateFlags flags; + const VkApplicationInfo* pApplicationInfo; + uint32_t enabledLayerCount; + const char* const* ppEnabledLayerNames; + uint32_t enabledExtensionCount; + const char* const* ppEnabledExtensionNames; +} VkInstanceCreateInfo; + +typedef struct VkAllocationCallbacks { + void* pUserData; + PFN_vkAllocationFunction pfnAllocation; + PFN_vkReallocationFunction pfnReallocation; + PFN_vkFreeFunction pfnFree; + PFN_vkInternalAllocationNotification pfnInternalAllocation; + PFN_vkInternalFreeNotification pfnInternalFree; +} VkAllocationCallbacks; + +typedef struct VkPhysicalDeviceFeatures { + VkBool32 robustBufferAccess; + VkBool32 fullDrawIndexUint32; + VkBool32 imageCubeArray; + VkBool32 independentBlend; + VkBool32 geometryShader; + VkBool32 tessellationShader; + VkBool32 sampleRateShading; + VkBool32 dualSrcBlend; + VkBool32 logicOp; + VkBool32 multiDrawIndirect; + VkBool32 drawIndirectFirstInstance; + VkBool32 depthClamp; + VkBool32 depthBiasClamp; + VkBool32 fillModeNonSolid; + VkBool32 depthBounds; + VkBool32 wideLines; + VkBool32 largePoints; + VkBool32 alphaToOne; + VkBool32 multiViewport; + VkBool32 samplerAnisotropy; + VkBool32 textureCompressionETC2; + VkBool32 textureCompressionASTC_LDR; + VkBool32 textureCompressionBC; + VkBool32 occlusionQueryPrecise; + VkBool32 pipelineStatisticsQuery; + VkBool32 vertexPipelineStoresAndAtomics; + VkBool32 fragmentStoresAndAtomics; + VkBool32 shaderTessellationAndGeometryPointSize; + VkBool32 shaderImageGatherExtended; + VkBool32 shaderStorageImageExtendedFormats; + VkBool32 shaderStorageImageMultisample; + VkBool32 shaderStorageImageReadWithoutFormat; + VkBool32 shaderStorageImageWriteWithoutFormat; + VkBool32 shaderUniformBufferArrayDynamicIndexing; + VkBool32 shaderSampledImageArrayDynamicIndexing; + VkBool32 shaderStorageBufferArrayDynamicIndexing; + VkBool32 shaderStorageImageArrayDynamicIndexing; + VkBool32 shaderClipDistance; + VkBool32 shaderCullDistance; + VkBool32 shaderFloat64; + VkBool32 shaderInt64; + VkBool32 shaderInt16; + VkBool32 shaderResourceResidency; + VkBool32 shaderResourceMinLod; + VkBool32 sparseBinding; + VkBool32 sparseResidencyBuffer; + VkBool32 sparseResidencyImage2D; + VkBool32 sparseResidencyImage3D; + VkBool32 sparseResidency2Samples; + VkBool32 sparseResidency4Samples; + VkBool32 sparseResidency8Samples; + VkBool32 sparseResidency16Samples; + VkBool32 sparseResidencyAliased; + VkBool32 variableMultisampleRate; + VkBool32 inheritedQueries; +} VkPhysicalDeviceFeatures; + +typedef struct VkFormatProperties { + VkFormatFeatureFlags linearTilingFeatures; + VkFormatFeatureFlags optimalTilingFeatures; + VkFormatFeatureFlags bufferFeatures; +} VkFormatProperties; + +typedef struct VkExtent3D { + uint32_t width; + uint32_t height; + uint32_t depth; +} VkExtent3D; + +typedef struct VkImageFormatProperties { + VkExtent3D maxExtent; + uint32_t maxMipLevels; + uint32_t maxArrayLayers; + VkSampleCountFlags sampleCounts; + VkDeviceSize maxResourceSize; +} VkImageFormatProperties; + +typedef struct VkPhysicalDeviceLimits { + uint32_t maxImageDimension1D; + uint32_t maxImageDimension2D; + uint32_t maxImageDimension3D; + uint32_t maxImageDimensionCube; + uint32_t maxImageArrayLayers; + uint32_t maxTexelBufferElements; + uint32_t maxUniformBufferRange; + uint32_t maxStorageBufferRange; + uint32_t maxPushConstantsSize; + uint32_t maxMemoryAllocationCount; + uint32_t maxSamplerAllocationCount; + VkDeviceSize bufferImageGranularity; + VkDeviceSize sparseAddressSpaceSize; + uint32_t maxBoundDescriptorSets; + uint32_t maxPerStageDescriptorSamplers; + uint32_t maxPerStageDescriptorUniformBuffers; + uint32_t maxPerStageDescriptorStorageBuffers; + uint32_t maxPerStageDescriptorSampledImages; + uint32_t maxPerStageDescriptorStorageImages; + uint32_t maxPerStageDescriptorInputAttachments; + uint32_t maxPerStageResources; + uint32_t maxDescriptorSetSamplers; + uint32_t maxDescriptorSetUniformBuffers; + uint32_t maxDescriptorSetUniformBuffersDynamic; + uint32_t maxDescriptorSetStorageBuffers; + uint32_t maxDescriptorSetStorageBuffersDynamic; + uint32_t maxDescriptorSetSampledImages; + uint32_t maxDescriptorSetStorageImages; + uint32_t maxDescriptorSetInputAttachments; + uint32_t maxVertexInputAttributes; + uint32_t maxVertexInputBindings; + uint32_t maxVertexInputAttributeOffset; + uint32_t maxVertexInputBindingStride; + uint32_t maxVertexOutputComponents; + uint32_t maxTessellationGenerationLevel; + uint32_t maxTessellationPatchSize; + uint32_t maxTessellationControlPerVertexInputComponents; + uint32_t maxTessellationControlPerVertexOutputComponents; + uint32_t maxTessellationControlPerPatchOutputComponents; + uint32_t maxTessellationControlTotalOutputComponents; + uint32_t maxTessellationEvaluationInputComponents; + uint32_t maxTessellationEvaluationOutputComponents; + uint32_t maxGeometryShaderInvocations; + uint32_t maxGeometryInputComponents; + uint32_t maxGeometryOutputComponents; + uint32_t maxGeometryOutputVertices; + uint32_t maxGeometryTotalOutputComponents; + uint32_t maxFragmentInputComponents; + uint32_t maxFragmentOutputAttachments; + uint32_t maxFragmentDualSrcAttachments; + uint32_t maxFragmentCombinedOutputResources; + uint32_t maxComputeSharedMemorySize; + uint32_t maxComputeWorkGroupCount[3]; + uint32_t maxComputeWorkGroupInvocations; + uint32_t maxComputeWorkGroupSize[3]; + uint32_t subPixelPrecisionBits; + uint32_t subTexelPrecisionBits; + uint32_t mipmapPrecisionBits; + uint32_t maxDrawIndexedIndexValue; + uint32_t maxDrawIndirectCount; + float maxSamplerLodBias; + float maxSamplerAnisotropy; + uint32_t maxViewports; + uint32_t maxViewportDimensions[2]; + float viewportBoundsRange[2]; + uint32_t viewportSubPixelBits; + size_t minMemoryMapAlignment; + VkDeviceSize minTexelBufferOffsetAlignment; + VkDeviceSize minUniformBufferOffsetAlignment; + VkDeviceSize minStorageBufferOffsetAlignment; + int32_t minTexelOffset; + uint32_t maxTexelOffset; + int32_t minTexelGatherOffset; + uint32_t maxTexelGatherOffset; + float minInterpolationOffset; + float maxInterpolationOffset; + uint32_t subPixelInterpolationOffsetBits; + uint32_t maxFramebufferWidth; + uint32_t maxFramebufferHeight; + uint32_t maxFramebufferLayers; + VkSampleCountFlags framebufferColorSampleCounts; + VkSampleCountFlags framebufferDepthSampleCounts; + VkSampleCountFlags framebufferStencilSampleCounts; + VkSampleCountFlags framebufferNoAttachmentsSampleCounts; + uint32_t maxColorAttachments; + VkSampleCountFlags sampledImageColorSampleCounts; + VkSampleCountFlags sampledImageIntegerSampleCounts; + VkSampleCountFlags sampledImageDepthSampleCounts; + VkSampleCountFlags sampledImageStencilSampleCounts; + VkSampleCountFlags storageImageSampleCounts; + uint32_t maxSampleMaskWords; + VkBool32 timestampComputeAndGraphics; + float timestampPeriod; + uint32_t maxClipDistances; + uint32_t maxCullDistances; + uint32_t maxCombinedClipAndCullDistances; + uint32_t discreteQueuePriorities; + float pointSizeRange[2]; + float lineWidthRange[2]; + float pointSizeGranularity; + float lineWidthGranularity; + VkBool32 strictLines; + VkBool32 standardSampleLocations; + VkDeviceSize optimalBufferCopyOffsetAlignment; + VkDeviceSize optimalBufferCopyRowPitchAlignment; + VkDeviceSize nonCoherentAtomSize; +} VkPhysicalDeviceLimits; + +typedef struct VkPhysicalDeviceSparseProperties { + VkBool32 residencyStandard2DBlockShape; + VkBool32 residencyStandard2DMultisampleBlockShape; + VkBool32 residencyStandard3DBlockShape; + VkBool32 residencyAlignedMipSize; + VkBool32 residencyNonResidentStrict; +} VkPhysicalDeviceSparseProperties; + +typedef struct VkPhysicalDeviceProperties { + uint32_t apiVersion; + uint32_t driverVersion; + uint32_t vendorID; + uint32_t deviceID; + VkPhysicalDeviceType deviceType; + char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; + uint8_t pipelineCacheUUID[VK_UUID_SIZE]; + VkPhysicalDeviceLimits limits; + VkPhysicalDeviceSparseProperties sparseProperties; +} VkPhysicalDeviceProperties; + +typedef struct VkQueueFamilyProperties { + VkQueueFlags queueFlags; + uint32_t queueCount; + uint32_t timestampValidBits; + VkExtent3D minImageTransferGranularity; +} VkQueueFamilyProperties; + +typedef struct VkMemoryType { + VkMemoryPropertyFlags propertyFlags; + uint32_t heapIndex; +} VkMemoryType; + +typedef struct VkMemoryHeap { + VkDeviceSize size; + VkMemoryHeapFlags flags; +} VkMemoryHeap; + +typedef struct VkPhysicalDeviceMemoryProperties { + uint32_t memoryTypeCount; + VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]; + uint32_t memoryHeapCount; + VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS]; +} VkPhysicalDeviceMemoryProperties; + +typedef struct VkDeviceQueueCreateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceQueueCreateFlags flags; + uint32_t queueFamilyIndex; + uint32_t queueCount; + const float* pQueuePriorities; +} VkDeviceQueueCreateInfo; + +typedef struct VkDeviceCreateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceCreateFlags flags; + uint32_t queueCreateInfoCount; + const VkDeviceQueueCreateInfo* pQueueCreateInfos; + uint32_t enabledLayerCount; + const char* const* ppEnabledLayerNames; + uint32_t enabledExtensionCount; + const char* const* ppEnabledExtensionNames; + const VkPhysicalDeviceFeatures* pEnabledFeatures; +} VkDeviceCreateInfo; + +typedef struct VkExtensionProperties { + char extensionName[VK_MAX_EXTENSION_NAME_SIZE]; + uint32_t specVersion; +} VkExtensionProperties; + +typedef struct VkLayerProperties { + char layerName[VK_MAX_EXTENSION_NAME_SIZE]; + uint32_t specVersion; + uint32_t implementationVersion; + char description[VK_MAX_DESCRIPTION_SIZE]; +} VkLayerProperties; + +typedef struct VkSubmitInfo { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + const VkPipelineStageFlags* pWaitDstStageMask; + uint32_t commandBufferCount; + const VkCommandBuffer* pCommandBuffers; + uint32_t signalSemaphoreCount; + const VkSemaphore* pSignalSemaphores; +} VkSubmitInfo; + +typedef struct VkMemoryAllocateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceSize allocationSize; + uint32_t memoryTypeIndex; +} VkMemoryAllocateInfo; + +typedef struct VkMappedMemoryRange { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkDeviceSize offset; + VkDeviceSize size; +} VkMappedMemoryRange; + +typedef struct VkMemoryRequirements { + VkDeviceSize size; + VkDeviceSize alignment; + uint32_t memoryTypeBits; +} VkMemoryRequirements; + +typedef struct VkSparseImageFormatProperties { + VkImageAspectFlags aspectMask; + VkExtent3D imageGranularity; + VkSparseImageFormatFlags flags; +} VkSparseImageFormatProperties; + +typedef struct VkSparseImageMemoryRequirements { + VkSparseImageFormatProperties formatProperties; + uint32_t imageMipTailFirstLod; + VkDeviceSize imageMipTailSize; + VkDeviceSize imageMipTailOffset; + VkDeviceSize imageMipTailStride; +} VkSparseImageMemoryRequirements; + +typedef struct VkSparseMemoryBind { + VkDeviceSize resourceOffset; + VkDeviceSize size; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + VkSparseMemoryBindFlags flags; +} VkSparseMemoryBind; + +typedef struct VkSparseBufferMemoryBindInfo { + VkBuffer buffer; + uint32_t bindCount; + const VkSparseMemoryBind* pBinds; +} VkSparseBufferMemoryBindInfo; + +typedef struct VkSparseImageOpaqueMemoryBindInfo { + VkImage image; + uint32_t bindCount; + const VkSparseMemoryBind* pBinds; +} VkSparseImageOpaqueMemoryBindInfo; + +typedef struct VkImageSubresource { + VkImageAspectFlags aspectMask; + uint32_t mipLevel; + uint32_t arrayLayer; +} VkImageSubresource; + +typedef struct VkOffset3D { + int32_t x; + int32_t y; + int32_t z; +} VkOffset3D; + +typedef struct VkSparseImageMemoryBind { + VkImageSubresource subresource; + VkOffset3D offset; + VkExtent3D extent; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + VkSparseMemoryBindFlags flags; +} VkSparseImageMemoryBind; + +typedef struct VkSparseImageMemoryBindInfo { + VkImage image; + uint32_t bindCount; + const VkSparseImageMemoryBind* pBinds; +} VkSparseImageMemoryBindInfo; + +typedef struct VkBindSparseInfo { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + uint32_t bufferBindCount; + const VkSparseBufferMemoryBindInfo* pBufferBinds; + uint32_t imageOpaqueBindCount; + const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds; + uint32_t imageBindCount; + const VkSparseImageMemoryBindInfo* pImageBinds; + uint32_t signalSemaphoreCount; + const VkSemaphore* pSignalSemaphores; +} VkBindSparseInfo; + +typedef struct VkFenceCreateInfo { + VkStructureType sType; + const void* pNext; + VkFenceCreateFlags flags; +} VkFenceCreateInfo; + +typedef struct VkSemaphoreCreateInfo { + VkStructureType sType; + const void* pNext; + VkSemaphoreCreateFlags flags; +} VkSemaphoreCreateInfo; + +typedef struct VkEventCreateInfo { + VkStructureType sType; + const void* pNext; + VkEventCreateFlags flags; +} VkEventCreateInfo; + +typedef struct VkQueryPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkQueryPoolCreateFlags flags; + VkQueryType queryType; + uint32_t queryCount; + VkQueryPipelineStatisticFlags pipelineStatistics; +} VkQueryPoolCreateInfo; + +typedef struct VkBufferCreateInfo { + VkStructureType sType; + const void* pNext; + VkBufferCreateFlags flags; + VkDeviceSize size; + VkBufferUsageFlags usage; + VkSharingMode sharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; +} VkBufferCreateInfo; + +typedef struct VkBufferViewCreateInfo { + VkStructureType sType; + const void* pNext; + VkBufferViewCreateFlags flags; + VkBuffer buffer; + VkFormat format; + VkDeviceSize offset; + VkDeviceSize range; +} VkBufferViewCreateInfo; + +typedef struct VkImageCreateInfo { + VkStructureType sType; + const void* pNext; + VkImageCreateFlags flags; + VkImageType imageType; + VkFormat format; + VkExtent3D extent; + uint32_t mipLevels; + uint32_t arrayLayers; + VkSampleCountFlagBits samples; + VkImageTiling tiling; + VkImageUsageFlags usage; + VkSharingMode sharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; + VkImageLayout initialLayout; +} VkImageCreateInfo; + +typedef struct VkSubresourceLayout { + VkDeviceSize offset; + VkDeviceSize size; + VkDeviceSize rowPitch; + VkDeviceSize arrayPitch; + VkDeviceSize depthPitch; +} VkSubresourceLayout; + +typedef struct VkComponentMapping { + VkComponentSwizzle r; + VkComponentSwizzle g; + VkComponentSwizzle b; + VkComponentSwizzle a; +} VkComponentMapping; + +typedef struct VkImageSubresourceRange { + VkImageAspectFlags aspectMask; + uint32_t baseMipLevel; + uint32_t levelCount; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkImageSubresourceRange; + +typedef struct VkImageViewCreateInfo { + VkStructureType sType; + const void* pNext; + VkImageViewCreateFlags flags; + VkImage image; + VkImageViewType viewType; + VkFormat format; + VkComponentMapping components; + VkImageSubresourceRange subresourceRange; +} VkImageViewCreateInfo; + +typedef struct VkShaderModuleCreateInfo { + VkStructureType sType; + const void* pNext; + VkShaderModuleCreateFlags flags; + size_t codeSize; + const uint32_t* pCode; +} VkShaderModuleCreateInfo; + +typedef struct VkPipelineCacheCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCacheCreateFlags flags; + size_t initialDataSize; + const void* pInitialData; +} VkPipelineCacheCreateInfo; + +typedef struct VkSpecializationMapEntry { + uint32_t constantID; + uint32_t offset; + size_t size; +} VkSpecializationMapEntry; + +typedef struct VkSpecializationInfo { + uint32_t mapEntryCount; + const VkSpecializationMapEntry* pMapEntries; + size_t dataSize; + const void* pData; +} VkSpecializationInfo; + +typedef struct VkPipelineShaderStageCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineShaderStageCreateFlags flags; + VkShaderStageFlagBits stage; + VkShaderModule module; + const char* pName; + const VkSpecializationInfo* pSpecializationInfo; +} VkPipelineShaderStageCreateInfo; + +typedef struct VkVertexInputBindingDescription { + uint32_t binding; + uint32_t stride; + VkVertexInputRate inputRate; +} VkVertexInputBindingDescription; + +typedef struct VkVertexInputAttributeDescription { + uint32_t location; + uint32_t binding; + VkFormat format; + uint32_t offset; +} VkVertexInputAttributeDescription; + +typedef struct VkPipelineVertexInputStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineVertexInputStateCreateFlags flags; + uint32_t vertexBindingDescriptionCount; + const VkVertexInputBindingDescription* pVertexBindingDescriptions; + uint32_t vertexAttributeDescriptionCount; + const VkVertexInputAttributeDescription* pVertexAttributeDescriptions; +} VkPipelineVertexInputStateCreateInfo; + +typedef struct VkPipelineInputAssemblyStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineInputAssemblyStateCreateFlags flags; + VkPrimitiveTopology topology; + VkBool32 primitiveRestartEnable; +} VkPipelineInputAssemblyStateCreateInfo; + +typedef struct VkPipelineTessellationStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineTessellationStateCreateFlags flags; + uint32_t patchControlPoints; +} VkPipelineTessellationStateCreateInfo; + +typedef struct VkViewport { + float x; + float y; + float width; + float height; + float minDepth; + float maxDepth; +} VkViewport; + +typedef struct VkOffset2D { + int32_t x; + int32_t y; +} VkOffset2D; + +typedef struct VkExtent2D { + uint32_t width; + uint32_t height; +} VkExtent2D; + +typedef struct VkRect2D { + VkOffset2D offset; + VkExtent2D extent; +} VkRect2D; + +typedef struct VkPipelineViewportStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineViewportStateCreateFlags flags; + uint32_t viewportCount; + const VkViewport* pViewports; + uint32_t scissorCount; + const VkRect2D* pScissors; +} VkPipelineViewportStateCreateInfo; + +typedef struct VkPipelineRasterizationStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineRasterizationStateCreateFlags flags; + VkBool32 depthClampEnable; + VkBool32 rasterizerDiscardEnable; + VkPolygonMode polygonMode; + VkCullModeFlags cullMode; + VkFrontFace frontFace; + VkBool32 depthBiasEnable; + float depthBiasConstantFactor; + float depthBiasClamp; + float depthBiasSlopeFactor; + float lineWidth; +} VkPipelineRasterizationStateCreateInfo; + +typedef struct VkPipelineMultisampleStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineMultisampleStateCreateFlags flags; + VkSampleCountFlagBits rasterizationSamples; + VkBool32 sampleShadingEnable; + float minSampleShading; + const VkSampleMask* pSampleMask; + VkBool32 alphaToCoverageEnable; + VkBool32 alphaToOneEnable; +} VkPipelineMultisampleStateCreateInfo; + +typedef struct VkStencilOpState { + VkStencilOp failOp; + VkStencilOp passOp; + VkStencilOp depthFailOp; + VkCompareOp compareOp; + uint32_t compareMask; + uint32_t writeMask; + uint32_t reference; +} VkStencilOpState; + +typedef struct VkPipelineDepthStencilStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineDepthStencilStateCreateFlags flags; + VkBool32 depthTestEnable; + VkBool32 depthWriteEnable; + VkCompareOp depthCompareOp; + VkBool32 depthBoundsTestEnable; + VkBool32 stencilTestEnable; + VkStencilOpState front; + VkStencilOpState back; + float minDepthBounds; + float maxDepthBounds; +} VkPipelineDepthStencilStateCreateInfo; + +typedef struct VkPipelineColorBlendAttachmentState { + VkBool32 blendEnable; + VkBlendFactor srcColorBlendFactor; + VkBlendFactor dstColorBlendFactor; + VkBlendOp colorBlendOp; + VkBlendFactor srcAlphaBlendFactor; + VkBlendFactor dstAlphaBlendFactor; + VkBlendOp alphaBlendOp; + VkColorComponentFlags colorWriteMask; +} VkPipelineColorBlendAttachmentState; + +typedef struct VkPipelineColorBlendStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineColorBlendStateCreateFlags flags; + VkBool32 logicOpEnable; + VkLogicOp logicOp; + uint32_t attachmentCount; + const VkPipelineColorBlendAttachmentState* pAttachments; + float blendConstants[4]; +} VkPipelineColorBlendStateCreateInfo; + +typedef struct VkPipelineDynamicStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineDynamicStateCreateFlags flags; + uint32_t dynamicStateCount; + const VkDynamicState* pDynamicStates; +} VkPipelineDynamicStateCreateInfo; + +typedef struct VkGraphicsPipelineCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags flags; + uint32_t stageCount; + const VkPipelineShaderStageCreateInfo* pStages; + const VkPipelineVertexInputStateCreateInfo* pVertexInputState; + const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState; + const VkPipelineTessellationStateCreateInfo* pTessellationState; + const VkPipelineViewportStateCreateInfo* pViewportState; + const VkPipelineRasterizationStateCreateInfo* pRasterizationState; + const VkPipelineMultisampleStateCreateInfo* pMultisampleState; + const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState; + const VkPipelineColorBlendStateCreateInfo* pColorBlendState; + const VkPipelineDynamicStateCreateInfo* pDynamicState; + VkPipelineLayout layout; + VkRenderPass renderPass; + uint32_t subpass; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkGraphicsPipelineCreateInfo; + +typedef struct VkComputePipelineCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags flags; + VkPipelineShaderStageCreateInfo stage; + VkPipelineLayout layout; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkComputePipelineCreateInfo; + +typedef struct VkPushConstantRange { + VkShaderStageFlags stageFlags; + uint32_t offset; + uint32_t size; +} VkPushConstantRange; + +typedef struct VkPipelineLayoutCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineLayoutCreateFlags flags; + uint32_t setLayoutCount; + const VkDescriptorSetLayout* pSetLayouts; + uint32_t pushConstantRangeCount; + const VkPushConstantRange* pPushConstantRanges; +} VkPipelineLayoutCreateInfo; + +typedef struct VkSamplerCreateInfo { + VkStructureType sType; + const void* pNext; + VkSamplerCreateFlags flags; + VkFilter magFilter; + VkFilter minFilter; + VkSamplerMipmapMode mipmapMode; + VkSamplerAddressMode addressModeU; + VkSamplerAddressMode addressModeV; + VkSamplerAddressMode addressModeW; + float mipLodBias; + VkBool32 anisotropyEnable; + float maxAnisotropy; + VkBool32 compareEnable; + VkCompareOp compareOp; + float minLod; + float maxLod; + VkBorderColor borderColor; + VkBool32 unnormalizedCoordinates; +} VkSamplerCreateInfo; + +typedef struct VkDescriptorSetLayoutBinding { + uint32_t binding; + VkDescriptorType descriptorType; + uint32_t descriptorCount; + VkShaderStageFlags stageFlags; + const VkSampler* pImmutableSamplers; +} VkDescriptorSetLayoutBinding; + +typedef struct VkDescriptorSetLayoutCreateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorSetLayoutCreateFlags flags; + uint32_t bindingCount; + const VkDescriptorSetLayoutBinding* pBindings; +} VkDescriptorSetLayoutCreateInfo; + +typedef struct VkDescriptorPoolSize { + VkDescriptorType type; + uint32_t descriptorCount; +} VkDescriptorPoolSize; + +typedef struct VkDescriptorPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorPoolCreateFlags flags; + uint32_t maxSets; + uint32_t poolSizeCount; + const VkDescriptorPoolSize* pPoolSizes; +} VkDescriptorPoolCreateInfo; + +typedef struct VkDescriptorSetAllocateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorPool descriptorPool; + uint32_t descriptorSetCount; + const VkDescriptorSetLayout* pSetLayouts; +} VkDescriptorSetAllocateInfo; + +typedef struct VkDescriptorImageInfo { + VkSampler sampler; + VkImageView imageView; + VkImageLayout imageLayout; +} VkDescriptorImageInfo; + +typedef struct VkDescriptorBufferInfo { + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize range; +} VkDescriptorBufferInfo; + +typedef struct VkWriteDescriptorSet { + VkStructureType sType; + const void* pNext; + VkDescriptorSet dstSet; + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; + VkDescriptorType descriptorType; + const VkDescriptorImageInfo* pImageInfo; + const VkDescriptorBufferInfo* pBufferInfo; + const VkBufferView* pTexelBufferView; +} VkWriteDescriptorSet; + +typedef struct VkCopyDescriptorSet { + VkStructureType sType; + const void* pNext; + VkDescriptorSet srcSet; + uint32_t srcBinding; + uint32_t srcArrayElement; + VkDescriptorSet dstSet; + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; +} VkCopyDescriptorSet; + +typedef struct VkFramebufferCreateInfo { + VkStructureType sType; + const void* pNext; + VkFramebufferCreateFlags flags; + VkRenderPass renderPass; + uint32_t attachmentCount; + const VkImageView* pAttachments; + uint32_t width; + uint32_t height; + uint32_t layers; +} VkFramebufferCreateInfo; + +typedef struct VkAttachmentDescription { + VkAttachmentDescriptionFlags flags; + VkFormat format; + VkSampleCountFlagBits samples; + VkAttachmentLoadOp loadOp; + VkAttachmentStoreOp storeOp; + VkAttachmentLoadOp stencilLoadOp; + VkAttachmentStoreOp stencilStoreOp; + VkImageLayout initialLayout; + VkImageLayout finalLayout; +} VkAttachmentDescription; + +typedef struct VkAttachmentReference { + uint32_t attachment; + VkImageLayout layout; +} VkAttachmentReference; + +typedef struct VkSubpassDescription { + VkSubpassDescriptionFlags flags; + VkPipelineBindPoint pipelineBindPoint; + uint32_t inputAttachmentCount; + const VkAttachmentReference* pInputAttachments; + uint32_t colorAttachmentCount; + const VkAttachmentReference* pColorAttachments; + const VkAttachmentReference* pResolveAttachments; + const VkAttachmentReference* pDepthStencilAttachment; + uint32_t preserveAttachmentCount; + const uint32_t* pPreserveAttachments; +} VkSubpassDescription; + +typedef struct VkSubpassDependency { + uint32_t srcSubpass; + uint32_t dstSubpass; + VkPipelineStageFlags srcStageMask; + VkPipelineStageFlags dstStageMask; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + VkDependencyFlags dependencyFlags; +} VkSubpassDependency; + +typedef struct VkRenderPassCreateInfo { + VkStructureType sType; + const void* pNext; + VkRenderPassCreateFlags flags; + uint32_t attachmentCount; + const VkAttachmentDescription* pAttachments; + uint32_t subpassCount; + const VkSubpassDescription* pSubpasses; + uint32_t dependencyCount; + const VkSubpassDependency* pDependencies; +} VkRenderPassCreateInfo; + +typedef struct VkCommandPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkCommandPoolCreateFlags flags; + uint32_t queueFamilyIndex; +} VkCommandPoolCreateInfo; + +typedef struct VkCommandBufferAllocateInfo { + VkStructureType sType; + const void* pNext; + VkCommandPool commandPool; + VkCommandBufferLevel level; + uint32_t commandBufferCount; +} VkCommandBufferAllocateInfo; + +typedef struct VkCommandBufferInheritanceInfo { + VkStructureType sType; + const void* pNext; + VkRenderPass renderPass; + uint32_t subpass; + VkFramebuffer framebuffer; + VkBool32 occlusionQueryEnable; + VkQueryControlFlags queryFlags; + VkQueryPipelineStatisticFlags pipelineStatistics; +} VkCommandBufferInheritanceInfo; + +typedef struct VkCommandBufferBeginInfo { + VkStructureType sType; + const void* pNext; + VkCommandBufferUsageFlags flags; + const VkCommandBufferInheritanceInfo* pInheritanceInfo; +} VkCommandBufferBeginInfo; + +typedef struct VkBufferCopy { + VkDeviceSize srcOffset; + VkDeviceSize dstOffset; + VkDeviceSize size; +} VkBufferCopy; + +typedef struct VkImageSubresourceLayers { + VkImageAspectFlags aspectMask; + uint32_t mipLevel; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkImageSubresourceLayers; + +typedef struct VkImageCopy { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageCopy; + +typedef struct VkImageBlit { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffsets[2]; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffsets[2]; +} VkImageBlit; + +typedef struct VkBufferImageCopy { + VkDeviceSize bufferOffset; + uint32_t bufferRowLength; + uint32_t bufferImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkBufferImageCopy; + +typedef union VkClearColorValue { + float float32[4]; + int32_t int32[4]; + uint32_t uint32[4]; +} VkClearColorValue; + +typedef struct VkClearDepthStencilValue { + float depth; + uint32_t stencil; +} VkClearDepthStencilValue; + +typedef union VkClearValue { + VkClearColorValue color; + VkClearDepthStencilValue depthStencil; +} VkClearValue; + +typedef struct VkClearAttachment { + VkImageAspectFlags aspectMask; + uint32_t colorAttachment; + VkClearValue clearValue; +} VkClearAttachment; + +typedef struct VkClearRect { + VkRect2D rect; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkClearRect; + +typedef struct VkImageResolve { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageResolve; + +typedef struct VkMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; +} VkMemoryBarrier; + +typedef struct VkBufferMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize size; +} VkBufferMemoryBarrier; + +typedef struct VkImageMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + VkImageLayout oldLayout; + VkImageLayout newLayout; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkImage image; + VkImageSubresourceRange subresourceRange; +} VkImageMemoryBarrier; + +typedef struct VkRenderPassBeginInfo { + VkStructureType sType; + const void* pNext; + VkRenderPass renderPass; + VkFramebuffer framebuffer; + VkRect2D renderArea; + uint32_t clearValueCount; + const VkClearValue* pClearValues; +} VkRenderPassBeginInfo; + +typedef struct VkDispatchIndirectCommand { + uint32_t x; + uint32_t y; + uint32_t z; +} VkDispatchIndirectCommand; + +typedef struct VkDrawIndexedIndirectCommand { + uint32_t indexCount; + uint32_t instanceCount; + uint32_t firstIndex; + int32_t vertexOffset; + uint32_t firstInstance; +} VkDrawIndexedIndirectCommand; + +typedef struct VkDrawIndirectCommand { + uint32_t vertexCount; + uint32_t instanceCount; + uint32_t firstVertex; + uint32_t firstInstance; +} VkDrawIndirectCommand; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance); +typedef void (VKAPI_PTR *PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties); +typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName); +typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetDeviceProcAddr)(VkDevice device, const char* pName); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice); +typedef void (VKAPI_PTR *PFN_vkDestroyDevice)(VkDevice device, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceExtensionProperties)(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t* pPropertyCount, VkLayerProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties); +typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue); +typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkQueueWaitIdle)(VkQueue queue); +typedef VkResult (VKAPI_PTR *PFN_vkDeviceWaitIdle)(VkDevice device); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateMemory)(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory); +typedef void (VKAPI_PTR *PFN_vkFreeMemory)(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkMapMemory)(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData); +typedef void (VKAPI_PTR *PFN_vkUnmapMemory)(VkDevice device, VkDeviceMemory memory); +typedef VkResult (VKAPI_PTR *PFN_vkFlushMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges); +typedef VkResult (VKAPI_PTR *PFN_vkInvalidateMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges); +typedef void (VKAPI_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes); +typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory)(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset); +typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory)(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset); +typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements)(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements)(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements)(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkQueueBindSparse)(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkCreateFence)(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); +typedef void (VKAPI_PTR *PFN_vkDestroyFence)(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceStatus)(VkDevice device, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkWaitForFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout); +typedef VkResult (VKAPI_PTR *PFN_vkCreateSemaphore)(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore); +typedef void (VKAPI_PTR *PFN_vkDestroySemaphore)(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateEvent)(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent); +typedef void (VKAPI_PTR *PFN_vkDestroyEvent)(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetEventStatus)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkSetEvent)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkResetEvent)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkCreateQueryPool)(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool); +typedef void (VKAPI_PTR *PFN_vkDestroyQueryPool)(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetQueryPoolResults)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkCreateBuffer)(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer); +typedef void (VKAPI_PTR *PFN_vkDestroyBuffer)(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateBufferView)(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView); +typedef void (VKAPI_PTR *PFN_vkDestroyBufferView)(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateImage)(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage); +typedef void (VKAPI_PTR *PFN_vkDestroyImage)(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout); +typedef VkResult (VKAPI_PTR *PFN_vkCreateImageView)(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView); +typedef void (VKAPI_PTR *PFN_vkDestroyImageView)(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateShaderModule)(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule); +typedef void (VKAPI_PTR *PFN_vkDestroyShaderModule)(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineCache)(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache); +typedef void (VKAPI_PTR *PFN_vkDestroyPipelineCache)(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineCacheData)(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkMergePipelineCaches)(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches); +typedef VkResult (VKAPI_PTR *PFN_vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); +typedef VkResult (VKAPI_PTR *PFN_vkCreateComputePipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); +typedef void (VKAPI_PTR *PFN_vkDestroyPipeline)(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineLayout)(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout); +typedef void (VKAPI_PTR *PFN_vkDestroyPipelineLayout)(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateSampler)(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler); +typedef void (VKAPI_PTR *PFN_vkDestroySampler)(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorSetLayout)(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout); +typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorSetLayout)(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorPool)(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool); +typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateDescriptorSets)(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets); +typedef VkResult (VKAPI_PTR *PFN_vkFreeDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets); +typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies); +typedef VkResult (VKAPI_PTR *PFN_vkCreateFramebuffer)(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer); +typedef void (VKAPI_PTR *PFN_vkDestroyFramebuffer)(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass); +typedef void (VKAPI_PTR *PFN_vkDestroyRenderPass)(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkGetRenderAreaGranularity)(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity); +typedef VkResult (VKAPI_PTR *PFN_vkCreateCommandPool)(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool); +typedef void (VKAPI_PTR *PFN_vkDestroyCommandPool)(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateCommandBuffers)(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers); +typedef void (VKAPI_PTR *PFN_vkFreeCommandBuffers)(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers); +typedef VkResult (VKAPI_PTR *PFN_vkBeginCommandBuffer)(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo); +typedef VkResult (VKAPI_PTR *PFN_vkEndCommandBuffer)(VkCommandBuffer commandBuffer); +typedef VkResult (VKAPI_PTR *PFN_vkResetCommandBuffer)(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdBindPipeline)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); +typedef void (VKAPI_PTR *PFN_vkCmdSetViewport)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports); +typedef void (VKAPI_PTR *PFN_vkCmdSetScissor)(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors); +typedef void (VKAPI_PTR *PFN_vkCmdSetLineWidth)(VkCommandBuffer commandBuffer, float lineWidth); +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBias)(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor); +typedef void (VKAPI_PTR *PFN_vkCmdSetBlendConstants)(VkCommandBuffer commandBuffer, const float blendConstants[4]); +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBounds)(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilCompareMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilWriteMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilReference)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference); +typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorSets)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets); +typedef void (VKAPI_PTR *PFN_vkCmdBindIndexBuffer)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType); +typedef void (VKAPI_PTR *PFN_vkCmdBindVertexBuffers)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets); +typedef void (VKAPI_PTR *PFN_vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexed)(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdDispatch)(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset); +typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter); +typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData); +typedef void (VKAPI_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data); +typedef void (VKAPI_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); +typedef void (VKAPI_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); +typedef void (VKAPI_PTR *PFN_vkCmdClearAttachments)(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects); +typedef void (VKAPI_PTR *PFN_vkCmdResolveImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdSetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (VKAPI_PTR *PFN_vkCmdResetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (VKAPI_PTR *PFN_vkCmdWaitEvents)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers); +typedef void (VKAPI_PTR *PFN_vkCmdPipelineBarrier)(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers); +typedef void (VKAPI_PTR *PFN_vkCmdBeginQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdEndQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query); +typedef void (VKAPI_PTR *PFN_vkCmdResetQueryPool)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); +typedef void (VKAPI_PTR *PFN_vkCmdWriteTimestamp)(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query); +typedef void (VKAPI_PTR *PFN_vkCmdCopyQueryPoolResults)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdPushConstants)(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues); +typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents); +typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass)(VkCommandBuffer commandBuffer, VkSubpassContents contents); +typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer commandBuffer); +typedef void (VKAPI_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( + const VkInstanceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkInstance* pInstance); + +VKAPI_ATTR void VKAPI_CALL vkDestroyInstance( + VkInstance instance, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices( + VkInstance instance, + uint32_t* pPhysicalDeviceCount, + VkPhysicalDevice* pPhysicalDevices); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures* pFeatures); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkFormatProperties* pFormatProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkImageTiling tiling, + VkImageUsageFlags usage, + VkImageCreateFlags flags, + VkImageFormatProperties* pImageFormatProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties* pProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties( + VkPhysicalDevice physicalDevice, + uint32_t* pQueueFamilyPropertyCount, + VkQueueFamilyProperties* pQueueFamilyProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties* pMemoryProperties); + +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr( + VkInstance instance, + const char* pName); + +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr( + VkDevice device, + const char* pName); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice( + VkPhysicalDevice physicalDevice, + const VkDeviceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDevice* pDevice); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDevice( + VkDevice device, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties( + const char* pLayerName, + uint32_t* pPropertyCount, + VkExtensionProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties( + VkPhysicalDevice physicalDevice, + const char* pLayerName, + uint32_t* pPropertyCount, + VkExtensionProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties( + uint32_t* pPropertyCount, + VkLayerProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkLayerProperties* pProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue( + VkDevice device, + uint32_t queueFamilyIndex, + uint32_t queueIndex, + VkQueue* pQueue); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit( + VkQueue queue, + uint32_t submitCount, + const VkSubmitInfo* pSubmits, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle( + VkQueue queue); + +VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle( + VkDevice device); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory( + VkDevice device, + const VkMemoryAllocateInfo* pAllocateInfo, + const VkAllocationCallbacks* pAllocator, + VkDeviceMemory* pMemory); + +VKAPI_ATTR void VKAPI_CALL vkFreeMemory( + VkDevice device, + VkDeviceMemory memory, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory( + VkDevice device, + VkDeviceMemory memory, + VkDeviceSize offset, + VkDeviceSize size, + VkMemoryMapFlags flags, + void** ppData); + +VKAPI_ATTR void VKAPI_CALL vkUnmapMemory( + VkDevice device, + VkDeviceMemory memory); + +VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges( + VkDevice device, + uint32_t memoryRangeCount, + const VkMappedMemoryRange* pMemoryRanges); + +VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges( + VkDevice device, + uint32_t memoryRangeCount, + const VkMappedMemoryRange* pMemoryRanges); + +VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment( + VkDevice device, + VkDeviceMemory memory, + VkDeviceSize* pCommittedMemoryInBytes); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory( + VkDevice device, + VkBuffer buffer, + VkDeviceMemory memory, + VkDeviceSize memoryOffset); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory( + VkDevice device, + VkImage image, + VkDeviceMemory memory, + VkDeviceSize memoryOffset); + +VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements( + VkDevice device, + VkBuffer buffer, + VkMemoryRequirements* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements( + VkDevice device, + VkImage image, + VkMemoryRequirements* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements( + VkDevice device, + VkImage image, + uint32_t* pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements* pSparseMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkSampleCountFlagBits samples, + VkImageUsageFlags usage, + VkImageTiling tiling, + uint32_t* pPropertyCount, + VkSparseImageFormatProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse( + VkQueue queue, + uint32_t bindInfoCount, + const VkBindSparseInfo* pBindInfo, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence( + VkDevice device, + const VkFenceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence); + +VKAPI_ATTR void VKAPI_CALL vkDestroyFence( + VkDevice device, + VkFence fence, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetFences( + VkDevice device, + uint32_t fenceCount, + const VkFence* pFences); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus( + VkDevice device, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences( + VkDevice device, + uint32_t fenceCount, + const VkFence* pFences, + VkBool32 waitAll, + uint64_t timeout); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore( + VkDevice device, + const VkSemaphoreCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSemaphore* pSemaphore); + +VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore( + VkDevice device, + VkSemaphore semaphore, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent( + VkDevice device, + const VkEventCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkEvent* pEvent); + +VKAPI_ATTR void VKAPI_CALL vkDestroyEvent( + VkDevice device, + VkEvent event, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool( + VkDevice device, + const VkQueryPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkQueryPool* pQueryPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool( + VkDevice device, + VkQueryPool queryPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults( + VkDevice device, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount, + size_t dataSize, + void* pData, + VkDeviceSize stride, + VkQueryResultFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer( + VkDevice device, + const VkBufferCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkBuffer* pBuffer); + +VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer( + VkDevice device, + VkBuffer buffer, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView( + VkDevice device, + const VkBufferViewCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkBufferView* pView); + +VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView( + VkDevice device, + VkBufferView bufferView, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage( + VkDevice device, + const VkImageCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkImage* pImage); + +VKAPI_ATTR void VKAPI_CALL vkDestroyImage( + VkDevice device, + VkImage image, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout( + VkDevice device, + VkImage image, + const VkImageSubresource* pSubresource, + VkSubresourceLayout* pLayout); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView( + VkDevice device, + const VkImageViewCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkImageView* pView); + +VKAPI_ATTR void VKAPI_CALL vkDestroyImageView( + VkDevice device, + VkImageView imageView, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule( + VkDevice device, + const VkShaderModuleCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkShaderModule* pShaderModule); + +VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule( + VkDevice device, + VkShaderModule shaderModule, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache( + VkDevice device, + const VkPipelineCacheCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkPipelineCache* pPipelineCache); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache( + VkDevice device, + VkPipelineCache pipelineCache, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData( + VkDevice device, + VkPipelineCache pipelineCache, + size_t* pDataSize, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches( + VkDevice device, + VkPipelineCache dstCache, + uint32_t srcCacheCount, + const VkPipelineCache* pSrcCaches); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkGraphicsPipelineCreateInfo* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkComputePipelineCreateInfo* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline( + VkDevice device, + VkPipeline pipeline, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout( + VkDevice device, + const VkPipelineLayoutCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkPipelineLayout* pPipelineLayout); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout( + VkDevice device, + VkPipelineLayout pipelineLayout, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler( + VkDevice device, + const VkSamplerCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSampler* pSampler); + +VKAPI_ATTR void VKAPI_CALL vkDestroySampler( + VkDevice device, + VkSampler sampler, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout( + VkDevice device, + const VkDescriptorSetLayoutCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDescriptorSetLayout* pSetLayout); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout( + VkDevice device, + VkDescriptorSetLayout descriptorSetLayout, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool( + VkDevice device, + const VkDescriptorPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDescriptorPool* pDescriptorPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool( + VkDevice device, + VkDescriptorPool descriptorPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool( + VkDevice device, + VkDescriptorPool descriptorPool, + VkDescriptorPoolResetFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets( + VkDevice device, + const VkDescriptorSetAllocateInfo* pAllocateInfo, + VkDescriptorSet* pDescriptorSets); + +VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets( + VkDevice device, + VkDescriptorPool descriptorPool, + uint32_t descriptorSetCount, + const VkDescriptorSet* pDescriptorSets); + +VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets( + VkDevice device, + uint32_t descriptorWriteCount, + const VkWriteDescriptorSet* pDescriptorWrites, + uint32_t descriptorCopyCount, + const VkCopyDescriptorSet* pDescriptorCopies); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer( + VkDevice device, + const VkFramebufferCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkFramebuffer* pFramebuffer); + +VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer( + VkDevice device, + VkFramebuffer framebuffer, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass( + VkDevice device, + const VkRenderPassCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkRenderPass* pRenderPass); + +VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass( + VkDevice device, + VkRenderPass renderPass, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity( + VkDevice device, + VkRenderPass renderPass, + VkExtent2D* pGranularity); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool( + VkDevice device, + const VkCommandPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkCommandPool* pCommandPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool( + VkDevice device, + VkCommandPool commandPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool( + VkDevice device, + VkCommandPool commandPool, + VkCommandPoolResetFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers( + VkDevice device, + const VkCommandBufferAllocateInfo* pAllocateInfo, + VkCommandBuffer* pCommandBuffers); + +VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers( + VkDevice device, + VkCommandPool commandPool, + uint32_t commandBufferCount, + const VkCommandBuffer* pCommandBuffers); + +VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer( + VkCommandBuffer commandBuffer, + const VkCommandBufferBeginInfo* pBeginInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer( + VkCommandBuffer commandBuffer); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer( + VkCommandBuffer commandBuffer, + VkCommandBufferResetFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport( + VkCommandBuffer commandBuffer, + uint32_t firstViewport, + uint32_t viewportCount, + const VkViewport* pViewports); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor( + VkCommandBuffer commandBuffer, + uint32_t firstScissor, + uint32_t scissorCount, + const VkRect2D* pScissors); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth( + VkCommandBuffer commandBuffer, + float lineWidth); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias( + VkCommandBuffer commandBuffer, + float depthBiasConstantFactor, + float depthBiasClamp, + float depthBiasSlopeFactor); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants( + VkCommandBuffer commandBuffer, + const float blendConstants[4]); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds( + VkCommandBuffer commandBuffer, + float minDepthBounds, + float maxDepthBounds); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t compareMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t writeMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t reference); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t firstSet, + uint32_t descriptorSetCount, + const VkDescriptorSet* pDescriptorSets, + uint32_t dynamicOffsetCount, + const uint32_t* pDynamicOffsets); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkIndexType indexType); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers( + VkCommandBuffer commandBuffer, + uint32_t firstBinding, + uint32_t bindingCount, + const VkBuffer* pBuffers, + const VkDeviceSize* pOffsets); + +VKAPI_ATTR void VKAPI_CALL vkCmdDraw( + VkCommandBuffer commandBuffer, + uint32_t vertexCount, + uint32_t instanceCount, + uint32_t firstVertex, + uint32_t firstInstance); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed( + VkCommandBuffer commandBuffer, + uint32_t indexCount, + uint32_t instanceCount, + uint32_t firstIndex, + int32_t vertexOffset, + uint32_t firstInstance); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + uint32_t drawCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + uint32_t drawCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatch( + VkCommandBuffer commandBuffer, + uint32_t x, + uint32_t y, + uint32_t z); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer( + VkCommandBuffer commandBuffer, + VkBuffer srcBuffer, + VkBuffer dstBuffer, + uint32_t regionCount, + const VkBufferCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageBlit* pRegions, + VkFilter filter); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage( + VkCommandBuffer commandBuffer, + VkBuffer srcBuffer, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkBufferImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkBuffer dstBuffer, + uint32_t regionCount, + const VkBufferImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer( + VkCommandBuffer commandBuffer, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize dataSize, + const uint32_t* pData); + +VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer( + VkCommandBuffer commandBuffer, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize size, + uint32_t data); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage( + VkCommandBuffer commandBuffer, + VkImage image, + VkImageLayout imageLayout, + const VkClearColorValue* pColor, + uint32_t rangeCount, + const VkImageSubresourceRange* pRanges); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage( + VkCommandBuffer commandBuffer, + VkImage image, + VkImageLayout imageLayout, + const VkClearDepthStencilValue* pDepthStencil, + uint32_t rangeCount, + const VkImageSubresourceRange* pRanges); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments( + VkCommandBuffer commandBuffer, + uint32_t attachmentCount, + const VkClearAttachment* pAttachments, + uint32_t rectCount, + const VkClearRect* pRects); + +VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageResolve* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + VkPipelineStageFlags stageMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + VkPipelineStageFlags stageMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents( + VkCommandBuffer commandBuffer, + uint32_t eventCount, + const VkEvent* pEvents, + VkPipelineStageFlags srcStageMask, + VkPipelineStageFlags dstStageMask, + uint32_t memoryBarrierCount, + const VkMemoryBarrier* pMemoryBarriers, + uint32_t bufferMemoryBarrierCount, + const VkBufferMemoryBarrier* pBufferMemoryBarriers, + uint32_t imageMemoryBarrierCount, + const VkImageMemoryBarrier* pImageMemoryBarriers); + +VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier( + VkCommandBuffer commandBuffer, + VkPipelineStageFlags srcStageMask, + VkPipelineStageFlags dstStageMask, + VkDependencyFlags dependencyFlags, + uint32_t memoryBarrierCount, + const VkMemoryBarrier* pMemoryBarriers, + uint32_t bufferMemoryBarrierCount, + const VkBufferMemoryBarrier* pBufferMemoryBarriers, + uint32_t imageMemoryBarrierCount, + const VkImageMemoryBarrier* pImageMemoryBarriers); + +VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t query, + VkQueryControlFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t query); + +VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount); + +VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp( + VkCommandBuffer commandBuffer, + VkPipelineStageFlagBits pipelineStage, + VkQueryPool queryPool, + uint32_t query); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize stride, + VkQueryResultFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants( + VkCommandBuffer commandBuffer, + VkPipelineLayout layout, + VkShaderStageFlags stageFlags, + uint32_t offset, + uint32_t size, + const void* pValues); + +VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass( + VkCommandBuffer commandBuffer, + const VkRenderPassBeginInfo* pRenderPassBegin, + VkSubpassContents contents); + +VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass( + VkCommandBuffer commandBuffer, + VkSubpassContents contents); + +VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass( + VkCommandBuffer commandBuffer); + +VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands( + VkCommandBuffer commandBuffer, + uint32_t commandBufferCount, + const VkCommandBuffer* pCommandBuffers); +#endif + +#define VK_KHR_surface 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) + +#define VK_KHR_SURFACE_SPEC_VERSION 25 +#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface" + + +typedef enum VkColorSpaceKHR { + VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0, + VK_COLORSPACE_BEGIN_RANGE = VK_COLORSPACE_SRGB_NONLINEAR_KHR, + VK_COLORSPACE_END_RANGE = VK_COLORSPACE_SRGB_NONLINEAR_KHR, + VK_COLORSPACE_RANGE_SIZE = (VK_COLORSPACE_SRGB_NONLINEAR_KHR - VK_COLORSPACE_SRGB_NONLINEAR_KHR + 1), + VK_COLORSPACE_MAX_ENUM = 0x7FFFFFFF +} VkColorSpaceKHR; + +typedef enum VkPresentModeKHR { + VK_PRESENT_MODE_IMMEDIATE_KHR = 0, + VK_PRESENT_MODE_MAILBOX_KHR = 1, + VK_PRESENT_MODE_FIFO_KHR = 2, + VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, + VK_PRESENT_MODE_BEGIN_RANGE = VK_PRESENT_MODE_IMMEDIATE_KHR, + VK_PRESENT_MODE_END_RANGE = VK_PRESENT_MODE_FIFO_RELAXED_KHR, + VK_PRESENT_MODE_RANGE_SIZE = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1), + VK_PRESENT_MODE_MAX_ENUM = 0x7FFFFFFF +} VkPresentModeKHR; + + +typedef enum VkSurfaceTransformFlagBitsKHR { + VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 0x00000001, + VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 0x00000002, + VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 0x00000004, + VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 0x00000008, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 0x00000010, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 0x00000020, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080, + VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100, +} VkSurfaceTransformFlagBitsKHR; +typedef VkFlags VkSurfaceTransformFlagsKHR; + +typedef enum VkCompositeAlphaFlagBitsKHR { + VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, + VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002, + VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004, + VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008, +} VkCompositeAlphaFlagBitsKHR; +typedef VkFlags VkCompositeAlphaFlagsKHR; + +typedef struct VkSurfaceCapabilitiesKHR { + uint32_t minImageCount; + uint32_t maxImageCount; + VkExtent2D currentExtent; + VkExtent2D minImageExtent; + VkExtent2D maxImageExtent; + uint32_t maxImageArrayLayers; + VkSurfaceTransformFlagsKHR supportedTransforms; + VkSurfaceTransformFlagBitsKHR currentTransform; + VkCompositeAlphaFlagsKHR supportedCompositeAlpha; + VkImageUsageFlags supportedUsageFlags; +} VkSurfaceCapabilitiesKHR; + +typedef struct VkSurfaceFormatKHR { + VkFormat format; + VkColorSpaceKHR colorSpace; +} VkSurfaceFormatKHR; + + +typedef void (VKAPI_PTR *PFN_vkDestroySurfaceKHR)(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR( + VkInstance instance, + VkSurfaceKHR surface, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + VkSurfaceKHR surface, + VkBool32* pSupported); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + VkSurfaceCapabilitiesKHR* pSurfaceCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t* pSurfaceFormatCount, + VkSurfaceFormatKHR* pSurfaceFormats); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t* pPresentModeCount, + VkPresentModeKHR* pPresentModes); +#endif + +#define VK_KHR_swapchain 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) + +#define VK_KHR_SWAPCHAIN_SPEC_VERSION 67 +#define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain" + +typedef VkFlags VkSwapchainCreateFlagsKHR; + +typedef struct VkSwapchainCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkSwapchainCreateFlagsKHR flags; + VkSurfaceKHR surface; + uint32_t minImageCount; + VkFormat imageFormat; + VkColorSpaceKHR imageColorSpace; + VkExtent2D imageExtent; + uint32_t imageArrayLayers; + VkImageUsageFlags imageUsage; + VkSharingMode imageSharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; + VkSurfaceTransformFlagBitsKHR preTransform; + VkCompositeAlphaFlagBitsKHR compositeAlpha; + VkPresentModeKHR presentMode; + VkBool32 clipped; + VkSwapchainKHR oldSwapchain; +} VkSwapchainCreateInfoKHR; + +typedef struct VkPresentInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + uint32_t swapchainCount; + const VkSwapchainKHR* pSwapchains; + const uint32_t* pImageIndices; + VkResult* pResults; +} VkPresentInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain); +typedef void (VKAPI_PTR *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages); +typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex); +typedef VkResult (VKAPI_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR* pPresentInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR( + VkDevice device, + const VkSwapchainCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSwapchainKHR* pSwapchain); + +VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR( + VkDevice device, + VkSwapchainKHR swapchain, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pSwapchainImageCount, + VkImage* pSwapchainImages); + +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR( + VkDevice device, + VkSwapchainKHR swapchain, + uint64_t timeout, + VkSemaphore semaphore, + VkFence fence, + uint32_t* pImageIndex); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR( + VkQueue queue, + const VkPresentInfoKHR* pPresentInfo); +#endif + +#define VK_KHR_display 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayModeKHR) + +#define VK_KHR_DISPLAY_SPEC_VERSION 21 +#define VK_KHR_DISPLAY_EXTENSION_NAME "VK_KHR_display" + + +typedef enum VkDisplayPlaneAlphaFlagBitsKHR { + VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, + VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002, + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004, + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008, +} VkDisplayPlaneAlphaFlagBitsKHR; +typedef VkFlags VkDisplayModeCreateFlagsKHR; +typedef VkFlags VkDisplayPlaneAlphaFlagsKHR; +typedef VkFlags VkDisplaySurfaceCreateFlagsKHR; + +typedef struct VkDisplayPropertiesKHR { + VkDisplayKHR display; + const char* displayName; + VkExtent2D physicalDimensions; + VkExtent2D physicalResolution; + VkSurfaceTransformFlagsKHR supportedTransforms; + VkBool32 planeReorderPossible; + VkBool32 persistentContent; +} VkDisplayPropertiesKHR; + +typedef struct VkDisplayModeParametersKHR { + VkExtent2D visibleRegion; + uint32_t refreshRate; +} VkDisplayModeParametersKHR; + +typedef struct VkDisplayModePropertiesKHR { + VkDisplayModeKHR displayMode; + VkDisplayModeParametersKHR parameters; +} VkDisplayModePropertiesKHR; + +typedef struct VkDisplayModeCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkDisplayModeCreateFlagsKHR flags; + VkDisplayModeParametersKHR parameters; +} VkDisplayModeCreateInfoKHR; + +typedef struct VkDisplayPlaneCapabilitiesKHR { + VkDisplayPlaneAlphaFlagsKHR supportedAlpha; + VkOffset2D minSrcPosition; + VkOffset2D maxSrcPosition; + VkExtent2D minSrcExtent; + VkExtent2D maxSrcExtent; + VkOffset2D minDstPosition; + VkOffset2D maxDstPosition; + VkExtent2D minDstExtent; + VkExtent2D maxDstExtent; +} VkDisplayPlaneCapabilitiesKHR; + +typedef struct VkDisplayPlanePropertiesKHR { + VkDisplayKHR currentDisplay; + uint32_t currentStackIndex; +} VkDisplayPlanePropertiesKHR; + +typedef struct VkDisplaySurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkDisplaySurfaceCreateFlagsKHR flags; + VkDisplayModeKHR displayMode; + uint32_t planeIndex; + uint32_t planeStackIndex; + VkSurfaceTransformFlagBitsKHR transform; + float globalAlpha; + VkDisplayPlaneAlphaFlagBitsKHR alphaMode; + VkExtent2D imageExtent; +} VkDisplaySurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPlanePropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneSupportedDisplaysKHR)(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayModePropertiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayModeKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR*pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayPlaneSurfaceKHR)(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkDisplayPropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlanePropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkDisplayPlanePropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysKHR( + VkPhysicalDevice physicalDevice, + uint32_t planeIndex, + uint32_t* pDisplayCount, + VkDisplayKHR* pDisplays); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display, + uint32_t* pPropertyCount, + VkDisplayModePropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display, + const VkDisplayModeCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDisplayModeKHR* pMode); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR( + VkPhysicalDevice physicalDevice, + VkDisplayModeKHR mode, + uint32_t planeIndex, + VkDisplayPlaneCapabilitiesKHR* pCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR( + VkInstance instance, + const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif + +#define VK_KHR_display_swapchain 1 +#define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 9 +#define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain" + +typedef struct VkDisplayPresentInfoKHR { + VkStructureType sType; + const void* pNext; + VkRect2D srcRect; + VkRect2D dstRect; + VkBool32 persistent; +} VkDisplayPresentInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateSharedSwapchainsKHR)(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR( + VkDevice device, + uint32_t swapchainCount, + const VkSwapchainCreateInfoKHR* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkSwapchainKHR* pSwapchains); +#endif + +#ifdef VK_USE_PLATFORM_XLIB_KHR +#define VK_KHR_xlib_surface 1 +#include <X11/Xlib.h> + +#define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 +#define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface" + +typedef VkFlags VkXlibSurfaceCreateFlagsKHR; + +typedef struct VkXlibSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkXlibSurfaceCreateFlagsKHR flags; + Display* dpy; + Window window; +} VkXlibSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR( + VkInstance instance, + const VkXlibSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + Display* dpy, + VisualID visualID); +#endif +#endif /* VK_USE_PLATFORM_XLIB_KHR */ + +#ifdef VK_USE_PLATFORM_XCB_KHR +#define VK_KHR_xcb_surface 1 +#include <xcb/xcb.h> + +#define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 +#define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" + +typedef VkFlags VkXcbSurfaceCreateFlagsKHR; + +typedef struct VkXcbSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkXcbSurfaceCreateFlagsKHR flags; + xcb_connection_t* connection; + xcb_window_t window; +} VkXcbSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( + VkInstance instance, + const VkXcbSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + xcb_connection_t* connection, + xcb_visualid_t visual_id); +#endif +#endif /* VK_USE_PLATFORM_XCB_KHR */ + +#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#define VK_KHR_wayland_surface 1 +#include <wayland-client.h> + +#define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 5 +#define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface" + +typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; + +typedef struct VkWaylandSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkWaylandSurfaceCreateFlagsKHR flags; + struct wl_display* display; + struct wl_surface* surface; +} VkWaylandSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR( + VkInstance instance, + const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + struct wl_display* display); +#endif +#endif /* VK_USE_PLATFORM_WAYLAND_KHR */ + +#ifdef VK_USE_PLATFORM_MIR_KHR +#define VK_KHR_mir_surface 1 +#include <mir_toolkit/client_types.h> + +#define VK_KHR_MIR_SURFACE_SPEC_VERSION 4 +#define VK_KHR_MIR_SURFACE_EXTENSION_NAME "VK_KHR_mir_surface" + +typedef VkFlags VkMirSurfaceCreateFlagsKHR; + +typedef struct VkMirSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkMirSurfaceCreateFlagsKHR flags; + MirConnection* connection; + MirSurface* mirSurface; +} VkMirSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateMirSurfaceKHR)(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR( + VkInstance instance, + const VkMirSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + MirConnection* connection); +#endif +#endif /* VK_USE_PLATFORM_MIR_KHR */ + +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#define VK_KHR_android_surface 1 +#include <android/native_window.h> + +#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6 +#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface" + +typedef VkFlags VkAndroidSurfaceCreateFlagsKHR; + +typedef struct VkAndroidSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkAndroidSurfaceCreateFlagsKHR flags; + ANativeWindow* window; +} VkAndroidSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( + VkInstance instance, + const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_ANDROID_KHR */ + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_win32_surface 1 +#include <windows.h> + +#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 5 +#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface" + +typedef VkFlags VkWin32SurfaceCreateFlagsKHR; + +typedef struct VkWin32SurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkWin32SurfaceCreateFlagsKHR flags; + HINSTANCE hinstance; + HWND hwnd; +} VkWin32SurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR( + VkInstance instance, + const VkWin32SurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_EXT_debug_report 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) + +#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 1 +#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report" + + +typedef enum VkDebugReportObjectTypeEXT { + VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, + VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1, + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3, + VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4, + VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6, + VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8, + VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10, + VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11, + VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12, + VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14, + VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17, + VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20, + VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23, + VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25, + VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, + VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, + VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28, +} VkDebugReportObjectTypeEXT; + +typedef enum VkDebugReportErrorEXT { + VK_DEBUG_REPORT_ERROR_NONE_EXT = 0, + VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1, +} VkDebugReportErrorEXT; + + +typedef enum VkDebugReportFlagBitsEXT { + VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001, + VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002, + VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004, + VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008, + VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010, +} VkDebugReportFlagBitsEXT; +typedef VkFlags VkDebugReportFlagsEXT; + +typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)( + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objectType, + uint64_t object, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char* pMessage, + void* pUserData); + + +typedef struct VkDebugReportCallbackCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkDebugReportFlagsEXT flags; + PFN_vkDebugReportCallbackEXT pfnCallback; + void* pUserData; +} VkDebugReportCallbackCreateInfoEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback); +typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT( + VkInstance instance, + const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDebugReportCallbackEXT* pCallback); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT( + VkInstance instance, + VkDebugReportCallbackEXT callback, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT( + VkInstance instance, + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objectType, + uint64_t object, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char* pMessage); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/3rdparty/bgfx/3rdparty/nvtt/nvcore/posh.h b/3rdparty/bgfx/3rdparty/nvtt/nvcore/posh.h index e401fb8f498..45d2d9e3ce9 100644 --- a/3rdparty/bgfx/3rdparty/nvtt/nvcore/posh.h +++ b/3rdparty/bgfx/3rdparty/nvtt/nvcore/posh.h @@ -412,7 +412,9 @@ LLVM: # if !defined POSH_OS_XBOX # if defined _WIN64 # define POSH_OS_WIN64 1 -# define POSH_OS_STRING "Win64" +# if !defined POSH_OS_STRING +# define POSH_OS_STRING "Win64" +# endif // !defined POSH_OS_STRING # else # if !defined POSH_OS_STRING # define POSH_OS_STRING "Win32" @@ -1026,5 +1028,3 @@ extern posh_i64_t POSH_ReadI64FromBig( const void *src ); #ifdef __cplusplus } #endif - - diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp index aa8d8f1d657..2cfcdfd369d 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp @@ -595,7 +595,7 @@ static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiSetCond cond); static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiSetCond cond); static void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiSetCond cond); -static ImGuiWindow* FindWindowByName(const char* name); +ImGuiWindow* FindWindowByName(const char* name); static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs); static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags); static inline bool IsWindowContentHoverable(ImGuiWindow* window); @@ -2286,25 +2286,26 @@ static void AddWindowToSortedBuffer(ImVector<ImGuiWindow*>& out_sorted_windows, static void AddDrawListToRenderList(ImVector<ImDrawList*>& out_render_list, ImDrawList* draw_list) { - if (!draw_list->CmdBuffer.empty() && !draw_list->VtxBuffer.empty()) - { - // Remove trailing command if unused - ImDrawCmd& last_cmd = draw_list->CmdBuffer.back(); - if (last_cmd.ElemCount == 0 && last_cmd.UserCallback == NULL) - draw_list->CmdBuffer.pop_back(); + if (draw_list->CmdBuffer.empty()) + return; - out_render_list.push_back(draw_list); + // Remove trailing command if unused + ImDrawCmd& last_cmd = draw_list->CmdBuffer.back(); + if (last_cmd.ElemCount == 0 && last_cmd.UserCallback == NULL) + { + draw_list->CmdBuffer.pop_back(); + if (draw_list->CmdBuffer.empty()) + return; + } - // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices) - // If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly. - const unsigned long long int max_vtx_idx = (unsigned long long int)1L << (sizeof(ImDrawIdx)*8); - (void)max_vtx_idx; - IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); // Sanity check. Bug or mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. - IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx); // Too many vertices in same ImDrawList. See comment above. + // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices) + // If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly. + IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); // Sanity check. Bug or mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. + IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= ((unsigned long long int)1L << (sizeof(ImDrawIdx)*8))); // Too many vertices in same ImDrawList. See comment above. - GImGui->IO.MetricsRenderVertices += draw_list->VtxBuffer.Size; - GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size; - } + out_render_list.push_back(draw_list); + GImGui->IO.MetricsRenderVertices += draw_list->VtxBuffer.Size; + GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size; } static void AddWindowToRenderList(ImVector<ImDrawList*>& out_render_list, ImGuiWindow* window) @@ -3458,9 +3459,9 @@ static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, return pos; } -static ImGuiWindow* FindWindowByName(const char* name) +ImGuiWindow* ImGui::FindWindowByName(const char* name) { - // FIXME-OPT: Store sorted hashes -> pointers. + // FIXME-OPT: Store sorted hashes -> pointers so we can do a bissection in a contiguous block ImGuiState& g = *GImGui; ImGuiID id = ImHash(name, 0); for (int i = 0; i < g.Windows.Size; i++) @@ -7209,6 +7210,7 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f } // Edit a string of text +// NB: when active, hold on a privately held copy of the text (and apply back to 'buf'). So changing 'buf' while active has no effect. // FIXME: Rather messy function partly because we are doing UTF8 > u16 > UTF8 conversions on the go to more easily handle stb_textedit calls. Ideally we should stay in UTF-8 all the time. See https://github.com/nothings/stb/issues/188 bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data) { diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h index 9e4a6c892ad..d00a936d6e0 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h @@ -146,8 +146,8 @@ namespace ImGui IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiSetCond cond = 0); // set current window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0); // set current window collapsed state IMGUI_API void SetWindowFocus(); // set current window to be focused / front-most - IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0); // set named window position - call within Begin()/End(). may incur tearing - IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0); // set named window size. set axis to 0.0f to force an auto-fit on this axis. may incur tearing + IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0); // set named window position. + IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0); // set named window size. set axis to 0.0f to force an auto-fit on this axis. IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0); // set named window collapsed state IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most. use NULL to remove focus. diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h index 54c777e0dfa..a4caacff7c1 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h @@ -675,6 +675,7 @@ namespace ImGui inline ImGuiWindow* GetCurrentWindowRead() { ImGuiState& g = *GImGui; return g.CurrentWindow; } inline ImGuiWindow* GetCurrentWindow() { ImGuiState& g = *GImGui; g.CurrentWindow->Accessed = true; return g.CurrentWindow; } IMGUI_API ImGuiWindow* GetParentWindow(); + IMGUI_API ImGuiWindow* FindWindowByName(const char* name); IMGUI_API void FocusWindow(ImGuiWindow* window); IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window); diff --git a/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h b/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h index 4666d1e4c5b..0e59b4d430a 100644 --- a/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h +++ b/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h @@ -1,7 +1,7 @@ /****************************************************************************** * The MIT License (MIT) * - * Copyright (c) 2015 Baldur Karlsson + * Copyright (c) 2015-2016 Baldur Karlsson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -445,10 +445,17 @@ typedef uint32_t (RENDERDOC_CC *pRENDERDOC_EndFrameCapture)(RENDERDOC_DevicePoin // instead of 1.0.0. You can check this with the GetAPIVersion entry point typedef enum { - eRENDERDOC_API_Version_1_0_0 = 10000, // RENDERDOC_API_1_0_0 = 1 000 000 + eRENDERDOC_API_Version_1_0_0 = 10000, // RENDERDOC_API_1_0_0 = 1 00 00 + eRENDERDOC_API_Version_1_0_1 = 10001, // RENDERDOC_API_1_0_1 = 1 00 01 } RENDERDOC_Version; -// eRENDERDOC_API_Version_1_0_0 +// API version changelog: +// +// 1.0.0 - initial release +// 1.0.1 - Bugfix: IsFrameCapturing() was returning false for captures that were triggered +// by keypress or TriggerCapture, instead of Start/EndFrameCapture. + +// eRENDERDOC_API_Version_1_0_1 typedef struct { pRENDERDOC_GetAPIVersion GetAPIVersion; @@ -484,7 +491,9 @@ typedef struct pRENDERDOC_StartFrameCapture StartFrameCapture; pRENDERDOC_IsFrameCapturing IsFrameCapturing; pRENDERDOC_EndFrameCapture EndFrameCapture; -} RENDERDOC_API_1_0_0; +} RENDERDOC_API_1_0_1; + +typedef RENDERDOC_API_1_0_1 RENDERDOC_API_1_0_0; ////////////////////////////////////////////////////////////////////////////////////////////////// // RenderDoc API entry point diff --git a/3rdparty/bgfx/3rdparty/stb/stb_image.c b/3rdparty/bgfx/3rdparty/stb/stb_image.c index 130d6c01d61..e98f211dcd8 100644 --- a/3rdparty/bgfx/3rdparty/stb/stb_image.c +++ b/3rdparty/bgfx/3rdparty/stb/stb_image.c @@ -1,6 +1,9 @@ #ifdef __GNUC__ # pragma GCC diagnostic ignored "-Wshadow" # pragma GCC diagnostic ignored "-Warray-bounds" +# ifndef __clang__ +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +# endif // __clang__ #elif defined(_MSC_VER) # pragma warning(disable:4312) // warning C4312: 'type cast': conversion from '' to '' of greater size # pragma warning(disable:4456) // warning C4456: declaration of 'k' hides previous local declaration diff --git a/3rdparty/bgfx/README.md b/3rdparty/bgfx/README.md index 521853b6f2b..09115745af2 100644 --- a/3rdparty/bgfx/README.md +++ b/3rdparty/bgfx/README.md @@ -55,14 +55,24 @@ Languages: * [Go language API bindings](https://github.com/james4k/go-bgfx) * [Java language API bindings](https://github.com/enleeten/twilight-bgfx) * [Haskell language API bindings](https://github.com/haskell-game/bgfx) + * [Python language API bindings](https://github.com/jnadro/pybgfx#pybgf) * [Rust language API bindings](https://github.com/rhoot/bgfx-rs) -Build ------ +[Building](https://bkaradzic.github.io/bgfx/build.html) +---------------------------------------------------- - AppVeyor https://ci.appveyor.com/project/bkaradzic/bgfx - TravisCI https://travis-ci.org/bkaradzic/bgfx +[Examples](https://bkaradzic.github.io/bgfx/examples.html) +---------------------------------------------------------- + +[API Reference](https://bkaradzic.github.io/bgfx/bgfx.html) +----------------------------------------------------------- + +[Tools](https://bkaradzic.github.io/bgfx/tools.html) +---------------------------------------------------- + Who is using it? ---------------- @@ -118,18 +128,6 @@ http://makingartstudios.itch.io/dls - DLS the digital logic simulator game. https://github.com/mamedev/mame MAME - Multiple Arcade Machine Emulator -[Building](https://bkaradzic.github.io/bgfx/build.html) -------------------------------------------------------- - -[Examples](https://bkaradzic.github.io/bgfx/examples.html) ----------------------------------------------------------- - -[API Reference](https://bkaradzic.github.io/bgfx/bgfx.html) ------------------------------------------------------------ - -[Tools](https://bkaradzic.github.io/bgfx/tools.html) ----------------------------------------------------- - [License (BSD 2-clause)](https://bkaradzic.github.io/bgfx/license.html) ----------------------------------------------------------------------- diff --git a/3rdparty/bgfx/examples/01-cubes/cubes.cpp b/3rdparty/bgfx/examples/01-cubes/cubes.cpp index de74b89e6d0..bf88eb3f7f0 100644 --- a/3rdparty/bgfx/examples/01-cubes/cubes.cpp +++ b/3rdparty/bgfx/examples/01-cubes/cubes.cpp @@ -55,7 +55,7 @@ static const uint16_t s_cubeIndices[36] = 6, 3, 7, }; -class Cubes : public entry::AppI +class ExampleCubes : public entry::AppI { void init(int _argc, char** _argv) BX_OVERRIDE { @@ -218,4 +218,4 @@ class Cubes : public entry::AppI int64_t m_timeOffset; }; -ENTRY_IMPLEMENT_MAIN(Cubes); +ENTRY_IMPLEMENT_MAIN(ExampleCubes); diff --git a/3rdparty/bgfx/examples/01-cubes/makefile b/3rdparty/bgfx/examples/01-cubes/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/01-cubes/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/02-metaballs/makefile b/3rdparty/bgfx/examples/02-metaballs/makefile index 2d351e1d215..818fe30cbd7 100644 --- a/3rdparty/bgfx/examples/02-metaballs/makefile +++ b/3rdparty/bgfx/examples/02-metaballs/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 # diff --git a/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp b/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp index be919f56538..bedf55497eb 100644 --- a/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp +++ b/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp @@ -462,16 +462,16 @@ uint32_t triangulate(uint8_t* _result, uint32_t _stride, const float* __restrict #define DIMS 32 -class Metaballs : public entry::AppI +class ExampleMetaballs : public entry::AppI { void init(int _argc, char** _argv) BX_OVERRIDE { Args args(_argc, _argv); - m_width = 1280; + m_width = 1280; m_height = 720; - m_debug = BGFX_DEBUG_TEXT; - m_reset = BGFX_RESET_VSYNC; + m_debug = BGFX_DEBUG_TEXT; + m_reset = BGFX_RESET_VSYNC; bgfx::init(args.m_type, args.m_pciId); bgfx::reset(m_width, m_height, m_reset); @@ -778,7 +778,6 @@ class Metaballs : public entry::AppI Grid* m_grid; int64_t m_timeOffset; - }; -ENTRY_IMPLEMENT_MAIN(Metaballs); +ENTRY_IMPLEMENT_MAIN(ExampleMetaballs); diff --git a/3rdparty/bgfx/examples/03-raymarch/makefile b/3rdparty/bgfx/examples/03-raymarch/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/03-raymarch/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/03-raymarch/raymarch.cpp b/3rdparty/bgfx/examples/03-raymarch/raymarch.cpp index df07fc7ea42..60a4664546e 100644 --- a/3rdparty/bgfx/examples/03-raymarch/raymarch.cpp +++ b/3rdparty/bgfx/examples/03-raymarch/raymarch.cpp @@ -102,138 +102,163 @@ void renderScreenSpaceQuad(uint32_t _view, bgfx::ProgramHandle _program, float _ } } -int _main_(int _argc, char** _argv) +class ExampleRaymarch : public entry::AppI { - Args args(_argc, _argv); - - uint32_t width = 1280; - uint32_t height = 720; - uint32_t debug = BGFX_DEBUG_TEXT; - uint32_t reset = BGFX_RESET_VSYNC; - - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(width, height, reset); - - // Enable debug text. - bgfx::setDebug(debug); - - // Set view 0 clear state. - bgfx::setViewClear(0 - , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH - , 0x303030ff - , 1.0f - , 0 - ); - - // Setup root path for binary shaders. Shader binaries are different - // for each renderer. - switch (bgfx::getRendererType() ) + void init(int _argc, char** _argv) BX_OVERRIDE { - default: - break; - - case bgfx::RendererType::OpenGL: - case bgfx::RendererType::OpenGLES: - s_oglNdc = true; - break; + Args args(_argc, _argv); + + m_width = 1280; + m_height = 720; + m_debug = BGFX_DEBUG_TEXT; + m_reset = BGFX_RESET_VSYNC; + + bgfx::init(args.m_type, args.m_pciId); + bgfx::reset(m_width, m_height, m_reset); + + // Enable debug text. + bgfx::setDebug(m_debug); + + // Set view 0 clear state. + bgfx::setViewClear(0 + , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH + , 0x303030ff + , 1.0f + , 0 + ); + + // Setup root path for binary shaders. Shader binaries are different + // for each renderer. + switch (bgfx::getRendererType() ) + { + default: + break; + + case bgfx::RendererType::OpenGL: + case bgfx::RendererType::OpenGLES: + s_oglNdc = true; + break; + } + + // Create vertex stream declaration. + PosColorTexCoord0Vertex::init(); + + u_mtx = bgfx::createUniform("u_mtx", bgfx::UniformType::Mat4); + u_lightDirTime = bgfx::createUniform("u_lightDirTime", bgfx::UniformType::Vec4); + + // Create program from shaders. + m_program = loadProgram("vs_raymarching", "fs_raymarching"); + + m_timeOffset = bx::getHPCounter(); } - // Create vertex stream declaration. - PosColorTexCoord0Vertex::init(); + int shutdown() BX_OVERRIDE + { + // Cleanup. + bgfx::destroyProgram(m_program); - bgfx::UniformHandle u_mtx = bgfx::createUniform("u_mtx", bgfx::UniformType::Mat4); - bgfx::UniformHandle u_lightDirTime = bgfx::createUniform("u_lightDirTime", bgfx::UniformType::Vec4); + bgfx::destroyUniform(u_mtx); + bgfx::destroyUniform(u_lightDirTime); - // Create program from shaders. - bgfx::ProgramHandle raymarching = loadProgram("vs_raymarching", "fs_raymarching"); + // Shutdown bgfx. + bgfx::shutdown(); - int64_t timeOffset = bx::getHPCounter(); + return 0; + } - while (!entry::processEvents(width, height, debug, reset) ) + bool update() BX_OVERRIDE { - // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, width, height); - - // Set view 1 default viewport. - bgfx::setViewRect(1, 0, 0, width, height); - - // This dummy draw call is here to make sure that view 0 is cleared - // if no other draw calls are submitted to viewZ 0. - bgfx::touch(0); - - int64_t now = bx::getHPCounter(); - static int64_t last = now; - const int64_t frameTime = now - last; - last = now; - const double freq = double(bx::getHPFrequency() ); - const double toMs = 1000.0/freq; - - // Use debug font to print information about this example. - bgfx::dbgTextClear(); - bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/03-raymarch"); - bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Updating shader uniforms."); - bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); - - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -15.0f }; - - float view[16]; - float proj[16]; - bx::mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f); - - // Set view and projection matrix for view 1. - bgfx::setViewTransform(0, view, proj); - - float ortho[16]; - bx::mtxOrtho(ortho, 0.0f, 1280.0f, 720.0f, 0.0f, 0.0f, 100.0f); - - // Set view and projection matrix for view 0. - bgfx::setViewTransform(1, NULL, ortho); - - float time = (float)( (bx::getHPCounter()-timeOffset)/double(bx::getHPFrequency() ) ); - - float vp[16]; - bx::mtxMul(vp, view, proj); - - float mtx[16]; - bx::mtxRotateXY(mtx - , time - , time*0.37f - ); - - float mtxInv[16]; - bx::mtxInverse(mtxInv, mtx); - float lightDirModel[4] = { -0.4f, -0.5f, -1.0f, 0.0f }; - float lightDirModelN[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; - bx::vec3Norm(lightDirModelN, lightDirModel); - float lightDirTime[4]; - bx::vec4MulMtx(lightDirTime, lightDirModelN, mtxInv); - lightDirTime[3] = time; - bgfx::setUniform(u_lightDirTime, lightDirTime); - - float mvp[16]; - bx::mtxMul(mvp, mtx, vp); - - float invMvp[16]; - bx::mtxInverse(invMvp, mvp); - bgfx::setUniform(u_mtx, invMvp); - - renderScreenSpaceQuad(1, raymarching, 0.0f, 0.0f, 1280.0f, 720.0f); - - // Advance to next frame. Rendering thread will be kicked to - // process submitted rendering primitives. - bgfx::frame(); + if (!entry::processEvents(m_width, m_height, m_debug, m_reset) ) + { + // Set view 0 default viewport. + bgfx::setViewRect(0, 0, 0, m_width, m_height); + + // Set view 1 default viewport. + bgfx::setViewRect(1, 0, 0, m_width, m_height); + + // This dummy draw call is here to make sure that view 0 is cleared + // if no other draw calls are submitted to viewZ 0. + bgfx::touch(0); + + int64_t now = bx::getHPCounter(); + static int64_t last = now; + const int64_t frameTime = now - last; + last = now; + const double freq = double(bx::getHPFrequency() ); + const double toMs = 1000.0/freq; + + // Use debug font to print information about this example. + bgfx::dbgTextClear(); + bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/03-raymarch"); + bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Updating shader uniforms."); + bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); + + float at[3] = { 0.0f, 0.0f, 0.0f }; + float eye[3] = { 0.0f, 0.0f, -15.0f }; + + float view[16]; + float proj[16]; + bx::mtxLookAt(view, eye, at); + mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f); + + // Set view and projection matrix for view 1. + bgfx::setViewTransform(0, view, proj); + + float ortho[16]; + bx::mtxOrtho(ortho, 0.0f, 1280.0f, 720.0f, 0.0f, 0.0f, 100.0f); + + // Set view and projection matrix for view 0. + bgfx::setViewTransform(1, NULL, ortho); + + float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ) ); + + float vp[16]; + bx::mtxMul(vp, view, proj); + + float mtx[16]; + bx::mtxRotateXY(mtx + , time + , time*0.37f + ); + + float mtxInv[16]; + bx::mtxInverse(mtxInv, mtx); + float lightDirModel[4] = { -0.4f, -0.5f, -1.0f, 0.0f }; + float lightDirModelN[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; + bx::vec3Norm(lightDirModelN, lightDirModel); + float lightDirTime[4]; + bx::vec4MulMtx(lightDirTime, lightDirModelN, mtxInv); + lightDirTime[3] = time; + bgfx::setUniform(u_lightDirTime, lightDirTime); + + float mvp[16]; + bx::mtxMul(mvp, mtx, vp); + + float invMvp[16]; + bx::mtxInverse(invMvp, mvp); + bgfx::setUniform(u_mtx, invMvp); + + renderScreenSpaceQuad(1, m_program, 0.0f, 0.0f, 1280.0f, 720.0f); + + // Advance to next frame. Rendering thread will be kicked to + // process submitted rendering primitives. + bgfx::frame(); + + return true; + } + + return false; } - // Cleanup. - bgfx::destroyProgram(raymarching); + uint32_t m_width; + uint32_t m_height; + uint32_t m_debug; + uint32_t m_reset; - bgfx::destroyUniform(u_mtx); - bgfx::destroyUniform(u_lightDirTime); - - // Shutdown bgfx. - bgfx::shutdown(); + int64_t m_timeOffset; + bgfx::UniformHandle u_mtx; + bgfx::UniformHandle u_lightDirTime; + bgfx::ProgramHandle m_program; +}; - return 0; -} +ENTRY_IMPLEMENT_MAIN(ExampleRaymarch); diff --git a/3rdparty/bgfx/examples/04-mesh/makefile b/3rdparty/bgfx/examples/04-mesh/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/04-mesh/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/04-mesh/mesh.cpp b/3rdparty/bgfx/examples/04-mesh/mesh.cpp index 854cf1a23a3..bfe61df6a3f 100644 --- a/3rdparty/bgfx/examples/04-mesh/mesh.cpp +++ b/3rdparty/bgfx/examples/04-mesh/mesh.cpp @@ -6,118 +6,143 @@ #include "common.h" #include "bgfx_utils.h" -int _main_(int _argc, char** _argv) +class ExampleMesh : public entry::AppI { - Args args(_argc, _argv); - - uint32_t width = 1280; - uint32_t height = 720; - uint32_t debug = BGFX_DEBUG_TEXT; - uint32_t reset = BGFX_RESET_VSYNC; + void init(int _argc, char** _argv) BX_OVERRIDE + { + Args args(_argc, _argv); + + m_width = 1280; + m_height = 720; + m_debug = BGFX_DEBUG_TEXT; + m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(width, height, reset); + bgfx::init(args.m_type, args.m_pciId); + bgfx::reset(m_width, m_height, m_reset); - // Enable debug text. - bgfx::setDebug(debug); + // Enable debug text. + bgfx::setDebug(m_debug); - // Set view 0 clear state. - bgfx::setViewClear(0 - , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH - , 0x303030ff - , 1.0f - , 0 - ); + // Set view 0 clear state. + bgfx::setViewClear(0 + , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH + , 0x303030ff + , 1.0f + , 0 + ); - bgfx::UniformHandle u_time = bgfx::createUniform("u_time", bgfx::UniformType::Vec4); + u_time = bgfx::createUniform("u_time", bgfx::UniformType::Vec4); - // Create program from shaders. - bgfx::ProgramHandle program = loadProgram("vs_mesh", "fs_mesh"); + // Create program from shaders. + m_program = loadProgram("vs_mesh", "fs_mesh"); - Mesh* mesh = meshLoad("meshes/bunny.bin"); + m_mesh = meshLoad("meshes/bunny.bin"); - int64_t timeOffset = bx::getHPCounter(); + m_timeOffset = bx::getHPCounter(); + } - while (!entry::processEvents(width, height, debug, reset) ) + int shutdown() BX_OVERRIDE { - // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, width, height); - - // This dummy draw call is here to make sure that view 0 is cleared - // if no other draw calls are submitted to view 0. - bgfx::touch(0); - - int64_t now = bx::getHPCounter(); - static int64_t last = now; - const int64_t frameTime = now - last; - last = now; - const double freq = double(bx::getHPFrequency() ); - const double toMs = 1000.0/freq; - float time = (float)( (bx::getHPCounter()-timeOffset)/double(bx::getHPFrequency() ) ); - bgfx::setUniform(u_time, &time); - - // Use debug font to print information about this example. - bgfx::dbgTextClear(); - bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/04-mesh"); - bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Loading meshes."); - bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); - - float at[3] = { 0.0f, 1.0f, 0.0f }; - float eye[3] = { 0.0f, 1.0f, -2.5f }; - - // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); + meshUnload(m_mesh); - float proj[16]; - bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f); + // Cleanup. + bgfx::destroyProgram(m_program); - bgfx::setViewTransform(0, view, proj); + bgfx::destroyUniform(u_time); - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else - { - float view[16]; - bx::mtxLookAt(view, eye, at); + // Shutdown bgfx. + bgfx::shutdown(); - float proj[16]; - bx::mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f); - bgfx::setViewTransform(0, view, proj); + return 0; + } + bool update() BX_OVERRIDE + { + if (!entry::processEvents(m_width, m_height, m_debug, m_reset) ) + { // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, width, height); + bgfx::setViewRect(0, 0, 0, m_width, m_height); + + // This dummy draw call is here to make sure that view 0 is cleared + // if no other draw calls are submitted to view 0. + bgfx::touch(0); + + int64_t now = bx::getHPCounter(); + static int64_t last = now; + const int64_t frameTime = now - last; + last = now; + const double freq = double(bx::getHPFrequency() ); + const double toMs = 1000.0/freq; + float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ) ); + bgfx::setUniform(u_time, &time); + + // Use debug font to print information about this example. + bgfx::dbgTextClear(); + bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/04-mesh"); + bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Loading meshes."); + bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); + + float at[3] = { 0.0f, 1.0f, 0.0f }; + float eye[3] = { 0.0f, 1.0f, -2.5f }; + + // Set view and projection matrix for view 0. + const bgfx::HMD* hmd = bgfx::getHMD(); + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) + { + float view[16]; + bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); + + float proj[16]; + bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f); + + bgfx::setViewTransform(0, view, proj); + + // Set view 0 default viewport. + // + // Use HMD's width/height since HMD's internal frame buffer size + // might be much larger than window size. + bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); + } + else + { + float view[16]; + bx::mtxLookAt(view, eye, at); + + float proj[16]; + bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f); + bgfx::setViewTransform(0, view, proj); + + // Set view 0 default viewport. + bgfx::setViewRect(0, 0, 0, m_width, m_height); + } + + float mtx[16]; + bx::mtxRotateXY(mtx + , 0.0f + , time*0.37f + ); + + meshSubmit(m_mesh, 0, m_program, mtx); + + // Advance to next frame. Rendering thread will be kicked to + // process submitted rendering primitives. + bgfx::frame(); + + return true; } - float mtx[16]; - bx::mtxRotateXY(mtx - , 0.0f - , time*0.37f - ); - - meshSubmit(mesh, 0, program, mtx); - - // Advance to next frame. Rendering thread will be kicked to - // process submitted rendering primitives. - bgfx::frame(); + return false; } - meshUnload(mesh); - - // Cleanup. - bgfx::destroyProgram(program); - - bgfx::destroyUniform(u_time); + uint32_t m_width; + uint32_t m_height; + uint32_t m_debug; + uint32_t m_reset; - // Shutdown bgfx. - bgfx::shutdown(); + int64_t m_timeOffset; + Mesh* m_mesh; + bgfx::ProgramHandle m_program; + bgfx::UniformHandle u_time; +}; - return 0; -} +ENTRY_IMPLEMENT_MAIN(ExampleMesh); diff --git a/3rdparty/bgfx/examples/05-instancing/instancing.cpp b/3rdparty/bgfx/examples/05-instancing/instancing.cpp index f0a62ea1039..6e854b20785 100644 --- a/3rdparty/bgfx/examples/05-instancing/instancing.cpp +++ b/3rdparty/bgfx/examples/05-instancing/instancing.cpp @@ -55,171 +55,196 @@ static const uint16_t s_cubeIndices[36] = 6, 3, 7, }; -int _main_(int _argc, char** _argv) +class ExampleInstancing : public entry::AppI { - Args args(_argc, _argv); + void init(int _argc, char** _argv) BX_OVERRIDE + { + Args args(_argc, _argv); - uint32_t width = 1280; - uint32_t height = 720; - uint32_t debug = BGFX_DEBUG_TEXT; - uint32_t reset = BGFX_RESET_VSYNC; + m_width = 1280; + m_height = 720; + m_debug = BGFX_DEBUG_TEXT; + m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(width, height, reset); + bgfx::init(args.m_type, args.m_pciId); + bgfx::reset(m_width, m_height, m_reset); - // Enable debug text. - bgfx::setDebug(debug); + // Enable debug text. + bgfx::setDebug(m_debug); - // Set view 0 clear state. - bgfx::setViewClear(0 - , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH - , 0x303030ff - , 1.0f - , 0 - ); + // Set view 0 clear state. + bgfx::setViewClear(0 + , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH + , 0x303030ff + , 1.0f + , 0 + ); - // Get renderer capabilities info. - const bgfx::Caps* caps = bgfx::getCaps(); + // Create vertex stream declaration. + PosColorVertex::init(); - // Create vertex stream declaration. - PosColorVertex::init(); + // Create static vertex buffer. + m_vbh = bgfx::createVertexBuffer( + bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) ) + , PosColorVertex::ms_decl + ); - const bgfx::Memory* mem; + // Create static index buffer. + m_ibh = bgfx::createIndexBuffer( + bgfx::makeRef(s_cubeIndices, sizeof(s_cubeIndices) ) + ); - // Create static vertex buffer. - mem = bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) ); - bgfx::VertexBufferHandle vbh = bgfx::createVertexBuffer(mem, PosColorVertex::ms_decl); + // Create program from shaders. + m_program = loadProgram("vs_instancing", "fs_instancing"); - // Create static index buffer. - mem = bgfx::makeRef(s_cubeIndices, sizeof(s_cubeIndices) ); - bgfx::IndexBufferHandle ibh = bgfx::createIndexBuffer(mem); + m_timeOffset = bx::getHPCounter(); + } - // Create program from shaders. - bgfx::ProgramHandle program = loadProgram("vs_instancing", "fs_instancing"); + int shutdown() BX_OVERRIDE + { + // Cleanup. + bgfx::destroyIndexBuffer(m_ibh); + bgfx::destroyVertexBuffer(m_vbh); + bgfx::destroyProgram(m_program); - int64_t timeOffset = bx::getHPCounter(); + // Shutdown bgfx. + bgfx::shutdown(); - while (!entry::processEvents(width, height, debug, reset) ) + return 0; + } + + bool update() BX_OVERRIDE { - // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, width, height); - - // This dummy draw call is here to make sure that view 0 is cleared - // if no other draw calls are submitted to view 0. - bgfx::touch(0); - - int64_t now = bx::getHPCounter(); - static int64_t last = now; - const int64_t frameTime = now - last; - last = now; - const double freq = double(bx::getHPFrequency() ); - const double toMs = 1000.0/freq; - float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) ); - - // Use debug font to print information about this example. - bgfx::dbgTextClear(); - bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/05-instancing"); - bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Geometry instancing."); - bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); - - // Check if instancing is supported. - if (0 == (BGFX_CAPS_INSTANCING & caps->supported) ) - { - // When instancing is not supported by GPU, implement alternative - // code path that doesn't use instancing. - bool blink = uint32_t(time*3.0f)&1; - bgfx::dbgTextPrintf(0, 5, blink ? 0x1f : 0x01, " Instancing is not supported by GPU. "); - } - else + if (!entry::processEvents(m_width, m_height, m_debug, m_reset) ) { - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -35.0f }; - - // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) + // Set view 0 default viewport. + bgfx::setViewRect(0, 0, 0, m_width, m_height); + + // This dummy draw call is here to make sure that view 0 is cleared + // if no other draw calls are submitted to view 0. + bgfx::touch(0); + + int64_t now = bx::getHPCounter(); + static int64_t last = now; + const int64_t frameTime = now - last; + last = now; + const double freq = double(bx::getHPFrequency() ); + const double toMs = 1000.0/freq; + float time = (float)( (now - m_timeOffset)/double(bx::getHPFrequency() ) ); + + // Use debug font to print information about this example. + bgfx::dbgTextClear(); + bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/05-instancing"); + bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Geometry instancing."); + bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); + + // Get renderer capabilities info. + const bgfx::Caps* caps = bgfx::getCaps(); + + // Check if instancing is supported. + if (0 == (BGFX_CAPS_INSTANCING & caps->supported) ) { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - - float proj[16]; - bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f); - - bgfx::setViewTransform(0, view, proj); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); + // When instancing is not supported by GPU, implement alternative + // code path that doesn't use instancing. + bool blink = uint32_t(time*3.0f)&1; + bgfx::dbgTextPrintf(0, 5, blink ? 0x1f : 0x01, " Instancing is not supported by GPU. "); } else { - float view[16]; - bx::mtxLookAt(view, eye, at); + float at[3] = { 0.0f, 0.0f, 0.0f }; + float eye[3] = { 0.0f, 0.0f, -35.0f }; - float proj[16]; - bx::mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f); - bgfx::setViewTransform(0, view, proj); + // Set view and projection matrix for view 0. + const bgfx::HMD* hmd = bgfx::getHMD(); + if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) + { + float view[16]; + bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, width, height); - } + float proj[16]; + bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f); - const uint16_t instanceStride = 80; - const bgfx::InstanceDataBuffer* idb = bgfx::allocInstanceDataBuffer(121, instanceStride); - if (NULL != idb) - { - uint8_t* data = idb->data; + bgfx::setViewTransform(0, view, proj); + + // Set view 0 default viewport. + // + // Use HMD's width/height since HMD's internal frame buffer size + // might be much larger than window size. + bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); + } + else + { + float view[16]; + bx::mtxLookAt(view, eye, at); + + float proj[16]; + bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f); + bgfx::setViewTransform(0, view, proj); + + // Set view 0 default viewport. + bgfx::setViewRect(0, 0, 0, m_width, m_height); + } - // Write instance data for 11x11 cubes. - for (uint32_t yy = 0, numInstances = 0; yy < 11 && numInstances < idb->num; ++yy) + const uint16_t instanceStride = 80; + const bgfx::InstanceDataBuffer* idb = bgfx::allocInstanceDataBuffer(121, instanceStride); + if (NULL != idb) { - for (uint32_t xx = 0; xx < 11 && numInstances < idb->num; ++xx, ++numInstances) + uint8_t* data = idb->data; + + // Write instance data for 11x11 cubes. + for (uint32_t yy = 0, numInstances = 0; yy < 11 && numInstances < idb->num; ++yy) { - float* mtx = (float*)data; - bx::mtxRotateXY(mtx, time + xx*0.21f, time + yy*0.37f); - mtx[12] = -15.0f + float(xx)*3.0f; - mtx[13] = -15.0f + float(yy)*3.0f; - mtx[14] = 0.0f; - - float* color = (float*)&data[64]; - color[0] = sinf(time+float(xx)/11.0f)*0.5f+0.5f; - color[1] = cosf(time+float(yy)/11.0f)*0.5f+0.5f; - color[2] = sinf(time*3.0f)*0.5f+0.5f; - color[3] = 1.0f; - - data += instanceStride; + for (uint32_t xx = 0; xx < 11 && numInstances < idb->num; ++xx, ++numInstances) + { + float* mtx = (float*)data; + bx::mtxRotateXY(mtx, time + xx*0.21f, time + yy*0.37f); + mtx[12] = -15.0f + float(xx)*3.0f; + mtx[13] = -15.0f + float(yy)*3.0f; + mtx[14] = 0.0f; + + float* color = (float*)&data[64]; + color[0] = sinf(time+float(xx)/11.0f)*0.5f+0.5f; + color[1] = cosf(time+float(yy)/11.0f)*0.5f+0.5f; + color[2] = sinf(time*3.0f)*0.5f+0.5f; + color[3] = 1.0f; + + data += instanceStride; + } } - } - // Set vertex and index buffer. - bgfx::setVertexBuffer(vbh); - bgfx::setIndexBuffer(ibh); + // Set vertex and index buffer. + bgfx::setVertexBuffer(m_vbh); + bgfx::setIndexBuffer(m_ibh); - // Set instance data buffer. - bgfx::setInstanceDataBuffer(idb); + // Set instance data buffer. + bgfx::setInstanceDataBuffer(idb); - // Set render states. - bgfx::setState(BGFX_STATE_DEFAULT); + // Set render states. + bgfx::setState(BGFX_STATE_DEFAULT); - // Submit primitive for rendering to view 0. - bgfx::submit(0, program); + // Submit primitive for rendering to view 0. + bgfx::submit(0, m_program); + } } + + // Advance to next frame. Rendering thread will be kicked to + // process submitted rendering primitives. + bgfx::frame(); + return true; } - // Advance to next frame. Rendering thread will be kicked to - // process submitted rendering primitives. - bgfx::frame(); + return false; } - // Cleanup. - bgfx::destroyIndexBuffer(ibh); - bgfx::destroyVertexBuffer(vbh); - bgfx::destroyProgram(program); + uint32_t m_width; + uint32_t m_height; + uint32_t m_debug; + uint32_t m_reset; + bgfx::VertexBufferHandle m_vbh; + bgfx::IndexBufferHandle m_ibh; + bgfx::ProgramHandle m_program; - // Shutdown bgfx. - bgfx::shutdown(); + int64_t m_timeOffset; +}; - return 0; -} +ENTRY_IMPLEMENT_MAIN(ExampleInstancing); diff --git a/3rdparty/bgfx/examples/05-instancing/makefile b/3rdparty/bgfx/examples/05-instancing/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/05-instancing/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/06-bump/bump.cpp b/3rdparty/bgfx/examples/06-bump/bump.cpp index 2956caddf64..bc5f9e74b7e 100644 --- a/3rdparty/bgfx/examples/06-bump/bump.cpp +++ b/3rdparty/bgfx/examples/06-bump/bump.cpp @@ -103,7 +103,7 @@ static const uint16_t s_cubeIndices[36] = 21, 23, 22, }; -class Bump : public entry::AppI +class ExampleBump : public entry::AppI { void init(int _argc, char** _argv) BX_OVERRIDE { @@ -387,4 +387,4 @@ class Bump : public entry::AppI int64_t m_timeOffset; }; -ENTRY_IMPLEMENT_MAIN(Bump); +ENTRY_IMPLEMENT_MAIN(ExampleBump); diff --git a/3rdparty/bgfx/examples/06-bump/makefile b/3rdparty/bgfx/examples/06-bump/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/06-bump/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/07-callback/makefile b/3rdparty/bgfx/examples/07-callback/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/07-callback/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/08-update/makefile b/3rdparty/bgfx/examples/08-update/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/08-update/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/08-update/update.cpp b/3rdparty/bgfx/examples/08-update/update.cpp index 8a5d851ba7c..baa54c17e20 100644 --- a/3rdparty/bgfx/examples/08-update/update.cpp +++ b/3rdparty/bgfx/examples/08-update/update.cpp @@ -115,10 +115,10 @@ static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _sid static const uint32_t m_textureside = 512; static const uint32_t m_texture2dSize = 256; -class Update : public entry::AppI +class ExampleUpdate : public entry::AppI { public: - Update() + ExampleUpdate() : m_cube(m_textureside) { } @@ -575,4 +575,4 @@ public: }; -ENTRY_IMPLEMENT_MAIN(Update); +ENTRY_IMPLEMENT_MAIN(ExampleUpdate); diff --git a/3rdparty/bgfx/examples/09-hdr/hdr.cpp b/3rdparty/bgfx/examples/09-hdr/hdr.cpp index 047fb0aa565..bee42aed2bf 100644 --- a/3rdparty/bgfx/examples/09-hdr/hdr.cpp +++ b/3rdparty/bgfx/examples/09-hdr/hdr.cpp @@ -139,7 +139,7 @@ inline float square(float _x) return _x*_x; } -class HDR : public entry::AppI +class ExampleHDR : public entry::AppI { void init(int _argc, char** _argv) BX_OVERRIDE { @@ -561,4 +561,4 @@ class HDR : public entry::AppI float m_time; }; -ENTRY_IMPLEMENT_MAIN(HDR); +ENTRY_IMPLEMENT_MAIN(ExampleHDR); diff --git a/3rdparty/bgfx/examples/09-hdr/makefile b/3rdparty/bgfx/examples/09-hdr/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/09-hdr/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/12-lod/lod.cpp b/3rdparty/bgfx/examples/12-lod/lod.cpp index e133872494f..ef37d254c11 100644 --- a/3rdparty/bgfx/examples/12-lod/lod.cpp +++ b/3rdparty/bgfx/examples/12-lod/lod.cpp @@ -23,7 +23,7 @@ static const KnightPos knightTour[8*4] = {7,1}, {6,3}, {5,1}, {7,0}, {6,2}, {4,3}, {3,1}, {2,3}, }; -class Lod : public entry::AppI +class ExampleLod : public entry::AppI { void init(int _argc, char** _argv) BX_OVERRIDE { @@ -316,4 +316,4 @@ class Lod : public entry::AppI bool m_transitions; }; -ENTRY_IMPLEMENT_MAIN(Lod); +ENTRY_IMPLEMENT_MAIN(ExampleLod); diff --git a/3rdparty/bgfx/examples/12-lod/makefile b/3rdparty/bgfx/examples/12-lod/makefile index 536534d372e..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/12-lod/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/13-stencil/makefile b/3rdparty/bgfx/examples/13-stencil/makefile index 420d008a7f2..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/13-stencil/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/13-stencil/stencil.cpp b/3rdparty/bgfx/examples/13-stencil/stencil.cpp index 773bdda0b08..53d484e2137 100644 --- a/3rdparty/bgfx/examples/13-stencil/stencil.cpp +++ b/3rdparty/bgfx/examples/13-stencil/stencil.cpp @@ -9,7 +9,7 @@ #include "common.h" #include "bgfx_utils.h" -#include <bx/readerwriter.h> +#include <bx/crtimpl.h> #include "camera.h" #include "imgui/imgui.h" @@ -646,13 +646,12 @@ struct Group namespace bgfx { - int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl); + int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl, bx::Error* _err = NULL); } struct Mesh { - void load(const void* _vertices, uint32_t _numVertices, const bgfx::VertexDecl _decl - , const uint16_t* _indices, uint32_t _numIndices) + void load(const void* _vertices, uint32_t _numVertices, const bgfx::VertexDecl _decl, const uint16_t* _indices, uint32_t _numIndices) { Group group; const bgfx::Memory* mem; @@ -666,12 +665,6 @@ struct Mesh mem = bgfx::makeRef(_indices, size); group.m_ibh = bgfx::createIndexBuffer(mem); - //TODO: - // group.m_sphere = ... - // group.m_aabb = ... - // group.m_obb = ... - // group.m_prims = ... - m_groups.push_back(group); } diff --git a/3rdparty/bgfx/examples/14-shadowvolumes/makefile b/3rdparty/bgfx/examples/14-shadowvolumes/makefile index f101bb91427..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/14-shadowvolumes/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp b/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp index 4084359ba35..fbdc8804b02 100644 --- a/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp @@ -21,11 +21,11 @@ using namespace std::tr1; #include <bgfx/bgfx.h> #include <bx/timer.h> -#include <bx/readerwriter.h> #include <bx/allocator.h> #include <bx/hash.h> #include <bx/float4_t.h> #include <bx/fpumath.h> +#include <bx/crtimpl.h> #include "entry/entry.h" #include "camera.h" #include "imgui/imgui.h" @@ -989,7 +989,7 @@ typedef std::vector<Group> GroupArray; namespace bgfx { - int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl); + int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl, bx::Error* _err = NULL); } struct Mesh diff --git a/3rdparty/bgfx/examples/15-shadowmaps-simple/makefile b/3rdparty/bgfx/examples/15-shadowmaps-simple/makefile index 420d008a7f2..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/15-shadowmaps-simple/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/16-shadowmaps/fs_shadowmaps_color_lighting_main.sh b/3rdparty/bgfx/examples/16-shadowmaps/fs_shadowmaps_color_lighting_main.sh index acadba377b0..1b2b6be31a8 100644 --- a/3rdparty/bgfx/examples/16-shadowmaps/fs_shadowmaps_color_lighting_main.sh +++ b/3rdparty/bgfx/examples/16-shadowmaps/fs_shadowmaps_color_lighting_main.sh @@ -182,9 +182,9 @@ Shader shader = evalShader(lc.x, lc.y); //Fog. - const vec3 fogColor = vec3_splat(0.0); - const float fogDensity = 0.0035; - const float LOG2 = 1.442695; + vec3 fogColor = vec3_splat(0.0); + float fogDensity = 0.0035; + float LOG2 = 1.442695; float z = length(v); float fogFactor = clamp(1.0/exp2(fogDensity*fogDensity*z*z*LOG2), 0.0, 1.0); diff --git a/3rdparty/bgfx/examples/16-shadowmaps/makefile b/3rdparty/bgfx/examples/16-shadowmaps/makefile index 547cea69a89..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/16-shadowmaps/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp b/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp index 1e8ddaee339..3296496b018 100644 --- a/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp +++ b/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp @@ -12,8 +12,8 @@ #include <bgfx/bgfx.h> #include <bx/timer.h> -#include <bx/readerwriter.h> #include <bx/fpumath.h> +#include <bx/crtimpl.h> #include "entry/entry.h" #include "camera.h" #include "imgui/imgui.h" @@ -856,7 +856,7 @@ struct Group namespace bgfx { - int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl); + int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl, bx::Error* _err = NULL); } struct Mesh diff --git a/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp b/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp index 258c00b5197..2e933c1cb9d 100644 --- a/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp +++ b/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp @@ -70,7 +70,7 @@ static const int64_t highwm = 1000000/65; static const int64_t lowwm = 1000000/57; #endif // BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_NACL -class DrawStress : public entry::AppI +class ExampleDrawStress : public entry::AppI { void init(int _argc, char** _argv) BX_OVERRIDE { @@ -350,4 +350,4 @@ class DrawStress : public entry::AppI bgfx::IndexBufferHandle m_ibh; }; -ENTRY_IMPLEMENT_MAIN(DrawStress); +ENTRY_IMPLEMENT_MAIN(ExampleDrawStress); diff --git a/3rdparty/bgfx/examples/17-drawstress/makefile b/3rdparty/bgfx/examples/17-drawstress/makefile index 2d351e1d215..818fe30cbd7 100644 --- a/3rdparty/bgfx/examples/17-drawstress/makefile +++ b/3rdparty/bgfx/examples/17-drawstress/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 # diff --git a/3rdparty/bgfx/examples/18-ibl/fs_ibl_mesh.sc b/3rdparty/bgfx/examples/18-ibl/fs_ibl_mesh.sc index 3ac5278f44f..28aa831331f 100644 --- a/3rdparty/bgfx/examples/18-ibl/fs_ibl_mesh.sc +++ b/3rdparty/bgfx/examples/18-ibl/fs_ibl_mesh.sc @@ -1,77 +1,110 @@ $input v_view, v_normal /* - * Copyright 2014 Dario Manesku. All rights reserved. + * Copyright 2014-2016 Dario Manesku. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ #include "../common/common.sh" - -uniform vec4 u_params; -uniform mat4 u_mtx; -uniform vec4 u_flags; -uniform vec4 u_rgbDiff; -uniform vec4 u_rgbSpec; +#include "uniforms.sh" SAMPLERCUBE(s_texCube, 0); SAMPLERCUBE(s_texCubeIrr, 1); -#define u_glossiness u_params.x -#define u_exposure u_params.y -#define u_diffspec u_params.z - -#define u_doDiffuse u_flags.x -#define u_doSpecular u_flags.y -#define u_doDiffuseIbl u_flags.z -#define u_doSpecularIbl u_flags.w - -vec3 fresnel(vec3 _cspec, float _dot) +vec3 calcFresnel(vec3 _cspec, float _dot) { - return _cspec + (1.0 - _cspec) * pow(1.0 - _dot, 5); + return _cspec + (1.0 - _cspec)*pow(1.0 - _dot, 5.0); } -void main() +vec3 calcLambert(vec3 _cdiff, float _ndotl) { - vec3 light = vec3(0.0, 0.0, -1.0); - vec3 clight = vec3(1.0, 1.0, 1.0); - - vec3 v = v_view; - vec3 n = normalize(v_normal); - vec3 l = normalize(light); - vec3 h = normalize(v + l); - - float ndotl = clamp(dot(n, l), 0.0, 1.0); //diff - float ndoth = clamp(dot(n, h), 0.0, 1.0); //spec - float vdoth = clamp(dot(v, h), 0.0, 1.0); //spec fresnel - float ndotv = clamp(dot(n, v), 0.0, 1.0); //env spec fresnel - - vec3 r = 2.0*ndotv*n - v; // reflect(v, n); - - vec3 cubeR = normalize(mul(u_mtx, vec4(r, 0.0)).xyz); - vec3 cubeN = normalize(mul(u_mtx, vec4(n, 0.0)).xyz); - - float mipLevel = min((1.0 - u_glossiness)*11.0 + 1.0, 8.0); - vec3 cenv = textureCubeLod(s_texCube, cubeR, mipLevel).xyz; - - vec3 kd = u_rgbDiff.xyz; - vec3 ks = u_rgbSpec.xyz; - - vec3 cs = ks * u_diffspec; - vec3 cd = kd * (1.0 - cs); - - vec3 diff = cd; - float pwr = exp2(u_glossiness * 11.0 + 1.0); - vec3 spec = cs * pow(ndoth, pwr) * ( (pwr + 8.0)/8.0) * fresnel(cs, vdoth); + return _cdiff*_ndotl; +} - vec3 ambspec = fresnel(cs, ndotv) * cenv; - vec3 ambdiff = cd * textureCube(s_texCubeIrr, cubeN).xyz; +vec3 calcBlinn(vec3 _cspec, float _ndoth, float _ndotl, float _specPwr) +{ + float norm = (_specPwr+8.0)*0.125; + float brdf = pow(_ndoth, _specPwr)*_ndotl*norm; + return _cspec*brdf; +} - vec3 lc = ( diff * u_doDiffuse + spec * u_doSpecular ) * ndotl * clight; - vec3 ec = (ambdiff * u_doDiffuseIbl + ambspec * u_doSpecularIbl); +float specPwr(float _gloss) +{ + return exp2(10.0*_gloss+2.0); +} - vec3 color = lc + ec; +void main() +{ + // Light. + vec3 ld = normalize(u_lightDir); + vec3 clight = u_lightCol; + + // Input. + vec3 nn = normalize(v_normal); + vec3 vv = normalize(v_view); + vec3 hh = normalize(vv + ld); + + float ndotv = clamp(dot(nn, vv), 0.0, 1.0); + float ndotl = clamp(dot(nn, ld), 0.0, 1.0); + float ndoth = clamp(dot(nn, hh), 0.0, 1.0); + float hdotv = clamp(dot(hh, vv), 0.0, 1.0); + + // Material params. + vec3 albedo = u_rgbDiff.xyz; + float reflectivity = u_reflectivity; + float gloss = u_glossiness; + + // Reflection. + vec3 refl; + if (0.0 == u_metalOrSpec) // Metalness workflow. + { + refl = mix(vec3_splat(0.04), albedo, reflectivity); + } + else // Specular workflow. + { + refl = u_rgbSpec.xyz * vec3_splat(reflectivity); + } + vec3 dirF0 = calcFresnel(refl, hdotv); + vec3 envF0 = calcFresnel(refl, ndotv); + + // Direct lighting. + vec3 dirSpec = dirF0; + vec3 dirDiff = albedo * 1.0-dirF0; + + vec3 lambert = u_doDiffuse * calcLambert(dirDiff, ndotl); + vec3 blinn = u_doSpecular * calcBlinn(dirSpec, ndoth, ndotl, specPwr(gloss)); + vec3 direct = (lambert + blinn)*clight; + + // Indirect lighting. + vec3 envSpec = envF0; + vec3 envDiff = albedo * 1.0-envF0; + + // Note: Environment textures are filtered with cmft: https://github.com/dariomanesku/cmft + // Params used: + // --excludeBase true //!< First level mip is not filtered. + // --mipCount 7 //!< 7 mip levels are used in total, [256x256 .. 4x4]. Lower res mip maps should be avoided. + // --glossScale 10 //!< Spec power scale. See: specPwr(). + // --glossBias 2 //!< Spec power bias. See: specPwr(). + // --edgeFixup warp //!< This must be used on DirectX9. When fileted with 'warp', fixCubeLookup() should be used. + float mip = 1.0 + 5.0*(1.0 - gloss); // Use mip levels [1..6] for radiance. + + mat4 mtx; + mtx[0] = u_mtx0; + mtx[1] = u_mtx1; + mtx[2] = u_mtx2; + mtx[3] = u_mtx3; + vec3 vr = 2.0*ndotv*nn - vv; // Same as: -reflect(vv, nn); + vec3 cubeR = normalize(instMul(mtx, vec4(vr, 0.0)).xyz); + vec3 cubeN = normalize(instMul(mtx, vec4(nn, 0.0)).xyz); + cubeR = fixCubeLookup(cubeR, mip, 256.0); + + vec3 radiance = u_doDiffuseIbl * envSpec * toLinear(textureCubeLod(s_texCube, cubeR, mip).xyz); + vec3 irradiance = u_doSpecularIbl * envDiff * toLinear(textureCube(s_texCubeIrr, cubeN).xyz); + vec3 indirect = radiance + irradiance; + + // Color. + vec3 color = direct + indirect; color = color * exp2(u_exposure); - gl_FragColor.xyz = toFilmic(color); gl_FragColor.w = 1.0; } diff --git a/3rdparty/bgfx/examples/18-ibl/fs_ibl_skybox.sc b/3rdparty/bgfx/examples/18-ibl/fs_ibl_skybox.sc index 790fc0144fc..d895037b26a 100644 --- a/3rdparty/bgfx/examples/18-ibl/fs_ibl_skybox.sc +++ b/3rdparty/bgfx/examples/18-ibl/fs_ibl_skybox.sc @@ -1,22 +1,31 @@ $input v_dir /* - * Copyright 2014 Dario Manesku. All rights reserved. + * Copyright 2014-2016 Dario Manesku. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ #include "../common/common.sh" +#include "uniforms.sh" SAMPLERCUBE(s_texCube, 0); - -uniform vec4 u_params; -#define u_exposure u_params.y +SAMPLERCUBE(s_texCubeIrr, 1); void main() { vec3 dir = normalize(v_dir); - vec4 color = textureCubeLod(s_texCube, dir, 0.0); + vec4 color; + if (u_bgType == 7.0) + { + color = toLinear(textureCube(s_texCubeIrr, dir)); + } + else + { + float lod = u_bgType; + dir = fixCubeLookup(dir, lod, 256.0); + color = toLinear(textureCubeLod(s_texCube, dir, lod)); + } color *= exp2(u_exposure); gl_FragColor = toFilmic(color); diff --git a/3rdparty/bgfx/examples/18-ibl/ibl.cpp b/3rdparty/bgfx/examples/18-ibl/ibl.cpp index 51a194730e4..a0cf6268d9c 100644 --- a/3rdparty/bgfx/examples/18-ibl/ibl.cpp +++ b/3rdparty/bgfx/examples/18-ibl/ibl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2014 Dario Manesku. All rights reserved. + * Copyright 2014-2016 Dario Manesku. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -18,86 +18,51 @@ static float s_texelHalf = 0.0f; struct Uniforms { - void init() - { - m_time = 0.0f; - bx::mtxIdentity(m_mtx); - - u_mtx = bgfx::createUniform("u_mtx", bgfx::UniformType::Mat4); - u_params = bgfx::createUniform("u_params", bgfx::UniformType::Vec4); - u_flags = bgfx::createUniform("u_flags", bgfx::UniformType::Vec4); - u_camPos = bgfx::createUniform("u_camPos", bgfx::UniformType::Vec4); - u_rgbDiff = bgfx::createUniform("u_rgbDiff", bgfx::UniformType::Vec4); - u_rgbSpec = bgfx::createUniform("u_rgbSpec", bgfx::UniformType::Vec4); - } + enum { NumVec4 = 12 }; - // Call this once per frame. - void submitPerFrameUniforms() + void init() { - bgfx::setUniform(u_mtx, m_mtx); - bgfx::setUniform(u_flags, m_flags); - bgfx::setUniform(u_camPos, m_camPosTime); - bgfx::setUniform(u_rgbDiff, m_rgbDiff); - bgfx::setUniform(u_rgbSpec, m_rgbSpec); + u_params = bgfx::createUniform("u_params", bgfx::UniformType::Vec4, NumVec4); } - // Call this before each draw call. - void submitPerDrawUniforms() + void submit() { - bgfx::setUniform(u_params, m_params); + bgfx::setUniform(u_params, m_params, NumVec4); } void destroy() { - bgfx::destroyUniform(u_rgbSpec); - bgfx::destroyUniform(u_rgbDiff); - bgfx::destroyUniform(u_camPos); - bgfx::destroyUniform(u_flags); bgfx::destroyUniform(u_params); - bgfx::destroyUniform(u_mtx); } union { struct { - float m_glossiness; - float m_exposure; - float m_diffspec; - float m_time; - }; - - float m_params[4]; - }; - - union - { - struct - { - float m_diffuse; - float m_specular; - float m_diffuseIbl; - float m_specularIbl; + union + { + float m_mtx[16]; + /* 0*/ struct { float m_mtx0[4]; }; + /* 1*/ struct { float m_mtx1[4]; }; + /* 2*/ struct { float m_mtx2[4]; }; + /* 3*/ struct { float m_mtx3[4]; }; + }; + /* 4*/ struct { float m_glossiness, m_reflectivity, m_exposure, m_bgType; }; + /* 5*/ struct { float m_metalOrSpec, m_unused5[3]; }; + /* 6*/ struct { float m_doDiffuse, m_doSpecular, m_doDiffuseIbl, m_doSpecularIbl; }; + /* 7*/ struct { float m_cameraPos[3], m_unused7[1]; }; + /* 8*/ struct { float m_rgbDiff[4]; }; + /* 9*/ struct { float m_rgbSpec[4]; }; + /*10*/ struct { float m_lightDir[3], m_unused10[1]; }; + /*11*/ struct { float m_lightCol[3], m_unused11[1]; }; }; - float m_flags[4]; + float m_params[NumVec4*4]; }; - float m_mtx[16]; - float m_camPosTime[4]; - float m_rgbDiff[4]; - float m_rgbSpec[4]; - - bgfx::UniformHandle u_mtx; bgfx::UniformHandle u_params; - bgfx::UniformHandle u_flags; - bgfx::UniformHandle u_camPos; - bgfx::UniformHandle u_rgbDiff; - bgfx::UniformHandle u_rgbSpec; }; -static Uniforms s_uniforms; - struct PosColorTexCoord0Vertex { float m_x; @@ -181,11 +146,8 @@ struct LightProbe { enum Enum { - Wells, - Uffizi, - Pisa, - Ennis, - Grace, + Bolonga, + Kyoto, Count }; @@ -213,6 +175,253 @@ struct LightProbe bgfx::TextureHandle m_texIrr; }; +struct Camera +{ + Camera() + { + reset(); + } + + void reset() + { + m_target.curr[0] = 0.0f; + m_target.curr[1] = 0.0f; + m_target.curr[2] = 0.0f; + m_target.dest[0] = 0.0f; + m_target.dest[1] = 0.0f; + m_target.dest[2] = 0.0f; + + m_pos.curr[0] = 0.0f; + m_pos.curr[1] = 0.0f; + m_pos.curr[2] = -3.0f; + m_pos.dest[0] = 0.0f; + m_pos.dest[1] = 0.0f; + m_pos.dest[2] = -3.0f; + + m_orbit[0] = 0.0f; + m_orbit[1] = 0.0f; + } + + void mtxLookAt(float* _outViewMtx) + { + bx::mtxLookAt(_outViewMtx, m_pos.curr, m_target.curr); + } + + void orbit(float _dx, float _dy) + { + m_orbit[0] += _dx; + m_orbit[1] += _dy; + } + + void dolly(float _dz) + { + const float cnear = 1.0f; + const float cfar = 10.0f; + + const float toTarget[3] = + { + m_target.dest[0] - m_pos.dest[0], + m_target.dest[1] - m_pos.dest[1], + m_target.dest[2] - m_pos.dest[2], + }; + const float toTargetLen = bx::vec3Length(toTarget); + const float invToTargetLen = 1.0f/(toTargetLen+FLT_MIN); + const float toTargetNorm[3] = + { + toTarget[0]*invToTargetLen, + toTarget[1]*invToTargetLen, + toTarget[2]*invToTargetLen, + }; + + float delta = toTargetLen*_dz; + float newLen = toTargetLen + delta; + if ( (cnear < newLen || _dz < 0.0f) + && (newLen < cfar || _dz > 0.0f) ) + { + m_pos.dest[0] += toTargetNorm[0]*delta; + m_pos.dest[1] += toTargetNorm[1]*delta; + m_pos.dest[2] += toTargetNorm[2]*delta; + } + } + + void consumeOrbit(float _amount) + { + float consume[2]; + consume[0] = m_orbit[0]*_amount; + consume[1] = m_orbit[1]*_amount; + m_orbit[0] -= consume[0]; + m_orbit[1] -= consume[1]; + + const float toPos[3] = + { + m_pos.curr[0] - m_target.curr[0], + m_pos.curr[1] - m_target.curr[1], + m_pos.curr[2] - m_target.curr[2], + }; + const float toPosLen = bx::vec3Length(toPos); + const float invToPosLen = 1.0f/(toPosLen+FLT_MIN); + const float toPosNorm[3] = + { + toPos[0]*invToPosLen, + toPos[1]*invToPosLen, + toPos[2]*invToPosLen, + }; + + float ll[2]; + latLongFromVec(ll[0], ll[1], toPosNorm); + ll[0] += consume[0]; + ll[1] -= consume[1]; + ll[1] = bx::fclamp(ll[1], 0.02f, 0.98f); + + float tmp[3]; + vecFromLatLong(tmp, ll[0], ll[1]); + + float diff[3]; + diff[0] = (tmp[0]-toPosNorm[0])*toPosLen; + diff[1] = (tmp[1]-toPosNorm[1])*toPosLen; + diff[2] = (tmp[2]-toPosNorm[2])*toPosLen; + + m_pos.curr[0] += diff[0]; + m_pos.curr[1] += diff[1]; + m_pos.curr[2] += diff[2]; + m_pos.dest[0] += diff[0]; + m_pos.dest[1] += diff[1]; + m_pos.dest[2] += diff[2]; + } + + void update(float _dt) + { + const float amount = bx::fmin(_dt/0.12f, 1.0f); + + consumeOrbit(amount); + + m_target.curr[0] = bx::flerp(m_target.curr[0], m_target.dest[0], amount); + m_target.curr[1] = bx::flerp(m_target.curr[1], m_target.dest[1], amount); + m_target.curr[2] = bx::flerp(m_target.curr[2], m_target.dest[2], amount); + m_pos.curr[0] = bx::flerp(m_pos.curr[0], m_pos.dest[0], amount); + m_pos.curr[1] = bx::flerp(m_pos.curr[1], m_pos.dest[1], amount); + m_pos.curr[2] = bx::flerp(m_pos.curr[2], m_pos.dest[2], amount); + } + + void envViewMtx(float* _mtx) + { + const float toTarget[3] = + { + m_target.curr[0] - m_pos.curr[0], + m_target.curr[1] - m_pos.curr[1], + m_target.curr[2] - m_pos.curr[2], + }; + + const float toTargetLen = bx::vec3Length(toTarget); + const float invToTargetLen = 1.0f/(toTargetLen+FLT_MIN); + const float toTargetNorm[3] = + { + toTarget[0]*invToTargetLen, + toTarget[1]*invToTargetLen, + toTarget[2]*invToTargetLen, + }; + + float tmp[3]; + const float fakeUp[3] = { 0.0f, 1.0f, 0.0f }; + + float right[3]; + bx::vec3Cross(tmp, fakeUp, toTargetNorm); + bx::vec3Norm(right, tmp); + + float up[3]; + bx::vec3Cross(tmp, toTargetNorm, right); + bx::vec3Norm(up, tmp); + + _mtx[ 0] = right[0]; + _mtx[ 1] = right[1]; + _mtx[ 2] = right[2]; + _mtx[ 3] = 0.0f; + _mtx[ 4] = up[0]; + _mtx[ 5] = up[1]; + _mtx[ 6] = up[2]; + _mtx[ 7] = 0.0f; + _mtx[ 8] = toTargetNorm[0]; + _mtx[ 9] = toTargetNorm[1]; + _mtx[10] = toTargetNorm[2]; + _mtx[11] = 0.0f; + _mtx[12] = 0.0f; + _mtx[13] = 0.0f; + _mtx[14] = 0.0f; + _mtx[15] = 1.0f; + } + + static inline void vecFromLatLong(float _vec[3], float _u, float _v) + { + const float phi = _u * 2.0f*bx::pi; + const float theta = _v * bx::pi; + + const float st = bx::fsin(theta); + const float sp = bx::fsin(phi); + const float ct = bx::fcos(theta); + const float cp = bx::fcos(phi); + + _vec[0] = -st*sp; + _vec[1] = ct; + _vec[2] = -st*cp; + } + + static inline void latLongFromVec(float& _u, float& _v, const float _vec[3]) + { + const float phi = atan2f(_vec[0], _vec[2]); + const float theta = acosf(_vec[1]); + + _u = (bx::pi + phi)*bx::invPi*0.5f; + _v = theta*bx::invPi; + } + + struct Interp3f + { + float curr[3]; + float dest[3]; + }; + + Interp3f m_target; + Interp3f m_pos; + float m_orbit[2]; +}; + +struct Mouse +{ + Mouse() + : m_dx(0.0f) + , m_dy(0.0f) + , m_prevMx(0.0f) + , m_prevMy(0.0f) + , m_scroll(0) + , m_scrollPrev(0) + { + } + + void update(float _mx, float _my, int32_t _mz, uint32_t _width, uint32_t _height) + { + const float widthf = float(int32_t(_width)); + const float heightf = float(int32_t(_height)); + + // Delta movement. + m_dx = float(_mx - m_prevMx)/widthf; + m_dy = float(_my - m_prevMy)/heightf; + + m_prevMx = _mx; + m_prevMy = _my; + + // Scroll. + m_scroll = _mz - m_scrollPrev; + m_scrollPrev = _mz; + } + + float m_dx; // Screen space. + float m_dy; + float m_prevMx; + float m_prevMy; + int32_t m_scroll; + int32_t m_scrollPrev; +}; + int _main_(int _argc, char** _argv) { Args args(_argc, _argv); @@ -220,7 +429,10 @@ int _main_(int _argc, char** _argv) uint32_t width = 1280; uint32_t height = 720; uint32_t debug = BGFX_DEBUG_TEXT; - uint32_t reset = BGFX_RESET_VSYNC; + uint32_t reset = 0 + | BGFX_RESET_VSYNC + | BGFX_RESET_MSAA_X16 + ; bgfx::init(args.m_type, args.m_pciId); bgfx::reset(width, height, reset); @@ -240,18 +452,16 @@ int _main_(int _argc, char** _argv) imguiCreate(); // Uniforms. - s_uniforms.init(); + Uniforms uniforms; + uniforms.init(); // Vertex declarations. PosColorTexCoord0Vertex::init(); LightProbe lightProbes[LightProbe::Count]; - lightProbes[LightProbe::Wells ].load("wells"); - lightProbes[LightProbe::Uffizi].load("uffizi"); - lightProbes[LightProbe::Pisa ].load("pisa"); - lightProbes[LightProbe::Ennis ].load("ennis"); - lightProbes[LightProbe::Grace ].load("grace"); - LightProbe::Enum currentLightProbe = LightProbe::Wells; + lightProbes[LightProbe::Bolonga].load("bolonga"); + lightProbes[LightProbe::Kyoto ].load("kyoto"); + LightProbe::Enum currentLightProbe = LightProbe::Bolonga; bgfx::UniformHandle u_mtx = bgfx::createUniform("u_mtx", bgfx::UniformType::Mat4); bgfx::UniformHandle u_params = bgfx::createUniform("u_params", bgfx::UniformType::Vec4); @@ -266,43 +476,73 @@ int _main_(int _argc, char** _argv) Mesh* meshBunny; meshBunny = meshLoad("meshes/bunny.bin"); + Mesh* meshOrb; + meshOrb = meshLoad("meshes/orb.bin"); + + Camera camera; + Mouse mouse; + struct Settings { - float m_speed; + Settings() + { + m_envRotCurr = 0.0f; + m_envRotDest = 0.0f; + m_lightDir[0] = -0.8f; + m_lightDir[1] = 0.2f; + m_lightDir[2] = -0.5f; + m_lightCol[0] = 1.0f; + m_lightCol[1] = 1.0f; + m_lightCol[2] = 1.0f; + m_glossiness = 0.7f; + m_exposure = 0.0f; + m_bgType = 3.0f; + m_radianceSlider = 2.0f; + m_reflectivity = 0.85f; + m_rgbDiff[0] = 1.0f; + m_rgbDiff[1] = 1.0f; + m_rgbDiff[2] = 1.0f; + m_rgbSpec[0] = 1.0f; + m_rgbSpec[1] = 1.0f; + m_rgbSpec[2] = 1.0f; + m_lod = 0.0f; + m_doDiffuse = false; + m_doSpecular = false; + m_doDiffuseIbl = true; + m_doSpecularIbl = true; + m_showLightColorWheel = true; + m_showDiffColorWheel = true; + m_showSpecColorWheel = true; + m_metalOrSpec = 0; + m_meshSelection = 0; + m_crossCubemapPreview = ImguiCubemap::Latlong; + } + + float m_envRotCurr; + float m_envRotDest; + float m_lightDir[3]; + float m_lightCol[3]; float m_glossiness; float m_exposure; - float m_diffspec; + float m_radianceSlider; + float m_bgType; + float m_reflectivity; float m_rgbDiff[3]; float m_rgbSpec[3]; - bool m_diffuse; - bool m_specular; - bool m_diffuseIbl; - bool m_specularIbl; + float m_lod; + bool m_doDiffuse; + bool m_doSpecular; + bool m_doDiffuseIbl; + bool m_doSpecularIbl; + bool m_showLightColorWheel; bool m_showDiffColorWheel; bool m_showSpecColorWheel; + uint8_t m_metalOrSpec; + uint8_t m_meshSelection; ImguiCubemap::Enum m_crossCubemapPreview; }; Settings settings; - settings.m_speed = 0.37f; - settings.m_glossiness = 1.0f; - settings.m_exposure = 0.0f; - settings.m_diffspec = 0.65f; - settings.m_rgbDiff[0] = 0.2f; - settings.m_rgbDiff[1] = 0.2f; - settings.m_rgbDiff[2] = 0.2f; - settings.m_rgbSpec[0] = 1.0f; - settings.m_rgbSpec[1] = 1.0f; - settings.m_rgbSpec[2] = 1.0f; - settings.m_diffuse = true; - settings.m_specular = true; - settings.m_diffuseIbl = true; - settings.m_specularIbl = true; - settings.m_showDiffColorWheel = true; - settings.m_showSpecColorWheel = false; - settings.m_crossCubemapPreview = ImguiCubemap::Cross; - - float time = 0.0f; int32_t leftScrollArea = 0; @@ -320,127 +560,114 @@ int _main_(int _argc, char** _argv) ); static int32_t rightScrollArea = 0; - imguiBeginScrollArea("Settings", width - 256 - 10, 10, 256, 540, &rightScrollArea); - - imguiLabel("Shade:"); - imguiSeparator(); - imguiBool("Diffuse", settings.m_diffuse); - imguiBool("Specular", settings.m_specular); - imguiBool("IBL Diffuse", settings.m_diffuseIbl); - imguiBool("IBL Specular", settings.m_specularIbl); - - imguiSeparatorLine(); - imguiSlider("Speed", settings.m_speed, 0.0f, 1.0f, 0.01f); - imguiSeparatorLine(); - - imguiSeparator(); - imguiSlider("Exposure", settings.m_exposure, -8.0f, 8.0f, 0.01f); - imguiSeparator(); - - imguiLabel("Environment:"); - currentLightProbe = LightProbe::Enum(imguiChoose(currentLightProbe - , "Wells" - , "Uffizi" - , "Pisa" - , "Ennis" - , "Grace" + imguiBeginScrollArea("", width - 256 - 10, 10, 256, 700, &rightScrollArea); + + imguiLabel("Environment light:"); + imguiIndent(); + imguiBool("IBL Diffuse", settings.m_doDiffuseIbl); + imguiBool("IBL Specular", settings.m_doSpecularIbl); + currentLightProbe = LightProbe::Enum(imguiTabs(currentLightProbe, true, ImguiAlign::LeftIndented, 16, 2, 2 + , "Bolonga" + , "Kyoto" ) ); - static float lod = 0.0f; - if (imguiCube(lightProbes[currentLightProbe].m_tex, lod, settings.m_crossCubemapPreview, true) ) + if (imguiCube(lightProbes[currentLightProbe].m_tex, settings.m_lod, settings.m_crossCubemapPreview, true) ) { settings.m_crossCubemapPreview = ImguiCubemap::Enum( (settings.m_crossCubemapPreview+1) % ImguiCubemap::Count); } - imguiSlider("Texture LOD", lod, 0.0f, 10.1f, 0.1f); - - imguiEndScrollArea(); - - imguiBeginScrollArea("Settings", 10, 70, 256, 576, &leftScrollArea); - - imguiLabel("Material properties:"); - imguiSeparator(); - imguiSlider("Diffuse - Specular", settings.m_diffspec, 0.0f, 1.0f, 0.01f); - imguiSlider("Glossiness" , settings.m_glossiness, 0.0f, 1.0f, 0.01f); - imguiSeparator(); - - imguiColorWheel("Diffuse color:", &settings.m_rgbDiff[0], settings.m_showDiffColorWheel); - imguiSeparator(); - imguiColorWheel("Specular color:", &settings.m_rgbSpec[0], settings.m_showSpecColorWheel); - - imguiSeparator(); - imguiLabel("Predefined materials:"); - imguiSeparator(); - - if (imguiButton("Gold") ) + imguiSlider("Texture LOD", settings.m_lod, 0.0f, 10.1f, 0.1f); + imguiUnindent(); + + imguiSeparator(8); + imguiLabel("Directional light:"); + imguiIndent(); + imguiBool("Diffuse", settings.m_doDiffuse); + imguiBool("Specular", settings.m_doSpecular); + const bool doDirectLighting = settings.m_doDiffuse || settings.m_doSpecular; + imguiSlider("Light direction X", settings.m_lightDir[0], -1.0f, 1.0f, 0.1f, doDirectLighting); + imguiSlider("Light direction Y", settings.m_lightDir[1], -1.0f, 1.0f, 0.1f, doDirectLighting); + imguiSlider("Light direction Z", settings.m_lightDir[2], -1.0f, 1.0f, 0.1f, doDirectLighting); + imguiColorWheel("Color:", settings.m_lightCol, settings.m_showLightColorWheel, 0.6f, doDirectLighting); + imguiUnindent(); + + imguiSeparator(8); + imguiLabel("Background:"); + imguiIndent(); { - settings.m_glossiness = 0.8f; - settings.m_diffspec = 1.0f; - - settings.m_rgbDiff[0] = 0.0f; - settings.m_rgbDiff[1] = 0.0f; - settings.m_rgbDiff[2] = 0.0f; - - settings.m_rgbSpec[0] = 1.0f; - settings.m_rgbSpec[1] = 0.86f; - settings.m_rgbSpec[2] = 0.58f; + int32_t selection; + if (0.0f == settings.m_bgType) { selection = 0; } + else if (7.0f == settings.m_bgType) { selection = 2; } + else { selection = 1; } + selection = imguiTabs(selection, true, ImguiAlign::LeftIndented, 16, 2, 3 + , "Skybox" + , "Radiance" + , "Irradiance" + ); + if (0 == selection) { settings.m_bgType = 0.0f; } + else if (2 == selection) { settings.m_bgType = 7.0f; } + else { settings.m_bgType = settings.m_radianceSlider; } + const bool isRadiance = (selection == 1); + imguiSlider("Mip level", settings.m_radianceSlider, 1.0f, 6.0f, 0.1f, isRadiance); } + imguiUnindent(); - if (imguiButton("Copper") ) - { - settings.m_glossiness = 0.67f; - settings.m_diffspec = 1.0f; + imguiSeparator(8); + imguiLabel("Post processing:"); + imguiIndent(); + imguiSlider("Exposure", settings.m_exposure, -4.0f, 4.0f, 0.1f); + imguiUnindent(); - settings.m_rgbDiff[0] = 0.0f; - settings.m_rgbDiff[1] = 0.0f; - settings.m_rgbDiff[2] = 0.0f; - - settings.m_rgbSpec[0] = 0.98f; - settings.m_rgbSpec[1] = 0.82f; - settings.m_rgbSpec[2] = 0.76f; - } + imguiSeparator(); - if (imguiButton("Titanium") ) - { - settings.m_glossiness = 0.57f; - settings.m_diffspec = 1.0f; + imguiEndScrollArea(); - settings.m_rgbDiff[0] = 0.0f; - settings.m_rgbDiff[1] = 0.0f; - settings.m_rgbDiff[2] = 0.0f; + imguiBeginScrollArea("", 10, 70, 256, 636, &leftScrollArea); - settings.m_rgbSpec[0] = 0.76f; - settings.m_rgbSpec[1] = 0.73f; - settings.m_rgbSpec[2] = 0.71f; - } + imguiLabel("Mesh:"); + imguiIndent(); + settings.m_meshSelection = imguiChoose(settings.m_meshSelection, "Bunny", "Orbs"); + imguiUnindent(); - if (imguiButton("Steel") ) + const bool isBunny = (0 == settings.m_meshSelection); + if (!isBunny) { - settings.m_glossiness = 0.82f; - settings.m_diffspec = 1.0f; - - settings.m_rgbDiff[0] = 0.0f; - settings.m_rgbDiff[1] = 0.0f; - settings.m_rgbDiff[2] = 0.0f; - - settings.m_rgbSpec[0] = 0.77f; - settings.m_rgbSpec[1] = 0.78f; - settings.m_rgbSpec[2] = 0.77f; + settings.m_metalOrSpec = 0; } + imguiSeparator(4); + imguiLabel("Workflow:"); + imguiIndent(); + if (imguiCheck("Metalness", 0 == settings.m_metalOrSpec, isBunny) ) { settings.m_metalOrSpec = 0; } + if (imguiCheck("Specular", 1 == settings.m_metalOrSpec, isBunny) ) { settings.m_metalOrSpec = 1; } + imguiUnindent(); + + imguiSeparator(4); + imguiLabel("Material:"); + imguiIndent(); + imguiSlider("Glossiness", settings.m_glossiness, 0.0f, 1.0f, 0.01f, isBunny); + imguiSlider(0 == settings.m_metalOrSpec ? "Metalness" : "Diffuse - Specular", settings.m_reflectivity, 0.0f, 1.0f, 0.01f, isBunny); + imguiUnindent(); + + imguiColorWheel("Diffuse:", &settings.m_rgbDiff[0], settings.m_showDiffColorWheel, 0.7f); + imguiSeparator(); + imguiColorWheel("Specular:", &settings.m_rgbSpec[0], settings.m_showSpecColorWheel, 0.7f, (1 == settings.m_metalOrSpec) && isBunny); + imguiEndScrollArea(); imguiEndFrame(); - s_uniforms.m_glossiness = settings.m_glossiness; - s_uniforms.m_exposure = settings.m_exposure; - s_uniforms.m_diffspec = settings.m_diffspec; - s_uniforms.m_flags[0] = float(settings.m_diffuse); - s_uniforms.m_flags[1] = float(settings.m_specular); - s_uniforms.m_flags[2] = float(settings.m_diffuseIbl); - s_uniforms.m_flags[3] = float(settings.m_specularIbl); - memcpy(s_uniforms.m_rgbDiff, settings.m_rgbDiff, 3*sizeof(float) ); - memcpy(s_uniforms.m_rgbSpec, settings.m_rgbSpec, 3*sizeof(float) ); - - s_uniforms.submitPerFrameUniforms(); + uniforms.m_glossiness = settings.m_glossiness; + uniforms.m_reflectivity = settings.m_reflectivity; + uniforms.m_exposure = settings.m_exposure; + uniforms.m_bgType = settings.m_bgType; + uniforms.m_metalOrSpec = float(settings.m_metalOrSpec); + uniforms.m_doDiffuse = float(settings.m_doDiffuse); + uniforms.m_doSpecular = float(settings.m_doSpecular); + uniforms.m_doDiffuseIbl = float(settings.m_doDiffuseIbl); + uniforms.m_doSpecularIbl = float(settings.m_doSpecularIbl); + memcpy(uniforms.m_rgbDiff, settings.m_rgbDiff, 3*sizeof(float) ); + memcpy(uniforms.m_rgbSpec, settings.m_rgbSpec, 3*sizeof(float) ); + memcpy(uniforms.m_lightDir, settings.m_lightDir, 3*sizeof(float) ); + memcpy(uniforms.m_lightCol, settings.m_lightCol, 3*sizeof(float) ); int64_t now = bx::getHPCounter(); static int64_t last = now; @@ -448,9 +675,7 @@ int _main_(int _argc, char** _argv) last = now; const double freq = double(bx::getHPFrequency() ); const double toMs = 1000.0/freq; - - time += (float)(frameTime*settings.m_speed/freq); - s_uniforms.m_camPosTime[3] = time; + const float deltaTimeSec = float(double(frameTime)/freq); // Use debug font to print information about this example. bgfx::dbgTextClear(); @@ -458,53 +683,111 @@ int _main_(int _argc, char** _argv) bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Image-based lighting."); bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -3.0f }; - - bx::mtxRotateXY(s_uniforms.m_mtx - , 0.0f - , time - ); + // Camera. + const bool mouseOverGui = imguiMouseOverArea(); + mouse.update(float(mouseState.m_mx), float(mouseState.m_my), mouseState.m_mz, width, height); + if (!mouseOverGui) + { + if (mouseState.m_buttons[entry::MouseButton::Left]) + { + camera.orbit(mouse.m_dx, mouse.m_dy); + } + else if (mouseState.m_buttons[entry::MouseButton::Right]) + { + camera.dolly(mouse.m_dx + mouse.m_dy); + } + else if (mouseState.m_buttons[entry::MouseButton::Middle]) + { + settings.m_envRotDest += mouse.m_dx*2.0f; + } + else if (0 != mouse.m_scroll) + { + camera.dolly(float(mouse.m_scroll)*0.05f); + } + } + camera.update(deltaTimeSec); + memcpy(uniforms.m_cameraPos, camera.m_pos.curr, 3*sizeof(float) ); + // View Transform 0. float view[16]; float proj[16]; - bx::mtxIdentity(view); bx::mtxOrtho(proj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f); bgfx::setViewTransform(0, view, proj); - bx::mtxLookAt(view, eye, at); - memcpy(s_uniforms.m_camPosTime, eye, 3*sizeof(float) ); - bx::mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f); + // View Transform 1. + camera.mtxLookAt(view); + bx::mtxProj(proj, 45.0f, float(width)/float(height), 0.1f, 100.0f); bgfx::setViewTransform(1, view, proj); + // View rect. bgfx::setViewRect(0, 0, 0, width, height); bgfx::setViewRect(1, 0, 0, width, height); - // View 0. + // Env rotation. + const float amount = bx::fmin(deltaTimeSec/0.12f, 1.0f); + settings.m_envRotCurr = bx::flerp(settings.m_envRotCurr, settings.m_envRotDest, amount); + + // Env mtx. + float mtxEnvView[16]; + camera.envViewMtx(mtxEnvView); + float mtxEnvRot[16]; + bx::mtxRotateY(mtxEnvRot, settings.m_envRotCurr); + bx::mtxMul(uniforms.m_mtx, mtxEnvView, mtxEnvRot); + + // Submit view 0. bgfx::setTexture(0, s_texCube, lightProbes[currentLightProbe].m_tex); + bgfx::setTexture(1, s_texCubeIrr, lightProbes[currentLightProbe].m_texIrr); bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); screenSpaceQuad( (float)width, (float)height, true); - s_uniforms.submitPerDrawUniforms(); + uniforms.submit(); bgfx::submit(0, programSky); - // View 1. - float mtx[16]; - bx::mtxSRT(mtx - , 1.0f - , 1.0f - , 1.0f - , 0.0f - , bx::pi+time - , 0.0f - , 0.0f - , -1.0f - , 0.0f - ); - - bgfx::setTexture(0, s_texCube, lightProbes[currentLightProbe].m_tex); - bgfx::setTexture(1, s_texCubeIrr, lightProbes[currentLightProbe].m_texIrr); - meshSubmit(meshBunny, 1, programMesh, mtx); + // Submit view 1. + if (0 == settings.m_meshSelection) + { + // Submit bunny. + float mtx[16]; + bx::mtxSRT(mtx, 1.0f, 1.0f, 1.0f, 0.0f, bx::pi, 0.0f, 0.0f, -0.80f, 0.0f); + bgfx::setTexture(0, s_texCube, lightProbes[currentLightProbe].m_tex); + bgfx::setTexture(1, s_texCubeIrr, lightProbes[currentLightProbe].m_texIrr); + meshSubmit(meshBunny, 1, programMesh, mtx); + } + else + { + // Submit orbs. + for (float yy = 0, yend = 5.0f; yy < yend; yy+=1.0f) + { + for (float xx = 0, xend = 5.0f; xx < xend; xx+=1.0f) + { + const float scale = 1.2f; + const float spacing = 2.2f; + const float yAdj = -0.8f; + + float mtx[16]; + bx::mtxSRT(mtx + , scale/xend + , scale/xend + , scale/xend + , 0.0f + , 0.0f + , 0.0f + , 0.0f + (xx/xend)*spacing - (1.0f + (scale-1.0f)*0.5f - 1.0f/xend) + , yAdj/yend + (yy/yend)*spacing - (1.0f + (scale-1.0f)*0.5f - 1.0f/yend) + , 0.0f + ); + + uniforms.m_glossiness = xx*(1.0f/xend); + uniforms.m_reflectivity = (yend-yy)*(1.0f/yend); + uniforms.m_metalOrSpec = 0.0f; + uniforms.submit(); + + bgfx::setTexture(0, s_texCube, lightProbes[currentLightProbe].m_tex); + bgfx::setTexture(1, s_texCubeIrr, lightProbes[currentLightProbe].m_texIrr); + meshSubmit(meshOrb, 1, programMesh, mtx); + } + } + } // Advance to next frame. Rendering thread will be kicked to // process submitted rendering primitives. @@ -512,6 +795,7 @@ int _main_(int _argc, char** _argv) } meshUnload(meshBunny); + meshUnload(meshOrb); // Cleanup. bgfx::destroyProgram(programMesh); @@ -530,7 +814,7 @@ int _main_(int _argc, char** _argv) lightProbes[ii].destroy(); } - s_uniforms.destroy(); + uniforms.destroy(); imguiDestroy(); diff --git a/3rdparty/bgfx/examples/18-ibl/makefile b/3rdparty/bgfx/examples/18-ibl/makefile index 65275428bce..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/18-ibl/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/18-ibl/screenshot.png b/3rdparty/bgfx/examples/18-ibl/screenshot.png Binary files differindex fca0996c376..9cb3c375df2 100644 --- a/3rdparty/bgfx/examples/18-ibl/screenshot.png +++ b/3rdparty/bgfx/examples/18-ibl/screenshot.png diff --git a/3rdparty/bgfx/examples/18-ibl/uniforms.sh b/3rdparty/bgfx/examples/18-ibl/uniforms.sh new file mode 100644 index 00000000000..61354fc87cb --- /dev/null +++ b/3rdparty/bgfx/examples/18-ibl/uniforms.sh @@ -0,0 +1,28 @@ +/* + * Copyright 2016 Dario Manesku. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +uniform vec4 u_params[12]; +#define u_mtx0 u_params[0] +#define u_mtx1 u_params[1] +#define u_mtx2 u_params[2] +#define u_mtx3 u_params[3] +#define u_glossiness u_params[4].x +#define u_reflectivity u_params[4].y +#define u_exposure u_params[4].z +#define u_bgType u_params[4].w +#define u_metalOrSpec u_params[5].x +#define u_unused u_params[5].yzw +#define u_doDiffuse u_params[6].x +#define u_doSpecular u_params[6].y +#define u_doDiffuseIbl u_params[6].z +#define u_doSpecularIbl u_params[6].w +#define u_camPos u_params[7].xyz +#define u_unused7 u_params[7].w +#define u_rgbDiff u_params[8] +#define u_rgbSpec u_params[9] +#define u_lightDir u_params[10].xyz +#define u_unused10 u_params[10].w +#define u_lightCol u_params[11].xyz +#define u_unused11 u_params[11].w diff --git a/3rdparty/bgfx/examples/18-ibl/vs_ibl_mesh.sc b/3rdparty/bgfx/examples/18-ibl/vs_ibl_mesh.sc index 7671fb74dfa..ad88136285c 100644 --- a/3rdparty/bgfx/examples/18-ibl/vs_ibl_mesh.sc +++ b/3rdparty/bgfx/examples/18-ibl/vs_ibl_mesh.sc @@ -2,19 +2,19 @@ $input a_position, a_normal $output v_view, v_normal /* - * Copyright 2014 Dario Manesku. All rights reserved. + * Copyright 2014-2016 Dario Manesku. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ #include "../common/common.sh" - -uniform vec4 u_camPos; +#include "uniforms.sh" void main() { gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); + v_view = u_camPos - mul(u_model[0], vec4(a_position, 1.0)).xyz; + vec3 normal = a_normal * 2.0 - 1.0; v_normal = mul(u_model[0], vec4(normal, 0.0) ).xyz; - v_view = normalize(u_camPos.xyz - mul(u_model[0], vec4(a_position, 1.0)).xyz); } diff --git a/3rdparty/bgfx/examples/18-ibl/vs_ibl_skybox.sc b/3rdparty/bgfx/examples/18-ibl/vs_ibl_skybox.sc index 1c15b18e25e..b83fdd19e25 100644 --- a/3rdparty/bgfx/examples/18-ibl/vs_ibl_skybox.sc +++ b/3rdparty/bgfx/examples/18-ibl/vs_ibl_skybox.sc @@ -2,11 +2,12 @@ $input a_position, a_texcoord0 $output v_dir /* - * Copyright 2014 Dario Manesku. All rights reserved. + * Copyright 2014-2016 Dario Manesku. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ #include "../common/common.sh" +#include "uniforms.sh" uniform mat4 u_mtx; @@ -14,6 +15,15 @@ void main() { gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); - vec2 tex = 2.0 * a_texcoord0 - 1.0; - v_dir = mul(u_mtx, vec4(tex, 1.0, 0.0) ).xyz; + float fov = 45.0; + float height = tan(fov*0.5); + float aspect = height*(4.0/3.0); + vec2 tex = (2.0*a_texcoord0-1.0) * vec2(aspect, height); + + mat4 mtx; + mtx[0] = u_mtx0; + mtx[1] = u_mtx1; + mtx[2] = u_mtx2; + mtx[3] = u_mtx3; + v_dir = instMul(mtx, vec4(tex, 1.0, 0.0) ).xyz; } diff --git a/3rdparty/bgfx/examples/19-oit/makefile b/3rdparty/bgfx/examples/19-oit/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/19-oit/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/19-oit/oit.cpp b/3rdparty/bgfx/examples/19-oit/oit.cpp index 66baed03cd1..b9bbd041934 100644 --- a/3rdparty/bgfx/examples/19-oit/oit.cpp +++ b/3rdparty/bgfx/examples/19-oit/oit.cpp @@ -146,322 +146,370 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, bool _originBott } } -int _main_(int _argc, char** _argv) +class ExampleOIT : public entry::AppI { - Args args(_argc, _argv); + void init(int _argc, char** _argv) BX_OVERRIDE + { + Args args(_argc, _argv); - uint32_t width = 1280; - uint32_t height = 720; - uint32_t debug = BGFX_DEBUG_TEXT; - uint32_t reset = BGFX_RESET_VSYNC; + m_width = 1280; + m_height = 720; + m_debug = BGFX_DEBUG_TEXT; + m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(width, height, reset); + bgfx::init(args.m_type, args.m_pciId); + bgfx::reset(m_width, m_height, m_reset); - // Create vertex stream declaration. - PosColorVertex::init(); - PosColorTexCoord0Vertex::init(); + // Enable debug text. + bgfx::setDebug(m_debug); - // Enable debug text. - bgfx::setDebug(debug); + // Create vertex stream declaration. + PosColorVertex::init(); + PosColorTexCoord0Vertex::init(); - // Get renderer capabilities info. - const bgfx::Caps* caps = bgfx::getCaps(); + // Get renderer capabilities info. + const bgfx::Caps* caps = bgfx::getCaps(); - // Setup root path for binary shaders. Shader binaries are different - // for each renderer. - switch (caps->rendererType) - { - default: - break; + // Setup root path for binary shaders. Shader binaries are different + // for each renderer. + switch (caps->rendererType) + { + default: + break; - case bgfx::RendererType::OpenGL: - case bgfx::RendererType::OpenGLES: - s_flipV = true; - break; - } + case bgfx::RendererType::OpenGL: + case bgfx::RendererType::OpenGLES: + s_flipV = true; + break; + } - // Imgui. - imguiCreate(); + // Imgui. + imguiCreate(); - const bgfx::Memory* mem; + // Create static vertex buffer. + m_vbh = bgfx::createVertexBuffer( + bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) ) + , PosColorVertex::ms_decl + ); - // Create static vertex buffer. - mem = bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) ); - bgfx::VertexBufferHandle vbh = bgfx::createVertexBuffer(mem, PosColorVertex::ms_decl); + // Create static index buffer. + m_ibh = bgfx::createIndexBuffer(bgfx::makeRef(s_cubeIndices, sizeof(s_cubeIndices) ) ); - // Create static index buffer. - mem = bgfx::makeRef(s_cubeIndices, sizeof(s_cubeIndices) ); - bgfx::IndexBufferHandle ibh = bgfx::createIndexBuffer(mem); + // Create texture sampler uniforms. + s_texColor0 = bgfx::createUniform("s_texColor0", bgfx::UniformType::Int1); + s_texColor1 = bgfx::createUniform("s_texColor1", bgfx::UniformType::Int1); + u_color = bgfx::createUniform("u_color", bgfx::UniformType::Vec4); - // Create texture sampler uniforms. - bgfx::UniformHandle s_texColor0 = bgfx::createUniform("s_texColor0", bgfx::UniformType::Int1); - bgfx::UniformHandle s_texColor1 = bgfx::createUniform("s_texColor1", bgfx::UniformType::Int1); - bgfx::UniformHandle u_color = bgfx::createUniform("u_color", bgfx::UniformType::Vec4); + m_blend = loadProgram("vs_oit", "fs_oit" ); + m_wbSeparatePass = loadProgram("vs_oit", "fs_oit_wb_separate" ); + m_wbSeparateBlit = loadProgram("vs_oit_blit", "fs_oit_wb_separate_blit" ); + m_wbPass = loadProgram("vs_oit", "fs_oit_wb" ); + m_wbBlit = loadProgram("vs_oit_blit", "fs_oit_wb_blit" ); - bgfx::ProgramHandle blend = loadProgram("vs_oit", "fs_oit" ); - bgfx::ProgramHandle wbSeparatePass = loadProgram("vs_oit", "fs_oit_wb_separate" ); - bgfx::ProgramHandle wbSeparateBlit = loadProgram("vs_oit_blit", "fs_oit_wb_separate_blit" ); - bgfx::ProgramHandle wbPass = loadProgram("vs_oit", "fs_oit_wb" ); - bgfx::ProgramHandle wbBlit = loadProgram("vs_oit_blit", "fs_oit_wb_blit" ); + m_fbtextures[0].idx = bgfx::invalidHandle; + m_fbtextures[1].idx = bgfx::invalidHandle; + m_fbh.idx = bgfx::invalidHandle; - bgfx::TextureHandle fbtextures[2] = { BGFX_INVALID_HANDLE, BGFX_INVALID_HANDLE }; - bgfx::FrameBufferHandle fbh = BGFX_INVALID_HANDLE; + m_mode = 1; + m_scrollArea = 0; + m_frontToBack = true; + m_fadeInOut = false; - int64_t timeOffset = bx::getHPCounter(); + m_oldWidth = 0; + m_oldHeight = 0; + m_oldReset = m_reset; - uint32_t mode = 1; - int32_t scrollArea = 0; - bool frontToBack = true; - bool fadeInOut = false; + m_timeOffset = bx::getHPCounter(); + } - uint32_t oldWidth = 0; - uint32_t oldHeight = 0; - uint32_t oldReset = reset; + int shutdown() BX_OVERRIDE + { + // Cleanup. + imguiDestroy(); + + bgfx::destroyFrameBuffer(m_fbh); + bgfx::destroyIndexBuffer(m_ibh); + bgfx::destroyVertexBuffer(m_vbh); + bgfx::destroyProgram(m_blend); + bgfx::destroyProgram(m_wbSeparatePass); + bgfx::destroyProgram(m_wbSeparateBlit); + bgfx::destroyProgram(m_wbPass); + bgfx::destroyProgram(m_wbBlit); + bgfx::destroyUniform(s_texColor0); + bgfx::destroyUniform(s_texColor1); + bgfx::destroyUniform(u_color); + + // Shutdown bgfx. + bgfx::shutdown(); + + return 0; + } - entry::MouseState mouseState; - while (!entry::processEvents(width, height, debug, reset, &mouseState) ) + bool update() BX_OVERRIDE { - if (oldWidth != width - || oldHeight != height - || oldReset != reset - || !bgfx::isValid(fbh) ) + if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) ) { - // Recreate variable size render targets when resolution changes. - oldWidth = width; - oldHeight = height; - oldReset = reset; - - if (bgfx::isValid(fbh) ) + if (m_oldWidth != m_width + || m_oldHeight != m_height + || m_oldReset != m_reset + || !bgfx::isValid(m_fbh) ) { - bgfx::destroyFrameBuffer(fbh); - } + // Recreate variable size render targets when resolution changes. + m_oldWidth = m_width; + m_oldHeight = m_height; + m_oldReset = m_reset; - fbtextures[0] = bgfx::createTexture2D(width, height, 1, bgfx::TextureFormat::RGBA16F, BGFX_TEXTURE_RT); - fbtextures[1] = bgfx::createTexture2D(width, height, 1, bgfx::TextureFormat::R16F, BGFX_TEXTURE_RT); - fbh = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true); - } + if (bgfx::isValid(m_fbh) ) + { + bgfx::destroyFrameBuffer(m_fbh); + } - imguiBeginFrame(mouseState.m_mx - , mouseState.m_my - , (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0) - | (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) - | (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) - , mouseState.m_mz - , width - , height - ); + m_fbtextures[0] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::RGBA16F, BGFX_TEXTURE_RT); + m_fbtextures[1] = bgfx::createTexture2D(m_width, m_height, 1, bgfx::TextureFormat::R16F, BGFX_TEXTURE_RT); + m_fbh = bgfx::createFrameBuffer(BX_COUNTOF(m_fbtextures), m_fbtextures, true); + } - imguiBeginScrollArea("Settings", width - width / 4 - 10, 10, width / 4, height / 3, &scrollArea); - imguiSeparatorLine(); + imguiBeginFrame(m_mouseState.m_mx + , m_mouseState.m_my + , (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0) + | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) + | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) + , m_mouseState.m_mz + , m_width + , m_height + ); - imguiLabel("Blend mode:"); + imguiBeginScrollArea("Settings", m_width - m_width / 4 - 10, 10, m_width / 4, m_height / 3, &m_scrollArea); + imguiSeparatorLine(); - mode = imguiChoose(mode - , "None" - , "Separate" - , "MRT Independent" - ); + imguiLabel("Blend mode:"); - imguiSeparatorLine(); + m_mode = imguiChoose(m_mode + , "None" + , "Separate" + , "MRT Independent" + ); - if (imguiCheck("Front to back", frontToBack) ) - { - frontToBack ^= true; - } + imguiSeparatorLine(); - if (imguiCheck("Fade in/out", fadeInOut) ) - { - fadeInOut ^= true; - } + if (imguiCheck("Front to back", m_frontToBack) ) + { + m_frontToBack ^= true; + } - imguiEndScrollArea(); - imguiEndFrame(); + if (imguiCheck("Fade in/out", m_fadeInOut) ) + { + m_fadeInOut ^= true; + } - // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, width, height); - bgfx::setViewRect(1, 0, 0, width, height); + imguiEndScrollArea(); + imguiEndFrame(); - int64_t now = bx::getHPCounter(); - static int64_t last = now; - const int64_t frameTime = now - last; - last = now; - const double freq = double(bx::getHPFrequency() ); - const double toMs = 1000.0/freq; + // Set view 0 default viewport. + bgfx::setViewRect(0, 0, 0, m_width, m_height); + bgfx::setViewRect(1, 0, 0, m_width, m_height); - float time = (float)( (now-timeOffset)/freq); + int64_t now = bx::getHPCounter(); + static int64_t last = now; + const int64_t frameTime = now - last; + last = now; + const double freq = double(bx::getHPFrequency() ); + const double toMs = 1000.0/freq; - // Use debug font to print information about this example. - bgfx::dbgTextClear(); - // Reference: - // Weighted, Blended Order-Independent Transparency - // http://jcgt.org/published/0002/02/09/ - // http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html - bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/19-oit"); - bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Weighted, Blended Order Independent Transparency."); - bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); + float time = (float)( (now-m_timeOffset)/freq); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -7.0f }; + // Use debug font to print information about this example. + bgfx::dbgTextClear(); + // Reference: + // Weighted, Blended Order-Independent Transparency + // http://jcgt.org/published/0002/02/09/ + // http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html + bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/19-oit"); + bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Weighted, Blended Order Independent Transparency."); + bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); - float view[16]; - float proj[16]; + float at[3] = { 0.0f, 0.0f, 0.0f }; + float eye[3] = { 0.0f, 0.0f, -7.0f }; - // Set view and projection matrix for view 0. - bx::mtxLookAt(view, eye, at); - mtxProj(proj, 60.0f, float(width)/float(height), 0.1f, 100.0f); + float view[16]; + float proj[16]; - bgfx::setViewTransform(0, view, proj); + // Set view and projection matrix for view 0. + bx::mtxLookAt(view, eye, at); + mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f); - // Set palette color for index 0 - bgfx::setPaletteColor(0, 0.0f, 0.0f, 0.0f, 0.0f); + bgfx::setViewTransform(0, view, proj); - // Set palette color for index 1 - bgfx::setPaletteColor(1, 1.0f, 1.0f, 1.0f, 1.0f); + // Set palette color for index 0 + bgfx::setPaletteColor(0, 0.0f, 0.0f, 0.0f, 0.0f); - bgfx::setViewClear(0 - , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH - , 1.0f // Depth - , 0 // Stencil - , 0 // FB texture 0, color palette 0 - , 1 == mode ? 1 : 0 // FB texture 1, color palette 1 - ); + // Set palette color for index 1 + bgfx::setPaletteColor(1, 1.0f, 1.0f, 1.0f, 1.0f); - bgfx::setViewClear(1 - , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH - , 1.0f // Depth - , 0 // Stencil - , 0 // Color palette 0 - ); + bgfx::setViewClear(0 + , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH + , 1.0f // Depth + , 0 // Stencil + , 0 // FB texture 0, color palette 0 + , 1 == m_mode ? 1 : 0 // FB texture 1, color palette 1 + ); - bgfx::FrameBufferHandle invalid = BGFX_INVALID_HANDLE; - bgfx::setViewFrameBuffer(0, 0 == mode ? invalid : fbh); + bgfx::setViewClear(1 + , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH + , 1.0f // Depth + , 0 // Stencil + , 0 // Color palette 0 + ); - // Set view and projection matrix for view 1. - bx::mtxIdentity(view); - bx::mtxOrtho(proj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f); - bgfx::setViewTransform(1, view, proj); + bgfx::FrameBufferHandle invalid = BGFX_INVALID_HANDLE; + bgfx::setViewFrameBuffer(0, 0 == m_mode ? invalid : m_fbh); - for (uint32_t depth = 0; depth < 3; ++depth) - { - uint32_t zz = frontToBack ? 2-depth : depth; + // Set view and projection matrix for view 1. + bx::mtxIdentity(view); + bx::mtxOrtho(proj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f); + bgfx::setViewTransform(1, view, proj); - for (uint32_t yy = 0; yy < 3; ++yy) + for (uint32_t depth = 0; depth < 3; ++depth) { - for (uint32_t xx = 0; xx < 3; ++xx) - { - float color[4] = { xx*1.0f/3.0f, zz*1.0f/3.0f, yy*1.0f/3.0f, 0.5f }; - - if (fadeInOut - && zz == 1) - { - color[3] = sinf(time*3.0f)*0.49f+0.5f; - } + uint32_t zz = m_frontToBack ? 2-depth : depth; - bgfx::setUniform(u_color, color); - - BX_UNUSED(time); - float mtx[16]; - bx::mtxRotateXY(mtx, time*0.023f + xx*0.21f, time*0.03f + yy*0.37f); - //mtxIdentity(mtx); - mtx[12] = -2.5f + float(xx)*2.5f; - mtx[13] = -2.5f + float(yy)*2.5f; - mtx[14] = -2.5f + float(zz)*2.5f; - - // Set transform for draw call. - bgfx::setTransform(mtx); - - // Set vertex and index buffer. - bgfx::setVertexBuffer(vbh); - bgfx::setIndexBuffer(ibh); - - const uint64_t state = 0 - | BGFX_STATE_CULL_CW - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_TEST_LESS - | BGFX_STATE_MSAA - ; - - bgfx::ProgramHandle program = BGFX_INVALID_HANDLE; - switch (mode) + for (uint32_t yy = 0; yy < 3; ++yy) + { + for (uint32_t xx = 0; xx < 3; ++xx) { - case 0: - // Set vertex and fragment shaders. - program = blend; - - // Set render states. - bgfx::setState(state - | BGFX_STATE_BLEND_ALPHA - ); - break; - - case 1: - // Set vertex and fragment shaders. - program = wbSeparatePass; - - // Set render states. - bgfx::setState(state - | BGFX_STATE_BLEND_FUNC_SEPARATE(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ZERO, BGFX_STATE_BLEND_INV_SRC_ALPHA) - ); - break; - - default: - // Set vertex and fragment shaders. - program = wbPass; - - // Set render states. - bgfx::setState(state - | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) - | BGFX_STATE_BLEND_INDEPENDENT - , 0 - | BGFX_STATE_BLEND_FUNC_RT_1(BGFX_STATE_BLEND_ZERO, BGFX_STATE_BLEND_SRC_COLOR) - ); - break; + float color[4] = { xx*1.0f/3.0f, zz*1.0f/3.0f, yy*1.0f/3.0f, 0.5f }; + + if (m_fadeInOut + && zz == 1) + { + color[3] = sinf(time*3.0f)*0.49f+0.5f; + } + + bgfx::setUniform(u_color, color); + + BX_UNUSED(time); + float mtx[16]; + bx::mtxRotateXY(mtx, time*0.023f + xx*0.21f, time*0.03f + yy*0.37f); + //mtxIdentity(mtx); + mtx[12] = -2.5f + float(xx)*2.5f; + mtx[13] = -2.5f + float(yy)*2.5f; + mtx[14] = -2.5f + float(zz)*2.5f; + + // Set transform for draw call. + bgfx::setTransform(mtx); + + // Set vertex and index buffer. + bgfx::setVertexBuffer(m_vbh); + bgfx::setIndexBuffer(m_ibh); + + const uint64_t state = 0 + | BGFX_STATE_CULL_CW + | BGFX_STATE_RGB_WRITE + | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_DEPTH_TEST_LESS + | BGFX_STATE_MSAA + ; + + bgfx::ProgramHandle program = BGFX_INVALID_HANDLE; + switch (m_mode) + { + case 0: + // Set vertex and fragment shaders. + program = m_blend; + + // Set render states. + bgfx::setState(state + | BGFX_STATE_BLEND_ALPHA + ); + break; + + case 1: + // Set vertex and fragment shaders. + program = m_wbSeparatePass; + + // Set render states. + bgfx::setState(state + | BGFX_STATE_BLEND_FUNC_SEPARATE(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ZERO, BGFX_STATE_BLEND_INV_SRC_ALPHA) + ); + break; + + default: + // Set vertex and fragment shaders. + program = m_wbPass; + + // Set render states. + bgfx::setState(state + | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) + | BGFX_STATE_BLEND_INDEPENDENT + , 0 + | BGFX_STATE_BLEND_FUNC_RT_1(BGFX_STATE_BLEND_ZERO, BGFX_STATE_BLEND_SRC_COLOR) + ); + break; + } + + // Submit primitive for rendering to view 0. + bgfx::submit(0, program); } - - // Submit primitive for rendering to view 0. - bgfx::submit(0, program); } } - } - if (0 != mode) - { - bgfx::setTexture(0, s_texColor0, fbtextures[0]); - bgfx::setTexture(1, s_texColor1, fbtextures[1]); - bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_INV_SRC_ALPHA, BGFX_STATE_BLEND_SRC_ALPHA) - ); - screenSpaceQuad( (float)width, (float)height, s_flipV); - bgfx::submit(1 - , 1 == mode ? wbSeparateBlit : wbBlit - ); + if (0 != m_mode) + { + bgfx::setTexture(0, s_texColor0, m_fbtextures[0]); + bgfx::setTexture(1, s_texColor1, m_fbtextures[1]); + bgfx::setState(0 + | BGFX_STATE_RGB_WRITE + | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_INV_SRC_ALPHA, BGFX_STATE_BLEND_SRC_ALPHA) + ); + screenSpaceQuad( (float)m_width, (float)m_height, s_flipV); + bgfx::submit(1 + , 1 == m_mode ? m_wbSeparateBlit : m_wbBlit + ); + } + + // Advance to next frame. Rendering thread will be kicked to + // process submitted rendering primitives. + bgfx::frame(); + + return true; } - // Advance to next frame. Rendering thread will be kicked to - // process submitted rendering primitives. - bgfx::frame(); + return false; } - // Cleanup. - imguiDestroy(); - - bgfx::destroyFrameBuffer(fbh); - bgfx::destroyIndexBuffer(ibh); - bgfx::destroyVertexBuffer(vbh); - bgfx::destroyProgram(blend); - bgfx::destroyProgram(wbSeparatePass); - bgfx::destroyProgram(wbSeparateBlit); - bgfx::destroyProgram(wbPass); - bgfx::destroyProgram(wbBlit); - bgfx::destroyUniform(s_texColor0); - bgfx::destroyUniform(s_texColor1); - bgfx::destroyUniform(u_color); - - // Shutdown bgfx. - bgfx::shutdown(); - - return 0; -} + uint32_t m_width; + uint32_t m_height; + uint32_t m_debug; + uint32_t m_reset; + + uint32_t m_mode; + int32_t m_scrollArea; + bool m_frontToBack; + bool m_fadeInOut; + + uint32_t m_oldWidth; + uint32_t m_oldHeight; + uint32_t m_oldReset; + + entry::MouseState m_mouseState; + + int64_t m_timeOffset; + + bgfx::VertexBufferHandle m_vbh; + bgfx::IndexBufferHandle m_ibh; + + bgfx::UniformHandle s_texColor0; + bgfx::UniformHandle s_texColor1; + bgfx::UniformHandle u_color; + + bgfx::ProgramHandle m_blend; + bgfx::ProgramHandle m_wbSeparatePass; + bgfx::ProgramHandle m_wbSeparateBlit; + bgfx::ProgramHandle m_wbPass; + bgfx::ProgramHandle m_wbBlit; + + bgfx::TextureHandle m_fbtextures[2]; + bgfx::FrameBufferHandle m_fbh; +}; + +ENTRY_IMPLEMENT_MAIN(ExampleOIT); diff --git a/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp b/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp index f667ba180c2..206bca10237 100644 --- a/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp +++ b/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp @@ -1201,80 +1201,105 @@ void renderDemo(struct NVGcontext* vg, float mx, float my, float width, float he nvgRestore(vg); } -int _main_(int _argc, char** _argv) +class ExampleNanoVG : public entry::AppI { - Args args(_argc, _argv); + void init(int _argc, char** _argv) BX_OVERRIDE + { + Args args(_argc, _argv); - uint32_t width = 1280; - uint32_t height = 720; - uint32_t debug = BGFX_DEBUG_TEXT; - uint32_t reset = BGFX_RESET_VSYNC; + m_width = 1280; + m_height = 720; + m_debug = BGFX_DEBUG_TEXT; + m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(width, height, reset); + bgfx::init(args.m_type, args.m_pciId); + bgfx::reset(m_width, m_height, m_reset); - // Enable debug text. - bgfx::setDebug(debug); + // Enable debug text. + bgfx::setDebug(m_debug); - // Set view 0 clear state. - bgfx::setViewClear(0 - , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH - , 0x303030ff - , 1.0f - , 0 - ); + // Set view 0 clear state. + bgfx::setViewClear(0 + , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH + , 0x303030ff + , 1.0f + , 0 + ); + + imguiCreate(); + + m_nvg = nvgCreate(1, 0); + bgfx::setViewSeq(0, true); + + loadDemoData(m_nvg, &m_data); + + bndSetFont(nvgCreateFont(m_nvg, "droidsans", "font/droidsans.ttf") ); + bndSetIconImage(nvgCreateImage(m_nvg, "images/blender_icons16.png", 0) ); + + m_timeOffset = bx::getHPCounter(); + } - imguiCreate(); + int shutdown() BX_OVERRIDE + { + freeDemoData(m_nvg, &m_data); - NVGcontext* nvg = nvgCreate(1, 0); - bgfx::setViewSeq(0, true); + nvgDelete(m_nvg); - DemoData data; - loadDemoData(nvg, &data); + imguiDestroy(); - bndSetFont(nvgCreateFont(nvg, "droidsans", "font/droidsans.ttf") ); - bndSetIconImage(nvgCreateImage(nvg, "images/blender_icons16.png", 0) ); + // Shutdown bgfx. + bgfx::shutdown(); - int64_t timeOffset = bx::getHPCounter(); + return 0; + } - entry::MouseState mouseState; - while (!entry::processEvents(width, height, debug, reset, &mouseState) ) + bool update() BX_OVERRIDE { - int64_t now = bx::getHPCounter(); - const double freq = double(bx::getHPFrequency() ); - float time = (float)( (now-timeOffset)/freq); + if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) ) + { + int64_t now = bx::getHPCounter(); + const double freq = double(bx::getHPFrequency() ); + float time = (float)( (now-m_timeOffset)/freq); - // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, width, height); + // Set view 0 default viewport. + bgfx::setViewRect(0, 0, 0, m_width, m_height); - // This dummy draw call is here to make sure that view 0 is cleared - // if no other draw calls are submitted to view 0. - bgfx::touch(0); + // This dummy draw call is here to make sure that view 0 is cleared + // if no other draw calls are submitted to view 0. + bgfx::touch(0); - // Use debug font to print information about this example. - bgfx::dbgTextClear(); - bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/20-nanovg"); - bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: NanoVG is small antialiased vector graphics rendering library."); + // Use debug font to print information about this example. + bgfx::dbgTextClear(); + bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/20-nanovg"); + bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: NanoVG is small antialiased vector graphics rendering library."); - nvgBeginFrame(nvg, width, height, 1.0f); + nvgBeginFrame(m_nvg, m_width, m_height, 1.0f); - renderDemo(nvg, float(mouseState.m_mx), float(mouseState.m_my), float(width), float(height), time, 0, &data); + renderDemo(m_nvg, float(m_mouseState.m_mx), float(m_mouseState.m_my), float(m_width), float(m_height), time, 0, &m_data); - nvgEndFrame(nvg); + nvgEndFrame(m_nvg); - // Advance to next frame. Rendering thread will be kicked to - // process submitted rendering primitives. - bgfx::frame(); + // Advance to next frame. Rendering thread will be kicked to + // process submitted rendering primitives. + bgfx::frame(); + + return true; + } + + return false; } - freeDemoData(nvg, &data); + uint32_t m_width; + uint32_t m_height; + uint32_t m_debug; + uint32_t m_reset; - nvgDelete(nvg); + entry::MouseState m_mouseState; - imguiDestroy(); + int64_t m_timeOffset; - // Shutdown bgfx. - bgfx::shutdown(); + NVGcontext* m_nvg; + DemoData m_data; +}; - return 0; -} +ENTRY_IMPLEMENT_MAIN(ExampleNanoVG); diff --git a/3rdparty/bgfx/examples/21-deferred/deferred.cpp b/3rdparty/bgfx/examples/21-deferred/deferred.cpp index 5a97b7f21b2..2f8fb5d3816 100644 --- a/3rdparty/bgfx/examples/21-deferred/deferred.cpp +++ b/3rdparty/bgfx/examples/21-deferred/deferred.cpp @@ -213,7 +213,7 @@ void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf } } -class Deferred : public entry::AppI +class ExampleDeferred : public entry::AppI { void init(int _argc, char** _argv) BX_OVERRIDE { @@ -792,4 +792,4 @@ class Deferred : public entry::AppI int64_t m_timeOffset; }; -ENTRY_IMPLEMENT_MAIN(Deferred); +ENTRY_IMPLEMENT_MAIN(ExampleDeferred); diff --git a/3rdparty/bgfx/examples/21-deferred/makefile b/3rdparty/bgfx/examples/21-deferred/makefile index 011773e023f..4f81fb5bfb9 100644 --- a/3rdparty/bgfx/examples/21-deferred/makefile +++ b/3rdparty/bgfx/examples/21-deferred/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 # diff --git a/3rdparty/bgfx/examples/23-vectordisplay/makefile b/3rdparty/bgfx/examples/23-vectordisplay/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/23-vectordisplay/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp index a49eace14aa..74bcbc9eb12 100644 --- a/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp +++ b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp @@ -186,7 +186,7 @@ void VectorDisplay::endFrame() bgfx::setTexture(0, s_texColor, m_lineTexId); - bgfx::setVertexBuffer(m_vertexBuffers[i], m_vertexBuffersSize[i]); // explicitly feed vertex number! + bgfx::setVertexBuffer(m_vertexBuffers[i], 0, m_vertexBuffersSize[i]); // explicitly feed vertex number! bgfx::setState(0 | BGFX_STATE_RGB_WRITE diff --git a/3rdparty/bgfx/examples/24-nbody/makefile b/3rdparty/bgfx/examples/24-nbody/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/24-nbody/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/25-c99/helloworld.c b/3rdparty/bgfx/examples/25-c99/helloworld.c index a362736b435..3dd01e8c633 100644 --- a/3rdparty/bgfx/examples/25-c99/helloworld.c +++ b/3rdparty/bgfx/examples/25-c99/helloworld.c @@ -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 */ diff --git a/3rdparty/bgfx/examples/26-occlusion/occlusion.cpp b/3rdparty/bgfx/examples/26-occlusion/occlusion.cpp index a6971cdd5cd..81e00f0c5fe 100644 --- a/3rdparty/bgfx/examples/26-occlusion/occlusion.cpp +++ b/3rdparty/bgfx/examples/26-occlusion/occlusion.cpp @@ -58,7 +58,7 @@ static const uint16_t s_cubeIndices[36] = 6, 3, 7, }; -class Occlusion : public entry::AppI +class ExampleOcclusion : public entry::AppI { void init(int _argc, char** _argv) BX_OVERRIDE { @@ -282,4 +282,4 @@ class Occlusion : public entry::AppI entry::WindowState m_state; }; -ENTRY_IMPLEMENT_MAIN(Occlusion); +ENTRY_IMPLEMENT_MAIN(ExampleOcclusion); diff --git a/3rdparty/bgfx/examples/27-terrain/makefile b/3rdparty/bgfx/examples/27-terrain/makefile index 011773e023f..e6278cb66dc 100644 --- a/3rdparty/bgfx/examples/27-terrain/makefile +++ b/3rdparty/bgfx/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/3rdparty/bgfx/examples/27-terrain/terrain.cpp b/3rdparty/bgfx/examples/27-terrain/terrain.cpp index 71ab88aa128..74d88ac350d 100644 --- a/3rdparty/bgfx/examples/27-terrain/terrain.cpp +++ b/3rdparty/bgfx/examples/27-terrain/terrain.cpp @@ -58,7 +58,7 @@ struct BrushData float m_power; }; -class Terrain : public entry::AppI +class ExampleTerrain : public entry::AppI { void init(int _argc, char** _argv) BX_OVERRIDE { @@ -169,9 +169,14 @@ class Terrain : public entry::AppI bgfx::destroyProgram(m_terrainProgram); bgfx::destroyProgram(m_terrainHeightTextureProgram); - BX_FREE(entry::getAllocator(), m_terrain.m_vertices); - BX_FREE(entry::getAllocator(), m_terrain.m_indices); - BX_FREE(entry::getAllocator(), m_terrain.m_heightMap); + /// When data is passed to bgfx via makeRef we need to make + /// sure library is done with it before freeing memory blocks. + bgfx::frame(); + + bx::AllocatorI* allocator = entry::getAllocator(); + BX_FREE(allocator, m_terrain.m_vertices); + BX_FREE(allocator, m_terrain.m_indices); + BX_FREE(allocator, m_terrain.m_heightMap); // Shutdown bgfx. bgfx::shutdown(); @@ -526,4 +531,4 @@ class Terrain : public entry::AppI int64_t m_timeOffset; }; -ENTRY_IMPLEMENT_MAIN(Terrain); +ENTRY_IMPLEMENT_MAIN(ExampleTerrain); diff --git a/3rdparty/bgfx/examples/28-wireframe/fs_wf_mesh.sc b/3rdparty/bgfx/examples/28-wireframe/fs_wf_mesh.sc new file mode 100644 index 00000000000..4a68b1472e1 --- /dev/null +++ b/3rdparty/bgfx/examples/28-wireframe/fs_wf_mesh.sc @@ -0,0 +1,78 @@ +$input v_view, v_bc, v_normal + +/* + * Copyright 2016 Dario Manesku. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" +#include "uniforms.sh" + +vec3 evalSh(vec3 _dir) +{ +# define k01 0.2820947918 // sqrt( 1/PI)/2 +# define k02 0.4886025119 // sqrt( 3/PI)/2 +# define k03 1.0925484306 // sqrt(15/PI)/2 +# define k04 0.3153915652 // sqrt( 5/PI)/4 +# define k05 0.5462742153 // sqrt(15/PI)/4 + + vec3 shEnv[9]; + shEnv[0] = vec3( 0.967757057878229854, 0.976516067990363390, 0.891218272348969998); /* Band 0 */ + shEnv[1] = vec3(-0.384163503608655643, -0.423492289131209787, -0.425532726148547868); /* Band 1 */ + shEnv[2] = vec3( 0.055906294587354334, 0.056627436881069373, 0.069969936396987467); + shEnv[3] = vec3( 0.120985157386215209, 0.119297994074027414, 0.117111965829213599); + shEnv[4] = vec3(-0.176711633774331106, -0.170331404095516392, -0.151345020570876621); /* Band 2 */ + shEnv[5] = vec3(-0.124682114349692147, -0.119340785411183953, -0.096300354204368860); + shEnv[6] = vec3( 0.001852378550138503, -0.032592784164597745, -0.088204495001329680); + shEnv[7] = vec3( 0.296365482782109446, 0.281268696656263029, 0.243328223888495510); + shEnv[8] = vec3(-0.079826665303240341, -0.109340956251195970, -0.157208859664677764); + + vec3 nn = _dir.zxy; + + float sh[9]; + sh[0] = k01; + sh[1] = -k02*nn.y; + sh[2] = k02*nn.z; + sh[3] = -k02*nn.x; + sh[4] = k03*nn.y*nn.x; + sh[5] = -k03*nn.y*nn.z; + sh[6] = k04*(3.0*nn.z*nn.z-1.0); + sh[7] = -k03*nn.x*nn.z; + sh[8] = k05*(nn.x*nn.x-nn.y*nn.y); + + vec3 rgb = vec3_splat(0.0); + rgb += shEnv[0] * sh[0] * 1.0; + rgb += shEnv[1] * sh[1] * 2.0/2.5; + rgb += shEnv[2] * sh[2] * 2.0/2.5; + rgb += shEnv[3] * sh[3] * 2.0/2.5; + rgb += shEnv[4] * sh[4] * 1.0/2.5; + rgb += shEnv[5] * sh[5] * 0.5; + rgb += shEnv[6] * sh[6] * 0.5; + rgb += shEnv[7] * sh[7] * 0.5; + rgb += shEnv[8] * sh[8] * 0.5; + + return rgb; +} + +void main() +{ + vec3 nn = normalize(v_normal); + vec3 col = evalSh(nn); + + if (0.0 != u_drawEdges) + { + vec3 wfColor = u_wfColor; + float wfOpacity = u_wfOpacity; + float thickness = u_wfThickness; + + vec3 fw = abs(dFdx(v_bc)) + abs(dFdy(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); + col = mix(edgeCol, col, edge); + } + + gl_FragColor.xyz = col; + gl_FragColor.w = 1.0; +} diff --git a/3rdparty/bgfx/examples/28-wireframe/fs_wf_wireframe.sc b/3rdparty/bgfx/examples/28-wireframe/fs_wf_wireframe.sc new file mode 100644 index 00000000000..e2ff1420011 --- /dev/null +++ b/3rdparty/bgfx/examples/28-wireframe/fs_wf_wireframe.sc @@ -0,0 +1,26 @@ +$input v_view, v_bc + +/* + * Copyright 2016 Dario Manesku. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" +#include "uniforms.sh" + +void main() +{ + vec3 color = u_wfColor; + float opacity = u_wfOpacity; + float thickness = u_wfThickness; + + if (gl_FrontFacing) { opacity *= 0.5; } + + vec3 fw = abs(dFdx(v_bc)) + abs(dFdy(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 around the edges. + + vec4 rgba = vec4(color, (1.0-edge)*opacity); + gl_FragColor = rgba; +} + diff --git a/3rdparty/bgfx/examples/28-wireframe/makefile b/3rdparty/bgfx/examples/28-wireframe/makefile new file mode 100644 index 00000000000..e6278cb66dc --- /dev/null +++ b/3rdparty/bgfx/examples/28-wireframe/makefile @@ -0,0 +1,18 @@ +# +# Copyright 2011-2016 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 + +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/3rdparty/bgfx/examples/28-wireframe/screenshot.png b/3rdparty/bgfx/examples/28-wireframe/screenshot.png Binary files differnew file mode 100644 index 00000000000..65957306a9d --- /dev/null +++ b/3rdparty/bgfx/examples/28-wireframe/screenshot.png diff --git a/3rdparty/bgfx/examples/28-wireframe/uniforms.sh b/3rdparty/bgfx/examples/28-wireframe/uniforms.sh new file mode 100644 index 00000000000..330555ee50d --- /dev/null +++ b/3rdparty/bgfx/examples/28-wireframe/uniforms.sh @@ -0,0 +1,12 @@ +/* + * Copyright 2016 Dario Manesku. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +uniform vec4 u_params[3]; +#define u_camPos u_params[0].xyz +#define u_unused0 u_params[0].w +#define u_wfColor u_params[1].xyz +#define u_wfOpacity u_params[1].w +#define u_drawEdges u_params[2].x +#define u_wfThickness u_params[2].y diff --git a/3rdparty/bgfx/examples/28-wireframe/varying.def.sc b/3rdparty/bgfx/examples/28-wireframe/varying.def.sc new file mode 100644 index 00000000000..c0c52962ad3 --- /dev/null +++ b/3rdparty/bgfx/examples/28-wireframe/varying.def.sc @@ -0,0 +1,7 @@ +vec3 v_view : TEXCOORD0 = vec3(0.0, 0.0, 0.0); +vec3 v_bc : TEXCOORD1 = vec3(0.0, 0.0, 0.0); +vec3 v_normal : NORMAL = vec3(0.0, 0.0, 1.0); + +vec3 a_position : POSITION; +vec3 a_color1 : COLOR1; +vec3 a_normal : NORMAL; diff --git a/3rdparty/bgfx/examples/28-wireframe/vs_wf_mesh.sc b/3rdparty/bgfx/examples/28-wireframe/vs_wf_mesh.sc new file mode 100644 index 00000000000..3f51abc59ad --- /dev/null +++ b/3rdparty/bgfx/examples/28-wireframe/vs_wf_mesh.sc @@ -0,0 +1,21 @@ +$input a_position, a_color1, a_normal +$output v_view, v_bc, v_normal + +/* + * Copyright 2016 Dario Manesku. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" +#include "uniforms.sh" + +void main() +{ + gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); + + v_view = u_camPos - mul(u_model[0], vec4(a_position, 1.0) ).xyz; + v_bc = a_color1; + + vec3 normal = a_normal.xyz*2.0 - 1.0; + v_normal = mul(u_model[0], vec4(normal, 0.0) ).xyz; +} diff --git a/3rdparty/bgfx/examples/28-wireframe/vs_wf_wireframe.sc b/3rdparty/bgfx/examples/28-wireframe/vs_wf_wireframe.sc new file mode 100644 index 00000000000..1956b0d64ef --- /dev/null +++ b/3rdparty/bgfx/examples/28-wireframe/vs_wf_wireframe.sc @@ -0,0 +1,19 @@ +$input a_position, a_color1 +$output v_view, v_bc + +/* + * Copyright 2016 Dario Manesku. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" +#include "uniforms.sh" + +void main() +{ + gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); + + v_view = u_camPos - mul(u_model[0], vec4(a_position, 1.0) ).xyz; + v_bc = a_color1; +} + diff --git a/3rdparty/bgfx/examples/28-wireframe/wireframe.cpp b/3rdparty/bgfx/examples/28-wireframe/wireframe.cpp new file mode 100644 index 00000000000..df464f51ff9 --- /dev/null +++ b/3rdparty/bgfx/examples/28-wireframe/wireframe.cpp @@ -0,0 +1,566 @@ +/* + * Copyright 2016 Dario Manesku. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "common.h" +#include "bgfx_utils.h" +#include "imgui/imgui.h" + +struct DrawMode +{ + enum + { + WireframeShaded, + Wireframe, + Shaded, + }; +}; + +struct Camera +{ + Camera() + { + reset(); + } + + void reset() + { + m_target.curr[0] = 0.0f; + m_target.curr[1] = 0.0f; + m_target.curr[2] = 0.0f; + m_target.dest[0] = 0.0f; + m_target.dest[1] = 0.0f; + m_target.dest[2] = 0.0f; + + m_pos.curr[0] = 0.0f; + m_pos.curr[1] = 0.0f; + m_pos.curr[2] = -2.0f; + m_pos.dest[0] = 0.0f; + m_pos.dest[1] = 0.0f; + m_pos.dest[2] = -2.0f; + + m_orbit[0] = 0.0f; + m_orbit[1] = 0.0f; + } + + void mtxLookAt(float* _outViewMtx) + { + bx::mtxLookAt(_outViewMtx, m_pos.curr, m_target.curr); + } + + void orbit(float _dx, float _dy) + { + m_orbit[0] += _dx; + m_orbit[1] += _dy; + } + + void dolly(float _dz) + { + const float cnear = 0.01f; + const float cfar = 10.0f; + + const float toTarget[3] = + { + m_target.dest[0] - m_pos.dest[0], + m_target.dest[1] - m_pos.dest[1], + m_target.dest[2] - m_pos.dest[2], + }; + const float toTargetLen = bx::vec3Length(toTarget); + const float invToTargetLen = 1.0f/(toTargetLen+FLT_MIN); + const float toTargetNorm[3] = + { + toTarget[0]*invToTargetLen, + toTarget[1]*invToTargetLen, + toTarget[2]*invToTargetLen, + }; + + float delta = toTargetLen*_dz; + float newLen = toTargetLen + delta; + if ( (cnear < newLen || _dz < 0.0f) + && (newLen < cfar || _dz > 0.0f) ) + { + m_pos.dest[0] += toTargetNorm[0]*delta; + m_pos.dest[1] += toTargetNorm[1]*delta; + m_pos.dest[2] += toTargetNorm[2]*delta; + } + } + + void consumeOrbit(float _amount) + { + float consume[2]; + consume[0] = m_orbit[0]*_amount; + consume[1] = m_orbit[1]*_amount; + m_orbit[0] -= consume[0]; + m_orbit[1] -= consume[1]; + + const float toPos[3] = + { + m_pos.curr[0] - m_target.curr[0], + m_pos.curr[1] - m_target.curr[1], + m_pos.curr[2] - m_target.curr[2], + }; + const float toPosLen = bx::vec3Length(toPos); + const float invToPosLen = 1.0f/(toPosLen+FLT_MIN); + const float toPosNorm[3] = + { + toPos[0]*invToPosLen, + toPos[1]*invToPosLen, + toPos[2]*invToPosLen, + }; + + float ll[2]; + latLongFromVec(ll[0], ll[1], toPosNorm); + ll[0] += consume[0]; + ll[1] -= consume[1]; + ll[1] = bx::fclamp(ll[1], 0.02f, 0.98f); + + float tmp[3]; + vecFromLatLong(tmp, ll[0], ll[1]); + + float diff[3]; + diff[0] = (tmp[0]-toPosNorm[0])*toPosLen; + diff[1] = (tmp[1]-toPosNorm[1])*toPosLen; + diff[2] = (tmp[2]-toPosNorm[2])*toPosLen; + + m_pos.curr[0] += diff[0]; + m_pos.curr[1] += diff[1]; + m_pos.curr[2] += diff[2]; + m_pos.dest[0] += diff[0]; + m_pos.dest[1] += diff[1]; + m_pos.dest[2] += diff[2]; + } + + void update(float _dt) + { + const float amount = bx::fmin(_dt/0.12f, 1.0f); + + consumeOrbit(amount); + + m_target.curr[0] = bx::flerp(m_target.curr[0], m_target.dest[0], amount); + m_target.curr[1] = bx::flerp(m_target.curr[1], m_target.dest[1], amount); + m_target.curr[2] = bx::flerp(m_target.curr[2], m_target.dest[2], amount); + m_pos.curr[0] = bx::flerp(m_pos.curr[0], m_pos.dest[0], amount); + m_pos.curr[1] = bx::flerp(m_pos.curr[1], m_pos.dest[1], amount); + m_pos.curr[2] = bx::flerp(m_pos.curr[2], m_pos.dest[2], amount); + } + + static inline void vecFromLatLong(float _vec[3], float _u, float _v) + { + const float phi = _u * 2.0f*bx::pi; + const float theta = _v * bx::pi; + + const float st = bx::fsin(theta); + const float sp = bx::fsin(phi); + const float ct = bx::fcos(theta); + const float cp = bx::fcos(phi); + + _vec[0] = -st*sp; + _vec[1] = ct; + _vec[2] = -st*cp; + } + + static inline void latLongFromVec(float& _u, float& _v, const float _vec[3]) + { + const float phi = atan2f(_vec[0], _vec[2]); + const float theta = acosf(_vec[1]); + + _u = (bx::pi + phi)*bx::invPi*0.5f; + _v = theta*bx::invPi; + } + + struct Interp3f + { + float curr[3]; + float dest[3]; + }; + + Interp3f m_target; + Interp3f m_pos; + float m_orbit[2]; +}; + +struct Mouse +{ + Mouse() + { + m_dx = 0.0f; + m_dy = 0.0f; + m_prevMx = 0.0f; + m_prevMx = 0.0f; + m_scroll = 0; + m_scrollPrev = 0; + } + + void update(float _mx, float _my, int32_t _mz, uint32_t _width, uint32_t _height) + { + const float widthf = float(int32_t(_width)); + const float heightf = float(int32_t(_height)); + + // Delta movement. + m_dx = float(_mx - m_prevMx)/widthf; + m_dy = float(_my - m_prevMy)/heightf; + + m_prevMx = _mx; + m_prevMy = _my; + + // Scroll. + m_scroll = _mz - m_scrollPrev; + m_scrollPrev = _mz; + } + + float m_dx; // Screen space. + float m_dy; + float m_prevMx; + float m_prevMy; + int32_t m_scroll; + int32_t m_scrollPrev; +}; + +struct MeshMtx +{ + MeshMtx() + { + m_mesh = NULL; + } + + void init(const char* _path + , float _scale = 1.0f + , float _rotX = 0.0f + , float _rotY = 0.0f + , float _rotZ = 0.0f + , float _transX = 0.0f + , float _transY = 0.0f + , float _transZ = 0.0f + ) + { + m_mesh = meshLoad(_path); + bx::mtxSRT(m_mtx + , _scale + , _scale + , _scale + , _rotX + , _rotY + , _rotZ + , _transX + , _transY + , _transZ + ); + } + + void destroy() + { + if (NULL != m_mesh) + { + meshUnload(m_mesh); + } + } + + Mesh* m_mesh; + float m_mtx[16]; +}; + +struct Uniforms +{ + enum { NumVec4 = 3 }; + + void init() + { + m_camPos[0] = 0.0f; + m_camPos[1] = 1.0f; + m_camPos[2] = -2.5f; + m_wfColor[0] = 1.0f; + m_wfColor[1] = 0.0f; + m_wfColor[2] = 0.0f; + m_wfOpacity = 0.7f; + m_drawEdges = 0.0f; + m_wfThickness = 1.5f; + + u_params = bgfx::createUniform("u_params", bgfx::UniformType::Vec4, NumVec4); + } + + void submit() + { + bgfx::setUniform(u_params, m_params, NumVec4); + } + + void destroy() + { + bgfx::destroyUniform(u_params); + } + + union + { + struct + { + /*0*/struct { float m_camPos[3], m_unused0; }; + /*1*/struct { float m_wfColor[3], m_wfOpacity; }; + /*2*/struct { float m_drawEdges, m_wfThickness, m_unused2[2]; }; + }; + + float m_params[NumVec4*4]; + }; + + bgfx::UniformHandle u_params; +}; + +class ExampleWireframe : public entry::AppI +{ + void init(int _argc, char** _argv) BX_OVERRIDE + { + Args args(_argc, _argv); + + m_width = 1280; + m_height = 720; + m_debug = BGFX_DEBUG_TEXT; + m_reset = 0 + | BGFX_RESET_VSYNC + | BGFX_RESET_MSAA_X16 + ; + + bgfx::init(args.m_type, args.m_pciId); + bgfx::reset(m_width, m_height, m_reset); + + // Enable m_debug text. + bgfx::setDebug(m_debug); + + // Set view 0 clear state. + bgfx::setViewClear(0 + , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH + , 0x303030ff + , 1.0f + , 0 + ); + + m_wfProgram = loadProgram("vs_wf_wireframe", "fs_wf_wireframe"); + m_meshProgram = loadProgram("vs_wf_mesh", "fs_wf_mesh"); + + m_uniforms.init(); + + m_meshes[0].init("meshes/bunny.bin", 1.0f, 0.0f, bx::pi, 0.0f, 0.0f, -0.8f, 0.0f); + m_meshes[1].init("meshes/hollowcube.bin", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); + m_meshes[2].init("meshes/orb.bin", 1.2f, 0.0f, 0.0f, 0.0f, 0.0f, -0.65f, 0.0f); + + // Imgui. + imguiCreate(); + + m_oldWidth = 0; + m_oldHeight = 0; + m_oldReset = m_reset; + + m_meshSelection = 1; + m_drawMode = DrawMode::WireframeShaded; + m_scrollArea = 0; + m_showWfColor = true; + } + + virtual int shutdown() BX_OVERRIDE + { + // Cleanup. + imguiDestroy(); + + m_meshes[0].destroy(); + m_meshes[1].destroy(); + m_meshes[2].destroy(); + + bgfx::destroyProgram(m_wfProgram); + bgfx::destroyProgram(m_meshProgram); + + m_uniforms.destroy(); + + // Shutdown bgfx. + bgfx::shutdown(); + + return 0; + } + + bool update() BX_OVERRIDE + { + if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) ) + { + if (m_oldWidth != m_width + || m_oldHeight != m_height + || m_oldReset != m_reset) + { + // Recreate variable size render targets when resolution changes. + m_oldWidth = m_width; + m_oldHeight = m_height; + m_oldReset = m_reset; + } + + imguiBeginFrame(m_mouseState.m_mx + , m_mouseState.m_my + , (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0) + | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) + | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) + , m_mouseState.m_mz + , m_width + , m_height + ); + + imguiBeginScrollArea("Settings" + , m_width - m_width / 5 - 10 + , 10 + , m_width / 5 + , 492 + , &m_scrollArea + ); + + imguiSeparatorLine(1); imguiIndent(8); imguiLabel("Draw mode:"); imguiUnindent(8); imguiSeparatorLine(1); + imguiSeparator(4); + { + imguiIndent(); + m_drawMode = imguiChoose(m_drawMode + , "Wireframe + Shaded" + , "Wireframe" + , "Shaded" + ); + imguiUnindent(); + } + imguiSeparator(8); + + const bool wfEnabled = (DrawMode::Shaded != m_drawMode); + imguiSeparatorLine(1); imguiIndent(8); imguiLabel("Wireframe:", wfEnabled); imguiUnindent(8); imguiSeparatorLine(1); + imguiSeparator(4); + { + imguiColorWheel("Color", m_uniforms.m_wfColor, m_showWfColor, 0.6f, wfEnabled); + imguiIndent(); + imguiSlider("Opacity", m_uniforms.m_wfOpacity, 0.1f, 1.0f, 0.1f, wfEnabled); + imguiSlider("Thickness", m_uniforms.m_wfThickness, 0.6f, 2.2f, 0.1f, wfEnabled); + imguiUnindent(); + } + imguiSeparator(8); + + imguiSeparatorLine(1); imguiIndent(8); imguiLabel("Mesh:"); imguiUnindent(8); imguiSeparatorLine(1); + imguiSeparator(4); + { + imguiIndent(); + const uint32_t prevMeshSel = m_meshSelection; + m_meshSelection = imguiChoose(m_meshSelection + , "Bunny" + , "Hollowcubes" + , "Orb" + ); + if (prevMeshSel != m_meshSelection) + { + m_camera.reset(); + } + imguiUnindent(); + } + imguiSeparator(8); + + imguiEndScrollArea(); + imguiEndFrame(); + + // This dummy draw call is here to make sure that view 0 is cleared + // if no other draw calls are submitted to view 0. + bgfx::touch(0); + + int64_t now = bx::getHPCounter(); + static int64_t last = now; + const int64_t frameTime = now - last; + last = now; + const double freq = double(bx::getHPFrequency() ); + const double toMs = 1000.0/freq; + const float deltaTimeSec = float(double(frameTime)/freq); + + // Use m_debug font to print information about this example. + bgfx::dbgTextClear(); + bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/28-wirefame"); + bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Drawing wireframe mesh."); + bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); + + // Setup view. + bgfx::setViewRect(0, 0, 0, bgfx::BackbufferRatio::Equal); + bgfx::setViewClear(0, BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH, 0x303030ff, 1.0f, 0); + + const bool mouseOverGui = imguiMouseOverArea(); + m_mouse.update(float(m_mouseState.m_mx), float(m_mouseState.m_my), m_mouseState.m_mz, m_width, m_height); + if (!mouseOverGui) + { + if (m_mouseState.m_buttons[entry::MouseButton::Left]) + { + m_camera.orbit(m_mouse.m_dx, m_mouse.m_dy); + } + else if (m_mouseState.m_buttons[entry::MouseButton::Right]) + { + m_camera.dolly(m_mouse.m_dx + m_mouse.m_dy); + } + else if (0 != m_mouse.m_scroll) + { + m_camera.dolly(float(m_mouse.m_scroll)*0.1f); + } + } + + float view[16]; + float proj[16]; + m_camera.update(deltaTimeSec); + memcpy(m_uniforms.m_camPos, m_camera.m_pos.curr, 3*sizeof(float)); + m_camera.mtxLookAt(view); + bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f); + bgfx::setViewTransform(0, view, proj); + + m_uniforms.m_drawEdges = (DrawMode::WireframeShaded == m_drawMode) ? 1.0f : 0.0f; + m_uniforms.submit(); + + if (DrawMode::Wireframe == m_drawMode) + { + uint64_t state = 0 + | BGFX_STATE_RGB_WRITE + | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_CULL_CCW + | BGFX_STATE_MSAA + | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) + ; + meshSubmit(m_meshes[m_meshSelection].m_mesh, 0, m_wfProgram, m_meshes[m_meshSelection].m_mtx, state); + } + else + { + uint64_t state = 0 + | BGFX_STATE_RGB_WRITE + | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_DEPTH_TEST_LESS + | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_CULL_CCW + | BGFX_STATE_MSAA + ; + meshSubmit(m_meshes[m_meshSelection].m_mesh, 0, m_meshProgram, m_meshes[m_meshSelection].m_mtx, state); + } + + // Advance to next frame. Rendering thread will be kicked to + // process submitted rendering primitives. + bgfx::frame(); + + return true; + } + + return false; + } + + entry::MouseState m_mouseState; + + bgfx::ProgramHandle m_wfProgram; + bgfx::ProgramHandle m_meshProgram; + + uint32_t m_width; + uint32_t m_height; + uint32_t m_debug; + uint32_t m_reset; + + uint32_t m_oldWidth; + uint32_t m_oldHeight; + uint32_t m_oldReset; + + Camera m_camera; + Mouse m_mouse; + Uniforms m_uniforms; + MeshMtx m_meshes[3]; + uint32_t m_meshSelection; + uint32_t m_drawMode; // Holds data for 'DrawMode'. + + bool m_showWfColor; + int32_t m_scrollArea; +}; + +ENTRY_IMPLEMENT_MAIN(ExampleWireframe); diff --git a/3rdparty/bgfx/examples/assets/meshes/makefile b/3rdparty/bgfx/examples/assets/meshes/makefile index f8b0ee890af..c171432ebd0 100644 --- a/3rdparty/bgfx/examples/assets/meshes/makefile +++ b/3rdparty/bgfx/examples/assets/meshes/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 # @@ -37,4 +37,4 @@ clean: rebuild: clean all $(RUNTIME_DIR)/meshes/%.bin : %.obj - $(SILENT) $(GEOMETRYC) -f $(<) -o $(@) --packnormal 1
\ No newline at end of file + $(SILENT) $(GEOMETRYC) -f $(<) -o $(@) --packnormal 1 diff --git a/3rdparty/bgfx/examples/common/bgfx_utils.cpp b/3rdparty/bgfx/examples/common/bgfx_utils.cpp index 9b03d3d70b9..8de8bf30964 100644 --- a/3rdparty/bgfx/examples/common/bgfx_utils.cpp +++ b/3rdparty/bgfx/examples/common/bgfx_utils.cpp @@ -389,7 +389,7 @@ struct Group namespace bgfx { - int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl); + int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl, bx::Error* _err = NULL); } struct Mesh @@ -540,17 +540,16 @@ struct Mesh ; } - uint32_t cached = bgfx::setTransform(_mtx); + bgfx::setTransform(_mtx); + bgfx::setState(_state); for (GroupArray::const_iterator it = m_groups.begin(), itEnd = m_groups.end(); it != itEnd; ++it) { const Group& group = *it; - bgfx::setTransform(cached); bgfx::setIndexBuffer(group.m_ibh); bgfx::setVertexBuffer(group.m_vbh); - bgfx::setState(_state); - bgfx::submit(_id, _program); + bgfx::submit(_id, _program, 0, it != itEnd-1); } } @@ -560,26 +559,28 @@ struct Mesh for (uint32_t pass = 0; pass < _numPasses; ++pass) { + bgfx::setTransform(cached, _numMatrices); + const MeshState& state = *_state[pass]; + bgfx::setState(state.m_state); + + for (uint8_t tex = 0; tex < state.m_numTextures; ++tex) + { + const MeshState::Texture& texture = state.m_textures[tex]; + bgfx::setTexture(texture.m_stage + , texture.m_sampler + , texture.m_texture + , texture.m_flags + ); + } for (GroupArray::const_iterator it = m_groups.begin(), itEnd = m_groups.end(); it != itEnd; ++it) { const Group& group = *it; - bgfx::setTransform(cached, _numMatrices); - for (uint8_t tex = 0; tex < state.m_numTextures; ++tex) - { - const MeshState::Texture& texture = state.m_textures[tex]; - bgfx::setTexture(texture.m_stage - , texture.m_sampler - , texture.m_texture - , texture.m_flags - ); - } bgfx::setIndexBuffer(group.m_ibh); bgfx::setVertexBuffer(group.m_vbh); - bgfx::setState(state.m_state); - bgfx::submit(state.m_viewId, state.m_program); + bgfx::submit(state.m_viewId, state.m_program, 0, it != itEnd-1); } } } @@ -646,10 +647,13 @@ Args::Args(int _argc, char** _argv) { m_type = bgfx::RendererType::OpenGL; } - else if (cmdLine.hasArg("noop") - || cmdLine.hasArg("vk") ) + else if (cmdLine.hasArg("vk") ) { - m_type = bgfx::RendererType::OpenGL; + m_type = bgfx::RendererType::Vulkan; + } + else if (cmdLine.hasArg("noop") ) + { + m_type = bgfx::RendererType::Null; } else if (BX_ENABLED(BX_PLATFORM_WINDOWS) ) { diff --git a/3rdparty/bgfx/examples/common/bounds.cpp b/3rdparty/bgfx/examples/common/bounds.cpp index 3937b550567..0b2ae4460c9 100644 --- a/3rdparty/bgfx/examples/common/bounds.cpp +++ b/3rdparty/bgfx/examples/common/bounds.cpp @@ -277,6 +277,36 @@ void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num _sphere.m_radius = bx::fsqrt(maxDistSq); } +void calcPlaneUv(const Plane& _plane, float* _udir, float* _vdir) +{ + const uint8_t axis = + bx::fabsolute(_plane.m_normal[0]) > 0.6f ? 0 + : (bx::fabsolute(_plane.m_normal[1]) > 0.6f ? 1 + : 2 + ); + const uint8_t* index = (uint8_t*)&"\x1\x2\x0\x2\x0\x1"[axis*2]; + const uint8_t idx0 = *(index ); + const uint8_t idx1 = *(index+1); + + _udir[0] = 0.0f; + _udir[1] = 0.0f; + _udir[2] = 0.0f; + _udir[idx0] = 1.0f; + + _vdir[0] = 0.0f; + _vdir[1] = 0.0f; + _vdir[2] = 0.0f; + _vdir[idx1] = 1.0f; + + const float invPlaneAxis = 1.0f / _plane.m_normal[axis]; + + _udir[axis] -= bx::vec3Dot(_udir, _plane.m_normal) * invPlaneAxis; + bx::vec3Norm(_udir, _udir); + + _vdir[axis] -= bx::vec3Dot(_vdir, _plane.m_normal) * invPlaneAxis; + bx::vec3Norm(_vdir, _vdir); +} + void buildFrustumPlanes(Plane* _result, const float* _viewProj) { const float xw = _viewProj[ 3]; diff --git a/3rdparty/bgfx/examples/common/bounds.h b/3rdparty/bgfx/examples/common/bounds.h index 24f23414f10..03cac67ca9a 100644 --- a/3rdparty/bgfx/examples/common/bounds.h +++ b/3rdparty/bgfx/examples/common/bounds.h @@ -94,6 +94,9 @@ void calcMaxBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num /// Calculate minimum bounding sphere. void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _numVertices, uint32_t _stride, float _step = 0.01f); +/// Calculate coplanar U/V vectors. +void calcPlaneUv(const Plane& _plane, float* _udir, float* _vdir); + /// Returns 6 (near, far, left, right, top, bottom) planes representing frustum planes. void buildFrustumPlanes(Plane* _planes, const float* _viewProj); diff --git a/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp b/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp new file mode 100644 index 00000000000..469e814eb87 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp @@ -0,0 +1,1490 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include <bgfx/bgfx.h> +#include "debugdraw.h" + +#include <bx/fpumath.h> +#include <bx/radixsort.h> +#include <bx/uint32_t.h> +#include <bx/crtimpl.h> + +struct DebugVertex +{ + float m_x; + float m_y; + float m_z; + float m_len; + uint32_t m_abgr; + + static void init() + { + ms_decl + .begin() + .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) + .add(bgfx::Attrib::TexCoord0, 1, bgfx::AttribType::Float) + .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) + .end(); + } + + static bgfx::VertexDecl ms_decl; +}; + +bgfx::VertexDecl DebugVertex::ms_decl; + +struct DebugShapeVertex +{ + float m_x; + float m_y; + float m_z; + float m_mask; + + static void init() + { + ms_decl + .begin() + .add(bgfx::Attrib::Position, 4, bgfx::AttribType::Float) + .end(); + } + + static bgfx::VertexDecl ms_decl; +}; + +bgfx::VertexDecl DebugShapeVertex::ms_decl; + +static DebugShapeVertex s_cubeVertices[8] = +{ + {-1.0f, 1.0f, 1.0f, 0.0f }, + { 1.0f, 1.0f, 1.0f, 0.0f }, + {-1.0f, -1.0f, 1.0f, 0.0f }, + { 1.0f, -1.0f, 1.0f, 0.0f }, + {-1.0f, 1.0f, -1.0f, 0.0f }, + { 1.0f, 1.0f, -1.0f, 0.0f }, + {-1.0f, -1.0f, -1.0f, 0.0f }, + { 1.0f, -1.0f, -1.0f, 0.0f }, +}; + +static const uint16_t s_cubeIndices[36] = +{ + 0, 1, 2, // 0 + 1, 3, 2, + 4, 6, 5, // 2 + 5, 6, 7, + 0, 2, 4, // 4 + 4, 2, 6, + 1, 5, 3, // 6 + 5, 7, 3, + 0, 4, 1, // 8 + 4, 5, 1, + 2, 3, 6, // 10 + 6, 3, 7, +}; + +static const uint8_t s_circleLod[] = +{ + 37, + 29, + 23, + 17, + 11, +}; + +static uint8_t getCircleLod(uint8_t _lod) +{ + _lod = _lod > BX_COUNTOF(s_circleLod)-1 ? BX_COUNTOF(s_circleLod)-1 : _lod; + return s_circleLod[_lod]; +} + +static void circle(float* _out, float _angle) +{ + float sa = bx::fsin(_angle); + float ca = bx::fcos(_angle); + _out[0] = sa; + _out[1] = ca; +} + +static void squircle(float* _out, float _angle) +{ + float sa = bx::fsin(_angle); + float ca = bx::fcos(_angle); + _out[0] = bx::fsqrt(bx::fabsolute(sa) ) * bx::fsign(sa); + _out[1] = bx::fsqrt(bx::fabsolute(ca) ) * bx::fsign(ca); +} + +uint32_t genSphere(uint8_t _subdiv0, void* _pos0 = NULL, uint16_t _posStride0 = 0, void* _normals0 = NULL, uint16_t _normalStride0 = 0) +{ + if (NULL != _pos0) + { + struct Gen + { + Gen(void* _pos, uint16_t _posStride, void* _normals, uint16_t _normalStride, uint8_t _subdiv) + : m_pos( (uint8_t*)_pos) + , m_normals( (uint8_t*)_normals) + , m_posStride(_posStride) + , m_normalStride(_normalStride) + { + static const float scale = 1.0f; + static const float golden = 1.6180339887f; + static const float len = bx::fsqrt(golden*golden + 1.0f); + static const float ss = 1.0f/len * scale; + static const float ll = ss*golden; + + static const float vv[12][4] = + { + { -ll, 0.0f, -ss, 0.0f }, + { ll, 0.0f, -ss, 0.0f }, + { ll, 0.0f, ss, 0.0f }, + { -ll, 0.0f, ss, 0.0f }, + + { -ss, ll, 0.0f, 0.0f }, + { ss, ll, 0.0f, 0.0f }, + { ss, -ll, 0.0f, 0.0f }, + { -ss, -ll, 0.0f, 0.0f }, + + { 0.0f, -ss, ll, 0.0f }, + { 0.0f, ss, ll, 0.0f }, + { 0.0f, ss, -ll, 0.0f }, + { 0.0f, -ss, -ll, 0.0f }, + }; + + m_numVertices = 0; + + triangle(vv[ 0], vv[ 4], vv[ 3], scale, _subdiv); + triangle(vv[ 0], vv[10], vv[ 4], scale, _subdiv); + triangle(vv[ 4], vv[10], vv[ 5], scale, _subdiv); + triangle(vv[ 5], vv[10], vv[ 1], scale, _subdiv); + triangle(vv[ 5], vv[ 1], vv[ 2], scale, _subdiv); + triangle(vv[ 5], vv[ 2], vv[ 9], scale, _subdiv); + triangle(vv[ 5], vv[ 9], vv[ 4], scale, _subdiv); + triangle(vv[ 3], vv[ 4], vv[ 9], scale, _subdiv); + + triangle(vv[ 0], vv[ 3], vv[ 7], scale, _subdiv); + triangle(vv[ 0], vv[ 7], vv[11], scale, _subdiv); + triangle(vv[11], vv[ 7], vv[ 6], scale, _subdiv); + triangle(vv[11], vv[ 6], vv[ 1], scale, _subdiv); + triangle(vv[ 1], vv[ 6], vv[ 2], scale, _subdiv); + triangle(vv[ 2], vv[ 6], vv[ 8], scale, _subdiv); + triangle(vv[ 8], vv[ 6], vv[ 7], scale, _subdiv); + triangle(vv[ 8], vv[ 7], vv[ 3], scale, _subdiv); + + triangle(vv[ 0], vv[11], vv[10], scale, _subdiv); + triangle(vv[ 1], vv[10], vv[11], scale, _subdiv); + triangle(vv[ 2], vv[ 8], vv[ 9], scale, _subdiv); + triangle(vv[ 3], vv[ 9], vv[ 8], scale, _subdiv); + } + + void addVert(const float* _v) + { + float* verts = (float*)m_pos; + verts[0] = _v[0]; + verts[1] = _v[1]; + verts[2] = _v[2]; + m_pos += m_posStride; + + if (NULL != m_normals) + { + float* normals = (float*)m_normals; + bx::vec3Norm(normals, _v); + m_normals += m_normalStride; + } + + m_numVertices++; + } + + void triangle(const float* _v0, const float* _v1, const float* _v2, float _scale, uint8_t _subdiv) + { + if (0 == _subdiv) + { + addVert(_v0); + addVert(_v1); + addVert(_v2); + } + else + { + float tmp0[4]; + float tmp1[4]; + + float v01[4]; + bx::vec3Add(tmp0, _v0, _v1); + bx::vec3Norm(tmp1, tmp0); + bx::vec3Mul(v01, tmp1, _scale); + + float v12[4]; + bx::vec3Add(tmp0, _v1, _v2); + bx::vec3Norm(tmp1, tmp0); + bx::vec3Mul(v12, tmp1, _scale); + + float v20[4]; + bx::vec3Add(tmp0, _v2, _v0); + bx::vec3Norm(tmp1, tmp0); + bx::vec3Mul(v20, tmp1, _scale); + + --_subdiv; + triangle(_v0, v01, v20, _scale, _subdiv); + triangle(_v1, v12, v01, _scale, _subdiv); + triangle(_v2, v20, v12, _scale, _subdiv); + triangle(v01, v12, v20, _scale, _subdiv); + } + } + + uint8_t* m_pos; + uint8_t* m_normals; + uint16_t m_posStride; + uint16_t m_normalStride; + uint32_t m_numVertices; + + } gen(_pos0, _posStride0, _normals0, _normalStride0, _subdiv0); + } + + uint32_t numVertices = 20*3*bx::uint32_max(1, (uint32_t)bx::fpow(4.0f, _subdiv0) ); + return numVertices; +} + +void getPoint(float* _result, Axis::Enum _axis, float _x, float _y) +{ + switch (_axis) + { + case Axis::X: + _result[0] = 0.0f; + _result[1] = _x; + _result[2] = _y; + break; + + case Axis::Y: + _result[0] = _y; + _result[1] = 0.0f; + _result[2] = _x; + break; + + default: + _result[0] = _x; + _result[1] = _y; + _result[2] = 0.0f; + break; + } +} + + +#include "vs_debugdraw_lines.bin.h" +#include "fs_debugdraw_lines.bin.h" +#include "vs_debugdraw_lines_stipple.bin.h" +#include "fs_debugdraw_lines_stipple.bin.h" +#include "vs_debugdraw_fill.bin.h" +#include "fs_debugdraw_fill.bin.h" +#include "vs_debugdraw_fill_lit.bin.h" +#include "fs_debugdraw_fill_lit.bin.h" + +struct EmbeddedShader +{ + bgfx::RendererType::Enum type; + const uint8_t* data; + uint32_t size; +}; + +#define BGFX_DECLARE_SHADER_EMBEDDED(_name) \ + { \ + { bgfx::RendererType::Direct3D9, BX_CONCATENATE(_name, _dx9 ), sizeof(BX_CONCATENATE(_name, _dx9 ) ) }, \ + { bgfx::RendererType::Direct3D11, BX_CONCATENATE(_name, _dx11), sizeof(BX_CONCATENATE(_name, _dx11) ) }, \ + { bgfx::RendererType::Direct3D12, BX_CONCATENATE(_name, _dx11), sizeof(BX_CONCATENATE(_name, _dx11) ) }, \ + { bgfx::RendererType::OpenGL, BX_CONCATENATE(_name, _glsl), sizeof(BX_CONCATENATE(_name, _glsl) ) }, \ + { bgfx::RendererType::OpenGLES, BX_CONCATENATE(_name, _glsl), sizeof(BX_CONCATENATE(_name, _glsl) ) }, \ + { bgfx::RendererType::Vulkan, BX_CONCATENATE(_name, _glsl), sizeof(BX_CONCATENATE(_name, _glsl) ) }, \ + { bgfx::RendererType::Metal, BX_CONCATENATE(_name, _mtl ), sizeof(BX_CONCATENATE(_name, _mtl ) ) }, \ + { bgfx::RendererType::Count, NULL, 0 }, \ + } + +static const EmbeddedShader s_embeddedShaders[][8] = +{ + BGFX_DECLARE_SHADER_EMBEDDED(vs_debugdraw_lines), + BGFX_DECLARE_SHADER_EMBEDDED(fs_debugdraw_lines), + BGFX_DECLARE_SHADER_EMBEDDED(vs_debugdraw_lines_stipple), + BGFX_DECLARE_SHADER_EMBEDDED(fs_debugdraw_lines_stipple), + BGFX_DECLARE_SHADER_EMBEDDED(vs_debugdraw_fill), + BGFX_DECLARE_SHADER_EMBEDDED(fs_debugdraw_fill), + BGFX_DECLARE_SHADER_EMBEDDED(vs_debugdraw_fill_lit), + BGFX_DECLARE_SHADER_EMBEDDED(fs_debugdraw_fill_lit), +}; + +static bgfx::ShaderHandle createEmbeddedShader(bgfx::RendererType::Enum _type, uint32_t _index) +{ + for (const EmbeddedShader* es = s_embeddedShaders[_index]; bgfx::RendererType::Count != es->type; ++es) + { + if (_type == es->type) + { + return bgfx::createShader(bgfx::makeRef(es->data, es->size) ); + } + } + + bgfx::ShaderHandle handle = BGFX_INVALID_HANDLE; + return handle; +} + +struct DebugDraw +{ + DebugDraw() + : m_state(State::Count) + { + } + + void init(bx::AllocatorI* _allocator) + { + m_allocator = _allocator; + +#if BX_CONFIG_ALLOCATOR_CRT + if (NULL == _allocator) + { + static bx::CrtAllocator allocator; + m_allocator = &allocator; + } +#endif // BX_CONFIG_ALLOCATOR_CRT + + DebugVertex::init(); + DebugShapeVertex::init(); + + bgfx::RendererType::Enum type = bgfx::getRendererType(); + + m_program[Program::Lines] = + bgfx::createProgram(createEmbeddedShader(type, 0) + , createEmbeddedShader(type, 1) + , true + ); + + m_program[Program::LinesStipple] = + bgfx::createProgram(createEmbeddedShader(type, 2) + , createEmbeddedShader(type, 3) + , true + ); + + m_program[Program::Fill] = + bgfx::createProgram(createEmbeddedShader(type, 4) + , createEmbeddedShader(type, 5) + , true + ); + + m_program[Program::FillLit] = + bgfx::createProgram(createEmbeddedShader(type, 6) + , createEmbeddedShader(type, 7) + , true + ); + + u_params = bgfx::createUniform("u_params", bgfx::UniformType::Vec4, 4); + + void* vertices[Mesh::Count] = {}; + uint16_t* indices[Mesh::Count] = {}; + uint16_t stride = DebugShapeVertex::ms_decl.getStride(); + + uint32_t startVertex = 0; + uint32_t startIndex = 0; + + for (uint32_t mesh = 0; mesh < 4; ++mesh) + { + Mesh::Enum id = Mesh::Enum(Mesh::Sphere0+mesh); + + const uint8_t tess = uint8_t(3-mesh); + const uint32_t numVertices = genSphere(tess); + const uint32_t numIndices = numVertices; + + vertices[id] = BX_ALLOC(m_allocator, numVertices*stride); + genSphere(tess, vertices[id], stride); + + uint16_t* trilist = (uint16_t*)BX_ALLOC(m_allocator, numIndices*sizeof(uint16_t) ); + for (uint32_t ii = 0; ii < numIndices; ++ii) + { + trilist[ii] = uint16_t(ii); + } + + + + + uint32_t numLineListIndices = bgfx::topologyConvert(bgfx::TopologyConvert::TriListToLineList + , NULL + , 0 + , trilist + , numIndices + , false + ); + indices[id] = (uint16_t*)BX_ALLOC(m_allocator, (numIndices + numLineListIndices)*sizeof(uint16_t) ); + uint16_t* indicesOut = indices[id]; + memcpy(indicesOut, trilist, numIndices*sizeof(uint16_t) ); + + bgfx::topologyConvert(bgfx::TopologyConvert::TriListToLineList + , &indicesOut[numIndices] + , numLineListIndices*sizeof(uint16_t) + , trilist + , numIndices + , false + ); + + m_mesh[id].m_startVertex = startVertex; + m_mesh[id].m_numVertices = numVertices; + m_mesh[id].m_startIndex[0] = startIndex; + m_mesh[id].m_numIndices[0] = numIndices; + m_mesh[id].m_startIndex[1] = startIndex+numIndices; + m_mesh[id].m_numIndices[1] = numLineListIndices; + + startVertex += numVertices; + startIndex += numIndices + numLineListIndices; + + BX_FREE(m_allocator, trilist); + } + + m_mesh[Mesh::Cube].m_startVertex = startVertex; + m_mesh[Mesh::Cube].m_numVertices = BX_COUNTOF(s_cubeVertices); + m_mesh[Mesh::Cube].m_startIndex[0] = startIndex; + m_mesh[Mesh::Cube].m_numIndices[0] = BX_COUNTOF(s_cubeIndices); + m_mesh[Mesh::Cube].m_startIndex[1] = 0; + m_mesh[Mesh::Cube].m_numIndices[1] = 0; + startVertex += m_mesh[Mesh::Cube].m_numVertices; + startIndex += m_mesh[Mesh::Cube].m_numIndices[0]; + + const bgfx::Memory* vb = bgfx::alloc(startVertex*stride); + const bgfx::Memory* ib = bgfx::alloc(startIndex*sizeof(uint16_t) ); + + for (uint32_t mesh = 0; mesh < 4; ++mesh) + { + Mesh::Enum id = Mesh::Enum(Mesh::Sphere0+mesh); + memcpy(&vb->data[m_mesh[id].m_startVertex * stride] + , vertices[id] + , m_mesh[id].m_numVertices*stride + ); + + memcpy(&ib->data[m_mesh[id].m_startIndex[0] * sizeof(uint16_t)] + , indices[id] + , (m_mesh[id].m_numIndices[0]+m_mesh[id].m_numIndices[1])*sizeof(uint16_t) + ); + + BX_FREE(m_allocator, vertices[id]); + BX_FREE(m_allocator, indices[id]); + } + + memcpy(&vb->data[m_mesh[Mesh::Cube].m_startVertex * stride] + , s_cubeVertices + , sizeof(s_cubeVertices) + ); + + memcpy(&ib->data[m_mesh[Mesh::Cube].m_startIndex[0] * sizeof(uint16_t)] + , s_cubeIndices + , sizeof(s_cubeIndices) + ); + + m_vbh = bgfx::createVertexBuffer(vb, DebugShapeVertex::ms_decl); + m_ibh = bgfx::createIndexBuffer(ib); + + m_mtx = 0; + m_viewId = 0; + m_pos = 0; + m_indexPos = 0; + m_vertexPos = 0; + } + + void shutdown() + { + bgfx::destroyIndexBuffer(m_ibh); + bgfx::destroyVertexBuffer(m_vbh); + for (uint32_t ii = 0; ii < Program::Count; ++ii) + { + bgfx::destroyProgram(m_program[ii]); + } + bgfx::destroyUniform(u_params); + } + + void begin(uint8_t _viewId) + { + BX_CHECK(State::Count == m_state); + + m_viewId = _viewId; + m_mtx = 0; + m_state = State::None; + m_stack = 0; + + Attrib& attrib = m_attrib[0]; + attrib.m_state = 0 + | BGFX_STATE_RGB_WRITE + | BGFX_STATE_DEPTH_TEST_LESS + | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_CULL_CW + ; + attrib.m_scale = 1.0f; + attrib.m_offset = 0.0f; + attrib.m_abgr = UINT32_MAX; + attrib.m_stipple = false; + attrib.m_wireframe = false; + attrib.m_lod = 0; + } + + void end() + { + BX_CHECK(0 == m_stack, "Invalid stack %d.", m_stack); + + flush(); + + m_state = State::Count; + } + + void push() + { + BX_CHECK(State::Count != m_state); + ++m_stack; + m_attrib[m_stack] = m_attrib[m_stack-1]; + } + + void pop() + { + BX_CHECK(State::Count != m_state); + if (m_attrib[m_stack].m_stipple != m_attrib[m_stack-1].m_stipple) + { + flush(); + } + --m_stack; + } + + void setTransform(const void* _mtx) + { + BX_CHECK(State::Count != m_state); + flush(); + + if (NULL == _mtx) + { + m_mtx = 0; + return; + } + + bgfx::Transform transform; + m_mtx = bgfx::allocTransform(&transform, 1); + memcpy(transform.data, _mtx, 64); + } + + void setTranslate(float _x, float _y, float _z) + { + float mtx[16]; + bx::mtxTranslate(mtx, _x, _y, _z); + setTransform(mtx); + } + + void setTranslate(const float* _pos) + { + setTranslate(_pos[0], _pos[1], _pos[2]); + } + + void setState(bool _depthTest, bool _depthWrite, bool _clockwise) + { + m_attrib[m_stack].m_state &= ~(0 + | BGFX_STATE_DEPTH_TEST_LESS + | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_CULL_CW + | BGFX_STATE_CULL_CCW + ); + + m_attrib[m_stack].m_state |= _depthTest + ? BGFX_STATE_DEPTH_TEST_LESS + : 0 + ; + + m_attrib[m_stack].m_state |= _depthWrite + ? BGFX_STATE_DEPTH_WRITE + : 0 + ; + + m_attrib[m_stack].m_state |= _clockwise + ? BGFX_STATE_CULL_CW + : BGFX_STATE_CULL_CCW + ; + } + + void setColor(uint32_t _abgr) + { + BX_CHECK(State::Count != m_state); + m_attrib[m_stack].m_abgr = _abgr; + } + + void setLod(uint8_t _lod) + { + BX_CHECK(State::Count != m_state); + m_attrib[m_stack].m_lod = _lod; + } + + void setWireframe(bool _wireframe) + { + BX_CHECK(State::Count != m_state); + m_attrib[m_stack].m_wireframe = _wireframe; + } + + void setStipple(bool _stipple, float _scale = 1.0f, float _offset = 0.0f) + { + BX_CHECK(State::Count != m_state); + + Attrib& attrib = m_attrib[m_stack]; + + if (attrib.m_stipple != _stipple) + { + flush(); + } + + attrib.m_stipple = _stipple; + attrib.m_offset = _offset; + attrib.m_scale = _scale; + } + + void moveTo(float _x, float _y, float _z = 0.0f) + { + BX_CHECK(State::Count != m_state); + + softFlush(); + + m_state = State::MoveTo; + + DebugVertex& vertex = m_cache[m_pos]; + vertex.m_x = _x; + vertex.m_y = _y; + vertex.m_z = _z; + + Attrib& attrib = m_attrib[m_stack]; + vertex.m_abgr = attrib.m_abgr; + vertex.m_len = attrib.m_offset; + + m_vertexPos = m_pos; + } + + void moveTo(const void* _pos) + { + BX_CHECK(State::Count != m_state); + + const float* pos = (const float*)_pos; + moveTo(pos[0], pos[1], pos[2]); + } + + void moveTo(Axis::Enum _axis, float _x, float _y) + { + float pos[3]; + getPoint(pos, _axis, _x, _y); + moveTo(pos); + } + + void lineTo(float _x, float _y, float _z = 0.0f) + { + BX_CHECK(State::Count != m_state); + if (State::None == m_state) + { + moveTo(_x, _y, _z); + return; + } + + if (m_pos+2 > uint16_t(BX_COUNTOF(m_cache) ) ) + { + uint32_t pos = m_pos; + uint32_t vertexPos = m_vertexPos; + + flush(); + + memcpy(&m_cache[0], &m_cache[vertexPos], sizeof(DebugVertex) ); + if (vertexPos == pos) + { + m_pos = 1; + } + else + { + memcpy(&m_cache[1], &m_cache[pos - 1], sizeof(DebugVertex) ); + m_pos = 2; + } + + m_state = State::LineTo; + } + else if (State::MoveTo == m_state) + { + ++m_pos; + m_state = State::LineTo; + } + + uint16_t prev = m_pos-1; + uint16_t curr = m_pos++; + DebugVertex& vertex = m_cache[curr]; + vertex.m_x = _x; + vertex.m_y = _y; + vertex.m_z = _z; + + Attrib& attrib = m_attrib[m_stack]; + vertex.m_abgr = attrib.m_abgr; + vertex.m_len = attrib.m_offset; + + float tmp[3]; + bx::vec3Sub(tmp, &vertex.m_x, &m_cache[prev].m_x); + float len = bx::vec3Length(tmp) * attrib.m_scale; + vertex.m_len = m_cache[prev].m_len + len; + + m_indices[m_indexPos++] = prev; + m_indices[m_indexPos++] = curr; + } + + void lineTo(const void* _pos) + { + BX_CHECK(State::Count != m_state); + + const float* pos = (const float*)_pos; + lineTo(pos[0], pos[1], pos[2]); + } + + void lineTo(Axis::Enum _axis, float _x, float _y) + { + float pos[3]; + getPoint(pos, _axis, _x, _y); + lineTo(pos); + } + + void close() + { + BX_CHECK(State::Count != m_state); + DebugVertex& vertex = m_cache[m_vertexPos]; + lineTo(vertex.m_x, vertex.m_y, vertex.m_z); + + m_state = State::None; + } + + void draw(const Aabb& _aabb) + { + moveTo(_aabb.m_min[0], _aabb.m_min[1], _aabb.m_min[2]); + lineTo(_aabb.m_max[0], _aabb.m_min[1], _aabb.m_min[2]); + lineTo(_aabb.m_max[0], _aabb.m_max[1], _aabb.m_min[2]); + lineTo(_aabb.m_min[0], _aabb.m_max[1], _aabb.m_min[2]); + close(); + + moveTo(_aabb.m_min[0], _aabb.m_min[1], _aabb.m_max[2]); + lineTo(_aabb.m_max[0], _aabb.m_min[1], _aabb.m_max[2]); + lineTo(_aabb.m_max[0], _aabb.m_max[1], _aabb.m_max[2]); + lineTo(_aabb.m_min[0], _aabb.m_max[1], _aabb.m_max[2]); + close(); + + moveTo(_aabb.m_min[0], _aabb.m_min[1], _aabb.m_min[2]); + lineTo(_aabb.m_min[0], _aabb.m_min[1], _aabb.m_max[2]); + + moveTo(_aabb.m_max[0], _aabb.m_min[1], _aabb.m_min[2]); + lineTo(_aabb.m_max[0], _aabb.m_min[1], _aabb.m_max[2]); + + moveTo(_aabb.m_min[0], _aabb.m_max[1], _aabb.m_min[2]); + lineTo(_aabb.m_min[0], _aabb.m_max[1], _aabb.m_max[2]); + + moveTo(_aabb.m_max[0], _aabb.m_max[1], _aabb.m_min[2]); + lineTo(_aabb.m_max[0], _aabb.m_max[1], _aabb.m_max[2]); + } + + void draw(const Cylinder& _cylinder, bool _capsule) + { + BX_UNUSED(_cylinder, _capsule); + } + + void draw(const Disk& _disk) + { + BX_UNUSED(_disk); + } + + void draw(const Obb& _obb) + { + const Attrib& attrib = m_attrib[m_stack]; + if (attrib.m_wireframe) + { + setTransform(_obb.m_mtx); + + moveTo(-1.0f, -1.0f, -1.0f); + lineTo( 1.0f, -1.0f, -1.0f); + lineTo( 1.0f, 1.0f, -1.0f); + lineTo(-1.0f, 1.0f, -1.0f); + close(); + + moveTo(-1.0f, 1.0f, 1.0f); + lineTo( 1.0f, 1.0f, 1.0f); + lineTo( 1.0f, -1.0f, 1.0f); + lineTo(-1.0f, -1.0f, 1.0f); + close(); + + moveTo( 1.0f, -1.0f, -1.0f); + lineTo( 1.0f, -1.0f, 1.0f); + + moveTo( 1.0f, 1.0f, -1.0f); + lineTo( 1.0f, 1.0f, 1.0f); + + moveTo(-1.0f, 1.0f, -1.0f); + lineTo(-1.0f, 1.0f, 1.0f); + + moveTo(-1.0f, -1.0f, -1.0f); + lineTo(-1.0f, -1.0f, 1.0f); + + setTransform(NULL); + } + else + { + draw(Mesh::Cube, _obb.m_mtx, false); + } + } + + void draw(const Sphere& _sphere) + { + const Attrib& attrib = m_attrib[m_stack]; + float mtx[16]; + bx::mtxSRT(mtx + , _sphere.m_radius + , _sphere.m_radius + , _sphere.m_radius + , 0.0f + , 0.0f + , 0.0f + , _sphere.m_center[0] + , _sphere.m_center[1] + , _sphere.m_center[2] + ); + uint8_t lod = attrib.m_lod > Mesh::SphereMaxLod + ? uint8_t(Mesh::SphereMaxLod) + : attrib.m_lod + ; + draw(Mesh::Enum(Mesh::Sphere0 + lod), mtx, attrib.m_wireframe); + } + + void drawFrustum(const float* _viewProj) + { + Plane planes[6]; + buildFrustumPlanes(planes, _viewProj); + + float points[24]; + intersectPlanes(&points[ 0], planes[0], planes[2], planes[4]); + intersectPlanes(&points[ 3], planes[0], planes[3], planes[4]); + intersectPlanes(&points[ 6], planes[0], planes[3], planes[5]); + intersectPlanes(&points[ 9], planes[0], planes[2], planes[5]); + intersectPlanes(&points[12], planes[1], planes[2], planes[4]); + intersectPlanes(&points[15], planes[1], planes[3], planes[4]); + intersectPlanes(&points[18], planes[1], planes[3], planes[5]); + intersectPlanes(&points[21], planes[1], planes[2], planes[5]); + + moveTo(&points[ 0]); + lineTo(&points[ 3]); + lineTo(&points[ 6]); + lineTo(&points[ 9]); + close(); + + moveTo(&points[12]); + lineTo(&points[15]); + lineTo(&points[18]); + lineTo(&points[21]); + close(); + + moveTo(&points[ 0]); + lineTo(&points[12]); + + moveTo(&points[ 3]); + lineTo(&points[15]); + + moveTo(&points[ 6]); + lineTo(&points[18]); + + moveTo(&points[ 9]); + lineTo(&points[21]); + } + + void drawFrustum(const void* _viewProj) + { + drawFrustum( (const float*)_viewProj); + } + + void drawArc(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _degrees) + { + const Attrib& attrib = m_attrib[m_stack]; + const uint32_t num = getCircleLod(attrib.m_lod); + const float step = bx::pi * 2.0f / num; + + _degrees = bx::fwrap(_degrees, 360.0f); + + float pos[3]; + getPoint(pos, _axis + , bx::fsin(step * 0)*_radius + , bx::fcos(step * 0)*_radius + ); + + moveTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); + + uint32_t n = uint32_t(num*_degrees/360.0f); + + for (uint32_t ii = 1; ii < n+1; ++ii) + { + getPoint(pos, _axis + , bx::fsin(step * ii)*_radius + , bx::fcos(step * ii)*_radius + ); + lineTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); + } + + moveTo(_x, _y, _z); + getPoint(pos, _axis + , bx::fsin(step * 0)*_radius + , bx::fcos(step * 0)*_radius + ); + lineTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); + + getPoint(pos, _axis + , bx::fsin(step * n)*_radius + , bx::fcos(step * n)*_radius + ); + moveTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); + lineTo(_x, _y, _z); + } + + void drawCircle(const float* _normal, const float* _center, float _radius, float _weight = 0.0f) + { + const Attrib& attrib = m_attrib[m_stack]; + const uint32_t num = getCircleLod(attrib.m_lod); + const float step = bx::pi * 2.0f / num; + _weight = bx::fclamp(_weight, 0.0f, 2.0f); + + Plane plane = { { _normal[0], _normal[1], _normal[2] }, 0.0f }; + float udir[3]; + float vdir[3]; + calcPlaneUv(plane, udir, vdir); + + float pos[3]; + float tmp0[3]; + float tmp1[3]; + + float xy0[2]; + float xy1[2]; + circle(xy0, 0.0f); + squircle(xy1, 0.0f); + + bx::vec3Mul(pos, udir, bx::flerp(xy0[0], xy1[0], _weight)*_radius); + bx::vec3Mul(tmp0, vdir, bx::flerp(xy0[1], xy1[1], _weight)*_radius); + bx::vec3Add(tmp1, pos, tmp0); + bx::vec3Add(pos, tmp1, _center); + moveTo(pos); + + for (uint32_t ii = 1; ii < num; ++ii) + { + float angle = step * ii; + circle(xy0, angle); + squircle(xy1, angle); + + bx::vec3Mul(pos, udir, bx::flerp(xy0[0], xy1[0], _weight)*_radius); + bx::vec3Mul(tmp0, vdir, bx::flerp(xy0[1], xy1[1], _weight)*_radius); + bx::vec3Add(tmp1, pos, tmp0); + bx::vec3Add(pos, tmp1, _center); + lineTo(pos); + } + + close(); + } + + void drawCircle(const void* _normal, const void* _center, float _radius, float _weight = 0.0f) + { + drawCircle( (const float*)_normal, (const float*)_center, _radius, _weight); + } + + void drawCircle(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _weight = 0.0f) + { + const Attrib& attrib = m_attrib[m_stack]; + const uint32_t num = getCircleLod(attrib.m_lod); + const float step = bx::pi * 2.0f / num; + _weight = bx::fclamp(_weight, 0.0f, 2.0f); + + float xy0[2]; + float xy1[2]; + circle(xy0, 0.0f); + squircle(xy1, 0.0f); + + float pos[3]; + getPoint(pos, _axis + , bx::flerp(xy0[0], xy1[0], _weight)*_radius + , bx::flerp(xy0[1], xy1[1], _weight)*_radius + ); + + moveTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); + for (uint32_t ii = 1; ii < num; ++ii) + { + float angle = step * ii; + circle(xy0, angle); + squircle(xy1, angle); + + getPoint(pos, _axis + , bx::flerp(xy0[0], xy1[0], _weight)*_radius + , bx::flerp(xy0[1], xy1[1], _weight)*_radius + ); + lineTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); + } + close(); + } + + void drawAxis(float _x, float _y, float _z, float _len, Axis::Enum _highlight) + { + push(); + + setColor(Axis::X == _highlight ? 0xff00ffff : 0xff0000ff); + moveTo(_x, _y, _z); + lineTo(_x + _len, _y, _z); + + setColor(Axis::Y == _highlight ? 0xff00ffff : 0xff00ff00); + moveTo(_x, _y, _z); + lineTo(_x, _y + _len, _z); + + setColor(Axis::Z == _highlight ? 0xff00ffff : 0xffff0000); + moveTo(_x, _y, _z); + lineTo(_x, _y, _z + _len); + + pop(); + } + + void drawGrid(const float* _normal, const float* _center, uint32_t _size, float _step) + { + float udir[3]; + float vdir[3]; + Plane plane = { { _normal[0], _normal[1], _normal[2] }, 0.0f }; + calcPlaneUv(plane, udir, vdir); + + bx::vec3Mul(udir, udir, _step); + bx::vec3Mul(vdir, vdir, _step); + + const uint32_t num = (_size/2)*2+1; + const float halfExtent = float(_size/2); + + float umin[3]; + bx::vec3Mul(umin, udir, -halfExtent); + + float umax[3]; + bx::vec3Mul(umax, udir, halfExtent); + + float vmin[3]; + bx::vec3Mul(vmin, vdir, -halfExtent); + + float vmax[3]; + bx::vec3Mul(vmax, vdir, halfExtent); + + float tmp[3]; + + float xs[3]; + float xe[3]; + + bx::vec3Add(tmp, umin, vmin); + bx::vec3Add(xs, _center, tmp); + + bx::vec3Add(tmp, umax, vmin); + bx::vec3Add(xe, _center, tmp); + + float ys[3]; + float ye[3]; + + bx::vec3Add(tmp, umin, vmin); + bx::vec3Add(ys, _center, tmp); + + bx::vec3Add(tmp, umin, vmax); + bx::vec3Add(ye, _center, tmp); + + for (uint32_t ii = 0; ii < num; ++ii) + { + moveTo(xs); + lineTo(xe); + bx::vec3Add(xs, xs, vdir); + bx::vec3Add(xe, xe, vdir); + + moveTo(ys); + lineTo(ye); + bx::vec3Add(ys, ys, udir); + bx::vec3Add(ye, ye, udir); + } + } + + void drawGrid(const void* _normal, const void* _center, uint32_t _size, float _step) + { + drawGrid( (const float*)_normal, (const float*)_center, _size, _step); + } + + void drawGrid(Axis::Enum _axis, const float* _center, uint32_t _size, float _step) + { + push(); + setTranslate(_center); + + const uint32_t num = (_size/2)*2-1; + const float halfExtent = float(_size/2) * _step; + + setColor(0xff606060); + float yy = -halfExtent + _step; + for (uint32_t ii = 0; ii < num; ++ii) + { + moveTo(_axis, -halfExtent, yy); + lineTo(_axis, halfExtent, yy); + + moveTo(_axis, yy, -halfExtent); + lineTo(_axis, yy, halfExtent); + + yy += _step; + } + + setColor(0xff101010); + moveTo(_axis, -halfExtent, -halfExtent); + lineTo(_axis, -halfExtent, halfExtent); + lineTo(_axis, halfExtent, halfExtent); + lineTo(_axis, halfExtent, -halfExtent); + close(); + + moveTo(_axis, -halfExtent, 0.0f); + lineTo(_axis, halfExtent, 0.0f); + + moveTo(_axis, 0.0f, -halfExtent); + lineTo(_axis, 0.0f, halfExtent); + + pop(); + } + + void drawGrid(Axis::Enum _axis, const void* _center, uint32_t _size, float _step) + { + drawGrid(_axis, (const float*)_center, _size, _step); + } + + void drawOrb(float _x, float _y, float _z, float _radius, Axis::Enum _hightlight) + { + push(); + + setColor(Axis::X == _hightlight ? 0xff00ffff : 0xff0000ff); + drawCircle(Axis::X, _x, _y, _z, _radius); + + setColor(Axis::Y == _hightlight ? 0xff00ffff : 0xff00ff00); + drawCircle(Axis::Y, _x, _y, _z, _radius); + + setColor(Axis::Z == _hightlight ? 0xff00ffff : 0xffff0000); + drawCircle(Axis::Z, _x, _y, _z, _radius); + + pop(); + } + +private: + struct Mesh + { + enum Enum + { + Sphere0, + Sphere1, + Sphere2, + Sphere3, + Cube, + + Count, + + SphereMaxLod = Sphere3 - Sphere0, + }; + + uint32_t m_startVertex; + uint32_t m_numVertices; + uint32_t m_startIndex[2]; + uint32_t m_numIndices[2]; + }; + + struct Program + { + enum Enum + { + Lines, + LinesStipple, + Fill, + FillLit, + + Count + }; + }; + + void draw(Mesh::Enum _mesh, const float* _mtx, bool _wireframe) const + { + const Mesh& mesh = m_mesh[_mesh]; + + const Attrib& attrib = m_attrib[m_stack]; + + if (0 != mesh.m_numIndices[_wireframe]) + { + bgfx::setIndexBuffer(m_ibh + , mesh.m_startIndex[_wireframe] + , mesh.m_numIndices[_wireframe] + ); + } + + float params[4][4] = + { + { + 0.0f, + -1.0f, + 0.0f, + 3.0f, + }, + { + 1.0f, + 0.9f, + 0.8f, + 0.0f, + }, + { + 0.2f, + 0.22f, + 0.5f, + 0.0f, + }, + { + ( (attrib.m_abgr>>24) )/255.0f, + ( (attrib.m_abgr>>16)&0xff)/255.0f, + ( (attrib.m_abgr>> 8)&0xff)/255.0f, + ( (attrib.m_abgr )&0xff)/255.0f, + }, + }; + + bx::vec3Norm(params[0], params[0]); + + bgfx::setUniform(u_params, params, 4); + + bgfx::setTransform(_mtx); + bgfx::setVertexBuffer(m_vbh, mesh.m_startVertex, mesh.m_numVertices); + bgfx::setState(0 + | attrib.m_state + | (_wireframe ? BGFX_STATE_PT_LINES : 0) + ); + bgfx::submit(m_viewId, m_program[_wireframe ? Program::Fill : Program::FillLit]); + } + + void softFlush() + { + if (m_pos == uint16_t(BX_COUNTOF(m_cache) ) ) + { + flush(); + } + } + + void flush() + { + if (0 != m_pos) + { + if (bgfx::checkAvailTransientBuffers(m_pos, DebugVertex::ms_decl, m_indexPos) ) + { + bgfx::TransientVertexBuffer tvb; + bgfx::allocTransientVertexBuffer(&tvb, m_pos, DebugVertex::ms_decl); + memcpy(tvb.data, m_cache, m_pos * DebugVertex::ms_decl.m_stride); + + bgfx::TransientIndexBuffer tib; + bgfx::allocTransientIndexBuffer(&tib, m_indexPos); + memcpy(tib.data, m_indices, m_indexPos * sizeof(uint16_t) ); + + bgfx::setVertexBuffer(&tvb); + bgfx::setIndexBuffer(&tib); + bgfx::setState(0 + | BGFX_STATE_RGB_WRITE + | BGFX_STATE_PT_LINES + | BGFX_STATE_DEPTH_TEST_LEQUAL + | BGFX_STATE_DEPTH_WRITE +// | BGFX_STATE_BLEND_ALPHA + ); + bgfx::setTransform(m_mtx); + bgfx::ProgramHandle program = m_program[m_attrib[m_stack].m_stipple ? 1 : 0]; + bgfx::submit(m_viewId, program); + } + + m_state = State::None; + m_pos = 0; + m_indexPos = 0; + m_vertexPos = 0; + } + } + + struct State + { + enum Enum + { + None, + MoveTo, + LineTo, + + Count + }; + }; + + static const uint32_t cacheSize = 1024; + static const uint32_t stackSize = 16; + BX_STATIC_ASSERT(cacheSize >= 3, "Cache must be at least 3 elements."); + DebugVertex m_cache[cacheSize+1]; + uint32_t m_mtx; + uint16_t m_indices[cacheSize*2]; + uint16_t m_pos; + uint16_t m_indexPos; + uint16_t m_vertexPos; + uint8_t m_viewId; + uint8_t m_stack; + + struct Attrib + { + uint64_t m_state; + float m_offset; + float m_scale; + uint32_t m_abgr; + bool m_stipple; + bool m_wireframe; + uint8_t m_lod; + }; + + Attrib m_attrib[stackSize]; + + State::Enum m_state; + + Mesh m_mesh[Mesh::Count]; + + bgfx::ProgramHandle m_program[Program::Count]; + bgfx::UniformHandle u_params; + + bgfx::VertexBufferHandle m_vbh; + bgfx::IndexBufferHandle m_ibh; + + bx::AllocatorI* m_allocator; +}; + +static DebugDraw s_dd; + +void ddInit(bx::AllocatorI* _allocator) +{ + s_dd.init(_allocator); +} + +void ddShutdown() +{ + s_dd.shutdown(); +} + +void ddBegin(uint8_t _viewId) +{ + s_dd.begin(_viewId); +} + +void ddEnd() +{ + s_dd.end(); +} + +void ddPush() +{ + s_dd.push(); +} + +void ddPop() +{ + s_dd.pop(); +} + +void ddSetState(bool _depthTest, bool _depthWrite, bool _clockwise) +{ + s_dd.setState(_depthTest, _depthWrite, _clockwise); +} + +void ddSetColor(uint32_t _abgr) +{ + s_dd.setColor(_abgr); +} + +void ddSetLod(uint8_t _lod) +{ + s_dd.setLod(_lod); +} + +void ddSetWireframe(bool _wireframe) +{ + s_dd.setWireframe(_wireframe); +} + +void ddSetStipple(bool _stipple, float _scale, float _offset) +{ + s_dd.setStipple(_stipple, _scale, _offset); +} + +void ddSetTransform(const void* _mtx) +{ + s_dd.setTransform(_mtx); +} + +void ddSetTranslate(float _x, float _y, float _z) +{ + s_dd.setTranslate(_x, _y, _z); +} + +void ddMoveTo(float _x, float _y, float _z) +{ + s_dd.moveTo(_x, _y, _z); +} + +void ddMoveTo(const void* _pos) +{ + s_dd.moveTo(_pos); +} + +void ddLineTo(float _x, float _y, float _z) +{ + s_dd.lineTo(_x, _y, _z); +} + +void ddLineTo(const void* _pos) +{ + s_dd.lineTo(_pos); +} + +void ddClose() +{ + s_dd.close(); +} + +void ddDraw(const Aabb& _aabb) +{ + s_dd.draw(_aabb); +} + +void ddDraw(const Cylinder& _cylinder, bool _capsule) +{ + s_dd.draw(_cylinder, _capsule); +} + +void ddDraw(const Disk& _disk) +{ + s_dd.draw(_disk); +} + +void ddDraw(const Obb& _obb) +{ + s_dd.draw(_obb); +} + +void ddDraw(const Sphere& _sphere) +{ + s_dd.draw(_sphere); +} + +void ddDrawFrustum(const void* _viewProj) +{ + s_dd.drawFrustum(_viewProj); +} + +void ddDrawArc(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _degrees) +{ + s_dd.drawArc(_axis, _x, _y, _z, _radius, _degrees); +} + +void ddDrawCircle(const void* _normal, const void* _center, float _radius, float _weight) +{ + s_dd.drawCircle(_normal, _center, _radius, _weight); +} + +void ddDrawCircle(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _weight) +{ + s_dd.drawCircle(_axis, _x, _y, _z, _radius, _weight); +} + +void ddDrawAxis(float _x, float _y, float _z, float _len, Axis::Enum _hightlight) +{ + s_dd.drawAxis(_x, _y, _z, _len, _hightlight); +} + +void ddDrawGrid(const void* _normal, const void* _center, uint32_t _size, float _step) +{ + s_dd.drawGrid(_normal, _center, _size, _step); +} + +void ddDrawGrid(Axis::Enum _axis, const void* _center, uint32_t _size, float _step) +{ + s_dd.drawGrid(_axis, _center, _size, _step); +} + +void ddDrawOrb(float _x, float _y, float _z, float _radius, Axis::Enum _hightlight) +{ + s_dd.drawOrb(_x, _y, _z, _radius, _hightlight); +} diff --git a/3rdparty/bgfx/examples/common/debugdraw/debugdraw.h b/3rdparty/bgfx/examples/common/debugdraw/debugdraw.h new file mode 100644 index 00000000000..e6c22094537 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/debugdraw.h @@ -0,0 +1,117 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#ifndef DEBUGDRAW_H_HEADER_GUARD +#define DEBUGDRAW_H_HEADER_GUARD + +#include <bx/allocator.h> +#include "../bounds.h" + +struct Axis +{ + enum Enum + { + X, + Y, + Z, + + Count + }; +}; + +/// +void ddInit(bx::AllocatorI* _allocator = NULL); + +/// +void ddShutdown(); + +/// +void ddBegin(uint8_t _viewId); + +/// +void ddEnd(); + +/// +void ddPush(); + +/// +void ddPop(); + +/// +void ddSetState(bool _depthTest, bool _depthWrite, bool _clockwise); + +/// +void ddSetColor(uint32_t _abgr); + +/// +void ddSetLod(uint8_t _lod); + +/// +void ddSetWireframe(bool _wireframe); + +/// +void ddSetStipple(bool _stipple, float _scale = 1.0f, float _offset = 0.0f); + +/// +void ddSetTransform(const void* _mtx); + +/// +void ddSetTranslate(float _x, float _y, float _z); + +/// +void ddMoveTo(float _x, float _y, float _z = 0.0f); + +/// +void ddMoveTo(const void* _pos); + +/// +void ddLineTo(float _x, float _y, float _z = 0.0f); + +/// +void ddLineTo(const void* _pos); + +/// +void ddClose(); + +/// +void ddDraw(const Aabb& _aabb); + +/// +void ddDraw(const Cylinder& _cylinder, bool _capsule = false); + +/// +void ddDraw(const Disk& _disk); + +/// +void ddDraw(const Obb& _obb); + +/// +void ddDraw(const Sphere& _sphere); + +/// +void ddDrawFrustum(const void* _viewProj); + +/// +void ddDrawArc(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _degrees); + +/// +void ddDrawCircle(const void* _normal, const void* _center, float _radius, float _weight = 0.0f); + +/// +void ddDrawCircle(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _weight = 0.0f); + +/// +void ddDrawAxis(float _x, float _y, float _z, float _len = 1.0f, Axis::Enum _highlight = Axis::Count); + +/// +void ddDrawGrid(const void* _normal, const void* _center, uint32_t _size = 20, float _step = 1.0f); + +/// +void ddDrawGrid(Axis::Enum _axis, const void* _center, uint32_t _size = 20, float _step = 1.0f); + +/// +void ddDrawOrb(float _x, float _y, float _z, float _radius, Axis::Enum _highlight = Axis::Count); + +#endif // DEBUGDRAW_H_HEADER_GUARD diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.bin.h b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.bin.h new file mode 100644 index 00000000000..5bdca884235 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.bin.h @@ -0,0 +1,73 @@ +static const uint8_t fs_debugdraw_fill_glsl[104] = +{ + 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par + 0x61, 0x6d, 0x73, 0x02, 0x04, 0x00, 0x00, 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, // ams......J...uni + 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // form vec4 u_para + 0x6d, 0x73, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, // ms[4];.void main + 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, // ().{. gl_FragC + 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5b, // olor = u_params[ + 0x33, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 3];.}... +}; +static const uint8_t fs_debugdraw_fill_dx9[192] = +{ + 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par + 0x61, 0x6d, 0x73, 0x12, 0x04, 0x00, 0x00, 0x04, 0x00, 0xa4, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, // ams............. + 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x00, // .#.CTAB....S.... + 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x4c, // ...............L + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3c, // ...0...........< + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, // .......u_params. + 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // ...ps_3_0.Micros + 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha + 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10. + 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x01, // 0.10011.16384... + 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ................ +}; +static const uint8_t fs_debugdraw_fill_dx11[251] = +{ + 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par + 0x61, 0x6d, 0x73, 0x12, 0x04, 0x00, 0x00, 0x04, 0x00, 0xdc, 0x00, 0x44, 0x58, 0x42, 0x43, 0xda, // ams........DXBC. + 0xfb, 0x8d, 0xd4, 0xad, 0x58, 0xef, 0x92, 0x13, 0x90, 0x07, 0xb7, 0x79, 0x4c, 0x38, 0x95, 0x01, // ....X......yL8.. + 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x60, // ...........,...` + 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, // .......ISGN,.... + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // ....... ........ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, // ...............S + 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x2c, // V_POSITION.OSGN, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, // ........... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, // ................ + 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, // ...SV_TARGET...S + 0x48, 0x44, 0x52, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x59, // HDR@...@.......Y + 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x65, // ...F. .........e + 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0xf2, // .... ......6.... + 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // ......F. ...... + 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, // ...>.....@. +}; +static const uint8_t fs_debugdraw_fill_mtl[410] = +{ + 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x01, 0x00, 0x00, 0x75, 0x73, // FSH...........us + 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me + 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { + 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, // tlShaderOutput { + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . float4 gl_Fra + 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // gColor;.};.struc + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, // t xlatMtlShaderU + 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // niform {. float + 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x7d, // 4 u_params[4];.} + 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // ;.fragment xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, // tlShaderOutput x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, // latMtlMain (xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, // MtlShaderInput _ + 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, // mtl_i [[stage_in + 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, // ]], constant xla + 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, // tMtlShaderUnifor + 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, // m& _mtl_u [[buff + 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, // er(0)]]).{. xla + 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // _mtl_o;. _mtl_ + 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, // o.gl_FragColor = + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // _mtl_u.u_params + 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // [3];. return _m + 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}... +}; diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc new file mode 100644 index 00000000000..3ae18cd6a5c --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc @@ -0,0 +1,19 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include <bgfx_shader.sh> + +uniform vec4 u_params[4]; + +#define u_lightDir u_params[0].xyz +#define u_shininess u_params[0].w +#define u_skyColor u_params[1].xyz +#define u_groundColor u_params[2].xyz +#define u_matColor u_params[3] + +void main() +{ + gl_FragColor = u_matColor; +} diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.bin.h b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.bin.h new file mode 100644 index 00000000000..7bc4cae198b --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.bin.h @@ -0,0 +1,168 @@ +static const uint8_t fs_debugdraw_fill_lit_glsl[510] = +{ + 0x46, 0x53, 0x48, 0x04, 0x0f, 0xc8, 0x56, 0x5f, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH...V_...u_par + 0x61, 0x6d, 0x73, 0x02, 0x04, 0x00, 0x00, 0x04, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x76, 0x61, 0x72, // ams..........var + 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, // ying highp vec3 + 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // v_world;.uniform + 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5b, 0x34, // vec4 u_params[4 + 0x5d, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, // ];.void main (). + 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, // {. highp vec3 t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // mpvar_1;. tmpva + 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x64, 0x46, 0x64, 0x78, 0x28, 0x76, 0x5f, 0x77, 0x6f, 0x72, // r_1 = dFdx(v_wor + 0x6c, 0x64, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // ld);. highp vec + 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // 3 tmpvar_2;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x64, 0x46, 0x64, 0x79, 0x28, 0x76, 0x5f, // pvar_2 = dFdy(v_ + 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, // world);. medium + 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, // p vec4 tmpvar_3; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, // . tmpvar_3.xyz + 0x3d, 0x20, 0x28, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // = (mix (u_params + 0x5b, 0x32, 0x5d, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // [2].xyz, u_param + 0x73, 0x5b, 0x31, 0x5d, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, // s[1].xyz, (. + 0x28, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, // (dot (normalize( + 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // (. (tmpvar_ + 0x31, 0x2e, 0x79, 0x7a, 0x78, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // 1.yzx * tmpvar_2 + 0x2e, 0x7a, 0x78, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x0a, 0x20, 0x20, // .zxy). - . + 0x20, 0x20, 0x20, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x78, // (tmpvar_1.zx + 0x79, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x79, 0x7a, 0x78, // y * tmpvar_2.yzx + 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ). )), u_para + 0x6d, 0x73, 0x5b, 0x30, 0x5d, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, // ms[0].xyz) * 0.5 + 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x75, // ). + 0.5)) * u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5b, 0x33, 0x5d, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, // _params[3].xyz); + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, // . tmpvar_3.w = + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5b, 0x33, 0x5d, 0x2e, 0x77, 0x3b, 0x0a, 0x20, // u_params[3].w;. + 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, // gl_FragColor = + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tmpvar_3;.}... +}; +static const uint8_t fs_debugdraw_fill_lit_dx9[412] = +{ + 0x46, 0x53, 0x48, 0x04, 0x0f, 0xc8, 0x56, 0x5f, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH...V_...u_par + 0x61, 0x6d, 0x73, 0x12, 0x04, 0x00, 0x00, 0x04, 0x00, 0x80, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, // ams............. + 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x00, // .#.CTAB....S.... + 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x4c, // ...............L + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3c, // ...0...........< + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, // .......u_params. + 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // ...ps_3_0.Micros + 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha + 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, // der Compiler 10. + 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x51, // 0.10011.16384..Q + 0x00, 0x00, 0x05, 0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........?..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x00, // ................ + 0x00, 0x07, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xc9, 0x91, 0x5c, // ................ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x5b, 0x00, 0x00, 0x02, 0x01, // ...........[.... + 0x00, 0x07, 0x80, 0x00, 0x00, 0xd2, 0x90, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x00, // ................ + 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x01, // ................ + 0x00, 0xd2, 0x80, 0x00, 0x00, 0xc9, 0x80, 0x02, 0x00, 0xe4, 0x81, 0x24, 0x00, 0x00, 0x02, 0x01, // ...........$.... + 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, // ................ + 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, // ................ + 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0xa0, 0x04, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ + 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0e, 0x80, 0x01, // ................ + 0x00, 0x90, 0x81, 0x01, 0x00, 0x90, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, // ................ + 0x00, 0x00, 0x80, 0x00, 0x00, 0xf9, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, // ................ + 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, // ................ + 0x08, 0x08, 0x80, 0x03, 0x00, 0xff, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ............ +}; +static const uint8_t fs_debugdraw_fill_lit_dx11[719] = +{ + 0x46, 0x53, 0x48, 0x04, 0x0f, 0xc8, 0x56, 0x5f, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH...V_...u_par + 0x61, 0x6d, 0x73, 0x12, 0x04, 0x00, 0x00, 0x04, 0x00, 0xb0, 0x02, 0x44, 0x58, 0x42, 0x43, 0x59, // ams........DXBCY + 0x1c, 0xf9, 0xc6, 0x41, 0xb7, 0xae, 0xfd, 0xa5, 0xa5, 0x0c, 0x28, 0x25, 0x0d, 0x24, 0x29, 0x01, // ...A......(%.$). + 0x00, 0x00, 0x00, 0xb0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, // ...........,.... + 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, // .......ISGNh.... + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // .......P........ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, // ................ + 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x53, // ...............S + 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, // V_POSITION.TEXCO + 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, // ORD....OSGN,.... + 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....... ........ + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, // ...............S + 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xd8, // V_TARGET...SHDR. + 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, // ...@...v...Y...F + 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x72, // . .........b...r + 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, // .......e.... ... + 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0x72, // ...h.......6...r + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x14, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x02, // ...........A.... + 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x05, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, // .......r.......F + 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x05, 0x72, 0x00, 0x10, 0x00, 0x01, // ...........r.... + 0x00, 0x00, 0x00, 0x26, 0x19, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, // ...&.......8...r + 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, // .......F.......F + 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, // .......2...r.... + 0x00, 0x00, 0x00, 0x26, 0x09, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x96, 0x04, 0x10, 0x00, 0x00, // ...&............ + 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, // ...F...A........ + 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, // ...........F.... + 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x05, 0x82, // ...F.......D.... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, // .......:.......8 + 0x00, 0x00, 0x07, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, // ...r............ + 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x12, // ...F............ + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, // .......F.......F + 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x09, 0x12, // . .........2.... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // ................ + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, // @.....?.@.....?. + 0x00, 0x00, 0x0a, 0xe2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x89, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x89, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, // ......... .A.... + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, // .......2...r.... + 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x07, 0x10, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x38, // ...F. .........8 + 0x00, 0x00, 0x08, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, // ...r ......F.... + 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, // ...F. .........6 + 0x00, 0x00, 0x06, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, // .... ......:. .. + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, // .......>.....@. +}; +static const uint8_t fs_debugdraw_fill_lit_mtl[835] = +{ + 0x46, 0x53, 0x48, 0x04, 0x0f, 0xc8, 0x56, 0x5f, 0x00, 0x00, 0x34, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH...V_..4...us + 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me + 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, // . float3 v_worl + 0x64, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, // d;.};.struct xla + 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput + 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, // {. float4 gl_F + 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, // ragColor;.};.str + 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // uct xlatMtlShade + 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // rUniform {. flo + 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5b, 0x34, 0x5d, 0x3b, // at4 u_params[4]; + 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, // .};.fragment xla + 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput + 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, // xlatMtlMain (xl + 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, // atMtlShaderInput + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, // _mtl_i [[stage_ + 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, // in]], constant x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif + 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, // orm& _mtl_u [[bu + 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, // ffer(0)]]).{. x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, // latMtlShaderOutp + 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // ut _mtl_o;. flo + 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, // at3 tmpvar_1;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x64, 0x66, 0x64, 0x78, 0x28, // tmpvar_1 = dfdx( + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x29, 0x3b, // _mtl_i.v_world); + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // . float3 tmpvar + 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, // _2;. tmpvar_2 = + 0x20, 0x64, 0x66, 0x64, 0x79, 0x28, 0x2d, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, // dfdy(-_mtl_i.v_ + 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // world);. float4 + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_3;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x69, 0x78, // var_3.xyz = (mix + 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // (_mtl_u.u_param + 0x73, 0x5b, 0x32, 0x5d, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // s[2].xyz, _mtl_u + 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5b, 0x31, 0x5d, 0x2e, 0x78, 0x79, 0x7a, // .u_params[1].xyz + 0x2c, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x6e, 0x6f, // , (. (dot (no + 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // rmalize((. + 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x7a, 0x78, 0x20, 0x2a, 0x20, // (tmpvar_1.yzx * + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x7a, 0x78, 0x79, 0x29, 0x0a, 0x20, 0x20, // tmpvar_2.zxy). + 0x20, 0x20, 0x20, 0x2d, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x74, 0x6d, 0x70, // - . (tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, // var_1.zxy * tmpv + 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x79, 0x7a, 0x78, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x29, 0x29, // ar_2.yzx). )) + 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // , _mtl_u.u_param + 0x73, 0x5b, 0x30, 0x5d, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, // s[0].xyz) * 0.5) + 0x0a, 0x20, 0x20, 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, // . + 0.5)) * _m + 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5b, 0x33, 0x5d, // tl_u.u_params[3] + 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // .xyz);. tmpvar_ + 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, // 3.w = _mtl_u.u_p + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5b, 0x33, 0x5d, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, // arams[3].w;. _m + 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, // tl_o.gl_FragColo + 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, // r = tmpvar_3;. + 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, // return _mtl_o;.} + 0x0a, 0x0a, 0x00, // ... +}; diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc new file mode 100644 index 00000000000..3e0638701e7 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc @@ -0,0 +1,35 @@ +$input v_view, v_world + +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include <bgfx_shader.sh> + +uniform vec4 u_params[4]; + +#define u_lightDir u_params[0].xyz +#define u_shininess u_params[0].w +#define u_skyColor u_params[1].xyz +#define u_groundColor u_params[2].xyz +#define u_matColor u_params[3] + +void main() +{ + vec3 normal = normalize(cross(dFdx(v_world), dFdy(v_world) ) ); + vec3 viewDir = -normalize(v_view); + + float ndotl = dot(normal, u_lightDir); + vec3 diffuse = mix(u_groundColor, u_skyColor, ndotl*0.5 + 0.5) * u_matColor.xyz; + +#if 0 + vec3 reflected = 2.0*ndotl*normal - u_lightDir; + float rdotv = dot(reflected, viewDir); + float spec = step(0.0, ndotl) * pow(max(0.0, rdotv), u_shininess); +#else + float spec = 0.0; +#endif + + gl_FragColor = vec4(diffuse + vec3_splat(spec), u_matColor.w); +} diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.bin.h b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.bin.h new file mode 100644 index 00000000000..747bb107908 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.bin.h @@ -0,0 +1,70 @@ +static const uint8_t fs_debugdraw_lines_glsl[89] = +{ + 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x76, 0x61, // FSH....I..J...va + 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // rying highp vec4 + 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, // v_color0;.void + 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, // main ().{. gl_F + 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ragColor = v_col + 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}... +}; +static const uint8_t fs_debugdraw_lines_dx9[141] = +{ + 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I........ + 0xfe, 0xff, 0x17, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... + 0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................ + 0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro + 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh + 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, // ader Compiler 10 + 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, // .0.10011.16384.. + 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, // ................ + 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............. +}; +static const uint8_t fs_debugdraw_lines_dx11[260] = +{ + 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0xf4, 0x00, 0x44, 0x58, 0x42, 0x43, // FSH....I....DXBC + 0xa6, 0x7f, 0x08, 0xe2, 0x95, 0xbd, 0x5f, 0xa3, 0x3f, 0x5b, 0x58, 0x8e, 0x54, 0x0f, 0x89, 0x67, // ......_.?[X.T..g + 0x01, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, // ............,... + 0x80, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, // ........ISGNL... + 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........8....... + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................ + 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // D............... + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, // ........SV_POSIT + 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, // ION.COLOR...OSGN + 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ,........... ... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, // ....SV_TARGET... + 0x53, 0x48, 0x44, 0x52, 0x38, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, // SHDR8...@....... + 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, // b...........e... + 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, // . ......6.... .. + 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, // ....F.......>... + 0x00, 0x00, 0x00, 0x00, // .... +}; +static const uint8_t fs_debugdraw_lines_mtl[404] = +{ + 0x46, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x85, 0x01, 0x00, 0x00, 0x75, 0x73, // FSH....I......us + 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me + 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // . float4 v_colo + 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, // r0;.};.struct xl + 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, // atMtlShaderOutpu + 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, // t {. float4 gl_ + 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, // FragColor;.};.st + 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ruct xlatMtlShad + 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, // erUniform {.};.f + 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // ragment xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // haderOutput xlat + 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // MtlMain (xlatMtl + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // ShaderInput _mtl + 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, // _i [[stage_in]], + 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // constant xlatMt + 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, // lShaderUniform& + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, // _mtl_u [[buffer( + 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // 0)]]).{. xlatMt + 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, // lShaderOutput _m + 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, // tl_o;. _mtl_o.g + 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // l_FragColor = _m + 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, // tl_i.v_color0;. + 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // return _mtl_o;. + 0x7d, 0x0a, 0x0a, 0x00, // }... +}; diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc new file mode 100644 index 00000000000..9ba669f81a2 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc @@ -0,0 +1,13 @@ +$input v_color0 + +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include <bgfx_shader.sh> + +void main() +{ + gl_FragColor = v_color0; +} diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.bin.h b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.bin.h new file mode 100644 index 00000000000..76ea1657b15 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.bin.h @@ -0,0 +1,110 @@ +static const uint8_t fs_debugdraw_lines_stipple_glsl[235] = +{ + 0x46, 0x53, 0x48, 0x04, 0xe7, 0x1a, 0x5a, 0xef, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x76, 0x61, // FSH...Z.......va + 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // rying highp vec4 + 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, // v_color0;.varyi + 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x76, // ng highp float v + 0x5f, 0x73, 0x74, 0x69, 0x70, 0x70, 0x6c, 0x65, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, // _stipple;.void m + 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // ain ().{. highp + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, // float tmpvar_1; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x66, // . tmpvar_1 = (f + 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x6d, 0x6f, 0x64, 0x20, 0x28, 0x76, 0x5f, 0x73, 0x74, 0x69, 0x70, // loat(mod (v_stip + 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x30, 0x2e, 0x32, 0x35, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // ple, 0.25)));. + 0x69, 0x66, 0x20, 0x28, 0x28, 0x30, 0x2e, 0x31, 0x32, 0x35, 0x20, 0x3c, 0x20, 0x74, 0x6d, 0x70, // if ((0.125 < tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x69, // var_1)) {. di + 0x73, 0x63, 0x61, 0x72, 0x64, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // scard;. };. gl + 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, // _FragColor = v_c + 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // olor0;.}... +}; +static const uint8_t fs_debugdraw_lines_stipple_dx9[309] = +{ + 0x46, 0x53, 0x48, 0x04, 0xe7, 0x1a, 0x5a, 0xef, 0x00, 0x00, 0x28, 0x01, 0x00, 0x03, 0xff, 0xff, // FSH...Z...(..... + 0xfe, 0xff, 0x17, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... + 0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................ + 0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro + 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh + 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, // ader Compiler 10 + 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, // .0.10011.16384.. + 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x3e, // Q..........@...> + 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, // ...>....Q....... + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................ + 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x01, 0x90, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, // ................ + 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, // ................ + 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x55, 0x81, // ..............U. + 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, // ................ + 0x00, 0x00, 0x55, 0xa1, 0x01, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, // ..U............. + 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0xaa, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, // ........X....... + 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x55, 0xa0, 0x41, 0x00, 0x00, 0x01, // ..........U.A... + 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, // ................ + 0xff, 0xff, 0x00, 0x00, 0x00, // ..... +}; +static const uint8_t fs_debugdraw_lines_stipple_dx11[440] = +{ + 0x46, 0x53, 0x48, 0x04, 0xe7, 0x1a, 0x5a, 0xef, 0x00, 0x00, 0xa8, 0x01, 0x44, 0x58, 0x42, 0x43, // FSH...Z.....DXBC + 0x6f, 0x8f, 0x64, 0x39, 0xd9, 0xef, 0xc7, 0x09, 0x59, 0xdc, 0x77, 0x5a, 0xe8, 0x91, 0x4c, 0x16, // o.d9....Y.wZ..L. + 0x01, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, // ............,... + 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, // ........ISGNl... + 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........P....... + 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................ + 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........b....... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, // ................ + 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, // SV_POSITION.COLO + 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, // R.TEXCOORD..OSGN + 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ,........... ... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, // ....SV_TARGET... + 0x53, 0x48, 0x44, 0x52, 0xcc, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, // SHDR....@...3... + 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, // b...........b... + 0x12, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, // ........e.... .. + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, // ....h.......8... + 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x41, 0x00, 0x00, 0x05, 0x12, 0x00, 0x10, 0x00, // .@.....@A....... + 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, // ............2... + 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, // ............A... + 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3e, 0x0a, 0x10, 0x10, 0x00, // .....@.....>.... + 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....1........... + 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // .@.....>........ + 0x0d, 0x00, 0x04, 0x03, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, // ............6... + 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // . ......F....... + 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, // >....... +}; +static const uint8_t fs_debugdraw_lines_stipple_mtl[551] = +{ + 0x46, 0x53, 0x48, 0x04, 0xe7, 0x1a, 0x5a, 0xef, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x75, 0x73, // FSH...Z.......us + 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me + 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // . float4 v_colo + 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x76, 0x5f, 0x73, 0x74, // r0;. float v_st + 0x69, 0x70, 0x70, 0x6c, 0x65, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, // ipple;.};.struct + 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, // xlatMtlShaderOu + 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // tput {. float4 + 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, // gl_FragColor;.}; + 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // .struct xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x7d, // haderUniform {.} + 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // ;.fragment xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, // tlShaderOutput x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, // latMtlMain (xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, // MtlShaderInput _ + 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, // mtl_i [[stage_in + 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, // ]], constant xla + 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, // tMtlShaderUnifor + 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, // m& _mtl_u [[buff + 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, // er(0)]]).{. xla + 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // _mtl_o;. float + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_1;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x28, 0x66, // var_1 = (float(f + 0x6d, 0x6f, 0x64, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x73, 0x74, // mod (_mtl_i.v_st + 0x69, 0x70, 0x70, 0x6c, 0x65, 0x2c, 0x20, 0x30, 0x2e, 0x32, 0x35, 0x29, 0x29, 0x29, 0x3b, 0x0a, // ipple, 0.25)));. + 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x30, 0x2e, 0x31, 0x32, 0x35, 0x20, 0x3c, 0x20, 0x74, // if ((0.125 < t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // mpvar_1)) {. + 0x64, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, // discard_fragment + 0x28, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // ();. };. _mtl_ + 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, // o.gl_FragColor = + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // _mtl_i.v_color0 + 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // ;. return _mtl_ + 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // o;.}... +}; diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc new file mode 100644 index 00000000000..bfc5b642508 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc @@ -0,0 +1,18 @@ +$input v_color0, v_stipple + +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include <bgfx_shader.sh> + +void main() +{ + if (0.125 < mod(v_stipple, 0.25) ) + { + discard; + } + + gl_FragColor = v_color0; +} diff --git a/3rdparty/bgfx/examples/common/debugdraw/makefile b/3rdparty/bgfx/examples/common/debugdraw/makefile new file mode 100644 index 00000000000..ab2bae2d539 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/makefile @@ -0,0 +1,9 @@ +# +# Copyright 2011-2016 Branimir Karadzic. All rights reserved. +# License: http://www.opensource.org/licenses/BSD-2-Clause +# + +include ../../../../bgfx/scripts/shader-embeded.mk + +rebuild: + @make -s --no-print-directory clean all diff --git a/3rdparty/bgfx/examples/common/debugdraw/varying.def.sc b/3rdparty/bgfx/examples/common/debugdraw/varying.def.sc new file mode 100644 index 00000000000..79ed7aebf68 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/varying.def.sc @@ -0,0 +1,8 @@ +vec3 a_position : POSITION; +vec4 a_color0 : COLOR0; +float a_texcoord0 : TEXCOORD0; + +vec4 v_color0 : COLOR = vec4(1.0, 0.0, 0.0, 1.0); +float v_stipple : TEXCOORD0 = 0.0; +vec3 v_view : TEXCOORD0 = vec3(0.0, 0.0, 0.0); +vec3 v_world : TEXCOORD1 = vec3(0.0, 0.0, 0.0); diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.bin.h b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.bin.h new file mode 100644 index 00000000000..16fd98a58ef --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.bin.h @@ -0,0 +1,107 @@ +static const uint8_t vs_debugdraw_fill_glsl[242] = +{ + 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... + 0xcd, 0x00, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // ....attribute hi + 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // ghp vec3 a_posit + 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, // ion;.uniform hig + 0x68, 0x70, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // hp mat4 u_modelV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, // iewProj;.void ma + 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // in ().{. highp + 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, // vec4 tmpvar_1;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, // tmpvar_1.w = 1. + 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, // 0;. tmpvar_1.xy + 0x7a, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, // z = a_position;. + 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, // gl_Position = + 0x28, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // (u_modelViewProj + 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, // * tmpvar_1);.}. + 0x0a, 0x00, // .. +}; +static const uint8_t vs_debugdraw_fill_dx9[287] = +{ + 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0xfc, 0x00, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........$.CTAB.. + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W............. + 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x03, 0x00, // modelViewProj... + 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs + 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft ( + 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100 + 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // 11.16384........ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, // ................ + 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x00, 0x00, // ................ + 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, // U............... + 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, // ................ + 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... +}; +static const uint8_t vs_debugdraw_fill_dx11[404] = +{ + 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0x6c, 0x01, 0x44, 0x58, 0x42, 0x43, 0x87, 0x3c, 0x16, 0xa4, 0x8d, 0x3d, 0x5b, 0xea, 0x61, 0x5c, // l.DXBC.<...=[.a. + 0x10, 0x3b, 0xa1, 0xf8, 0xf8, 0xa1, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x01, 0x00, 0x00, 0x03, 0x00, // .;........l..... + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...`.......IS + 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0xab, // ......POSITION.. + 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, // ..OSGN,......... + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, // .. ............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, // ..........SV_POS + 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x53, 0x48, 0x44, 0x52, 0xd0, 0x00, 0x00, 0x00, 0x40, 0x00, // ITION.SHDR....@. + 0x01, 0x00, 0x34, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..4...Y...F. ... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x00, 0x00, // ......_...r..... + 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..g.... ........ + 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, // ..h.......8..... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, // ......V.......F. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, // .........2..... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......F. ....... + 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, // ..........F..... + 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, // ..2...........F. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, 0x00, 0x00, // ............... + 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, // ..F............ + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, // ......F.......F. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x01, // .........>..... + 0x01, 0x00, 0x40, 0x00, // ..@. +}; +static const uint8_t vs_debugdraw_fill_mtl[555] = +{ + 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH...........us + 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me + 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, // . float3 a_posi + 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, // tion [[attribute + 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, // (0)]];.};.struct + 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, // xlatMtlShaderOu + 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // tput {. float4 + 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, 0x6f, // gl_Position [[po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, // sition]];.};.str + 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // uct xlatMtlShade + 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // rUniform {. flo + 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // at4x4 u_modelVie + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, // wProj;.};.vertex + 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, // xlatMtlShaderOu + 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, // tput xlatMtlMain + 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, // (xlatMtlShaderI + 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, // nput _mtl_i [[st + 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, // age_in]], consta + 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // nt xlatMtlShader + 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, // Uniform& _mtl_u + 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, // [[buffer(0)]]).{ + 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // . xlatMtlShader + 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, // Output _mtl_o;. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // float4 tmpvar_1 + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, // ;. tmpvar_1.w = + 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // 1.0;. tmpvar_1 + 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, // .xyz = _mtl_i.a_ + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // position;. _mtl + 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, // _o.gl_Position = + 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // (_mtl_u.u_model + 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ViewProj * tmpva + 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, // r_1);. return _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mtl_o;.}... +}; diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc new file mode 100644 index 00000000000..d007e9367cd --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc @@ -0,0 +1,13 @@ +$input a_position + +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include <bgfx_shader.sh> + +void main() +{ + gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); +} diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.bin.h b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.bin.h new file mode 100644 index 00000000000..2df5e3fbe89 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.bin.h @@ -0,0 +1,195 @@ +static const uint8_t vs_debugdraw_fill_lit_glsl[613] = +{ + 0x56, 0x53, 0x48, 0x04, 0x0f, 0xc8, 0x56, 0x5f, 0x03, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH...V_...u_mod + 0x65, 0x6c, 0x04, 0x20, 0x00, 0x00, 0x20, 0x00, 0x0b, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // el. .. ..u_model + 0x56, 0x69, 0x65, 0x77, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // View.......u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... + 0x20, 0x02, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // ...attribute hi + 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // ghp vec3 a_posit + 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, // ion;.varying hig + 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x3b, 0x0a, // hp vec3 v_view;. + 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, // varying highp ve + 0x63, 0x33, 0x20, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, // c3 v_world;.unif + 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // orm mat4 u_model + 0x5b, 0x33, 0x32, 0x5d, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, // [32];.uniform hi + 0x67, 0x68, 0x70, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // ghp mat4 u_model + 0x56, 0x69, 0x65, 0x77, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, // View;.uniform hi + 0x67, 0x68, 0x70, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // ghp mat4 u_model + 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, // ViewProj;.void m + 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // ain ().{. highp + 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, // vec4 tmpvar_1;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, // tmpvar_1.w = 1 + 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, // .0;. tmpvar_1.x + 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, // yz = a_position; + 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, // . gl_Position = + 0x20, 0x28, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // (u_modelViewPro + 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, // j * tmpvar_1);. + 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // highp vec4 tmpv + 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // ar_2;. tmpvar_2 + 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // .w = 1.0;. tmpv + 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, // ar_2.xyz = a_pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x20, // ition;. v_view + 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x20, 0x2a, // = (u_modelView * + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, // tmpvar_2).xyz;. + 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, // highp vec4 tmp + 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_3;. tmpvar_ + 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // 3.w = 1.0;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x70, 0x6f, // var_3.xyz = a_po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, // sition;. v_worl + 0x64, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5b, 0x30, 0x5d, 0x20, // d = (u_model[0] + 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, // * tmpvar_3).xyz; + 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... +}; +static const uint8_t vs_debugdraw_fill_lit_dx9[563] = +{ + 0x56, 0x53, 0x48, 0x04, 0x0f, 0xc8, 0x56, 0x5f, 0x03, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH...V_...u_mod + 0x65, 0x6c, 0x04, 0x20, 0x00, 0x00, 0x04, 0x00, 0x0b, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // el. .....u_model + 0x56, 0x69, 0x65, 0x77, 0x04, 0x01, 0x04, 0x00, 0x04, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // View.......u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x08, 0x00, 0x04, 0x00, // elViewProj...... + 0xf0, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x37, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........7.CTAB.. + 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, // ................ + 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, // ..........X..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, // ......`.......p. + 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........|..... + 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7c, 0x00, // ..............|. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x03, 0x00, // ......u_model... + 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ...... .......u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, // modelView....... + 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..........u_mode + 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, // lViewProj.vs_3_0 + 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, // .Microsoft (R) H + 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, // LSL Shader Compi + 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, // ler 10.0.10011.1 + 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, // 6384............ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x07, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ + 0x01, 0x80, 0x02, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x09, 0x00, // ................ + 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x08, 0x00, // ....U........... + 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x0f, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x0b, 0x00, 0xe4, 0xa0, 0x05, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x05, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, // ............U... + 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x04, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x00, 0x00, // ................ + 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0xe0, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x07, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, // ................ + 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, // ....U........... + 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x07, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................ + 0x00, 0x03, 0x02, 0x00, 0x07, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, // ................ + 0x00, 0x00, 0x00, // ... +}; +static const uint8_t vs_debugdraw_fill_lit_dx11[808] = +{ + 0x56, 0x53, 0x48, 0x04, 0x0f, 0xc8, 0x56, 0x5f, 0x03, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH...V_...u_mod + 0x65, 0x6c, 0x04, 0x20, 0x00, 0x00, 0x80, 0x00, 0x0b, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // el. .....u_model + 0x56, 0x69, 0x65, 0x77, 0x04, 0x00, 0x00, 0x08, 0x04, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // View.......u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x00, 0x40, 0x08, 0x04, 0x00, // elViewProj..@... + 0xe0, 0x02, 0x44, 0x58, 0x42, 0x43, 0xda, 0xb8, 0xef, 0x0e, 0x34, 0xc8, 0x8c, 0x2c, 0x06, 0xbc, // ..DXBC....4..,.. + 0x07, 0x0b, 0x43, 0x58, 0xee, 0x33, 0x01, 0x00, 0x00, 0x00, 0xe0, 0x02, 0x00, 0x00, 0x03, 0x00, // ..CX.3.......... + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...`.......IS + 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0xab, // ......POSITION.. + 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, // ..OSGNh......... + 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, // ..P............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x08, // ................ + 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, // ..........SV_POS + 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, // ITION.TEXCOORD.. + 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x08, 0x02, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x82, 0x00, // ..SHDR....@..... + 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, // ..Y...F. ....... + 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x00, // .._...r.......g. + 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, // ... ..........e. + 0x00, 0x03, 0x72, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x72, 0x20, // ..r ......e...r + 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, // ......h.......8. + 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00, // ..........V..... + 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x32, 0x00, // ..F. .........2. + 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..........F. ... + 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..............F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2......... + 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0xa6, 0x1a, // ..F. ........... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......F......... + 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, // ... ......F..... + 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x38, 0x00, // ..F. .........8. + 0x00, 0x08, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00, // ..r.......V..... + 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x32, 0x00, // ..F. .........2. + 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, // ..r.......F. ... + 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..............F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2...r..... + 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0xa6, 0x1a, // ..F. ........... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......F......... + 0x00, 0x08, 0x72, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, // ..r ......F..... + 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x38, 0x00, // ..F. .........8. + 0x00, 0x08, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00, // ..r.......V..... + 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, // ..F. .........2. + 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, // ..r.......F. ... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..............F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2...r..... + 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa6, 0x1a, // ..F. ........... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......F......... + 0x00, 0x08, 0x72, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, // ..r ......F..... + 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..F. .........>. + 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x80, 0x08, // ........ +}; +static const uint8_t vs_debugdraw_fill_lit_mtl[898] = +{ + 0x56, 0x53, 0x48, 0x04, 0x0f, 0xc8, 0x56, 0x5f, 0x00, 0x00, 0x73, 0x03, 0x00, 0x00, 0x75, 0x73, // VSH...V_..s...us + 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me + 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, // . float3 a_posi + 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, // tion [[attribute + 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, // (0)]];.};.struct + 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, // xlatMtlShaderOu + 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // tput {. float4 + 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, 0x6f, // gl_Position [[po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // sition]];. floa + 0x74, 0x33, 0x20, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // t3 v_view;. flo + 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, // at3 v_world;.};. + 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // struct xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, // aderUniform {. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // float4x4 u_model + 0x5b, 0x33, 0x32, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, // [32];. float4x4 + 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x3b, 0x0a, 0x20, 0x20, // u_modelView;. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // float4x4 u_model + 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x76, 0x65, 0x72, // ViewProj;.};.ver + 0x74, 0x65, 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // tex xlatMtlShade + 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, // rOutput xlatMtlM + 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ain (xlatMtlShad + 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, // erInput _mtl_i [ + 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, // [stage_in]], con + 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // stant xlatMtlSha + 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // derUniform& _mtl + 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, // _u [[buffer(0)]] + 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // ).{. xlatMtlSha + 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // derOutput _mtl_o + 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ;. float4 tmpva + 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // r_1;. tmpvar_1. + 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // w = 1.0;. tmpva + 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // r_1.xyz = _mtl_i + 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // .a_position;. _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // mtl_o.gl_Positio + 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, // n = (_mtl_u.u_mo + 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, // delViewProj * tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // pvar_1);. float + 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // 4 tmpvar_2;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, // pvar_2.w = 1.0;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, // tmpvar_2.xyz = + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // _mtl_i.a_positi + 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x76, // on;. _mtl_o.v_v + 0x69, 0x65, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // iew = (_mtl_u.u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, // modelView * tmpv + 0x61, 0x72, 0x5f, 0x32, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // ar_2).xyz;. flo + 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, // at4 tmpvar_3;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, // tmpvar_3.w = 1.0 + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, // ;. tmpvar_3.xyz + 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, // = _mtl_i.a_posi + 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, // tion;. _mtl_o.v + 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // _world = (_mtl_u + 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5b, 0x30, 0x5d, 0x20, 0x2a, 0x20, 0x74, 0x6d, // .u_model[0] * tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x72, // pvar_3).xyz;. r + 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, // eturn _mtl_o;.}. + 0x0a, 0x00, // .. +}; diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc new file mode 100644 index 00000000000..02054e3ef28 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc @@ -0,0 +1,16 @@ +$input a_position +$output v_view, v_world + +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include <bgfx_shader.sh> + +void main() +{ + gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); + v_view = mul(u_modelView, vec4(a_position, 1.0) ).xyz; + v_world = mul(u_model[0], vec4(a_position, 1.0) ).xyz; +} diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.bin.h b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.bin.h new file mode 100644 index 00000000000..b5c9c73d715 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.bin.h @@ -0,0 +1,127 @@ +static const uint8_t vs_debugdraw_lines_glsl[325] = +{ + 0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH....I...u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... + 0x20, 0x01, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // ...attribute hi + 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ghp vec4 a_color + 0x30, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, 0x67, // 0;.attribute hig + 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // hp vec3 a_positi + 0x6f, 0x6e, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, // on;.varying high + 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // p vec4 v_color0; + 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x6d, // .uniform highp m + 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // at4 u_modelViewP + 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, // roj;.void main ( + 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // ).{. highp vec4 + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_1;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, // var_1.w = 1.0;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, // tmpvar_1.xyz = + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // a_position;. gl + 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x6d, // _Position = (u_m + 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, // odelViewProj * t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, // mpvar_1);. v_co + 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // lor0 = a_color0; + 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... +}; +static const uint8_t vs_debugdraw_lines_dx9[323] = +{ + 0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH....I...u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0x20, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // .......$.CTAB.. + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W............. + 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x03, 0x00, // modelViewProj... + 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs + 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft ( + 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100 + 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // 11.16384........ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U....... + 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, // ................ + 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, // ................ + 0x00, 0x00, 0x00, // ... +}; +static const uint8_t vs_debugdraw_lines_dx11[510] = +{ + 0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH....I...u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0xd4, 0x01, 0x44, 0x58, 0x42, 0x43, 0x32, 0x9b, 0xdd, 0xb5, 0xa9, 0xb7, 0x22, 0xf0, 0xcf, 0x5e, // ..DXBC2....."..^ + 0x34, 0x2c, 0x72, 0xf0, 0x87, 0x00, 0x01, 0x00, 0x00, 0x00, 0xd4, 0x01, 0x00, 0x00, 0x03, 0x00, // 4,r............. + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...|.......IS + 0x47, 0x4e, 0x48, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, // GNH...........8. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......>......... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x43, 0x4f, // ..............CO + 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0xab, 0x4f, 0x53, // LOR.POSITION..OS + 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, // GNL...........8. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......D......... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, // ..............SV + 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, // _POSITION.COLOR. + 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xfc, 0x00, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x3f, 0x00, // ..SHDR....@...?. + 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, // ..Y...F. ....... + 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, // .._..........._. + 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, // ..r.......g.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, // ..........e.... + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, // ......h.......8. + 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, // ..........V..... + 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, // ..F. .........2. + 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..........F. ... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..............F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2......... + 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa6, 0x1a, // ..F. ........... + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......F......... + 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, // ... ......F..... + 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, // ..F. .........6. + 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x00, 0x00, // ... ......F..... + 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x02, 0x05, 0x00, 0x01, 0x00, 0x40, 0x00, // ..>.........@. +}; +static const uint8_t vs_debugdraw_lines_mtl[647] = +{ + 0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x78, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH....I..x...us + 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me + 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // . float4 a_colo + 0x72, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x30, // r0 [[attribute(0 + 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, // )]];. float3 a_ + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, // position [[attri + 0x62, 0x75, 0x74, 0x65, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, // bute(1)]];.};.st + 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ruct xlatMtlShad + 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // erOutput {. flo + 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, // at4 gl_Position + 0x5b, 0x5b, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, // [[position]];. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // float4 v_color0; + 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // tlShaderUniform + 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x6d, // {. float4x4 u_m + 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x7d, 0x3b, // odelViewProj;.}; + 0x0a, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // .vertex xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // haderOutput xlat + 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // MtlMain (xlatMtl + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // ShaderInput _mtl + 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, // _i [[stage_in]], + 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // constant xlatMt + 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, // lShaderUniform& + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, // _mtl_u [[buffer( + 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // 0)]]).{. xlatMt + 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, // lShaderOutput _m + 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, // tl_o;. float4 t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // mpvar_1;. tmpva + 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, // r_1.w = 1.0;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // mpvar_1.xyz = _m + 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, // tl_i.a_position; + 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // . _mtl_o.gl_Pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // ition = (_mtl_u. + 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, // u_modelViewProj + 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // * tmpvar_1);. _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // mtl_o.v_color0 = + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // _mtl_i.a_color0 + 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // ;. return _mtl_ + 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // o;.}... +}; diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc new file mode 100644 index 00000000000..b4090d2c29a --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc @@ -0,0 +1,15 @@ +$input a_position, a_color0 +$output v_color0 + +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include <bgfx_shader.sh> + +void main() +{ + gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); + v_color0 = a_color0; +} diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.bin.h b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.bin.h new file mode 100644 index 00000000000..875c4ac10c6 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.bin.h @@ -0,0 +1,148 @@ +static const uint8_t vs_debugdraw_lines_stipple_glsl[418] = +{ + 0x56, 0x53, 0x48, 0x04, 0xe7, 0x1a, 0x5a, 0xef, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH...Z....u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... + 0x7d, 0x01, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // }...attribute hi + 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ghp vec4 a_color + 0x30, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, 0x67, // 0;.attribute hig + 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // hp vec3 a_positi + 0x6f, 0x6e, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // on;.attribute hi + 0x67, 0x68, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, // ghp float a_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // oord0;.varying h + 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // ighp vec4 v_colo + 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, // r0;.varying high + 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x76, 0x5f, 0x73, 0x74, 0x69, 0x70, 0x70, 0x6c, // p float v_stippl + 0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // e;.uniform highp + 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // mat4 u_modelVie + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, // wProj;.void main + 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, // ().{. highp ve + 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, // c4 tmpvar_1;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, // mpvar_1.w = 1.0; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, // . tmpvar_1.xyz + 0x3d, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, // = a_position;. + 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x75, // gl_Position = (u + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, // _modelViewProj * + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, // tmpvar_1);. v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color0 = a_color + 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x73, 0x74, 0x69, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x3d, // 0;. v_stipple = + 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, // a_texcoord0;.}. + 0x0a, 0x00, // .. +}; +static const uint8_t vs_debugdraw_lines_stipple_dx9[359] = +{ + 0x56, 0x53, 0x48, 0x04, 0xe7, 0x1a, 0x5a, 0xef, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH...Z....u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0x44, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // D.......$.CTAB.. + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W............. + 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x03, 0x00, // modelViewProj... + 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs + 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft ( + 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, // ompiler 10.0.100 + 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // 11.16384........ + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, // ................ + 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, // ................ + 0x01, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................ + 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, // U............... + 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, // ................ + 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, // ................ + 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0xe0, 0x02, 0x00, // ................ + 0x00, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ....... +}; +static const uint8_t vs_debugdraw_lines_stipple_dx11[620] = +{ + 0x56, 0x53, 0x48, 0x04, 0xe7, 0x1a, 0x5a, 0xef, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH...Z....u_mod + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0x40, 0x02, 0x44, 0x58, 0x42, 0x43, 0xe3, 0xb5, 0xa4, 0x88, 0xa6, 0x8c, 0xfa, 0x02, 0x7e, 0x55, // @.DXBC........~U + 0x75, 0xcd, 0x57, 0x76, 0xf4, 0xc2, 0x01, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x03, 0x00, // u.Wv......@..... + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x49, 0x53, // ..,...........IS + 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, // GNh...........P. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......V......... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x5f, 0x00, // .............._. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x4f, 0x53, 0x49, // ......COLOR.POSI + 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x4f, 0x53, // TION.TEXCOORD.OS + 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, // GNl...........P. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x62, 0x00, // ..............b. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x01, 0x0e, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, // ......SV_POSITIO + 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, // N.COLOR.TEXCOORD + 0x00, 0xab, 0x53, 0x48, 0x44, 0x52, 0x28, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x4a, 0x00, // ..SHDR(...@...J. + 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, // ..Y...F. ....... + 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, // .._..........._. + 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x12, 0x10, // ..r......._..... + 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......g.... .... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, // ......e.... .... + 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x12, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x68, 0x00, // ..e.... ......h. + 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8......... + 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..V.......F. ... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2......... + 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, // ..F. ........... + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, // ......F.......2. + 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..........F. ... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..............F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ........... .... + 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..F.......F. ... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, // ......6.... .... + 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x12, 0x20, // ..F.......6.... + 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..............>. + 0x00, 0x01, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // ..........@. +}; +static const uint8_t vs_debugdraw_lines_stipple_mtl[745] = +{ + 0x56, 0x53, 0x48, 0x04, 0xe7, 0x1a, 0x5a, 0xef, 0x00, 0x00, 0xda, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH...Z.......us + 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me + 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // . float4 a_colo + 0x72, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x30, // r0 [[attribute(0 + 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, // )]];. float3 a_ + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, // position [[attri + 0x62, 0x75, 0x74, 0x65, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // bute(1)]];. flo + 0x61, 0x74, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x5b, // at a_texcoord0 [ + 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, // [attribute(2)]]; + 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.struct xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, // tlShaderOutput { + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // . float4 gl_Pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // ition [[position + 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, // ]];. float4 v_c + 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x76, // olor0;. float v + 0x5f, 0x73, 0x74, 0x69, 0x70, 0x70, 0x6c, 0x65, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, // _stipple;.};.str + 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // uct xlatMtlShade + 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // rUniform {. flo + 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // at4x4 u_modelVie + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, // wProj;.};.vertex + 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, // xlatMtlShaderOu + 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, // tput xlatMtlMain + 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, // (xlatMtlShaderI + 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, // nput _mtl_i [[st + 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, // age_in]], consta + 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // nt xlatMtlShader + 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, // Uniform& _mtl_u + 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, // [[buffer(0)]]).{ + 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // . xlatMtlShader + 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, // Output _mtl_o;. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // float4 tmpvar_1 + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, // ;. tmpvar_1.w = + 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // 1.0;. tmpvar_1 + 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, // .xyz = _mtl_i.a_ + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // position;. _mtl + 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, // _o.gl_Position = + 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // (_mtl_u.u_model + 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ViewProj * tmpva + 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, // r_1);. _mtl_o.v + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // _color0 = _mtl_i + 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // .a_color0;. _mt + 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x73, 0x74, 0x69, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x3d, 0x20, // l_o.v_stipple = + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // _mtl_i.a_texcoor + 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, // d0;. return _mt + 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // l_o;.}... +}; diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc new file mode 100644 index 00000000000..9607a45509e --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc @@ -0,0 +1,16 @@ +$input a_position, a_color0, a_texcoord0 +$output v_color0, v_stipple + +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include <bgfx_shader.sh> + +void main() +{ + gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); + v_color0 = a_color0; + v_stipple = a_texcoord0; +} diff --git a/3rdparty/bgfx/examples/common/entry/entry.cpp b/3rdparty/bgfx/examples/common/entry/entry.cpp index 1fb0497be85..03cf82b5373 100644 --- a/3rdparty/bgfx/examples/common/entry/entry.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry.cpp @@ -6,7 +6,7 @@ #include <bx/bx.h> #include <bgfx/bgfx.h> #include <bx/string.h> -#include <bx/readerwriter.h> +#include <bx/crtimpl.h> #include <time.h> diff --git a/3rdparty/bgfx/examples/common/entry/entry_qnx.cpp b/3rdparty/bgfx/examples/common/entry/entry_noop.cpp index af91ca7db40..c6544595229 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_qnx.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_noop.cpp @@ -5,7 +5,7 @@ #include "entry_p.h" -#if ENTRY_CONFIG_USE_NATIVE && BX_PLATFORM_QNX +#if ENTRY_CONFIG_USE_NOOP #include <stdio.h> @@ -76,4 +76,4 @@ int main(int _argc, char** _argv) entry::main(_argc, _argv); } -#endif // ENTRY_CONFIG_USE_NATIVE && BX_PLATFORM_QNX +#endif // ENTRY_CONFIG_USE_NOOP diff --git a/3rdparty/bgfx/examples/common/entry/entry_p.h b/3rdparty/bgfx/examples/common/entry/entry_p.h index 502eed673ad..f44a421946a 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_p.h +++ b/3rdparty/bgfx/examples/common/entry/entry_p.h @@ -13,6 +13,10 @@ #include "entry.h" #include <string.h> // memcpy +#ifndef ENTRY_CONFIG_USE_NOOP +# define ENTRY_CONFIG_USE_NOOP (BX_PLATFORM_QNX || BX_PLATFORM_XBOXONE) +#endif // ENTRY_CONFIG_USE_NOOP + #ifndef ENTRY_CONFIG_USE_SDL # define ENTRY_CONFIG_USE_SDL BX_PLATFORM_STEAMLINK #endif // ENTRY_CONFIG_USE_SDL @@ -22,6 +26,7 @@ #endif // ENTRY_CONFIG_USE_GLFW #if !defined(ENTRY_CONFIG_USE_NATIVE) \ + && !ENTRY_CONFIG_USE_NOOP \ && !ENTRY_CONFIG_USE_SDL \ && !ENTRY_CONFIG_USE_GLFW # define ENTRY_CONFIG_USE_NATIVE 1 diff --git a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp index 989d0ae0667..07193b83ca7 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp @@ -29,6 +29,7 @@ BX_PRAGMA_DIAGNOSTIC_POP_CLANG() #include <bx/thread.h> #include <bx/handlealloc.h> #include <bx/readerwriter.h> +#include <bx/crtimpl.h> #include <tinystl/allocator.h> #include <tinystl/string.h> @@ -219,7 +220,7 @@ namespace entry # elif BX_PLATFORM_WINDOWS return wmi.info.win.window; # elif BX_PLATFORM_STEAMLINK - return wmi.info.vivante.window; + return wmi.info.vivante.window; # endif // BX_PLATFORM_ } @@ -307,6 +308,7 @@ namespace entry initTranslateKey(SDL_SCANCODE_PRINTSCREEN, Key::Print); initTranslateKey(SDL_SCANCODE_KP_PLUS, Key::Plus); initTranslateKey(SDL_SCANCODE_KP_MINUS, Key::Minus); + initTranslateKey(SDL_SCANCODE_GRAVE, Key::Tilde); initTranslateKey(SDL_SCANCODE_F1, Key::F1); initTranslateKey(SDL_SCANCODE_F2, Key::F2); initTranslateKey(SDL_SCANCODE_F3, Key::F3); diff --git a/3rdparty/bgfx/examples/common/entry/input.cpp b/3rdparty/bgfx/examples/common/entry/input.cpp index c0d2686d293..bb9925990b0 100644 --- a/3rdparty/bgfx/examples/common/entry/input.cpp +++ b/3rdparty/bgfx/examples/common/entry/input.cpp @@ -11,6 +11,7 @@ #include <bx/allocator.h> #include <bx/ringbuffer.h> +#include <tinystl/string.h> #include <tinystl/allocator.h> #include <tinystl/unordered_map.h> namespace stl = tinystl; @@ -197,12 +198,12 @@ struct Input void addBindings(const char* _name, const InputBinding* _bindings) { - m_inputBindingsMap.insert(stl::make_pair(_name, _bindings) ); + m_inputBindingsMap.insert(stl::make_pair(stl::string(_name), _bindings) ); } void removeBindings(const char* _name) { - InputBindingMap::iterator it = m_inputBindingsMap.find(_name); + InputBindingMap::iterator it = m_inputBindingsMap.find(stl::string(_name)); if (it != m_inputBindingsMap.end() ) { m_inputBindingsMap.erase(it); @@ -275,7 +276,7 @@ struct Input } } - typedef stl::unordered_map<const char*, const InputBinding*> InputBindingMap; + typedef stl::unordered_map<stl::string, const InputBinding*> InputBindingMap; InputBindingMap m_inputBindingsMap; Mouse m_mouse; Keyboard m_keyboard; diff --git a/3rdparty/bgfx/examples/common/font/makefile b/3rdparty/bgfx/examples/common/font/makefile index 13b0215ee97..38f4d0d7d86 100644 --- a/3rdparty/bgfx/examples/common/font/makefile +++ b/3rdparty/bgfx/examples/common/font/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 # diff --git a/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp b/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp index 230eb97e164..9acb796212f 100644 --- a/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp +++ b/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp @@ -822,8 +822,8 @@ void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, uint8_t _id, ); } - bgfx::setVertexBuffer(vbh, bc.textBuffer->getVertexCount() ); - bgfx::setIndexBuffer(ibh, bc.textBuffer->getIndexCount() ); + bgfx::setVertexBuffer(vbh, 0, bc.textBuffer->getVertexCount() ); + bgfx::setIndexBuffer(ibh, 0, bc.textBuffer->getIndexCount() ); } break; diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h index 593de84d168..11044efd9ae 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h @@ -1,10 +1,10 @@ -static const uint8_t fs_imgui_image_swizz_glsl[425] = +static const uint8_t fs_imgui_image_swizz_glsl[565] = { 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x03, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x02, 0x01, 0x00, 0x00, // geLodEnabled.... 0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x02, 0x01, 0x00, 0x00, // ...u_swizzle.... 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, // ...s_texColor... - 0x00, 0x01, 0x00, 0x61, 0x01, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...a...varying h + 0x00, 0x01, 0x00, 0xed, 0x01, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // .......varying h 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 v_texc 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ighp vec4 u_imag @@ -13,20 +13,29 @@ static const uint8_t fs_imgui_image_swizz_glsl[425] = 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // u_swizzle;.unifo 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, // rm sampler2D s_t 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, // exColor;.void ma - 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, // in ().{. lowp v - 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, // ec4 tmpvar_1;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x76, // tmpvar_1.xyz = v - 0x65, 0x63, 0x33, 0x28, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // ec3(dot (texture - 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // 2DLod (s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // olor, v_texcoord - 0x30, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, // 0, u_imageLodEna - 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2c, 0x20, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, // bled.x), u_swizz - 0x6c, 0x65, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // le));. tmpvar_1 - 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, // .w = (0.2 + (0.8 - 0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, // * u_imageLodEna - 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, // bled.y));. gl_F - 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva - 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_1;.}... + 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66, // in ().{. lowp f + 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, // loat tmpvar_1;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x64, 0x6f, 0x74, 0x20, // tmpvar_1 = dot + 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, // (texture2DLod + 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, // (s_texColor, v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, // texcoord0, u_ima + 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2c, // geLodEnabled.x), + 0x20, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6c, // u_swizzle);. l + 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // owp vec3 tmpvar_ + 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x20, // 2;. tmpvar_2.x + 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // = tmpvar_1;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // pvar_2.y = tmpva + 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, // r_1;. tmpvar_2. + 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, // z = tmpvar_1;. + 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, // mediump vec4 tmp + 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_3;. tmpvar_ + 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // 3.xyz = tmpvar_2 + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, // ;. tmpvar_3.w = + 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, 0x75, // (0.2 + (0.8 * u + 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, // _imageLodEnabled + 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, // .y));. gl_FragC + 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, // olor = tmpvar_3; + 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... }; static const uint8_t fs_imgui_image_swizz_dx9[462] = { @@ -94,9 +103,9 @@ static const uint8_t fs_imgui_image_swizz_dx11[493] = 0x3e, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04, 0x10, // >6.... ......... 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, // .....>..... . }; -static const uint8_t fs_imgui_image_swizz_mtl[879] = +static const uint8_t fs_imgui_image_swizz_mtl[1005] = { - 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x60, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH.o.><..`...us + 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0xde, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH.o.><......us 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, // ing namespace me 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // tal;.struct xlat 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, // MtlShaderInput { @@ -135,20 +144,28 @@ static const uint8_t fs_imgui_image_swizz_mtl[879] = 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, // _texcoord0), lev 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // el(_mtl_u.u_imag 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x29, 0x29, // eLodEnabled.x))) + 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // ;. half tmpvar_ + 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, // 2;. tmpvar_2 = + 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x28, 0x66, 0x6c, 0x6f, // ((half)dot ((flo + 0x61, 0x74, 0x34, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2c, 0x20, 0x5f, 0x6d, // at4)tmpvar_1, _m + 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x29, 0x29, // tl_u.u_swizzle)) 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ;. float tmpvar - 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, // _2;. tmpvar_2 = + 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, // _3;. tmpvar_3 = 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, 0x5f, // (0.2 + (0.8 * _ 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, // mtl_u.u_imageLod 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, // Enabled.y));. h - 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, // alf4 tmpvar_3;. - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, // tmpvar_3.xyz = - 0x68, 0x61, 0x6c, 0x66, 0x33, 0x28, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x64, 0x6f, 0x74, // half3(((half)dot - 0x20, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ((float4)tmpvar - 0x5f, 0x31, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x73, 0x77, 0x69, // _1, _mtl_u.u_swi - 0x7a, 0x7a, 0x6c, 0x65, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // zzle)));. tmpva - 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x28, 0x74, 0x6d, 0x70, // r_3.w = half(tmp - 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // var_2);. _mtl_o - 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, // .gl_FragColor = - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, // tmpvar_3;. retu - 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // rn _mtl_o;.}... + 0x61, 0x6c, 0x66, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // alf3 tmpvar_4;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x74, 0x6d, // tmpvar_4.x = tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_2;. tmpvar + 0x5f, 0x34, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, // _4.y = tmpvar_2; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x7a, 0x20, 0x3d, 0x20, // . tmpvar_4.z = + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // tmpvar_2;. half + 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // 4 tmpvar_5;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // pvar_5.xyz = tmp + 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_4;. tmpvar_ + 0x35, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // 5.w = half(tmpva + 0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, // r_3);. _mtl_o.g + 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, // l_FragColor = tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, // pvar_5;. return + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... }; diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.cpp b/3rdparty/bgfx/examples/common/imgui/imgui.cpp index 4cdc5f30fe5..60afe3df290 100644 --- a/3rdparty/bgfx/examples/common/imgui/imgui.cpp +++ b/3rdparty/bgfx/examples/common/imgui/imgui.cpp @@ -28,6 +28,7 @@ #include <bx/uint32_t.h> #include <bx/fpumath.h> #include <bx/handlealloc.h> +#include <bx/crtimpl.h> #include "imgui.h" #include "ocornut_imgui.h" @@ -454,11 +455,13 @@ struct Imgui { m_allocator = _allocator; - if (NULL == m_allocator) +#if BX_CONFIG_ALLOCATOR_CRT + if (NULL == _allocator) { static bx::CrtAllocator allocator; m_allocator = &allocator; } +#endif // BX_CONFIG_ALLOCATOR_CRT if (NULL == _data) { diff --git a/3rdparty/bgfx/examples/common/imgui/makefile b/3rdparty/bgfx/examples/common/imgui/makefile index 70d3ff0e69d..965ac34d302 100644 --- a/3rdparty/bgfx/examples/common/imgui/makefile +++ b/3rdparty/bgfx/examples/common/imgui/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 # diff --git a/3rdparty/bgfx/examples/common/nanovg/makefile b/3rdparty/bgfx/examples/common/nanovg/makefile index 13b0215ee97..38f4d0d7d86 100644 --- a/3rdparty/bgfx/examples/common/nanovg/makefile +++ b/3rdparty/bgfx/examples/common/nanovg/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 # diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp index 1da34bd790f..e5795ad2131 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp @@ -30,6 +30,7 @@ #include <bx/bx.h> #include <bx/allocator.h> +#include <bx/crtimpl.h> BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4244); // warning C4244: '=' : conversion from '' to '', possible loss of data diff --git a/3rdparty/bgfx/examples/common/shaderlib.sh b/3rdparty/bgfx/examples/common/shaderlib.sh index a6a51199a1f..51f9b6a445f 100644 --- a/3rdparty/bgfx/examples/common/shaderlib.sh +++ b/3rdparty/bgfx/examples/common/shaderlib.sh @@ -367,4 +367,20 @@ float random(vec2 _uv) return fract(sin(dot(_uv.xy, vec2(12.9898, 78.233) ) ) * 43758.5453); } +vec3 fixCubeLookup(vec3 _v, float _lod, float _topLevelCubeSize) +{ + // Reference: + // Seamless cube-map filtering + // http://the-witness.net/news/2012/02/seamless-cube-map-filtering/ + float ax = abs(_v.x); + float ay = abs(_v.y); + float az = abs(_v.z); + float vmax = max(max(ax, ay), az); + float scale = 1.0 - exp2(_lod) / _topLevelCubeSize; + if (ax != vmax) { _v.x *= scale; } + if (ay != vmax) { _v.y *= scale; } + if (az != vmax) { _v.z *= scale; } + return _v; +} + #endif // __SHADERLIB_SH__ diff --git a/3rdparty/bgfx/examples/makefile b/3rdparty/bgfx/examples/makefile index 9e53c42cd5e..13ce9f336b8 100644 --- a/3rdparty/bgfx/examples/makefile +++ b/3rdparty/bgfx/examples/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 # @@ -30,27 +30,7 @@ rebuild: # @make -s --no-print-directory rebuild -C 25-c99 # @make -s --no-print-directory rebuild -C 26-occlusion @make -s --no-print-directory rebuild -C 27-terrain + @make -s --no-print-directory rebuild -C 28-wireframe @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 diff --git a/3rdparty/bgfx/examples/runtime/meshes/bunny.bin b/3rdparty/bgfx/examples/runtime/meshes/bunny.bin Binary files differindex b34244a745d..794ec22c7fe 100644 --- a/3rdparty/bgfx/examples/runtime/meshes/bunny.bin +++ b/3rdparty/bgfx/examples/runtime/meshes/bunny.bin diff --git a/3rdparty/bgfx/examples/runtime/meshes/hollowcube.bin b/3rdparty/bgfx/examples/runtime/meshes/hollowcube.bin Binary files differindex 69a4a38c125..0ea300901e5 100644 --- a/3rdparty/bgfx/examples/runtime/meshes/hollowcube.bin +++ b/3rdparty/bgfx/examples/runtime/meshes/hollowcube.bin diff --git a/3rdparty/bgfx/examples/runtime/meshes/orb.bin b/3rdparty/bgfx/examples/runtime/meshes/orb.bin Binary files differindex 336f3680565..ac9455a25a5 100644 --- a/3rdparty/bgfx/examples/runtime/meshes/orb.bin +++ b/3rdparty/bgfx/examples/runtime/meshes/orb.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_ibl_mesh.bin Binary files differindex d3ea732918d..155058f3846 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_ibl_skybox.bin Binary files differindex 13b5e270386..07ca7e697d5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin Binary files differindex e599c4ec016..b27f3fd3fc7 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin Binary files differindex c2ac4161f46..03a3f89b28f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin Binary files differindex acb5c01247e..f85d0ec52b1 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin Binary files differindex 3430e96d811..39d115c48e3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin Binary files differindex 6c4859be087..13ad93358d9 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin Binary files differindex 95467349adc..d688775bd11 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_esm_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin Binary files differindex d1612f8ca11..00300aa3a4e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin Binary files differindex f6b2ac6587d..3fa09702654 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin Binary files differindex 52ac4285db6..12eaab3eb5e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin Binary files differindex 221a4278dd8..98f5ff1429a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin Binary files differindex 03b37762125..07e12b43e1b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin Binary files differindex 11f1c23b014..cde6f19fc26 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_hard_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin Binary files differindex 19d9bba4d4a..2faada8a015 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin Binary files differindex 9581dddcd64..76b37271222 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin Binary files differindex 8746b286f44..cf8a001ccb4 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin Binary files differindex 9957e3b8588..67c95d9110b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin Binary files differindex 3c72697a9d3..748714f916d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin Binary files differindex 834b235eebe..26fac391383 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_pcf_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin Binary files differindex 0ae83c419f1..27d528221a8 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin Binary files differindex 87536cda4d4..e2184d5b475 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin Binary files differindex 5129fdb6b0b..c06948c1609 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin Binary files differindex 08a5970da44..91716e56c98 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin Binary files differindex 39d3bff0226..338bd6fc819 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin Binary files differindex 0991b66851f..4ecfdbb92da 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowmaps_color_lighting_vsm_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_wf_mesh.bin Binary files differnew file mode 100644 index 00000000000..76647c0b804 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_wf_wireframe.bin Binary files differnew file mode 100644 index 00000000000..3706b830375 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_ibl_mesh.bin Binary files differindex b9febc31cb4..90127469c67 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_ibl_skybox.bin Binary files differindex 5aa032ea932..8c29510aa1b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_wf_mesh.bin Binary files differnew file mode 100644 index 00000000000..f65702b92e7 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_wf_wireframe.bin Binary files differnew file mode 100644 index 00000000000..076f9d1dabe --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin Binary files differindex 3a3ecaba313..74ad610bbf1 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin Binary files differindex 2e49131b0a3..031de157008 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin Binary files differindex 99f5564ce4d..bd5c93be505 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin Binary files differindex 420080db2fd..046ad528e4e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin Binary files differindex 2b80ccad6c3..ae7c92272c0 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin Binary files differindex 3bbfea99ae7..a47bbbbb521 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin Binary files differindex c9d81f6fa64..4c1eb4fff5b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin Binary files differindex 308f93ef2e3..e1964e28fd8 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_esm_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin Binary files differindex 3de4dcbce87..ac0c477d7e5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin Binary files differindex c53e8814a34..42ffa588595 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin Binary files differindex d29c6e8c1ed..c57f980bdbf 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin Binary files differindex ca069354ca4..3035d4d8848 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin Binary files differindex c316724a908..8169fc8a1a3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin Binary files differindex bef6549d95b..c9b5cd1b755 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_hard_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin Binary files differindex 55bce42f02a..cccab4c488c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin Binary files differindex 7427157c5fa..7b2afedb883 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin Binary files differindex a8c173e3c39..100b6afa14c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin Binary files differindex 984458101ee..ff07f745bcf 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin Binary files differindex e96824aae10..de0f7436c62 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin Binary files differindex bf00e8523f3..a58ecb13461 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_pcf_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin Binary files differindex ac96c99da43..e5654bea62a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin Binary files differindex 0e69a3950ac..fabcb490544 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin Binary files differindex a1ce662b545..d01917f3f12 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin Binary files differindex 80befb85a01..d283cc99403 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin Binary files differindex f0bdfd66f7b..14941129ad7 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin Binary files differindex 856c659ffe6..9d5f242964f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowmaps_color_lighting_vsm_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_wf_mesh.bin Binary files differnew file mode 100644 index 00000000000..06e389eb117 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_wf_wireframe.bin Binary files differnew file mode 100644 index 00000000000..6d992770f5e --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin Binary files differindex 4218e8ab377..f0c040a4ce1 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin Binary files differindex c0e84000a3a..0c8d2ffaf25 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_wf_mesh.bin Binary files differnew file mode 100644 index 00000000000..6f13919f414 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_wf_wireframe.bin Binary files differnew file mode 100644 index 00000000000..54e1d124e03 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_indirect.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/cs_indirect.bin Binary files differindex 72c5eaf6bb2..1faf1aeb562 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_indirect.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/cs_indirect.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_init_instances.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/cs_init_instances.bin Binary files differindex 048a96abc67..d74d461cfac 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_init_instances.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/cs_init_instances.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_update_instances.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/cs_update_instances.bin Binary files differindex 1059fa84416..ddd207ccf9a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_update_instances.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/cs_update_instances.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_mesh.bin Binary files differindex 5e96353619c..75c93b113e3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_skybox.bin Binary files differindex bb2e9aeafe3..76079d0ec8d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin Binary files differindex df53debb5b1..e594526cf19 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin Binary files differindex 2ae88a47fff..3b51e727e87 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin Binary files differindex 700694d399e..72ed5111aee 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin Binary files differindex 525a27cdd51..7c77f0cbbfe 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin Binary files differindex 04c38666671..789141dcccc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin Binary files differindex 27d8231f863..3c1d07e15f6 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin Binary files differindex 4ca43066c34..1503d413ab3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin Binary files differindex 4b3fea74139..f79e214b2da 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin Binary files differindex 7c5095f0e29..c6f6593ea1e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin Binary files differindex b77c2c824c4..74c0c1cf2a9 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin Binary files differindex 3988caee216..c0e05951bdd 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin Binary files differindex 9a8ae99224e..19062f01b8c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin Binary files differindex 1965c493afa..6187725d9f2 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin Binary files differindex 31b8e22ba35..133e398538c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin Binary files differindex c867113fd8c..422bf35ec8e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin Binary files differindex c78a27741db..9f78cbeee15 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin Binary files differindex 85cebb56f07..5ee79f73a28 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin Binary files differindex 93c5b80ef33..4bb6fa06e51 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin Binary files differindex 4769169ac7f..456040c60a3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin Binary files differindex 18a43e1ea27..fc57ca84ebc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin Binary files differindex f42d12496d6..ccababe2e1b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin Binary files differindex 50e5c4f14cb..74ff8b8dd26 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin Binary files differindex 3e96ec50a4c..754e424ea12 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin Binary files differindex df85bd9510c..53f2ea31f22 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin Binary files differindex 2d63ad15e45..0b0a1bbbf16 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin Binary files differindex 772ec28f6ed..ad331bd4ffd 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin Binary files differindex d8509532b15..c50ce9cc452 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin Binary files differindex 3997cd62a98..d6bdeb0b6c9 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin Binary files differindex a366ac46963..c1c6b516290 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin Binary files differindex 0fd472eda28..db9d665275d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin Binary files differindex d8509532b15..c50ce9cc452 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbackblank.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbackblank.bin Binary files differindex 2222aa66d6d..c2fb7eac9cc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbackblank.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbackblank.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfrontblank.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfrontblank.bin Binary files differindex cbe487457f7..4b7b683d8cc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfrontblank.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfrontblank.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin Binary files differindex 5844d74493e..227b76c4fa2 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow.bin Binary files differindex 98147ab064a..3262874eaf3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin Binary files differindex 384de3f5387..3c4b91fdcca 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_color_lighting.bin Binary files differindex 776c24867fd..f3e5bd234a5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_texture_lighting.bin Binary files differindex 3ceba55ea2f..f35896a59d8 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_texture_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_update_3d.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_update_3d.bin Binary files differindex b7b8fb4cd0e..1566fb77bef 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_update_3d.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_update_3d.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_wf_mesh.bin Binary files differnew file mode 100644 index 00000000000..a090c615b90 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_wf_wireframe.bin Binary files differnew file mode 100644 index 00000000000..f39c7916d82 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/fs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_mesh.bin Binary files differindex fa99121843b..bbd50acd51f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_skybox.bin Binary files differindex 6a3f2f2e619..d0c60ada93c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/vs_wf_mesh.bin Binary files differnew file mode 100644 index 00000000000..39b2f0bbc48 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/vs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/gles/vs_wf_wireframe.bin Binary files differnew file mode 100644 index 00000000000..f456e30f22c --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/gles/vs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_indirect.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_indirect.bin Binary files differindex 146f0f80889..9a0b306fb00 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_indirect.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_indirect.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_init_instances.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_init_instances.bin Binary files differindex 8c0aa81a7c4..bd4bd9b6086 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_init_instances.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_init_instances.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update_instances.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update_instances.bin Binary files differindex 04eb1a408b5..3b695029314 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update_instances.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update_instances.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_ibl_mesh.bin Binary files differindex 2e35f1e240e..3260e151099 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_ibl_skybox.bin Binary files differindex 16c6969b746..3ac60719279 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin Binary files differindex 1bfc2361d5c..32f69e5aed2 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin Binary files differindex f8ae5bc9b81..56a47cab952 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_oit_wb_separate.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin Binary files differindex f5a580f1289..4f66a07bb0f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin Binary files differindex 1e7a4d25acd..7249ac3fc01 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin Binary files differindex 3c41f4ed3f7..57a0637840f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin Binary files differindex b930d047c81..daa9d7bc412 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin Binary files differindex 5b5e123eaec..5213127e2b3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin Binary files differindex 9e5441e5839..0728fd38ac9 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_esm_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin Binary files differindex 62a4fab7411..40a6fe35f34 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin Binary files differindex 7ae79a1339c..27694944113 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin Binary files differindex 52a0b821316..68de56248ff 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin Binary files differindex 08808de87a7..e9d07c376e4 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin Binary files differindex 3218ab5f3cc..eceb44fdf0f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin Binary files differindex 0f8e094c7e9..d7893ba4369 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_hard_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin Binary files differindex 797ec0bcdbe..3638832c180 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin Binary files differindex c649bf07a24..957f309bc5e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin Binary files differindex 5f0c1c7c365..03143cba754 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin Binary files differindex 5b07162b001..202b3b76236 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin Binary files differindex 34d5c091ce2..7d6487b1514 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin Binary files differindex 53f13abd5c8..d8f9e902fac 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_pcf_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin Binary files differindex 3ba96599cd4..46a9e14444f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin Binary files differindex d1d4d641bdb..5af575e1be6 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin Binary files differindex 5b675445db3..17290531064 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin Binary files differindex cbcecf1feb4..79058cad0d7 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin Binary files differindex a2aeda4ead7..5915c930f4e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin Binary files differindex fd9d3902609..93b5a2a0bb2 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_color_lighting_vsm_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin Binary files differindex f1180dceb51..f8fa7a5d8b6 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_hblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin Binary files differindex 960eba1e085..6148b430945 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin Binary files differindex a592392cdd6..d59593b94a3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_packdepth_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin Binary files differindex acda8d5f64f..6602f5e43e0 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_unpackdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin Binary files differindex f1180dceb51..f8fa7a5d8b6 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowmaps_vblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowvolume_svbackblank.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowvolume_svbackblank.bin Binary files differindex 2222aa66d6d..5bbd5e24023 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowvolume_svbackblank.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowvolume_svbackblank.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowvolume_svfrontblank.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowvolume_svfrontblank.bin Binary files differindex cbe487457f7..04a7b089fef 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowvolume_svfrontblank.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_shadowvolume_svfrontblank.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin Binary files differindex a036a3a6254..8e0fb26cd2b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_mesh_pd.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow.bin Binary files differindex 98147ab064a..946d0e83e3b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin Binary files differindex 7286ee6bf99..c590fd26595 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_sms_shadow_pd.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_stencil_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_stencil_color_lighting.bin Binary files differindex 4135af924d1..7977435653d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_stencil_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_stencil_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_stencil_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_stencil_texture_lighting.bin Binary files differindex aa333ccb02c..b53189391ea 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_stencil_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_stencil_texture_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_update_3d.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_update_3d.bin Binary files differindex 8b9af3fc299..f5f2c0271dd 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_update_3d.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_update_3d.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_wf_mesh.bin Binary files differnew file mode 100644 index 00000000000..d297e624e2a --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_wf_wireframe.bin Binary files differnew file mode 100644 index 00000000000..c6118cce70f --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_ibl_mesh.bin Binary files differindex 172605cd36f..924d39fbdcf 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_ibl_skybox.bin Binary files differindex dcf57829e4a..be3bea2edbd 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_wf_mesh.bin Binary files differnew file mode 100644 index 00000000000..558881a8f49 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_wf_wireframe.bin Binary files differnew file mode 100644 index 00000000000..70a464fa95a --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_ibl_mesh.bin Binary files differindex 3ee33011539..917de5500a2 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_ibl_skybox.bin Binary files differindex f36f1f5ebba..1fd0392deaa 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb.bin Binary files differindex 2dae0e8f200..e7e9e98bb8e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_blit.bin Binary files differindex ef295e63d22..76eb570a740 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_blit.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_blit.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_separate.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_separate.bin Binary files differindex 2ef7b1b065c..0cf73b0621a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_separate.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_separate.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_separate_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_separate_blit.bin Binary files differindex 3772fd2de80..5b4ccf94d83 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_separate_blit.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_oit_wb_separate_blit.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm.bin Binary files differindex 5b9813e8595..9b2b3ac0881 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_csm.bin Binary files differindex c5a8b4b215c..04b4c14e4c1 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear.bin Binary files differindex c4d87c03987..5c8a98f584a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear_csm.bin Binary files differindex 2eeed8cde91..6c95e24e176 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear_omni.bin Binary files differindex 4ce8af71a63..aa490324ea3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_omni.bin Binary files differindex ca3449ca4d2..eebf557cdfa 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_esm_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard.bin Binary files differindex d8fe2fc1ae9..efd340c5844 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_csm.bin Binary files differindex 5089c8f1d23..f168696c34b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear.bin Binary files differindex 1884107d6bc..8b57ab983a7 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear_csm.bin Binary files differindex 2fa958d85bd..78c3faa2538 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear_omni.bin Binary files differindex 6e7bffc7959..0e2962e2781 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_omni.bin Binary files differindex af048da8a6f..7a75fac01a0 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_hard_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf.bin Binary files differindex 467c47d243e..5e0d6d5c618 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_csm.bin Binary files differindex 6faad277fd6..f4ea4faa7ac 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear.bin Binary files differindex 3e0fbb37abc..a8fa89d7f0e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear_csm.bin Binary files differindex 31dd9f7c420..a14ca23e82e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear_omni.bin Binary files differindex 3a5f285cf37..89e922cc5c5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_omni.bin Binary files differindex e7c3ad1fa1a..d9c75ba069a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_pcf_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm.bin Binary files differindex a76c572dc2a..b20618eeb15 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_csm.bin Binary files differindex 8915dd6c718..3822c869067 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear.bin Binary files differindex 79ddb6551c8..1f0b147ec5a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear_csm.bin Binary files differindex 392fceccbd3..1dc620e1147 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear_omni.bin Binary files differindex b377bf7db6a..94be509057a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_omni.bin Binary files differindex 953b60d9b18..4490f1ef874 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_lighting_vsm_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_texture.bin Binary files differindex ae7007c7af8..52de7234847 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_color_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_hblur.bin Binary files differindex b5fe202adc9..76c36a25cde 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_hblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_hblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_hblur_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_hblur_vsm.bin Binary files differindex f42eef2fcc8..45aba573279 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_hblur_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_hblur_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth.bin Binary files differindex ccec78ba002..2fe89fbc1e5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth_linear.bin Binary files differindex 67b12c79dcc..4d2a474262a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_texture.bin Binary files differindex 436d6d4471f..e48079000cc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_unpackdepth.bin Binary files differindex cd9a6e88530..60c98b10a77 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_unpackdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_unpackdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_unpackdepth_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_unpackdepth_vsm.bin Binary files differindex 94abea67646..54fe70de383 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_unpackdepth_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_unpackdepth_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_vblur.bin Binary files differindex b5fe202adc9..76c36a25cde 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_vblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_vblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_vblur_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_vblur_vsm.bin Binary files differindex f42eef2fcc8..45aba573279 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_vblur_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_vblur_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svbackblank.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svbackblank.bin Binary files differindex 187800af846..7fddc0e0d93 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svbackblank.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svbackblank.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svfrontblank.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svfrontblank.bin Binary files differindex 747c3963734..682bfa5fa57 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svfrontblank.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svfrontblank.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_mesh.bin Binary files differindex 5c173c76aac..862531d061c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_mesh_pd.bin Binary files differindex 26a2cc3de69..fb1631dffaf 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_mesh_pd.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_mesh_pd.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow.bin Binary files differindex 5281abc6100..b5140b48e9a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin Binary files differindex 4d4b4469ace..d4ee3580678 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_color_lighting.bin Binary files differindex ec312f8a3d8..f6898291c93 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_texture_lighting.bin Binary files differindex b0f45e5b5b6..229840b069a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_texture_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_terrain.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_terrain.bin Binary files differnew file mode 100644 index 00000000000..bb0f5dd11e5 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_terrain.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_tree.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_tree.bin Binary files differindex c36a93d60b5..f272476055b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_tree.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_tree.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_update_3d.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_update_3d.bin Binary files differindex aa8f3cb2e9a..dfdd88e41ce 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_update_3d.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_update_3d.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_wf_mesh.bin Binary files differnew file mode 100644 index 00000000000..3628dd93e5d --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_wf_wireframe.bin Binary files differnew file mode 100644 index 00000000000..e00b6fa3f91 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_ibl_mesh.bin Binary files differindex c29d5680e10..b842f18e72f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_ibl_skybox.bin Binary files differindex ada939a9055..0052efc7049 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_terrain.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_terrain.bin Binary files differnew file mode 100644 index 00000000000..003bac66ae8 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_terrain.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_terrain_height_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_terrain_height_texture.bin Binary files differnew file mode 100644 index 00000000000..135157b549a --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_terrain_height_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_wf_mesh.bin Binary files differnew file mode 100644 index 00000000000..caec269a5d4 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_wf_wireframe.bin Binary files differnew file mode 100644 index 00000000000..b72c2f84c67 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/textures/bolonga_irr.dds b/3rdparty/bgfx/examples/runtime/textures/bolonga_irr.dds Binary files differnew file mode 100644 index 00000000000..618b3342961 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/textures/bolonga_irr.dds diff --git a/3rdparty/bgfx/examples/runtime/textures/bolonga_lod.dds b/3rdparty/bgfx/examples/runtime/textures/bolonga_lod.dds Binary files differnew file mode 100644 index 00000000000..139328bed2d --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/textures/bolonga_lod.dds diff --git a/3rdparty/bgfx/examples/runtime/textures/ennis_irr.dds b/3rdparty/bgfx/examples/runtime/textures/ennis_irr.dds Binary files differdeleted file mode 100644 index 1a55992e19c..00000000000 --- a/3rdparty/bgfx/examples/runtime/textures/ennis_irr.dds +++ /dev/null diff --git a/3rdparty/bgfx/examples/runtime/textures/ennis_lod.dds b/3rdparty/bgfx/examples/runtime/textures/ennis_lod.dds Binary files differdeleted file mode 100644 index 1bda2347a91..00000000000 --- a/3rdparty/bgfx/examples/runtime/textures/ennis_lod.dds +++ /dev/null diff --git a/3rdparty/bgfx/examples/runtime/textures/grace_irr.dds b/3rdparty/bgfx/examples/runtime/textures/grace_irr.dds Binary files differdeleted file mode 100644 index 85fa2fd495d..00000000000 --- a/3rdparty/bgfx/examples/runtime/textures/grace_irr.dds +++ /dev/null diff --git a/3rdparty/bgfx/examples/runtime/textures/grace_lod.dds b/3rdparty/bgfx/examples/runtime/textures/grace_lod.dds Binary files differdeleted file mode 100644 index a76097b0646..00000000000 --- a/3rdparty/bgfx/examples/runtime/textures/grace_lod.dds +++ /dev/null diff --git a/3rdparty/bgfx/examples/runtime/textures/kyoto_irr.dds b/3rdparty/bgfx/examples/runtime/textures/kyoto_irr.dds Binary files differnew file mode 100644 index 00000000000..c3f5ccfa72c --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/textures/kyoto_irr.dds diff --git a/3rdparty/bgfx/examples/runtime/textures/kyoto_lod.dds b/3rdparty/bgfx/examples/runtime/textures/kyoto_lod.dds Binary files differnew file mode 100644 index 00000000000..dc2e0552072 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/textures/kyoto_lod.dds diff --git a/3rdparty/bgfx/examples/runtime/textures/pisa_irr.dds b/3rdparty/bgfx/examples/runtime/textures/pisa_irr.dds Binary files differdeleted file mode 100644 index 34f355cae2d..00000000000 --- a/3rdparty/bgfx/examples/runtime/textures/pisa_irr.dds +++ /dev/null diff --git a/3rdparty/bgfx/examples/runtime/textures/pisa_lod.dds b/3rdparty/bgfx/examples/runtime/textures/pisa_lod.dds Binary files differdeleted file mode 100644 index b8afe83cf21..00000000000 --- a/3rdparty/bgfx/examples/runtime/textures/pisa_lod.dds +++ /dev/null diff --git a/3rdparty/bgfx/examples/runtime/textures/uffizi_irr.dds b/3rdparty/bgfx/examples/runtime/textures/uffizi_irr.dds Binary files differdeleted file mode 100644 index 5a1013108dd..00000000000 --- a/3rdparty/bgfx/examples/runtime/textures/uffizi_irr.dds +++ /dev/null diff --git a/3rdparty/bgfx/examples/runtime/textures/uffizi_lod.dds b/3rdparty/bgfx/examples/runtime/textures/uffizi_lod.dds Binary files differdeleted file mode 100644 index fe20eabba29..00000000000 --- a/3rdparty/bgfx/examples/runtime/textures/uffizi_lod.dds +++ /dev/null diff --git a/3rdparty/bgfx/examples/runtime/textures/wells_irr.dds b/3rdparty/bgfx/examples/runtime/textures/wells_irr.dds Binary files differdeleted file mode 100644 index b972bcfc9a5..00000000000 --- a/3rdparty/bgfx/examples/runtime/textures/wells_irr.dds +++ /dev/null diff --git a/3rdparty/bgfx/examples/runtime/textures/wells_lod.dds b/3rdparty/bgfx/examples/runtime/textures/wells_lod.dds Binary files differdeleted file mode 100644 index d66a0c443db..00000000000 --- a/3rdparty/bgfx/examples/runtime/textures/wells_lod.dds +++ /dev/null diff --git a/3rdparty/bgfx/include/bgfx/bgfx.h b/3rdparty/bgfx/include/bgfx/bgfx.h index e30d7417158..0ba9ddd0783 100644 --- a/3rdparty/bgfx/include/bgfx/bgfx.h +++ b/3rdparty/bgfx/include/bgfx/bgfx.h @@ -200,6 +200,10 @@ namespace bgfx RG32I, RG32U, RG32F, + RGB8, + RGB8I, + RGB8U, + RGB8S, RGB9E5F, BGRA8, RGBA8, @@ -264,24 +268,45 @@ namespace bgfx /// Backbuffer ratios: enum Enum { - Equal, - Half, - Quarter, - Eighth, - Sixteenth, - Double, + Equal, //!< Equal to backbuffer. + Half, //!< One half size of backbuffer. + Quarter, //!< One quarter size of backbuffer. + Eighth, //!< One eighth size of backbuffer. + Sixteenth, //!< One sixteenth size of backbuffer. + Double, //!< Double size of backbuffer. Count }; }; + /// Occlusion query result. + /// + /// @attention C99 equivalent is `bgfx_occlusion_query_result_t`. + /// struct OcclusionQueryResult { enum Enum { - Invisible, - Visible, - NoResult, + Invisible, //!< Query failed test. + Visible, //!< Query passed test. + NoResult, //!< Query result is not available yet. + + Count + }; + }; + + /// Topology conversion function. + /// + /// @attention C99 equivalent is `bgfx_topology_convert_t`. + /// + struct TopologyConvert + { + enum Enum + { + TriListFlipWinding, //!< Flip winding order of triangle list. + TriListToLineList, //!< Convert triangle list to line list. + TriStripToTriList, //!< Convert triangle strip to triangle list. + LineStripToLineList, //!< Convert line strip to line list. Count }; @@ -532,6 +557,9 @@ namespace bgfx bool cubeMap; //!< Texture is cubemap. }; + /// Frame buffer texture attachemnt info. + /// + /// @attention C99 equivalent is `bgfx_attachment_t`. /// struct Attachment { @@ -700,6 +728,24 @@ namespace bgfx /// uint16_t weldVertices(uint16_t* _output, const VertexDecl& _decl, const void* _data, uint16_t _num, float _epsilon = 0.001f); + /// Convert index buffer for use with different primitive topologies. + /// + /// @param[in] _conversion Conversion type, see `TopologyConvert::Enum`. + /// @param[in] _dst Destination index buffer. If this argument it NULL + /// function will return number of indices after conversion. + /// @param[in] _dstSize Destination index buffer in bytes. It must be + /// large enough to contain output indices. If destination size is + /// insufficient index buffer will be truncated. + /// @param[in] _indices Source indices. + /// @param[in] _numIndices Number of input indices. + /// @param[in] _index32 Set to `true` if input indices are 32-bit. + /// + /// @returns Number of output indices after conversion. + /// + /// @attention C99 equivalent is `bgfx_topology_convert`. + /// + uint32_t topologyConvert(TopologyConvert::Enum _conversion, void* _dst, uint32_t _dstSize, const void* _indices, uint32_t _numIndices, bool _index32); + /// Swizzle RGBA8 image to BGRA8. /// /// @param[in] _width Width of input image (pixels). @@ -1481,7 +1527,7 @@ namespace bgfx /// Create frame buffer. /// /// @param[in] _num Number of texture attachments. - /// @param[in] _attachment Attachment info. See: `Attachment`. + /// @param[in] _attachment Attachment texture info. See: `Attachment`. /// @param[in] _destroyTextures If true, textures will be destroyed when /// frame buffer is destroyed. /// @@ -1861,12 +1907,28 @@ namespace bgfx /// Set index buffer for draw primitive. /// /// @param[in] _handle Index buffer. + /// + /// @attention C99 equivalent is `bgfx_set_index_buffer`. + /// + void setIndexBuffer(IndexBufferHandle _handle); + + /// Set index buffer for draw primitive. + /// + /// @param[in] _handle Index buffer. /// @param[in] _firstIndex First index to render. /// @param[in] _numIndices Number of indices to render. /// /// @attention C99 equivalent is `bgfx_set_index_buffer`. /// - void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex = 0, uint32_t _numIndices = UINT32_MAX); + void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices); + + /// Set index buffer for draw primitive. + /// + /// @param[in] _handle Dynamic index buffer. + /// + /// @attention C99 equivalent is `bgfx_set_dynamic_index_buffer`. + /// + void setIndexBuffer(DynamicIndexBufferHandle _handle); /// Set index buffer for draw primitive. /// @@ -1876,7 +1938,7 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_set_dynamic_index_buffer`. /// - void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex = 0, uint32_t _numIndices = UINT32_MAX); + void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices); /// Set index buffer for draw primitive. /// @@ -1917,11 +1979,20 @@ namespace bgfx /// Set vertex buffer for draw primitive. /// /// @param[in] _handle Dynamic vertex buffer. + /// + /// @attention C99 equivalent is `bgfx_set_dynamic_vertex_buffer`. + /// + void setVertexBuffer(DynamicVertexBufferHandle _handle); + + /// Set vertex buffer for draw primitive. + /// + /// @param[in] _handle Dynamic vertex buffer. + /// @param[in] _startVertex First vertex to render. /// @param[in] _numVertices Number of vertices to render. /// /// @attention C99 equivalent is `bgfx_set_dynamic_vertex_buffer`. /// - void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices = UINT32_MAX); + void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices); /// Set vertex buffer for draw primitive. /// @@ -2003,11 +2074,13 @@ namespace bgfx /// @param[in] _id View id. /// @param[in] _program Program. /// @param[in] _depth Depth for sorting. + /// @param[in] _preserveState Preserve internal draw state for next draw + /// call submit. /// @returns Number of draw calls. /// /// @attention C99 equivalent is `bgfx_submit`. /// - uint32_t submit(uint8_t _id, ProgramHandle _program, int32_t _depth = 0); + uint32_t submit(uint8_t _id, ProgramHandle _program, int32_t _depth = 0, bool _preserveState = false); /// Submit primitive with occlusion query for rendering. /// @@ -2015,11 +2088,13 @@ namespace bgfx /// @param[in] _program Program. /// @param[in] _occlusionQuery Occlusion query. /// @param[in] _depth Depth for sorting. + /// @param[in] _preserveState Preserve internal draw state for next draw + /// call submit. /// @returns Number of draw calls. /// /// @attention C99 equivalent is `bgfx_submit_occlusion_query. /// - uint32_t submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth = 0); + uint32_t submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth = 0, bool _preserveState = false); /// Submit primitive for rendering with index and instance data info from /// indirect buffer. @@ -2030,10 +2105,13 @@ namespace bgfx /// @param[in] _start First element in indirect buffer. /// @param[in] _num Number of dispatches. /// @param[in] _depth Depth for sorting. + /// @param[in] _preserveState Preserve internal draw state for next draw + /// call submit. + /// @returns Number of draw calls. /// /// @attention C99 equivalent is `bgfx_submit_indirect`. /// - uint32_t submit(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start = 0, uint16_t _num = 1, int32_t _depth = 0); + uint32_t submit(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start = 0, uint16_t _num = 1, int32_t _depth = 0, bool _preserveState = false); /// Set compute index buffer. /// diff --git a/3rdparty/bgfx/include/bgfx/bgfxdefines.h b/3rdparty/bgfx/include/bgfx/bgfxdefines.h index b80622743a6..0fa429c8784 100644 --- a/3rdparty/bgfx/include/bgfx/bgfxdefines.h +++ b/3rdparty/bgfx/include/bgfx/bgfxdefines.h @@ -6,7 +6,7 @@ #ifndef BGFX_DEFINES_H_HEADER_GUARD #define BGFX_DEFINES_H_HEADER_GUARD -#define BGFX_API_VERSION UINT32_C(9) +#define BGFX_API_VERSION UINT32_C(11) /// #define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write. @@ -21,7 +21,7 @@ #define BGFX_STATE_DEPTH_TEST_NOTEQUAL UINT64_C(0x0000000000000060) //!< Enable depth test, not equal. #define BGFX_STATE_DEPTH_TEST_NEVER UINT64_C(0x0000000000000070) //!< Enable depth test, never. #define BGFX_STATE_DEPTH_TEST_ALWAYS UINT64_C(0x0000000000000080) //!< Enable depth test, always. -#define BGFX_STATE_DEPTH_TEST_SHIFT 4 +#define BGFX_STATE_DEPTH_TEST_SHIFT 4 //!< Depth test state bit shift. #define BGFX_STATE_DEPTH_TEST_MASK UINT64_C(0x00000000000000f0) //!< Depth test state bit mask. #define BGFX_STATE_BLEND_ZERO UINT64_C(0x0000000000001000) //!< @@ -149,19 +149,19 @@ #define BGFX_STENCIL_TEST_NOTEQUAL UINT32_C(0x00060000) //!< #define BGFX_STENCIL_TEST_NEVER UINT32_C(0x00070000) //!< #define BGFX_STENCIL_TEST_ALWAYS UINT32_C(0x00080000) //!< -#define BGFX_STENCIL_TEST_SHIFT 16 //!< -#define BGFX_STENCIL_TEST_MASK UINT32_C(0x000f0000) //!< - -#define BGFX_STENCIL_OP_FAIL_S_ZERO UINT32_C(0x00000000) //!< -#define BGFX_STENCIL_OP_FAIL_S_KEEP UINT32_C(0x00100000) //!< -#define BGFX_STENCIL_OP_FAIL_S_REPLACE UINT32_C(0x00200000) //!< -#define BGFX_STENCIL_OP_FAIL_S_INCR UINT32_C(0x00300000) //!< -#define BGFX_STENCIL_OP_FAIL_S_INCRSAT UINT32_C(0x00400000) //!< -#define BGFX_STENCIL_OP_FAIL_S_DECR UINT32_C(0x00500000) //!< -#define BGFX_STENCIL_OP_FAIL_S_DECRSAT UINT32_C(0x00600000) //!< -#define BGFX_STENCIL_OP_FAIL_S_INVERT UINT32_C(0x00700000) //!< -#define BGFX_STENCIL_OP_FAIL_S_SHIFT 20 //!< -#define BGFX_STENCIL_OP_FAIL_S_MASK UINT32_C(0x00f00000) //!< +#define BGFX_STENCIL_TEST_SHIFT 16 //!< Stencil test bit shift. +#define BGFX_STENCIL_TEST_MASK UINT32_C(0x000f0000) //!< Stencil test bit mask. + +#define BGFX_STENCIL_OP_FAIL_S_ZERO UINT32_C(0x00000000) //!< Zero. +#define BGFX_STENCIL_OP_FAIL_S_KEEP UINT32_C(0x00100000) //!< Keep. +#define BGFX_STENCIL_OP_FAIL_S_REPLACE UINT32_C(0x00200000) //!< Replace. +#define BGFX_STENCIL_OP_FAIL_S_INCR UINT32_C(0x00300000) //!< Increment and wrap. +#define BGFX_STENCIL_OP_FAIL_S_INCRSAT UINT32_C(0x00400000) //!< Increment and clamp. +#define BGFX_STENCIL_OP_FAIL_S_DECR UINT32_C(0x00500000) //!< Decrement and wrap. +#define BGFX_STENCIL_OP_FAIL_S_DECRSAT UINT32_C(0x00600000) //!< Decrement and clamp. +#define BGFX_STENCIL_OP_FAIL_S_INVERT UINT32_C(0x00700000) //!< Invert. +#define BGFX_STENCIL_OP_FAIL_S_SHIFT 20 //!< Stencil operation fail bit shift. +#define BGFX_STENCIL_OP_FAIL_S_MASK UINT32_C(0x00f00000) //!< Stencil operation fail bit mask. #define BGFX_STENCIL_OP_FAIL_Z_ZERO UINT32_C(0x00000000) //!< #define BGFX_STENCIL_OP_FAIL_Z_KEEP UINT32_C(0x01000000) //!< @@ -171,8 +171,8 @@ #define BGFX_STENCIL_OP_FAIL_Z_DECR UINT32_C(0x05000000) //!< #define BGFX_STENCIL_OP_FAIL_Z_DECRSAT UINT32_C(0x06000000) //!< #define BGFX_STENCIL_OP_FAIL_Z_INVERT UINT32_C(0x07000000) //!< -#define BGFX_STENCIL_OP_FAIL_Z_SHIFT 24 //!< -#define BGFX_STENCIL_OP_FAIL_Z_MASK UINT32_C(0x0f000000) //!< +#define BGFX_STENCIL_OP_FAIL_Z_SHIFT 24 //!< Stencil operation fail depth bit shift. +#define BGFX_STENCIL_OP_FAIL_Z_MASK UINT32_C(0x0f000000) //!< Stencil operation fail depth bit mask. #define BGFX_STENCIL_OP_PASS_Z_ZERO UINT32_C(0x00000000) //!< #define BGFX_STENCIL_OP_PASS_Z_KEEP UINT32_C(0x10000000) //!< @@ -182,8 +182,8 @@ #define BGFX_STENCIL_OP_PASS_Z_DECR UINT32_C(0x50000000) //!< #define BGFX_STENCIL_OP_PASS_Z_DECRSAT UINT32_C(0x60000000) //!< #define BGFX_STENCIL_OP_PASS_Z_INVERT UINT32_C(0x70000000) //!< -#define BGFX_STENCIL_OP_PASS_Z_SHIFT 28 //!< -#define BGFX_STENCIL_OP_PASS_Z_MASK UINT32_C(0xf0000000) //!< +#define BGFX_STENCIL_OP_PASS_Z_SHIFT 28 //!< Stencil operation pass depth bit shift. +#define BGFX_STENCIL_OP_PASS_Z_MASK UINT32_C(0xf0000000) //!< Stencil operation pass depth bit mask. #define BGFX_STENCIL_NONE UINT32_C(0x00000000) //!< #define BGFX_STENCIL_MASK UINT32_C(0xffffffff) //!< diff --git a/3rdparty/bgfx/include/bgfx/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/bgfxplatform.h index 52b330112d5..1912c05b9d8 100644 --- a/3rdparty/bgfx/include/bgfx/bgfxplatform.h +++ b/3rdparty/bgfx/include/bgfx/bgfxplatform.h @@ -232,7 +232,7 @@ namespace bgfx } // namespace bgfx -#elif BX_PLATFORM_WINRT +#elif BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT # include <Unknwn.h> namespace bgfx diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfx.h b/3rdparty/bgfx/include/bgfx/c99/bgfx.h index cba442ef0be..736ac51f132 100644 --- a/3rdparty/bgfx/include/bgfx/c99/bgfx.h +++ b/3rdparty/bgfx/include/bgfx/c99/bgfx.h @@ -149,6 +149,10 @@ typedef enum bgfx_texture_format BGFX_TEXTURE_FORMAT_RG32I, BGFX_TEXTURE_FORMAT_RG32U, BGFX_TEXTURE_FORMAT_RG32F, + BGFX_TEXTURE_FORMAT_RGB8, + BGFX_TEXTURE_FORMAT_RGB8I, + BGFX_TEXTURE_FORMAT_RGB8U, + BGFX_TEXTURE_FORMAT_RGB8S, BGFX_TEXTURE_FORMAT_RGB9E5F, BGFX_TEXTURE_FORMAT_BGRA8, BGFX_TEXTURE_FORMAT_RGBA8, @@ -220,6 +224,17 @@ typedef enum bgfx_occlusion_query_result } bgfx_occlusion_query_result_t; +typedef enum bgfx_topology_convert +{ + BGFX_TOPOLOGY_CONVERT_TRI_LIST_FLIP_WINDING, + BGFX_TOPOLOGY_CONVERT_TRI_LIST_TO_LINE_LIST, + BGFX_TOPOLOGY_CONVERT_TRI_STRIP_TO_TRI_LIST, + BGFX_TOPOLOGY_CONVERT_LINE_STRIP_TO_LINE_LIST, + + BGFX_TOPOLOGY_CONVERT_COUNT + +} bgfx_topology_convert_t; + #define BGFX_HANDLE_T(_name) \ typedef struct _name { uint16_t idx; } _name##_t @@ -753,7 +768,7 @@ BGFX_C_API void bgfx_set_transient_index_buffer(const bgfx_transient_index_buffe BGFX_C_API void bgfx_set_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); /**/ -BGFX_C_API void bgfx_set_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _numVertices); +BGFX_C_API void bgfx_set_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); /**/ BGFX_C_API void bgfx_set_transient_vertex_buffer(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices); @@ -777,13 +792,13 @@ BGFX_C_API void bgfx_set_texture_from_frame_buffer(uint8_t _stage, bgfx_uniform_ BGFX_C_API uint32_t bgfx_touch(uint8_t _id); /**/ -BGFX_C_API uint32_t bgfx_submit(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth); +BGFX_C_API uint32_t bgfx_submit(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState); /**/ -BGFX_C_API uint32_t bgfx_submit_occlusion_query(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth); +BGFX_C_API uint32_t bgfx_submit_occlusion_query(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState); /**/ -BGFX_C_API uint32_t bgfx_submit_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth); +BGFX_C_API uint32_t bgfx_submit_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState); /**/ BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h index 61ff57d2b29..0253a482e24 100644 --- a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h +++ b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h @@ -77,6 +77,7 @@ typedef struct bgfx_interface_vtbl void (*vertex_unpack)(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, const void* _data, uint32_t _index); void (*vertex_convert)(const bgfx_vertex_decl_t* _destDecl, void* _destData, const bgfx_vertex_decl_t* _srcDecl, const void* _srcData, uint32_t _num); uint16_t (*weld_vertices)(uint16_t* _output, const bgfx_vertex_decl_t* _decl, const void* _data, uint16_t _num, float _epsilon); + uint32_t (*topology_convert)(bgfx_topology_convert_t _conversion, void* _dst, uint32_t _dstSize, const void* _indices, uint32_t _numIndices, bool _index32); void (*image_swizzle_bgra8)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst); void (*image_rgba8_downsample_2x2)(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst); uint8_t (*get_supported_renderers)(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT]); @@ -170,7 +171,7 @@ typedef struct bgfx_interface_vtbl void (*set_dynamic_index_buffer)(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); void (*set_transient_index_buffer)(const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices); void (*set_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); - void (*set_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _numVertices); + void (*set_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); void (*set_transient_vertex_buffer)(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices); void (*set_instance_data_buffer)(const bgfx_instance_data_buffer_t* _idb, uint32_t _num); void (*set_instance_data_from_vertex_buffer)(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); @@ -178,9 +179,9 @@ typedef struct bgfx_interface_vtbl void (*set_texture)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags); void (*set_texture_from_frame_buffer)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, uint32_t _flags); uint32_t (*touch)(uint8_t _id); - uint32_t (*submit)(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth); - uint32_t (*submit_occlusion_query)(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth); - uint32_t (*submit_indirect)(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth); + uint32_t (*submit)(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState); + uint32_t (*submit_occlusion_query)(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState); + uint32_t (*submit_indirect)(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState); void (*set_image)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); void (*set_image_from_frame_buffer)(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_access_t _access, bgfx_texture_format_t _format); void (*set_compute_index_buffer)(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); diff --git a/3rdparty/bgfx/makefile b/3rdparty/bgfx/makefile index afa61759a85..30f3e3eb9c4 100644 --- a/3rdparty/bgfx/makefile +++ b/3rdparty/bgfx/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 # @@ -16,6 +16,9 @@ endif endif else OS=windows + +help: projgen + endif # $(info $(OS)) @@ -23,7 +26,18 @@ endif BX_DIR?=../bx GENIE?=$(BX_DIR)/tools/bin/$(OS)/genie -all: +.PHONY: help + +help: + @echo Available targets: + @grep -E "^[a-zA-Z0-9_-]+:.*?## .*$$" $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +clean: ## Clean all intermediate files. + @echo Cleaning... + -@rm -rf .build + @mkdir .build + +projgen: ## Generate project files for all configurations. $(GENIE) --with-tools --with-shared-lib vs2008 $(GENIE) --with-tools --with-shared-lib vs2010 $(GENIE) --with-tools --with-shared-lib vs2012 @@ -49,171 +63,207 @@ all: .build/projects/gmake-android-arm: $(GENIE) --gcc=android-arm gmake -android-arm-debug: .build/projects/gmake-android-arm +android-arm-debug: .build/projects/gmake-android-arm ## Build - Android ARM Debug $(MAKE) -R -C .build/projects/gmake-android-arm config=debug -android-arm-release: .build/projects/gmake-android-arm +android-arm-release: .build/projects/gmake-android-arm ## Build - Android ARM Release $(MAKE) -R -C .build/projects/gmake-android-arm config=release -android-arm: android-arm-debug android-arm-release +android-arm: android-arm-debug android-arm-release ## Build - Android ARM Debug and Release .build/projects/gmake-android-mips: $(GENIE) --gcc=android-mips gmake -android-mips-debug: .build/projects/gmake-android-mips +android-mips-debug: .build/projects/gmake-android-mips ## Build - Android MIPS Debug $(MAKE) -R -C .build/projects/gmake-android-mips config=debug -android-mips-release: .build/projects/gmake-android-mips +android-mips-release: .build/projects/gmake-android-mips ## Build - Android MIPS Release $(MAKE) -R -C .build/projects/gmake-android-mips config=release -android-mips: android-mips-debug android-mips-release +android-mips: android-mips-debug android-mips-release ## Build - Android MIPS Debug and Release .build/projects/gmake-android-x86: $(GENIE) --gcc=android-x86 gmake -android-x86-debug: .build/projects/gmake-android-x86 +android-x86-debug: .build/projects/gmake-android-x86 ## Build - Android x86 Debug and Release $(MAKE) -R -C .build/projects/gmake-android-x86 config=debug -android-x86-release: .build/projects/gmake-android-x86 +android-x86-release: .build/projects/gmake-android-x86 ## Build - Android x86 Debug and Release $(MAKE) -R -C .build/projects/gmake-android-x86 config=release -android-x86: android-x86-debug android-x86-release +android-x86: android-x86-debug android-x86-release ## Build - Android x86 Debug and Release .build/projects/gmake-asmjs: $(GENIE) --gcc=asmjs gmake -asmjs-debug: .build/projects/gmake-asmjs +asmjs-debug: .build/projects/gmake-asmjs ## Build - Emscripten Debug $(MAKE) -R -C .build/projects/gmake-asmjs config=debug -asmjs-release: .build/projects/gmake-asmjs +asmjs-release: .build/projects/gmake-asmjs ## Build - Emscripten Release $(MAKE) -R -C .build/projects/gmake-asmjs config=release -asmjs: asmjs-debug asmjs-release +asmjs: asmjs-debug asmjs-release ## Build - Emscripten Debug and Release .build/projects/gmake-linux: $(GENIE) --with-tools --with-shared-lib --gcc=linux-gcc gmake -linux-debug32: .build/projects/gmake-linux +linux-debug32: .build/projects/gmake-linux ## Build - Linux x86 Debug $(MAKE) -R -C .build/projects/gmake-linux config=debug32 -linux-release32: .build/projects/gmake-linux +linux-release32: .build/projects/gmake-linux ## Build - Linux x86 Release $(MAKE) -R -C .build/projects/gmake-linux config=release32 -linux-debug64: .build/projects/gmake-linux +linux-debug64: .build/projects/gmake-linux ## Build - Linux x64 Debug $(MAKE) -R -C .build/projects/gmake-linux config=debug64 -linux-release64: .build/projects/gmake-linux +linux-release64: .build/projects/gmake-linux ## Build - Linux x64 Release $(MAKE) -R -C .build/projects/gmake-linux config=release64 -linux: linux-debug32 linux-release32 linux-debug64 linux-release64 +linux: linux-debug32 linux-release32 linux-debug64 linux-release64 ## Build - Linux x86/x64 Debug and Release .build/projects/gmake-freebsd: $(GENIE) --with-tools --with-shared-lib --gcc=freebsd gmake -freebsd-debug32: .build/projects/gmake-freebsd +freebsd-debug32: .build/projects/gmake-freebsd ## Build - FreeBSD x86 Debug $(MAKE) -R -C .build/projects/gmake-freebsd config=debug32 -freebsd-release32: .build/projects/gmake-freebsd +freebsd-release32: .build/projects/gmake-freebsd ## Build - FreeBSD x86 Release $(MAKE) -R -C .build/projects/gmake-freebsd config=release32 -freebsd-debug64: .build/projects/gmake-freebsd +freebsd-debug64: .build/projects/gmake-freebsd ## Build - FreeBSD x86 Debug $(MAKE) -R -C .build/projects/gmake-freebsd config=debug64 -freebsd-release64: .build/projects/gmake-freebsd +freebsd-release64: .build/projects/gmake-freebsd ## Build - FreeBSD x86 Release $(MAKE) -R -C .build/projects/gmake-freebsd config=release64 -freebsd: freebsd-debug32 freebsd-release32 freebsd-debug64 freebsd-release64 +freebsd: freebsd-debug32 freebsd-release32 freebsd-debug64 freebsd-release64 ## Build - FreeBSD x86/x64 Debug and Release .build/projects/gmake-mingw-gcc: $(GENIE) --with-tools --with-shared-lib --gcc=mingw-gcc gmake -mingw-gcc-debug32: .build/projects/gmake-mingw-gcc +mingw-gcc-debug32: .build/projects/gmake-mingw-gcc ## Build - MinGW GCC x86 Debug $(MAKE) -R -C .build/projects/gmake-mingw-gcc config=debug32 -mingw-gcc-release32: .build/projects/gmake-mingw-gcc +mingw-gcc-release32: .build/projects/gmake-mingw-gcc ## Build - MinGW GCC x86 Release $(MAKE) -R -C .build/projects/gmake-mingw-gcc config=release32 -mingw-gcc-debug64: .build/projects/gmake-mingw-gcc +mingw-gcc-debug64: .build/projects/gmake-mingw-gcc ## Build - MinGW GCC x64 Debug $(MAKE) -R -C .build/projects/gmake-mingw-gcc config=debug64 -mingw-gcc-release64: .build/projects/gmake-mingw-gcc +mingw-gcc-release64: .build/projects/gmake-mingw-gcc ## Build - MinGW GCC x64 Release $(MAKE) -R -C .build/projects/gmake-mingw-gcc config=release64 -mingw-gcc: mingw-gcc-debug32 mingw-gcc-release32 mingw-gcc-debug64 mingw-gcc-release64 +mingw-gcc: mingw-gcc-debug32 mingw-gcc-release32 mingw-gcc-debug64 mingw-gcc-release64 ## Build - MinGW GCC x86/x64 Debug and Release .build/projects/gmake-mingw-clang: $(GENIE) --gcc=mingw-clang gmake -mingw-clang-debug32: .build/projects/gmake-mingw-clang +mingw-clang-debug32: .build/projects/gmake-mingw-clang ## Build - MinGW Clang x86 Debug $(MAKE) -R -C .build/projects/gmake-mingw-clang config=debug32 -mingw-clang-release32: .build/projects/gmake-mingw-clang +mingw-clang-release32: .build/projects/gmake-mingw-clang ## Build - MinGW Clang x86 Release $(MAKE) -R -C .build/projects/gmake-mingw-clang config=release32 -mingw-clang-debug64: .build/projects/gmake-mingw-clang +mingw-clang-debug64: .build/projects/gmake-mingw-clang ## Build - MinGW Clang x64 Debug $(MAKE) -R -C .build/projects/gmake-mingw-clang config=debug64 -mingw-clang-release64: .build/projects/gmake-mingw-clang +mingw-clang-release64: .build/projects/gmake-mingw-clang ## Build - MinGW Clang x64 Release $(MAKE) -R -C .build/projects/gmake-mingw-clang config=release64 -mingw-clang: mingw-clang-debug32 mingw-clang-release32 mingw-clang-debug64 mingw-clang-release64 +mingw-clang: mingw-clang-debug32 mingw-clang-release32 mingw-clang-debug64 mingw-clang-release64 ## Build - MinGW Clang x86/x64 Debug and Release .build/projects/vs2008: $(GENIE) --with-tools --with-shared-lib vs2008 -vs2008-debug32: .build/projects/vs2008 +vs2008-debug32: .build/projects/vs2008 ## Build - VS2008 x86 Debug devenv .build/projects/vs2008/bgfx.sln /Build "Debug|Win32" -vs2008-release32: .build/projects/vs2008 +vs2008-release32: .build/projects/vs2008 ## Build - VS2008 x86 Release devenv .build/projects/vs2008/bgfx.sln /Build "Release|Win32" -vs2008-debug64: .build/projects/vs2008 +vs2008-debug64: .build/projects/vs2008 ## Build - VS2008 x64 Debug devenv .build/projects/vs2008/bgfx.sln /Build "Debug|x64" -vs2008-release64: .build/projects/vs2008 +vs2008-release64: .build/projects/vs2008 ## Build - VS2008 x64 Release devenv .build/projects/vs2008/bgfx.sln /Build "Release|x64" -vs2008: vs2008-debug32 vs2008-release32 vs2008-debug64 vs2008-release64 +vs2008: vs2008-debug32 vs2008-release32 vs2008-debug64 vs2008-release64 ## Build - VS2008 x86/x64 Debug and Release .build/projects/vs2010: $(GENIE) --with-tools --with-shared-lib vs2010 +vs2010-debug32: .build/projects/vs2010 ## Build - VS2010 x86 Debug + devenv .build/projects/vs2010/bgfx.sln /Build "Debug|Win32" +vs2010-release32: .build/projects/vs2010 ## Build - VS2010 x86 Release + devenv .build/projects/vs2010/bgfx.sln /Build "Release|Win32" +vs2010-debug64: .build/projects/vs2010 ## Build - VS2010 x64 Debug + devenv .build/projects/vs2010/bgfx.sln /Build "Debug|x64" +vs2010-release64: .build/projects/vs2010 ## Build - VS2010 x64 Release + devenv .build/projects/vs2010/bgfx.sln /Build "Release|x64" +vs2010: vs2010-debug32 vs2010-release32 vs2010-debug64 vs2010-release64 ## Build - VS2010 x86/x64 Debug and Release .build/projects/vs2012: $(GENIE) --with-tools --with-shared-lib vs2012 +vs2012-debug32: .build/projects/vs2012 ## Build - VS2012 x86 Debug + devenv .build/projects/vs2012/bgfx.sln /Build "Debug|Win32" +vs2012-release32: .build/projects/vs2012 ## Build - VS2012 x86 Release + devenv .build/projects/vs2012/bgfx.sln /Build "Release|Win32" +vs2012-debug64: .build/projects/vs2012 ## Build - VS2012 x64 Debug + devenv .build/projects/vs2012/bgfx.sln /Build "Debug|x64" +vs2012-release64: .build/projects/vs2012 ## Build - VS2012 x64 Release + devenv .build/projects/vs2012/bgfx.sln /Build "Release|x64" +vs2012: vs2012-debug32 vs2012-release32 vs2012-debug64 vs2012-release64 ## Build - VS2012 x86/x64 Debug and Release .build/projects/vs2013: $(GENIE) --with-tools --with-shared-lib vs2013 +vs2013-debug32: .build/projects/vs2013 ## Build - VS2013 x86 Debug + devenv .build/projects/vs2013/bgfx.sln /Build "Debug|Win32" +vs2013-release32: .build/projects/vs2013 ## Build - VS2013 x86 Release + devenv .build/projects/vs2013/bgfx.sln /Build "Release|Win32" +vs2013-debug64: .build/projects/vs2013 ## Build - VS2013 x64 Debug + devenv .build/projects/vs2013/bgfx.sln /Build "Debug|x64" +vs2013-release64: .build/projects/vs2013 ## Build - VS2013 x64 Release + devenv .build/projects/vs2013/bgfx.sln /Build "Release|x64" +vs2013: vs2013-debug32 vs2013-release32 vs2013-debug64 vs2013-release64 ## Build - VS2013 x86/x64 Debug and Release .build/projects/vs2015: $(GENIE) --with-tools --with-shared-lib vs2015 +vs2015-debug32: .build/projects/vs2015 ## Build - VS2015 x86 Debug + devenv .build/projects/vs2015/bgfx.sln /Build "Debug|Win32" +vs2015-release32: .build/projects/vs2015 ## Build - VS2015 x86 Release + devenv .build/projects/vs2015/bgfx.sln /Build "Release|Win32" +vs2015-debug64: .build/projects/vs2015 ## Build - VS2015 x64 Debug + devenv .build/projects/vs2015/bgfx.sln /Build "Debug|x64" +vs2015-release64: .build/projects/vs2015 ## Build - VS2015 x64 Release + devenv .build/projects/vs2015/bgfx.sln /Build "Release|x64" +vs2015: vs2015-debug32 vs2015-release32 vs2015-debug64 vs2015-release64 ## Build - VS2015 x86/x64 Debug and Release .build/projects/gmake-nacl: $(GENIE) --gcc=nacl gmake -nacl-debug32: .build/projects/gmake-nacl +nacl-debug32: .build/projects/gmake-nacl ## Build - Native Client x86 Debug $(MAKE) -R -C .build/projects/gmake-nacl config=debug32 -nacl-release32: .build/projects/gmake-nacl +nacl-release32: .build/projects/gmake-nacl ## Build - Native Client x86 Release $(MAKE) -R -C .build/projects/gmake-nacl config=release32 -nacl-debug64: .build/projects/gmake-nacl +nacl-debug64: .build/projects/gmake-nacl ## Build - Native Client x64 Debug $(MAKE) -R -C .build/projects/gmake-nacl config=debug64 -nacl-release64: .build/projects/gmake-nacl +nacl-release64: .build/projects/gmake-nacl ## Build - Native Client x64 Release $(MAKE) -R -C .build/projects/gmake-nacl config=release64 -nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64 +nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64 ## Build - Native Client x86/x64 Debug and Release .build/projects/gmake-nacl-arm: $(GENIE) --gcc=nacl-arm gmake -nacl-arm-debug: .build/projects/gmake-nacl-arm +nacl-arm-debug: .build/projects/gmake-nacl-arm ## Build - Native Client ARM Debug $(MAKE) -R -C .build/projects/gmake-nacl-arm config=debug -nacl-arm-release: .build/projects/gmake-nacl-arm +nacl-arm-release: .build/projects/gmake-nacl-arm ## Build - Native Client ARM Release $(MAKE) -R -C .build/projects/gmake-nacl-arm config=release -nacl-arm: nacl-arm-debug32 nacl-arm-release32 +nacl-arm: nacl-arm-debug32 nacl-arm-release32 ## Build - Native Client ARM Debug and Release .build/projects/gmake-pnacl: $(GENIE) --gcc=pnacl gmake -pnacl-debug: .build/projects/gmake-pnacl +pnacl-debug: .build/projects/gmake-pnacl ## Build - Portable Native Client Debug $(MAKE) -R -C .build/projects/gmake-pnacl config=debug -pnacl-release: .build/projects/gmake-pnacl +pnacl-release: .build/projects/gmake-pnacl ## Build - Portable Native Client Release $(MAKE) -R -C .build/projects/gmake-pnacl config=release -pnacl: pnacl-debug pnacl-release +pnacl: pnacl-debug pnacl-release ## Build - Portable Native Client Debug and Release .build/projects/gmake-osx: $(GENIE) --with-tools --with-shared-lib --gcc=osx gmake -osx-debug32: .build/projects/gmake-osx +osx-debug32: .build/projects/gmake-osx ## Build - OSX x86 Debug $(MAKE) -C .build/projects/gmake-osx config=debug32 -osx-release32: .build/projects/gmake-osx +osx-release32: .build/projects/gmake-osx ## Build - OSX x86 Release $(MAKE) -C .build/projects/gmake-osx config=release32 -osx-debug64: .build/projects/gmake-osx +osx-debug64: .build/projects/gmake-osx ## Build - OSX x64 Debug $(MAKE) -C .build/projects/gmake-osx config=debug64 -osx-release64: .build/projects/gmake-osx +osx-release64: .build/projects/gmake-osx ## Build - OSX x64 Release $(MAKE) -C .build/projects/gmake-osx config=release64 -osx: osx-debug32 osx-release32 osx-debug64 osx-release64 +osx: osx-debug32 osx-release32 osx-debug64 osx-release64 ## Build - OSX x86/x64 Debug and Release .build/projects/gmake-ios-arm: $(GENIE) --gcc=ios-arm gmake -ios-arm-debug: .build/projects/gmake-ios-arm +ios-arm-debug: .build/projects/gmake-ios-arm ## Build - iOS ARM Debug $(MAKE) -R -C .build/projects/gmake-ios-arm config=debug -ios-arm-release: .build/projects/gmake-ios-arm +ios-arm-release: .build/projects/gmake-ios-arm ## Build - iOS ARM Release $(MAKE) -R -C .build/projects/gmake-ios-arm config=release -ios-arm: ios-arm-debug ios-arm-release +ios-arm: ios-arm-debug ios-arm-release ## Build - iOS ARM Debug and Release .build/projects/gmake-ios-simulator: $(GENIE) --gcc=ios-simulator gmake -ios-simulator-debug: .build/projects/gmake-ios-simulator +ios-simulator-debug: .build/projects/gmake-ios-simulator ## Build - iOS Simulator Debug $(MAKE) -R -C .build/projects/gmake-ios-simulator config=debug -ios-simulator-release: .build/projects/gmake-ios-simulator +ios-simulator-release: .build/projects/gmake-ios-simulator ## Build - iOS Simulator Release $(MAKE) -R -C .build/projects/gmake-ios-simulator config=release -ios-simulator: ios-simulator-debug ios-simulator-release +ios-simulator: ios-simulator-debug ios-simulator-release ## Build - iOS Simulator Debug and Release .build/projects/gmake-rpi: $(GENIE) --gcc=rpi gmake -rpi-debug: .build/projects/gmake-rpi +rpi-debug: .build/projects/gmake-rpi ## Build - RasberryPi Debug $(MAKE) -R -C .build/projects/gmake-rpi config=debug -rpi-release: .build/projects/gmake-rpi +rpi-release: .build/projects/gmake-rpi ## Build - RasberryPi Release $(MAKE) -R -C .build/projects/gmake-rpi config=release -rpi: rpi-debug rpi-release +rpi: rpi-debug rpi-release ## Build - RasberryPi Debug and Release build-darwin: osx @@ -234,10 +284,6 @@ docs: doxygen scripts/bgfx.doxygen markdown README.md > .build/docs/readme.html -clean: - @echo Cleaning... - -@rm -rf .build - ### SILENT ?= @ @@ -271,22 +317,48 @@ endif else OS=windows BUILD_PROJECT_DIR=gmake-mingw-gcc -BUILD_OUTPUT_DIR=win32_mingw-gcc -BUILD_TOOLS_CONFIG=release32 +BUILD_OUTPUT_DIR=win64_mingw-gcc +BUILD_TOOLS_CONFIG=release64 BUILD_TOOLS_SUFFIX=Release EXE=.exe endif -geometryc: .build/projects/$(BUILD_PROJECT_DIR) +geometryc: .build/projects/$(BUILD_PROJECT_DIR) ## Build geometryc tool. $(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f geometryc.make config=$(BUILD_TOOLS_CONFIG) $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/geometryc$(BUILD_TOOLS_SUFFIX)$(EXE) tools/bin/$(OS)/geometryc$(EXE) -shaderc: .build/projects/$(BUILD_PROJECT_DIR) +shaderc: .build/projects/$(BUILD_PROJECT_DIR) ## Build shaderc tool. $(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f shaderc.make config=$(BUILD_TOOLS_CONFIG) $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/shaderc$(BUILD_TOOLS_SUFFIX)$(EXE) tools/bin/$(OS)/shaderc$(EXE) -texturec: .build/projects/$(BUILD_PROJECT_DIR) +texturec: .build/projects/$(BUILD_PROJECT_DIR) ## Build texturec tool. $(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) -f texturec.make config=$(BUILD_TOOLS_CONFIG) $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/texturec$(BUILD_TOOLS_SUFFIX)$(EXE) tools/bin/$(OS)/texturec$(EXE) -tools: geometryc shaderc texturec +tools: geometryc shaderc texturec ## Build tools. + +dist-windows: .build/projects/gmake-mingw-gcc + $(SILENT) $(MAKE) -C .build/projects/gmake-mingw-gcc config=release64 -j 6 geometryc + $(SILENT) cp .build/win64_mingw-gcc/bin/geometrycRelease tools/bin/windows/geometryc.exe + $(SILENT) $(MAKE) -C .build/projects/gmake-mingw-gcc config=release64 -j 6 shaderc + $(SILENT) cp .build/win64_mingw-gcc/bin/shadercRelease tools/bin/windows/shaderc.exe + $(SILENT) $(MAKE) -C .build/projects/gmake-mingw-gcc config=release64 -j 6 texturec + $(SILENT) cp .build/win64_mingw-gcc/bin/texturecRelease tools/bin/windows/texturec.exe + +dist-linux: .build/projects/gmake-linux + $(SILENT) $(MAKE) -C .build/projects/gmake-linux config=release64 -j 6 geometryc + $(SILENT) cp .build/linux64_gcc/bin/geometrycRelease tools/bin/linux/geometryc + $(SILENT) $(MAKE) -C .build/projects/gmake-linux config=release64 -j 6 shaderc + $(SILENT) cp .build/linux64_gcc/bin/shadercRelease tools/bin/linux/shaderc + $(SILENT) $(MAKE) -C .build/projects/gmake-linux config=release64 -j 6 texturec + $(SILENT) cp .build/linux64_gcc/bin/texturecRelease tools/bin/linux/texturec + +dist-darwin: .build/projects/gmake-osx + $(SILENT) $(MAKE) -C .build/projects/gmake-osx config=release64 -j 6 geometryc + $(SILENT) cp .build/osx64_clang/bin/geometrycRelease tools/bin/darwin/geometryc + $(SILENT) $(MAKE) -C .build/projects/gmake-osx config=release64 -j 6 shaderc + $(SILENT) cp .build/osx64_clang/bin/shadercRelease tools/bin/darwin/shaderc + $(SILENT) $(MAKE) -C .build/projects/gmake-osx config=release64 -j 6 texturec + $(SILENT) cp .build/osx64_clang/bin/texturecRelease tools/bin/darwin/texturec + +dist: clean dist-windows dist-linux dist-darwin diff --git a/3rdparty/bgfx/scripts/genie.lua b/3rdparty/bgfx/scripts/genie.lua index 52554366dfb..a0fa5b712d1 100644 --- a/3rdparty/bgfx/scripts/genie.lua +++ b/3rdparty/bgfx/scripts/genie.lua @@ -218,7 +218,7 @@ function exampleProject(_name) configuration {} end - configuration { "vs*" } + configuration { "vs*", "x32 or x64" } linkoptions { "/ignore:4199", -- LNK4199: /DELAYLOAD:*.dll ignored; no imports found from *.dll } @@ -226,7 +226,7 @@ function exampleProject(_name) "DelayImp", } - configuration { "vs201*" } + configuration { "vs201*", "x32 or x64" } linkoptions { -- this is needed only for testing with GLES2/3 on Windows with VS201x "/DELAYLOAD:\"libEGL.dll\"", "/DELAYLOAD:\"libGLESv2.dll\"", @@ -234,13 +234,24 @@ function exampleProject(_name) configuration { "mingw*" } targetextension ".exe" + links { + "gdi32", + "psapi", + } - configuration { "vs20* or mingw*" } + configuration { "vs20*", "x32 or x64" } links { "gdi32", "psapi", } + configuration { "durango" } + links { + "d3d11_x", + "combase", + "kernelx", + } + configuration { "winphone8* or winstore8*" } removelinks { "DelayImp", @@ -318,7 +329,7 @@ function exampleProject(_name) "SDL2", "pthread", } - + configuration { "rpi" } links { "X11", @@ -409,6 +420,7 @@ exampleProject("23-vectordisplay") exampleProject("24-nbody") exampleProject("26-occlusion") exampleProject("27-terrain") +exampleProject("28-wireframe") -- C99 source doesn't compile under WinRT settings if not premake.vstudio.iswinrt() then diff --git a/3rdparty/bgfx/scripts/shader-embeded.mk b/3rdparty/bgfx/scripts/shader-embeded.mk index 59bb3d9d037..d6ccecf61dd 100644 --- a/3rdparty/bgfx/scripts/shader-embeded.mk +++ b/3rdparty/bgfx/scripts/shader-embeded.mk @@ -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 # @@ -8,14 +8,17 @@ include $(THISDIR)/tools.mk VS_FLAGS+=-i $(THISDIR)../src/ --type vertex FS_FLAGS+=-i $(THISDIR)../src/ --type fragment +CS_FLAGS+=-i $(THISDIR)../src/ --type compute VS_SOURCES=$(wildcard vs_*.sc) FS_SOURCES=$(wildcard fs_*.sc) +CS_SOURCES=$(wildcard cs_*.sc) VS_BIN = $(addsuffix .bin.h, $(basename $(VS_SOURCES))) FS_BIN = $(addsuffix .bin.h, $(basename $(FS_SOURCES))) +CS_BIN = $(addsuffix .bin.h, $(basename $(CS_SOURCES))) -BIN = $(VS_BIN) $(FS_BIN) +BIN = $(VS_BIN) $(FS_BIN) $(CS_BIN) SHADER_TMP = $(TEMP)/tmp @@ -41,6 +44,13 @@ fs_%.bin.h : fs_%.sc -$(SILENT) $(SHADERC) $(FS_FLAGS) --platform ios -p metal -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_mtl -@cat $(SHADER_TMP) >> $(@) +cs_%.bin.h : cs_%.sc + @echo [$(<)] + $(SILENT) $(SHADERC) $(CS_FLAGS) --platform linux -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl + @cat $(SHADER_TMP) > $(@) + -$(SILENT) $(SHADERC) $(CS_FLAGS) --platform windows -p cs_5_0 -O 1 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11 + -@cat $(SHADER_TMP) >> $(@) + .PHONY: all all: $(BIN) diff --git a/3rdparty/bgfx/scripts/shader.mk b/3rdparty/bgfx/scripts/shader.mk index d7e0e151597..7a479ea8896 100644 --- a/3rdparty/bgfx/scripts/shader.mk +++ b/3rdparty/bgfx/scripts/shader.mk @@ -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 # diff --git a/3rdparty/bgfx/scripts/tools.mk b/3rdparty/bgfx/scripts/tools.mk index fec2885b7be..1c810c0d14d 100644 --- a/3rdparty/bgfx/scripts/tools.mk +++ b/3rdparty/bgfx/scripts/tools.mk @@ -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 # diff --git a/3rdparty/bgfx/src/amalgamated.cpp b/3rdparty/bgfx/src/amalgamated.cpp index d98dd37ddab..d61f06845cd 100644 --- a/3rdparty/bgfx/src/amalgamated.cpp +++ b/3rdparty/bgfx/src/amalgamated.cpp @@ -20,4 +20,5 @@ #include "shader_dxbc.cpp" #include "shader_dx9bc.cpp" #include "shader_spirv.cpp" +#include "topology.cpp" #include "vertexdecl.cpp" diff --git a/3rdparty/bgfx/src/bgfx.cpp b/3rdparty/bgfx/src/bgfx.cpp index e16d4f71c3f..0e9a558903c 100644 --- a/3rdparty/bgfx/src/bgfx.cpp +++ b/3rdparty/bgfx/src/bgfx.cpp @@ -18,6 +18,9 @@ # include <remotery/lib/Remotery.c> #endif // BGFX_CONFIG_PROFILER_REMOTERY_BUILD_LIB +#include <bx/crtimpl.h> +#include "topology.h" + namespace bgfx { #define BGFX_MAIN_THREAD_MAGIC UINT32_C(0x78666762) @@ -700,7 +703,8 @@ namespace bgfx } } else if (RendererType::OpenGLES == g_caps.rendererType - || RendererType::OpenGL == g_caps.rendererType) + || RendererType::OpenGL == g_caps.rendererType + || RendererType::Vulkan == g_caps.rendererType) { vsh = createShader(makeRef(vs_clear_glsl, sizeof(vs_clear_glsl) ) ); @@ -844,7 +848,7 @@ namespace bgfx return PredefinedUniform::Count; } - uint32_t Frame::submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth) + uint32_t Frame::submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) { if (m_discard) { @@ -891,9 +895,12 @@ namespace bgfx m_renderItem[m_numRenderItems].draw = m_draw; ++m_numRenderItems; - m_draw.clear(); - m_uniformBegin = m_uniformEnd; - m_stateFlags = BGFX_STATE_NONE; + if (!_preserveState) + { + m_draw.clear(); + m_uniformBegin = m_uniformEnd; + m_stateFlags = BGFX_STATE_NONE; + } return m_num; } @@ -981,13 +988,13 @@ namespace bgfx { m_sortKeys[ii] = SortKey::remapView(m_sortKeys[ii], m_viewRemap); } - bx::radixSort64(m_sortKeys, s_ctx->m_tempKeys, m_sortValues, s_ctx->m_tempValues, m_num); + bx::radixSort(m_sortKeys, s_ctx->m_tempKeys, m_sortValues, s_ctx->m_tempValues, m_num); for (uint32_t ii = 0, num = m_num; ii < num; ++ii) { m_blitKeys[ii] = BlitKey::remapView(m_blitKeys[ii], m_viewRemap); } - bx::radixSort32(m_blitKeys, (uint32_t*)&s_ctx->m_tempKeys, m_numBlitItems); + bx::radixSort(m_blitKeys, (uint32_t*)&s_ctx->m_tempKeys, m_numBlitItems); } RenderFrame::Enum renderFrame() @@ -1145,6 +1152,38 @@ namespace bgfx BX_TRACE("Max FB attachments: %d", g_caps.maxFBAttachments); } + TextureFormat::Enum getViableTextureFormat(const ImageContainer& _imageContainer) + { + const uint32_t formatCaps = g_caps.formats[_imageContainer.m_format]; + bool convert = 0 == formatCaps; + + if (_imageContainer.m_cubeMap) + { + convert |= 0 == (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_CUBE) + && 0 != (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED) + ; + } + else if (_imageContainer.m_depth > 1) + { + convert |= 0 == (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_3D) + && 0 != (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED) + ; + } + else + { + convert |= 0 == (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_2D) + && 0 != (formatCaps & BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED) + ; + } + + if (convert) + { + return TextureFormat::BGRA8; + } + + return _imageContainer.m_format; + } + static TextureFormat::Enum s_emulatedFormats[] = { TextureFormat::BC1, @@ -1244,20 +1283,17 @@ namespace bgfx for (uint32_t ii = 0; ii < BX_COUNTOF(s_emulatedFormats); ++ii) { const uint32_t fmt = s_emulatedFormats[ii]; - if (0 == (g_caps.formats[fmt] & BGFX_CAPS_FORMAT_TEXTURE_2D) ) - { - g_caps.formats[fmt] |= BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED; - } - - if (0 == (g_caps.formats[fmt] & BGFX_CAPS_FORMAT_TEXTURE_3D) ) - { - g_caps.formats[fmt] |= BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED; - } + g_caps.formats[fmt] |= 0 == (g_caps.formats[fmt] & BGFX_CAPS_FORMAT_TEXTURE_2D ) ? BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED : 0; + g_caps.formats[fmt] |= 0 == (g_caps.formats[fmt] & BGFX_CAPS_FORMAT_TEXTURE_3D ) ? BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED : 0; + g_caps.formats[fmt] |= 0 == (g_caps.formats[fmt] & BGFX_CAPS_FORMAT_TEXTURE_CUBE) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED : 0; + } - if (0 == (g_caps.formats[fmt] & BGFX_CAPS_FORMAT_TEXTURE_CUBE) ) - { - g_caps.formats[fmt] |= BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED; - } + for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) + { + bool convertable = imageConvert(TextureFormat::BGRA8, TextureFormat::Enum(ii) ); + g_caps.formats[ii] |= 0 == (g_caps.formats[ii] & BGFX_CAPS_FORMAT_TEXTURE_2D ) && convertable ? BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED : 0; + g_caps.formats[ii] |= 0 == (g_caps.formats[ii] & BGFX_CAPS_FORMAT_TEXTURE_3D ) && convertable ? BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED : 0; + g_caps.formats[ii] |= 0 == (g_caps.formats[ii] & BGFX_CAPS_FORMAT_TEXTURE_CUBE) && convertable ? BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED : 0; } g_caps.rendererType = m_renderCtx->getRendererType(); @@ -1721,6 +1757,8 @@ namespace bgfx RendererContextI* rendererCreate(RendererType::Enum _type) { + RendererType::Enum last = RendererType::Count; + if (RendererType::Count == _type) { again: @@ -1793,7 +1831,7 @@ again: { _type = RendererType::OpenGLES; } - else if (BX_ENABLED(BX_PLATFORM_WINRT) ) + else if (BX_ENABLED(BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT) ) { _type = RendererType::Direct3D11; } @@ -1823,14 +1861,17 @@ again: } RendererContextI* renderCtx = s_rendererCreator[_type].createFn(); - - if (NULL == renderCtx) + if (last != _type) { - s_rendererCreator[_type].supported = false; - goto again; - } + if (NULL == renderCtx) + { + s_rendererCreator[_type].supported = false; + last = _type; + goto again; + } - s_rendererDestroyFn = s_rendererCreator[_type].destroyFn; + s_rendererDestroyFn = s_rendererCreator[_type].destroyFn; + } return renderCtx; } @@ -2339,6 +2380,11 @@ again: flushTextureUpdateBatch(_cmdbuf); } + uint32_t topologyConvert(TopologyConvert::Enum _conversion, void* _dst, uint32_t _dstSize, const void* _indices, uint32_t _numIndices, bool _index32) + { + return topologyConvert(_conversion, _dst, _dstSize, _indices, _numIndices, _index32, g_allocator); + } + uint8_t getSupportedRenderers(RendererType::Enum _enum[RendererType::Count]) { uint8_t num = 0; @@ -3359,12 +3405,22 @@ again: s_ctx->setUniform(_handle, _value, _num); } + void setIndexBuffer(IndexBufferHandle _handle) + { + setIndexBuffer(_handle, 0, UINT32_MAX); + } + void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) { BGFX_CHECK_MAIN_THREAD(); s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices); } + void setIndexBuffer(DynamicIndexBufferHandle _handle) + { + setIndexBuffer(_handle, 0, UINT32_MAX); + } + void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) { BGFX_CHECK_MAIN_THREAD(); @@ -3395,10 +3451,15 @@ again: s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices); } - void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices) + void setVertexBuffer(DynamicVertexBufferHandle _handle) + { + setVertexBuffer(_handle, 0, UINT32_MAX); + } + + void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) { BGFX_CHECK_MAIN_THREAD(); - s_ctx->setVertexBuffer(_handle, _numVertices); + s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices); } void setVertexBuffer(const TransientVertexBuffer* _tvb) @@ -3450,13 +3511,13 @@ again: return submit(_id, handle); } - uint32_t submit(uint8_t _id, ProgramHandle _program, int32_t _depth) + uint32_t submit(uint8_t _id, ProgramHandle _program, int32_t _depth, bool _preserveState) { OcclusionQueryHandle handle = BGFX_INVALID_HANDLE; - return submit(_id, _program, handle, _depth); + return submit(_id, _program, handle, _depth, _preserveState); } - uint32_t submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth) + uint32_t submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) { BGFX_CHECK_MAIN_THREAD(); BX_CHECK(false @@ -3464,13 +3525,13 @@ again: || 0 != (g_caps.supported & BGFX_CAPS_OCCLUSION_QUERY) , "Occlusion query is not supported! Use bgfx::getCaps to check BGFX_CAPS_OCCLUSION_QUERY backend renderer capabilities." ); - return s_ctx->submit(_id, _program, _occlusionQuery, _depth); + return s_ctx->submit(_id, _program, _occlusionQuery, _depth, _preserveState); } - uint32_t submit(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth) + uint32_t submit(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) { BGFX_CHECK_MAIN_THREAD(); - return s_ctx->submit(_id, _program, _indirectHandle, _start, _num, _depth); + return s_ctx->submit(_id, _program, _indirectHandle, _start, _num, _depth, _preserveState); } void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) @@ -3593,23 +3654,34 @@ BX_STATIC_ASSERT(FLAGS_MASK_TEST(0 #undef FLAGS_MASK_TEST -BX_STATIC_ASSERT(bgfx::Fatal::Count == bgfx::Fatal::Enum(BGFX_FATAL_COUNT) ); -BX_STATIC_ASSERT(bgfx::RendererType::Count == bgfx::RendererType::Enum(BGFX_RENDERER_TYPE_COUNT) ); -BX_STATIC_ASSERT(bgfx::Attrib::Count == bgfx::Attrib::Enum(BGFX_ATTRIB_COUNT) ); -BX_STATIC_ASSERT(bgfx::AttribType::Count == bgfx::AttribType::Enum(BGFX_ATTRIB_TYPE_COUNT) ); -BX_STATIC_ASSERT(bgfx::TextureFormat::Count == bgfx::TextureFormat::Enum(BGFX_TEXTURE_FORMAT_COUNT) ); -BX_STATIC_ASSERT(bgfx::UniformType::Count == bgfx::UniformType::Enum(BGFX_UNIFORM_TYPE_COUNT) ); -BX_STATIC_ASSERT(bgfx::RenderFrame::Count == bgfx::RenderFrame::Enum(BGFX_RENDER_FRAME_COUNT) ); - -BX_STATIC_ASSERT(sizeof(bgfx::Memory) == sizeof(bgfx_memory_t) ); -BX_STATIC_ASSERT(sizeof(bgfx::VertexDecl) == sizeof(bgfx_vertex_decl_t) ); -BX_STATIC_ASSERT(sizeof(bgfx::TransientIndexBuffer) == sizeof(bgfx_transient_index_buffer_t) ); -BX_STATIC_ASSERT(sizeof(bgfx::TransientVertexBuffer) == sizeof(bgfx_transient_vertex_buffer_t) ); -BX_STATIC_ASSERT(sizeof(bgfx::InstanceDataBuffer) == sizeof(bgfx_instance_data_buffer_t) ); -BX_STATIC_ASSERT(sizeof(bgfx::TextureInfo) == sizeof(bgfx_texture_info_t) ); -BX_STATIC_ASSERT(sizeof(bgfx::Caps) == sizeof(bgfx_caps_t) ); -BX_STATIC_ASSERT(sizeof(bgfx::PlatformData) == sizeof(bgfx_platform_data_t) ); -BX_STATIC_ASSERT(sizeof(bgfx::InternalData) == sizeof(bgfx_internal_data_t) ); +#define BGFX_C99_ENUM_CHECK(_enum, _c99enumcount) \ + BX_STATIC_ASSERT(_enum::Count == _enum::Enum(_c99enumcount) ) + +BGFX_C99_ENUM_CHECK(bgfx::Fatal, BGFX_FATAL_COUNT); +BGFX_C99_ENUM_CHECK(bgfx::RendererType, BGFX_RENDERER_TYPE_COUNT); +BGFX_C99_ENUM_CHECK(bgfx::Attrib, BGFX_ATTRIB_COUNT); +BGFX_C99_ENUM_CHECK(bgfx::AttribType, BGFX_ATTRIB_TYPE_COUNT); +BGFX_C99_ENUM_CHECK(bgfx::TextureFormat, BGFX_TEXTURE_FORMAT_COUNT); +BGFX_C99_ENUM_CHECK(bgfx::UniformType, BGFX_UNIFORM_TYPE_COUNT); +BGFX_C99_ENUM_CHECK(bgfx::BackbufferRatio, BGFX_BACKBUFFER_RATIO_COUNT); +BGFX_C99_ENUM_CHECK(bgfx::OcclusionQueryResult, BGFX_OCCLUSION_QUERY_RESULT_COUNT); +BGFX_C99_ENUM_CHECK(bgfx::TopologyConvert, BGFX_TOPOLOGY_CONVERT_COUNT); +BGFX_C99_ENUM_CHECK(bgfx::RenderFrame, BGFX_RENDER_FRAME_COUNT); +#undef BGFX_C99_ENUM_CHECK + +#define BGFX_C99_STRUCT_SIZE_CHECK(_cppstruct, _c99struct) \ + BX_STATIC_ASSERT(sizeof(_cppstruct) == sizeof(_c99struct) ) + +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Memory, bgfx_memory_t); +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::VertexDecl, bgfx_vertex_decl_t); +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientIndexBuffer, bgfx_transient_index_buffer_t); +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientVertexBuffer, bgfx_transient_vertex_buffer_t); +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InstanceDataBuffer, bgfx_instance_data_buffer_t); +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TextureInfo, bgfx_texture_info_t); +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps, bgfx_caps_t); +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::PlatformData, bgfx_platform_data_t); +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InternalData, bgfx_internal_data_t); +#undef BGFX_C99_STRUCT_SIZE_CHECK namespace bgfx { @@ -3738,6 +3810,11 @@ BGFX_C_API uint16_t bgfx_weld_vertices(uint16_t* _output, const bgfx_vertex_decl return bgfx::weldVertices(_output, decl, _data, _num, _epsilon); } +uint32_t bgfx_topology_convert(bgfx_topology_convert_t _conversion, void* _dst, uint32_t _dstSize, const void* _indices, uint32_t _numIndices, bool _index32) +{ + return bgfx::topologyConvert(bgfx::TopologyConvert::Enum(_conversion), _dst, _dstSize, _indices, _numIndices, _index32); +} + BGFX_C_API void bgfx_image_swizzle_bgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst) { bgfx::imageSwizzleBgra8(_width, _height, _pitch, _src, _dst); @@ -4317,10 +4394,10 @@ BGFX_C_API void bgfx_set_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint bgfx::setVertexBuffer(handle.cpp, _startVertex, _numVertices); } -BGFX_C_API void bgfx_set_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _numVertices) +BGFX_C_API void bgfx_set_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices) { union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle }; - bgfx::setVertexBuffer(handle.cpp, _numVertices); + bgfx::setVertexBuffer(handle.cpp, _startVertex, _numVertices); } BGFX_C_API void bgfx_set_transient_vertex_buffer(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices) @@ -4364,24 +4441,24 @@ BGFX_C_API uint32_t bgfx_touch(uint8_t _id) return bgfx::touch(_id); } -BGFX_C_API uint32_t bgfx_submit(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth) +BGFX_C_API uint32_t bgfx_submit(uint8_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; - return bgfx::submit(_id, handle.cpp, _depth); + return bgfx::submit(_id, handle.cpp, _depth, _preserveState); } -BGFX_C_API uint32_t bgfx_submit_occlusion_query(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth) +BGFX_C_API uint32_t bgfx_submit_occlusion_query(uint8_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program }; union { bgfx_occlusion_query_handle c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery }; - return bgfx::submit(_id, program.cpp, occlusionQuery.cpp, _depth); + return bgfx::submit(_id, program.cpp, occlusionQuery.cpp, _depth, _preserveState); } -BGFX_C_API uint32_t bgfx_submit_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth) +BGFX_C_API uint32_t bgfx_submit_indirect(uint8_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; - return bgfx::submit(_id, handle.cpp, indirectHandle.cpp, _start, _num, _depth); + return bgfx::submit(_id, handle.cpp, indirectHandle.cpp, _start, _num, _depth, _preserveState); } BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format) @@ -4510,6 +4587,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) BGFX_IMPORT_FUNC(vertex_unpack) \ BGFX_IMPORT_FUNC(vertex_convert) \ BGFX_IMPORT_FUNC(weld_vertices) \ + BGFX_IMPORT_FUNC(topology_convert) \ BGFX_IMPORT_FUNC(image_swizzle_bgra8) \ BGFX_IMPORT_FUNC(image_rgba8_downsample_2x2) \ BGFX_IMPORT_FUNC(get_supported_renderers) \ diff --git a/3rdparty/bgfx/src/bgfx_p.h b/3rdparty/bgfx/src/bgfx_p.h index 1434b5ca41f..c56d8691794 100644 --- a/3rdparty/bgfx/src/bgfx_p.h +++ b/3rdparty/bgfx/src/bgfx_p.h @@ -332,6 +332,7 @@ namespace bgfx void release(const Memory* _mem); const char* getAttribName(Attrib::Enum _attr); void getTextureSizeFromRatio(BackbufferRatio::Enum _ratio, uint16_t& _width, uint16_t& _height); + TextureFormat::Enum getViableTextureFormat(const ImageContainer& _imageContainer); inline uint32_t castfu(float _value) { @@ -504,7 +505,7 @@ namespace bgfx { uint32_t* tempKeys = (uint32_t*)alloca(sizeof(m_keys) ); uint32_t* tempValues = (uint32_t*)alloca(sizeof(m_values) ); - bx::radixSort32(m_keys, tempKeys, m_values, tempValues, m_num); + bx::radixSort(m_keys, tempKeys, m_values, tempValues, m_num); return true; } @@ -626,7 +627,7 @@ namespace bgfx void write(const void* _data, uint32_t _size) { BX_CHECK(m_size == BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE, "Called write outside start/finish?"); - BX_CHECK(m_pos < m_size, ""); + BX_CHECK(m_pos < m_size, "CommandBuffer::write error (pos: %d, size: %d).", m_pos, m_size); memcpy(&m_buffer[m_pos], _data, _size); m_pos += _size; } @@ -640,7 +641,7 @@ namespace bgfx void read(void* _data, uint32_t _size) { - BX_CHECK(m_pos < m_size, ""); + BX_CHECK(m_pos < m_size, "CommandBuffer::read error (pos: %d, size: %d).", m_pos, m_size); memcpy(_data, &m_buffer[m_pos], _size); m_pos += _size; } @@ -654,7 +655,7 @@ namespace bgfx const uint8_t* skip(uint32_t _size) { - BX_CHECK(m_pos < m_size, ""); + BX_CHECK(m_pos < m_size, "CommandBuffer::skip error (pos: %d, size: %d).", m_pos, m_size); const uint8_t* result = &m_buffer[m_pos]; m_pos += _size; return result; @@ -1245,8 +1246,8 @@ namespace bgfx uint32_t m_startVertex; uint32_t m_numVertices; uint32_t m_instanceDataOffset; + uint32_t m_numInstances; uint16_t m_instanceDataStride; - uint16_t m_numInstances; uint16_t m_startIndirect; uint16_t m_numIndirect; uint16_t m_num; @@ -1537,10 +1538,10 @@ namespace bgfx m_draw.m_vertexBuffer = _handle; } - void setVertexBuffer(const DynamicVertexBuffer& _dvb, uint32_t _numVertices) + void setVertexBuffer(const DynamicVertexBuffer& _dvb, uint32_t _startVertex, uint32_t _numVertices) { - m_draw.m_startVertex = _dvb.m_startVertex; - m_draw.m_numVertices = bx::uint32_min(_dvb.m_numVertices, _numVertices); + m_draw.m_startVertex = _dvb.m_startVertex + _startVertex; + m_draw.m_numVertices = bx::uint32_min(bx::uint32_imax(0, _dvb.m_numVertices - _startVertex), _numVertices); m_draw.m_vertexBuffer = _dvb.m_handle; m_draw.m_vertexDecl = _dvb.m_decl; } @@ -1548,7 +1549,7 @@ namespace bgfx void setVertexBuffer(const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) { m_draw.m_startVertex = _tvb->startVertex + _startVertex; - m_draw.m_numVertices = bx::uint32_min(_tvb->size/_tvb->stride, _numVertices); + m_draw.m_numVertices = bx::uint32_min(bx::uint32_imax(0, _tvb->size/_tvb->stride - _startVertex), _numVertices); m_draw.m_vertexBuffer = _tvb->handle; m_draw.m_vertexDecl = _tvb->decl; } @@ -1557,7 +1558,7 @@ namespace bgfx { m_draw.m_instanceDataOffset = _idb->offset; m_draw.m_instanceDataStride = _idb->stride; - m_draw.m_numInstances = uint16_t(bx::uint32_min(_idb->num, _num) ); + m_draw.m_numInstances = bx::uint32_min(_idb->num, _num); m_draw.m_instanceDataBuffer = _idb->handle; BX_FREE(g_allocator, const_cast<InstanceDataBuffer*>(_idb) ); } @@ -1566,7 +1567,7 @@ namespace bgfx { m_draw.m_instanceDataOffset = _startVertex * _stride; m_draw.m_instanceDataStride = _stride; - m_draw.m_numInstances = uint16_t(_num); + m_draw.m_numInstances = _num; m_draw.m_instanceDataBuffer = _handle; } @@ -1631,15 +1632,15 @@ namespace bgfx m_stateFlags = BGFX_STATE_NONE; } - uint32_t submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth); + uint32_t submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState); - uint32_t submit(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth) + uint32_t submit(uint8_t _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) { m_draw.m_startIndirect = _start; m_draw.m_numIndirect = _num; m_draw.m_indirectBuffer = _indirectHandle; OcclusionQueryHandle handle = BGFX_INVALID_HANDLE; - return submit(_id, _program, handle, _depth); + return submit(_id, _program, handle, _depth, _preserveState); } uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _ngx, uint16_t _ngy, uint16_t _ngz, uint8_t _flags); @@ -2281,12 +2282,14 @@ namespace bgfx return ptr; } + uint32_t allocSize = bx::uint32_max(BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE, _size); + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicIndexBuffer); cmdbuf.write(indexBufferHandle); - cmdbuf.write(BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE); + cmdbuf.write(allocSize); cmdbuf.write(_flags); - m_dynIndexBufferAllocator.add(uint64_t(indexBufferHandle.idx) << 32, BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE); + m_dynIndexBufferAllocator.add(uint64_t(indexBufferHandle.idx) << 32, allocSize); ptr = m_dynIndexBufferAllocator.alloc(_size); } @@ -2431,12 +2434,14 @@ namespace bgfx return NonLocalAllocator::invalidBlock; } + uint32_t allocSize = bx::uint32_max(BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE, _size); + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicVertexBuffer); cmdbuf.write(vertexBufferHandle); - cmdbuf.write(BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE); + cmdbuf.write(allocSize); cmdbuf.write(_flags); - m_dynVertexBufferAllocator.add(uint64_t(vertexBufferHandle.idx)<<32, BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE); + m_dynVertexBufferAllocator.add(uint64_t(vertexBufferHandle.idx) << 32, allocSize); ptr = m_dynVertexBufferAllocator.alloc(_size); } @@ -2493,8 +2498,7 @@ namespace bgfx BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl, uint16_t _flags) ) { uint32_t numVertices = _mem->size/_decl.m_stride; - BX_CHECK(numVertices <= UINT16_MAX, "Num vertices exceeds maximum (num %d, max %d).", numVertices, UINT16_MAX); - DynamicVertexBufferHandle handle = createDynamicVertexBuffer(uint16_t(numVertices), _decl, _flags); + DynamicVertexBufferHandle handle = createDynamicVertexBuffer(numVertices, _decl, _flags); if (isValid(handle) ) { updateDynamicVertexBuffer(handle, 0, _mem); @@ -2794,14 +2798,14 @@ namespace bgfx for (uint32_t ii = 0; ii < count; ++ii) { - uint8_t nameSize; + uint8_t nameSize = 0; bx::read(&reader, nameSize); char name[256]; bx::read(&reader, &name, nameSize); name[nameSize] = '\0'; - uint8_t type; + uint8_t type = 0; bx::read(&reader, type); type &= ~BGFX_UNIFORM_MASK; @@ -3649,10 +3653,10 @@ namespace bgfx m_submit->setVertexBuffer(_handle, _startVertex, _numVertices); } - BGFX_API_FUNC(void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices) ) + BGFX_API_FUNC(void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) ) { BGFX_CHECK_HANDLE("setVertexBuffer", m_dynamicVertexBufferHandle, _handle); - m_submit->setVertexBuffer(m_dynamicVertexBuffers[_handle.idx], _numVertices); + m_submit->setVertexBuffer(m_dynamicVertexBuffers[_handle.idx], _startVertex, _numVertices); } BGFX_API_FUNC(void setVertexBuffer(const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) ) @@ -3708,11 +3712,12 @@ namespace bgfx m_submit->setTexture(_stage, _sampler, textureHandle, _flags); } - BGFX_API_FUNC(uint32_t submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth) ) + BGFX_API_FUNC(uint32_t submit(uint8_t _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) ) { BGFX_CHECK_HANDLE_INVALID_OK("submit", m_programHandle, _program); BGFX_CHECK_HANDLE_INVALID_OK("submit", m_occlusionQueryHandle, _occlusionQuery); - if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) + if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) + && !_preserveState) { m_uniformSet.clear(); } @@ -3727,18 +3732,19 @@ namespace bgfx m_occlusionQuerySet.insert(_occlusionQuery.idx); } - return m_submit->submit(_id, _program, _occlusionQuery, _depth); + return m_submit->submit(_id, _program, _occlusionQuery, _depth, _preserveState); } - BGFX_API_FUNC(uint32_t submit(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth) ) + BGFX_API_FUNC(uint32_t submit(uint8_t _id, ProgramHandle _handle, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) ) { BGFX_CHECK_HANDLE_INVALID_OK("submit", m_programHandle, _handle); BGFX_CHECK_HANDLE("submit", m_vertexBufferHandle, _indirectHandle); - if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) + if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) + && !_preserveState) { m_uniformSet.clear(); } - return m_submit->submit(_id, _handle, _indirectHandle, _start, _num, _depth); + return m_submit->submit(_id, _handle, _indirectHandle, _start, _num, _depth, _preserveState); } BGFX_API_FUNC(void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) ) diff --git a/3rdparty/bgfx/src/bgfx_shader.sh b/3rdparty/bgfx/src/bgfx_shader.sh index 77998652e9d..a675fb6e68c 100644 --- a/3rdparty/bgfx/src/bgfx_shader.sh +++ b/3rdparty/bgfx/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; @@ -239,14 +246,6 @@ float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord) # endif // BGFX_SHADER_LANGUAGE_HLSL > 3 -vec2 vec2_splat(float _x) { return vec2(_x, _x); } -vec3 vec3_splat(float _x) { return vec3(_x, _x, _x); } -vec4 vec4_splat(float _x) { return vec4(_x, _x, _x, _x); } - -uvec2 uvec2_splat(uint _x) { return uvec2(_x, _x); } -uvec3 uvec3_splat(uint _x) { return uvec3(_x, _x, _x); } -uvec4 uvec4_splat(uint _x) { return uvec4(_x, _x, _x, _x); } - vec3 instMul(vec3 _vec, mat3 _mtx) { return mul(_mtx, _vec); } vec3 instMul(mat3 _mtx, vec3 _vec) { return mul(_vec, _mtx); } vec4 instMul(vec4 _vec, mat4 _mtx) { return mul(_mtx, _vec); } @@ -294,12 +293,6 @@ vec4 mod(vec4 _a, vec4 _b) { return _a - _b * floor(_a / _b); } # define SAMPLER3D(_name, _reg) uniform sampler3D _name # define SAMPLERCUBE(_name, _reg) uniform samplerCube _name # define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name -# define vec2_splat(_x) vec2(_x) -# define vec3_splat(_x) vec3(_x) -# define vec4_splat(_x) vec4(_x) -# define uvec2_splat(_x) uvec2(_x) -# define uvec3_splat(_x) uvec3(_x) -# define uvec4_splat(_x) uvec4(_x) # if BGFX_SHADER_LANGUAGE_GLSL >= 130 # define ISAMPLER3D(_name, _reg) uniform isampler3D _name @@ -319,6 +312,16 @@ vec3 rcp(vec3 _a) { return vec3(1.0)/_a; } vec4 rcp(vec4 _a) { return vec4(1.0)/_a; } #endif // BGFX_SHADER_LANGUAGE_* +vec2 vec2_splat(float _x) { return vec2(_x, _x); } +vec3 vec3_splat(float _x) { return vec3(_x, _x, _x); } +vec4 vec4_splat(float _x) { return vec4(_x, _x, _x, _x); } + +#if BGFX_SHADER_LANGUAGE_GLSL >= 130 || BGFX_SHADER_LANGUAGE_HLSL +uvec2 uvec2_splat(uint _x) { return uvec2(_x, _x); } +uvec3 uvec3_splat(uint _x) { return uvec3(_x, _x, _x); } +uvec4 uvec4_splat(uint _x) { return uvec4(_x, _x, _x, _x); } +#endif // BGFX_SHADER_LANGUAGE_GLSL >= 130 || BGFX_SHADER_LANGUAGE_HLSL + uniform vec4 u_viewRect; uniform vec4 u_viewTexel; uniform mat4 u_view; diff --git a/3rdparty/bgfx/src/config.h b/3rdparty/bgfx/src/config.h index edfa69da75a..a0ccbe1dd06 100644 --- a/3rdparty/bgfx/src/config.h +++ b/3rdparty/bgfx/src/config.h @@ -32,12 +32,14 @@ # define BGFX_CONFIG_RENDERER_DIRECT3D11 (0 \ || BX_PLATFORM_WINDOWS \ || BX_PLATFORM_WINRT \ + || BX_PLATFORM_XBOXONE \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_DIRECT3D11 # ifndef BGFX_CONFIG_RENDERER_DIRECT3D12 # define BGFX_CONFIG_RENDERER_DIRECT3D12 (0 \ || BX_PLATFORM_WINDOWS \ + || BX_PLATFORM_XBOXONE \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_DIRECT3D12 diff --git a/3rdparty/bgfx/src/glcontext_ppapi.cpp b/3rdparty/bgfx/src/glcontext_ppapi.cpp index a4887103e63..c0c2c45aea6 100644 --- a/3rdparty/bgfx/src/glcontext_ppapi.cpp +++ b/3rdparty/bgfx/src/glcontext_ppapi.cpp @@ -121,15 +121,13 @@ namespace bgfx { namespace gl static void GL_APIENTRY naclGetQueryObjectiv(GLuint _id, GLenum _pname, GLint* _params) { - BX_UNUSED(_id); - BX_UNUSED(_pname); + BX_UNUSED(_id, _pname); s_ppapi.m_query->GetQueryivEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT, GL_CURRENT_QUERY_EXT, _params); } static void GL_APIENTRY naclGetQueryObjectui64v(GLuint _id, GLenum _pname, GLuint64* _params) { - BX_UNUSED(_id); - BX_UNUSED(_pname); + BX_UNUSED(_id, _pname); GLint params; s_ppapi.m_query->GetQueryivEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT, GL_CURRENT_QUERY_EXT, ¶ms); *_params = params; diff --git a/3rdparty/bgfx/src/image.cpp b/3rdparty/bgfx/src/image.cpp index 3a5c0d592b5..5b25a1df6b5 100644 --- a/3rdparty/bgfx/src/image.cpp +++ b/3rdparty/bgfx/src/image.cpp @@ -64,6 +64,10 @@ namespace bgfx { 64, 1, 1, 8, 1, 1, 0, 0, uint8_t(EncodingType::Int ) }, // RG32I { 64, 1, 1, 8, 1, 1, 0, 0, uint8_t(EncodingType::Uint ) }, // RG32U { 64, 1, 1, 8, 1, 1, 0, 0, uint8_t(EncodingType::Float) }, // RG32F + { 24, 1, 1, 3, 1, 1, 0, 0, uint8_t(EncodingType::Unorm) }, // RGB8 + { 24, 1, 1, 3, 1, 1, 0, 0, uint8_t(EncodingType::Int ) }, // RGB8I + { 24, 1, 1, 3, 1, 1, 0, 0, uint8_t(EncodingType::Uint ) }, // RGB8U + { 24, 1, 1, 3, 1, 1, 0, 0, uint8_t(EncodingType::Snorm) }, // RGB8S { 32, 1, 1, 4, 1, 1, 0, 0, uint8_t(EncodingType::Float) }, // RGB9E5F { 32, 1, 1, 4, 1, 1, 0, 0, uint8_t(EncodingType::Unorm) }, // BGRA8 { 32, 1, 1, 4, 1, 1, 0, 0, uint8_t(EncodingType::Unorm) }, // RGBA8 @@ -141,6 +145,10 @@ namespace bgfx "RG32I", // RG32I "RG32U", // RG32U "RG32F", // RG32F + "RGB8", // RGB8 + "RGB8I", // RGB8I + "RGB8U", // RGB8U + "RGB8S", // RGB8S "RGB9E5", // RGB9E5F "BGRA8", // BGRA8 "RGBA8", // RGBA8 @@ -717,23 +725,72 @@ namespace bgfx _dst[1] = float(src[1]); } - // RGBA8 - void packRgba8(void* _dst, const float* _src) + // RGB8 + void packRgb8(void* _dst, const float* _src) { uint8_t* dst = (uint8_t*)_dst; dst[0] = uint8_t(toUnorm(_src[0], 255.0f) ); dst[1] = uint8_t(toUnorm(_src[1], 255.0f) ); dst[2] = uint8_t(toUnorm(_src[2], 255.0f) ); - dst[3] = uint8_t(toUnorm(_src[3], 255.0f) ); } - void unpackRgba8(float* _dst, const void* _src) + void unpackRgb8(float* _dst, const void* _src) { const uint8_t* src = (const uint8_t*)_src; _dst[0] = fromUnorm(src[0], 255.0f); _dst[1] = fromUnorm(src[1], 255.0f); _dst[2] = fromUnorm(src[2], 255.0f); - _dst[3] = fromUnorm(src[3], 255.0f); + } + + // RGB8S + void packRgb8S(void* _dst, const float* _src) + { + int8_t* dst = (int8_t*)_dst; + dst[0] = int8_t(toSnorm(_src[0], 127.0f) ); + dst[1] = int8_t(toSnorm(_src[1], 127.0f) ); + dst[2] = int8_t(toSnorm(_src[2], 127.0f) ); + } + + void unpackRgb8S(float* _dst, const void* _src) + { + const int8_t* src = (const int8_t*)_src; + _dst[0] = fromSnorm(src[0], 127.0f); + _dst[1] = fromSnorm(src[1], 127.0f); + _dst[2] = fromSnorm(src[2], 127.0f); + } + + // RGB8I + void packRgb8I(void* _dst, const float* _src) + { + int8_t* dst = (int8_t*)_dst; + dst[0] = int8_t(_src[0]); + dst[1] = int8_t(_src[1]); + dst[2] = int8_t(_src[2]); + } + + void unpackRgb8I(float* _dst, const void* _src) + { + const int8_t* src = (const int8_t*)_src; + _dst[0] = float(src[0]); + _dst[1] = float(src[1]); + _dst[2] = float(src[2]); + } + + // RGB8U + void packRgb8U(void* _dst, const float* _src) + { + uint8_t* dst = (uint8_t*)_dst; + dst[0] = uint8_t(_src[0]); + dst[1] = uint8_t(_src[1]); + dst[2] = uint8_t(_src[2]); + } + + void unpackRgb8U(float* _dst, const void* _src) + { + const uint8_t* src = (const uint8_t*)_src; + _dst[0] = float(src[0]); + _dst[1] = float(src[1]); + _dst[2] = float(src[2]); } // BGRA8 @@ -755,6 +812,25 @@ namespace bgfx _dst[3] = fromUnorm(src[3], 255.0f); } + // RGBA8 + void packRgba8(void* _dst, const float* _src) + { + uint8_t* dst = (uint8_t*)_dst; + dst[0] = uint8_t(toUnorm(_src[0], 255.0f) ); + dst[1] = uint8_t(toUnorm(_src[1], 255.0f) ); + dst[2] = uint8_t(toUnorm(_src[2], 255.0f) ); + dst[3] = uint8_t(toUnorm(_src[3], 255.0f) ); + } + + void unpackRgba8(float* _dst, const void* _src) + { + const uint8_t* src = (const uint8_t*)_src; + _dst[0] = fromUnorm(src[0], 255.0f); + _dst[1] = fromUnorm(src[1], 255.0f); + _dst[2] = fromUnorm(src[2], 255.0f); + _dst[3] = fromUnorm(src[3], 255.0f); + } + // RGBA8S void packRgba8S(void* _dst, const float* _src) { @@ -1218,18 +1294,18 @@ namespace bgfx void packR5G6B5(void* _dst, const float* _src) { *( (uint16_t*)_dst) = 0 - | uint16_t(toUnorm(_src[0], 31.0f) ) + | uint16_t(toUnorm(_src[0], 31.0f)<<11) | uint16_t(toUnorm(_src[1], 63.0f)<< 5) - | uint16_t(toUnorm(_src[2], 31.0f)<<11) + | uint16_t(toUnorm(_src[2], 31.0f) ) ; } void unpackR5G6B5(float* _dst, const void* _src) { uint16_t packed = *( (const uint16_t*)_src); - _dst[0] = float( ( (packed ) & 0x1f) ) / 31.0f; + _dst[0] = float( ( (packed>>11) & 0x1f) ) / 31.0f; _dst[1] = float( ( (packed>> 5) & 0x3f) ) / 63.0f; - _dst[2] = float( ( (packed>>11) & 0x1f) ) / 31.0f; + _dst[2] = float( ( (packed ) & 0x1f) ) / 31.0f; } // RGBA4 @@ -1252,6 +1328,26 @@ namespace bgfx _dst[3] = float( ( (packed>>12) & 0xf) ) / 15.0f; } + // RGBA4 + void packBgra4(void* _dst, const float* _src) + { + *( (uint16_t*)_dst) = 0 + | uint16_t(toUnorm(_src[0], 15.0f)<< 8) + | uint16_t(toUnorm(_src[1], 15.0f)<< 4) + | uint16_t(toUnorm(_src[2], 15.0f) ) + | uint16_t(toUnorm(_src[3], 15.0f)<<12) + ; + } + + void unpackBgra4(float* _dst, const void* _src) + { + uint16_t packed = *( (const uint16_t*)_src); + _dst[0] = float( ( (packed>> 8) & 0xf) ) / 15.0f; + _dst[1] = float( ( (packed>> 4) & 0xf) ) / 15.0f; + _dst[2] = float( ( (packed ) & 0xf) ) / 15.0f; + _dst[3] = float( ( (packed>>12) & 0xf) ) / 15.0f; + } + // RGB5A1 void packRgb5a1(void* _dst, const float* _src) { @@ -1272,6 +1368,26 @@ namespace bgfx _dst[3] = float( ( (packed>>14) & 0x1) ); } + // BGR5A1 + void packBgr5a1(void* _dst, const float* _src) + { + *( (uint16_t*)_dst) = 0 + | uint16_t(toUnorm(_src[0], 31.0f)<<10) + | uint16_t(toUnorm(_src[1], 31.0f)<< 5) + | uint16_t(toUnorm(_src[2], 31.0f) ) + | uint16_t(toUnorm(_src[3], 1.0f)<<15) + ; + } + + void unpackBgr5a1(float* _dst, const void* _src) + { + uint16_t packed = *( (const uint16_t*)_src); + _dst[0] = float( ( (packed>>10) & 0x1f) ) / 31.0f; + _dst[1] = float( ( (packed>> 5) & 0x1f) ) / 31.0f; + _dst[2] = float( ( (packed ) & 0x1f) ) / 31.0f; + _dst[3] = float( ( (packed>>14) & 0x1) ); + } + // RGB10A2 void packRgb10A2(void* _dst, const float* _src) { @@ -1310,9 +1426,6 @@ namespace bgfx _dst[2] = bx::halfToFloat( (packed>>17) & 0x7fe0); } - typedef void (*PackFn)(void*, const float*); - typedef void (*UnpackFn)(float*, const void*); - struct PackUnpack { PackFn pack; @@ -1365,6 +1478,10 @@ namespace bgfx { packRg32I, unpackRg32I }, // RG32I { packRg32U, unpackRg32U }, // RG32U { packRg32F, unpackRg32F }, // RG32F + { packRgb8, unpackRgb8 }, // RGB8 + { packRgb8S, unpackRgb8S }, // RGB8S + { packRgb8I, unpackRgb8I }, // RGB8I + { packRgb8U, unpackRgb8U }, // RGB8U { packRgb9E5F, unpackRgb9E5F }, // RGB9E5F { packBgra8, unpackBgra8 }, // BGRA8 { packRgba8, unpackRgba8 }, // RGBA8 @@ -1396,37 +1513,71 @@ namespace bgfx }; BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_packUnpack) ); - bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height) + bool imageConvert(TextureFormat::Enum _dstFormat, TextureFormat::Enum _srcFormat) { UnpackFn unpack = s_packUnpack[_srcFormat].unpack; PackFn pack = s_packUnpack[_dstFormat].pack; - if (NULL == pack - || NULL == unpack) + return NULL != pack + && NULL != unpack + ; + } + + void imageConvert(void* _dst, uint32_t _bpp, PackFn _pack, const void* _src, UnpackFn _unpack, uint32_t _size) + { + const uint8_t* src = (uint8_t*)_src; + uint8_t* dst = (uint8_t*)_dst; + + const uint32_t size = _size * 8 / _bpp; + + for (uint32_t ii = 0; ii < size; ++ii) { - return false; + float rgba[4]; + _unpack(rgba, &src[ii*_bpp/8]); + _pack(&dst[ii*_bpp/8], rgba); } + } + void imageConvert(void* _dst, uint32_t _dstBpp, PackFn _pack, const void* _src, uint32_t _srcBpp, UnpackFn _unpack, uint32_t _width, uint32_t _height, uint32_t _srcPitch) + { const uint8_t* src = (uint8_t*)_src; uint8_t* dst = (uint8_t*)_dst; - const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel; - const uint32_t dstBpp = s_imageBlockInfo[_dstFormat].bitsPerPixel; - const uint32_t srcPitch = _width * srcBpp / 8; - const uint32_t dstPitch = _width * dstBpp / 8; + const uint32_t dstPitch = _width * _dstBpp / 8; - for (uint32_t yy = 0; yy < _height; ++yy, src += srcPitch, dst += dstPitch) + for (uint32_t yy = 0; yy < _height; ++yy, src += _srcPitch, dst += dstPitch) { for (uint32_t xx = 0; xx < _width; ++xx) { float rgba[4]; - unpack(rgba, &src[xx*srcBpp/8]); - pack(&dst[xx*dstBpp/8], rgba); + _unpack(rgba, &src[xx*_srcBpp/8]); + _pack(&dst[xx*_dstBpp/8], rgba); } } + } + + bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height, uint32_t _srcPitch) + { + UnpackFn unpack = s_packUnpack[_srcFormat].unpack; + PackFn pack = s_packUnpack[_dstFormat].pack; + if (NULL == pack + || NULL == unpack) + { + return false; + } + + const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel; + const uint32_t dstBpp = s_imageBlockInfo[_dstFormat].bitsPerPixel; + imageConvert(_dst, dstBpp, pack, _src, srcBpp, unpack, _width, _height, _srcPitch); return true; } + bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height) + { + const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel; + return imageConvert(_dst, _dstFormat, _src, _srcFormat, _width, _height, _width*srcBpp); + } + uint8_t bitRangeConvert(uint32_t _in, uint32_t _from, uint32_t _to) { using namespace bx; @@ -2211,9 +2362,9 @@ namespace bgfx } } - const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _mipsActive) + const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _generateMips) { - const uint8_t numMips = _mipsActive ? imageGetNumMips(_format, _width, _height) : 1; + const uint8_t numMips = _generateMips ? imageGetNumMips(_format, _width, _height) : 1; uint32_t size = imageGetSize(_format, _width, _height, 0, false, numMips); const Memory* image = alloc(size); @@ -2673,6 +2824,7 @@ namespace bgfx #define KTX_RG16_SNORM 0x8F99 #define KTX_RGB16_SNORM 0x8F9A #define KTX_RGBA16_SNORM 0x8F9B +#define KTX_SRGB8 0x8C41 #define KTX_SRGB8_ALPHA8 0x8C43 #define KTX_RGBA32UI 0x8D70 #define KTX_RGB32UI 0x8D71 @@ -2685,6 +2837,7 @@ namespace bgfx #define KTX_RGBA16I 0x8D88 #define KTX_RGB16I 0x8D89 #define KTX_RGBA8I 0x8D8E +#define KTX_RGB8 0x8051 #define KTX_RGB8I 0x8D8F #define KTX_RGB9_E5 0x8C3D #define KTX_R11F_G11F_B10F 0x8C3A @@ -2766,6 +2919,10 @@ namespace bgfx { KTX_RG32I, KTX_ZERO, KTX_RG, KTX_INT, }, // RG32I { KTX_RG32UI, KTX_ZERO, KTX_RG, KTX_UNSIGNED_INT, }, // RG32U { KTX_RG32F, KTX_ZERO, KTX_RG, KTX_FLOAT, }, // RG32F + { KTX_RGB8, KTX_SRGB8, KTX_RGB, KTX_UNSIGNED_BYTE, }, // RGB8 + { KTX_RGB8I, KTX_ZERO, KTX_RGB, KTX_BYTE, }, // RGB8I + { KTX_RGB8UI, KTX_ZERO, KTX_RGB, KTX_UNSIGNED_BYTE, }, // RGB8U + { KTX_RGB8_SNORM, KTX_ZERO, KTX_RGB, KTX_BYTE, }, // RGB8S { KTX_RGB9_E5, KTX_ZERO, KTX_RGB, KTX_UNSIGNED_INT_5_9_9_9_REV, }, // RGB9E5F { KTX_BGRA, KTX_SRGB8_ALPHA8, KTX_BGRA, KTX_UNSIGNED_BYTE, }, // BGRA8 { KTX_RGBA8, KTX_SRGB8_ALPHA8, KTX_RGBA, KTX_UNSIGNED_BYTE, }, // RGBA8 @@ -3277,8 +3434,11 @@ namespace bgfx break; default: - // Decompression not implemented... Make ugly red-yellow checkerboard texture. - imageCheckerboard(_width, _height, 16, UINT32_C(0xffff0000), UINT32_C(0xffffff00), _dst); + if (!imageConvert(_dst, TextureFormat::BGRA8, _src, _format, _width, _height, _pitch) ) + { + // Failed to convert, just make ugly red-yellow checkerboard texture. + imageCheckerboard(_width, _height, 16, UINT32_C(0xffff0000), UINT32_C(0xffffff00), _dst); + } break; } } @@ -3544,8 +3704,10 @@ namespace bgfx return false; } - void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, bool _grayscale, bool _yflip) + void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, bool _grayscale, bool _yflip, bx::Error* _err) { + BX_ERROR_SCOPE(_err); + uint8_t type = _grayscale ? 3 : 2; uint8_t bpp = _grayscale ? 8 : 32; @@ -3558,7 +3720,7 @@ namespace bgfx header[16] = bpp; header[17] = 32; - bx::write(_writer, header, sizeof(header) ); + bx::write(_writer, header, sizeof(header), _err); uint32_t dstPitch = _width*bpp/8; if (_yflip) @@ -3566,52 +3728,56 @@ namespace bgfx uint8_t* data = (uint8_t*)_src + _pitch*_height - _pitch; for (uint32_t yy = 0; yy < _height; ++yy) { - bx::write(_writer, data, dstPitch); + bx::write(_writer, data, dstPitch, _err); data -= _pitch; } } else if (_pitch == dstPitch) { - bx::write(_writer, _src, _height*_pitch); + bx::write(_writer, _src, _height*_pitch, _err); } else { uint8_t* data = (uint8_t*)_src; for (uint32_t yy = 0; yy < _height; ++yy) { - bx::write(_writer, data, dstPitch); + bx::write(_writer, data, dstPitch, _err); data += _pitch; } } } - static int32_t imageWriteKtxHeader(bx::WriterI* _writer, TextureFormat::Enum _format, bool _cubeMap, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips) + static int32_t imageWriteKtxHeader(bx::WriterI* _writer, TextureFormat::Enum _format, bool _cubeMap, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, bx::Error* _err) { + BX_ERROR_SCOPE(_err); + const KtxFormatInfo& tfi = s_translateKtxFormat[_format]; int32_t size = 0; - size += bx::write(_writer, "\xabKTX 11\xbb\r\n\x1a\n", 12); - size += bx::write(_writer, UINT32_C(0x04030201) ); - size += bx::write(_writer, UINT32_C(0) ); // glType - size += bx::write(_writer, UINT32_C(1) ); // glTypeSize - size += bx::write(_writer, UINT32_C(0) ); // glFormat - size += bx::write(_writer, tfi.m_internalFmt); // glInternalFormat - size += bx::write(_writer, tfi.m_fmt); // glBaseInternalFormat - size += bx::write(_writer, _width); - size += bx::write(_writer, _height); - size += bx::write(_writer, _depth); - size += bx::write(_writer, UINT32_C(0) ); // numberOfArrayElements - size += bx::write(_writer, _cubeMap ? UINT32_C(6) : UINT32_C(0) ); - size += bx::write(_writer, uint32_t(_numMips) ); - size += bx::write(_writer, UINT32_C(0) ); // Meta-data size. - - BX_CHECK(size == 64, "KTX: Failed to write header size %d (expected: %d).", size, 64); + size += bx::write(_writer, "\xabKTX 11\xbb\r\n\x1a\n", 12, _err); + size += bx::write(_writer, UINT32_C(0x04030201), _err); + size += bx::write(_writer, UINT32_C(0), _err); // glType + size += bx::write(_writer, UINT32_C(1), _err); // glTypeSize + size += bx::write(_writer, UINT32_C(0), _err); // glFormat + size += bx::write(_writer, tfi.m_internalFmt, _err); // glInternalFormat + size += bx::write(_writer, tfi.m_fmt, _err); // glBaseInternalFormat + size += bx::write(_writer, _width, _err); + size += bx::write(_writer, _height, _err); + size += bx::write(_writer, _depth, _err); + size += bx::write(_writer, UINT32_C(0), _err); // numberOfArrayElements + size += bx::write(_writer, _cubeMap ? UINT32_C(6) : UINT32_C(0), _err); + size += bx::write(_writer, uint32_t(_numMips), _err); + size += bx::write(_writer, UINT32_C(0), _err); // Meta-data size. + + BX_WARN(size == 64, "KTX: Failed to write header size %d (expected: %d).", size, 64); return size; } - void imageWriteKtx(bx::WriterI* _writer, TextureFormat::Enum _format, bool _cubeMap, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, const void* _src) + void imageWriteKtx(bx::WriterI* _writer, TextureFormat::Enum _format, bool _cubeMap, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, const void* _src, bx::Error* _err) { - imageWriteKtxHeader(_writer, _format, _cubeMap, _width, _height, _depth, _numMips); + BX_ERROR_SCOPE(_err); + + imageWriteKtxHeader(_writer, _format, _cubeMap, _width, _height, _depth, _numMips, _err); const ImageBlockInfo& blockInfo = s_imageBlockInfo[_format]; const uint8_t bpp = blockInfo.bitsPerPixel; @@ -3632,11 +3798,11 @@ namespace bgfx depth = bx::uint32_max(1, depth); uint32_t size = width*height*depth*bpp/8; - bx::write(_writer, size); + bx::write(_writer, size, _err); for (uint8_t side = 0, numSides = _cubeMap ? 6 : 1; side < numSides; ++side) { - bx::write(_writer, src, size); + bx::write(_writer, src, size, _err); src += size; } @@ -3646,8 +3812,10 @@ namespace bgfx } } - void imageWriteKtx(bx::WriterI* _writer, ImageContainer& _imageContainer, const void* _data, uint32_t _size) + void imageWriteKtx(bx::WriterI* _writer, ImageContainer& _imageContainer, const void* _data, uint32_t _size, bx::Error* _err) { + BX_ERROR_SCOPE(_err); + imageWriteKtxHeader(_writer , TextureFormat::Enum(_imageContainer.m_format) , _imageContainer.m_cubeMap @@ -3655,19 +3823,20 @@ namespace bgfx , _imageContainer.m_height , _imageContainer.m_depth , _imageContainer.m_numMips + , _err ); for (uint8_t lod = 0, num = _imageContainer.m_numMips; lod < num; ++lod) { ImageMip mip; imageGetRawData(_imageContainer, 0, lod, _data, _size, mip); - bx::write(_writer, mip.m_size); + bx::write(_writer, mip.m_size, _err); for (uint8_t side = 0, numSides = _imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side) { if (imageGetRawData(_imageContainer, side, lod, _data, _size, mip) ) { - bx::write(_writer, mip.m_data, mip.m_size); + bx::write(_writer, mip.m_data, mip.m_size, _err); } } } diff --git a/3rdparty/bgfx/src/image.h b/3rdparty/bgfx/src/image.h index 1baba0bae68..173cf7b0fff 100644 --- a/3rdparty/bgfx/src/image.h +++ b/3rdparty/bgfx/src/image.h @@ -66,6 +66,205 @@ namespace bgfx uint8_t encoding; }; + typedef void (*PackFn)(void*, const float*); + typedef void (*UnpackFn)(float*, const void*); + + // R8 + void packR8(void* _dst, const float* _src); + void unpackR8(float* _dst, const void* _src); + + // R8S + void packR8S(void* _dst, const float* _src); + void unpackR8S(float* _dst, const void* _src); + + // R8I + void packR8I(void* _dst, const float* _src); + void unpackR8I(float* _dst, const void* _src); + + // R8U + void packR8U(void* _dst, const float* _src); + void unpackR8U(float* _dst, const void* _src); + + // RG8 + void packRg8(void* _dst, const float* _src); + void unpackRg8(float* _dst, const void* _src); + + // RG8S + void packRg8S(void* _dst, const float* _src); + void unpackRg8S(float* _dst, const void* _src); + + // RG8I + void packRg8I(void* _dst, const float* _src); + void unpackRg8I(float* _dst, const void* _src); + + // RG8U + void packRg8U(void* _dst, const float* _src); + void unpackRg8U(float* _dst, const void* _src); + + // RGB8 + void packRgb8(void* _dst, const float* _src); + void unpackRgb8(float* _dst, const void* _src); + + // RGB8S + void packRgb8S(void* _dst, const float* _src); + void unpackRgb8S(float* _dst, const void* _src); + + // RGB8I + void packRgb8I(void* _dst, const float* _src); + void unpackRgb8I(float* _dst, const void* _src); + + // RGB8U + void packRgb8U(void* _dst, const float* _src); + void unpackRgb8U(float* _dst, const void* _src); + + // RGBA8 + void packRgba8(void* _dst, const float* _src); + void unpackRgba8(float* _dst, const void* _src); + + // BGRA8 + void packBgra8(void* _dst, const float* _src); + void unpackBgra8(float* _dst, const void* _src); + + // RGBA8S + void packRgba8S(void* _dst, const float* _src); + void unpackRgba8S(float* _dst, const void* _src); + + // RGBA8I + void packRgba8I(void* _dst, const float* _src); + void unpackRgba8I(float* _dst, const void* _src); + + // RGBA8U + void packRgba8U(void* _dst, const float* _src); + void unpackRgba8U(float* _dst, const void* _src); + + // R16 + void packR16(void* _dst, const float* _src); + void unpackR16(float* _dst, const void* _src); + + // R16S + void packR16S(void* _dst, const float* _src); + void unpackR16S(float* _dst, const void* _src); + + // R16I + void packR16I(void* _dst, const float* _src); + void unpackR16I(float* _dst, const void* _src); + + // R16U + void packR16U(void* _dst, const float* _src); + void unpackR16U(float* _dst, const void* _src); + + // R16F + void packR16F(void* _dst, const float* _src); + void unpackR16F(float* _dst, const void* _src); + + // RG16 + void packRg16(void* _dst, const float* _src); + void unpackRg16(float* _dst, const void* _src); + + // RG16S + void packRg16S(void* _dst, const float* _src); + void unpackRg16S(float* _dst, const void* _src); + + // RG16I + void packRg16I(void* _dst, const float* _src); + void unpackRg16I(float* _dst, const void* _src); + + // RG16U + void packRg16U(void* _dst, const float* _src); + void unpackRg16U(float* _dst, const void* _src); + + // RG16F + void packRg16F(void* _dst, const float* _src); + void unpackRg16F(float* _dst, const void* _src); + + // RGBA16 + void packRgba16(void* _dst, const float* _src); + void unpackRgba16(float* _dst, const void* _src); + + // RGBA16S + void packRgba16S(void* _dst, const float* _src); + void unpackRgba16S(float* _dst, const void* _src); + + // RGBA16I + void packRgba16I(void* _dst, const float* _src); + void unpackRgba16I(float* _dst, const void* _src); + + // RGBA16U + void packRgba16U(void* _dst, const float* _src); + void unpackRgba16U(float* _dst, const void* _src); + + // RGBA16F + void packRgba16F(void* _dst, const float* _src); + void unpackRgba16F(float* _dst, const void* _src); + + // R32I + void packR32I(void* _dst, const float* _src); + void unpackR32I(float* _dst, const void* _src); + + // R32U + void packR32U(void* _dst, const float* _src); + void unpackR32U(float* _dst, const void* _src); + + // R32F + void packR32F(void* _dst, const float* _src); + void unpackR32F(float* _dst, const void* _src); + + // RG32I + void packRg32I(void* _dst, const float* _src); + void unpackRg32I(float* _dst, const void* _src); + + // RG32U + void packRg32U(void* _dst, const float* _src); + void unpackRg32U(float* _dst, const void* _src); + + // RGB9E5F + void packRgb9E5F(void* _dst, const float* _src); + void unpackRgb9E5F(float* _dst, const void* _src); + + // RGBA32I + void packRgba32I(void* _dst, const float* _src); + void unpackRgba32I(float* _dst, const void* _src); + + // RGBA32U + void packRgba32U(void* _dst, const float* _src); + void unpackRgba32U(float* _dst, const void* _src); + + // RGBA32F + void packRgba32F(void* _dst, const float* _src); + void unpackRgba32F(float* _dst, const void* _src); + + // R5G6B5 + void packR5G6B5(void* _dst, const float* _src); + void unpackR5G6B5(float* _dst, const void* _src); + + // RGBA4 + void packRgba4(void* _dst, const float* _src); + void unpackRgba4(float* _dst, const void* _src); + + // RGBA4 + void packBgra4(void* _dst, const float* _src); + void unpackBgra4(float* _dst, const void* _src); + + // RGB5A1 + void packRgb5a1(void* _dst, const float* _src); + void unpackRgb5a1(float* _dst, const void* _src); + + // BGR5A1 + void packBgr5a1(void* _dst, const float* _src); + void unpackBgr5a1(float* _dst, const void* _src); + + // RGB10A2 + void packRgb10A2(void* _dst, const float* _src); + void unpackRgb10A2(float* _dst, const void* _src); + + // R11G11B10F + void packR11G11B10F(void* _dst, const float* _src); + void unpackR11G11B10F(float* _dst, const void* _src); + + // RG32F + void packRg32F(void* _dst, const float* _src); + void unpackRg32F(float* _dst, const void* _src); + /// Returns true if texture format is compressed. bool isCompressed(TextureFormat::Enum _format); @@ -118,22 +317,31 @@ namespace bgfx void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _pitch, const void* _src, void* _dst); /// + bool imageConvert(TextureFormat::Enum _dstFormat, TextureFormat::Enum _srcFormat); + + /// + void imageConvert(void* _dst, uint32_t _bpp, PackFn _pack, const void* _src, UnpackFn _unpack, uint32_t _size); + + /// + void imageConvert(void* _dst, uint32_t _dstBpp, PackFn _pack, const void* _src, uint32_t _srcBpp, UnpackFn _unpack, uint32_t _width, uint32_t _height, uint32_t _srcPitch); + + /// bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height); /// - const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0, bool _cubeMap = false, bool _mipsActive = false); + const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0, bool _cubeMap = false, bool _generateMips = false); /// void imageFree(const Memory* _memory); /// - void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, bool _grayscale, bool _yflip); + void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, bool _grayscale, bool _yflip, bx::Error* _err = NULL); /// - void imageWriteKtx(bx::WriterI* _writer, TextureFormat::Enum _format, bool _cubeMap, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, const void* _src); + void imageWriteKtx(bx::WriterI* _writer, TextureFormat::Enum _format, bool _cubeMap, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, const void* _src, bx::Error* _err = NULL); /// - void imageWriteKtx(bx::WriterI* _writer, ImageContainer& _imageContainer, const void* _data, uint32_t _size); + void imageWriteKtx(bx::WriterI* _writer, ImageContainer& _imageContainer, const void* _data, uint32_t _size, bx::Error* _err = NULL); /// bool imageParse(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader); diff --git a/3rdparty/bgfx/src/makefile b/3rdparty/bgfx/src/makefile index 84d9bb33869..a09ec27c16b 100644 --- a/3rdparty/bgfx/src/makefile +++ b/3rdparty/bgfx/src/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 # diff --git a/3rdparty/bgfx/src/renderer_d3d.h b/3rdparty/bgfx/src/renderer_d3d.h index 314fbaa0f89..97cfb045821 100644 --- a/3rdparty/bgfx/src/renderer_d3d.h +++ b/3rdparty/bgfx/src/renderer_d3d.h @@ -21,6 +21,12 @@ namespace bgfx { +#if BX_PLATFORM_XBOXONE + typedef ::IGraphicsUnknown IUnknown; +#else + typedef ::IUnknown IUnknown; +#endif // BX_PLATFORM_XBOXONE + #define _DX_CHECK(_call) \ BX_MACRO_BLOCK_BEGIN \ HRESULT __hr__ = _call; \ @@ -96,7 +102,7 @@ namespace bgfx return _interface->Release(); } - template <typename Ty> + template<typename Ty> class StateCacheT { public: diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp index 4446d6b0324..27f1681a0d2 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.cpp +++ b/3rdparty/bgfx/src/renderer_d3d11.cpp @@ -8,10 +8,12 @@ #if BGFX_CONFIG_RENDERER_DIRECT3D11 # include "renderer_d3d11.h" -#if BX_PLATFORM_WINRT +#if !BX_PLATFORM_WINDOWS # include <inspectable.h> -# include <windows.ui.xaml.media.dxinterop.h> -#endif // BX_PLATFORM_WINRT +# if BX_PLATFORM_WINRT +# include <windows.ui.xaml.media.dxinterop.h> +# endif // BX_PLATFORM_WINRT +#endif // !BX_PLATFORM_WINDOWS #if BGFX_CONFIG_PROFILER_REMOTERY # define BGFX_GPU_PROFILER_BIND(_device, _context) rmt_BindD3D11(_device, _context) @@ -101,20 +103,20 @@ namespace bgfx { namespace d3d11 static const D3D11_BLEND s_blendFactor[][2] = { - { (D3D11_BLEND)0, (D3D11_BLEND)0 }, // ignored + { D3D11_BLEND(0), D3D11_BLEND(0) }, // ignored { D3D11_BLEND_ZERO, D3D11_BLEND_ZERO }, // ZERO - { D3D11_BLEND_ONE, D3D11_BLEND_ONE }, // ONE - { D3D11_BLEND_SRC_COLOR, D3D11_BLEND_SRC_ALPHA }, // SRC_COLOR - { D3D11_BLEND_INV_SRC_COLOR, D3D11_BLEND_INV_SRC_ALPHA }, // INV_SRC_COLOR - { D3D11_BLEND_SRC_ALPHA, D3D11_BLEND_SRC_ALPHA }, // SRC_ALPHA - { D3D11_BLEND_INV_SRC_ALPHA, D3D11_BLEND_INV_SRC_ALPHA }, // INV_SRC_ALPHA - { D3D11_BLEND_DEST_ALPHA, D3D11_BLEND_DEST_ALPHA }, // DST_ALPHA - { D3D11_BLEND_INV_DEST_ALPHA, D3D11_BLEND_INV_DEST_ALPHA }, // INV_DST_ALPHA - { D3D11_BLEND_DEST_COLOR, D3D11_BLEND_DEST_ALPHA }, // DST_COLOR - { D3D11_BLEND_INV_DEST_COLOR, D3D11_BLEND_INV_DEST_ALPHA }, // INV_DST_COLOR - { D3D11_BLEND_SRC_ALPHA_SAT, D3D11_BLEND_ONE }, // SRC_ALPHA_SAT - { D3D11_BLEND_BLEND_FACTOR, D3D11_BLEND_BLEND_FACTOR }, // FACTOR - { D3D11_BLEND_INV_BLEND_FACTOR, D3D11_BLEND_INV_BLEND_FACTOR }, // INV_FACTOR + { D3D11_BLEND_ONE, D3D11_BLEND_ONE }, // ONE + { D3D11_BLEND_SRC_COLOR, D3D11_BLEND_SRC_ALPHA }, // SRC_COLOR + { D3D11_BLEND_INV_SRC_COLOR, D3D11_BLEND_INV_SRC_ALPHA }, // INV_SRC_COLOR + { D3D11_BLEND_SRC_ALPHA, D3D11_BLEND_SRC_ALPHA }, // SRC_ALPHA + { D3D11_BLEND_INV_SRC_ALPHA, D3D11_BLEND_INV_SRC_ALPHA }, // INV_SRC_ALPHA + { D3D11_BLEND_DEST_ALPHA, D3D11_BLEND_DEST_ALPHA }, // DST_ALPHA + { D3D11_BLEND_INV_DEST_ALPHA, D3D11_BLEND_INV_DEST_ALPHA }, // INV_DST_ALPHA + { D3D11_BLEND_DEST_COLOR, D3D11_BLEND_DEST_ALPHA }, // DST_COLOR + { D3D11_BLEND_INV_DEST_COLOR, D3D11_BLEND_INV_DEST_ALPHA }, // INV_DST_COLOR + { D3D11_BLEND_SRC_ALPHA_SAT, D3D11_BLEND_ONE }, // SRC_ALPHA_SAT + { D3D11_BLEND_BLEND_FACTOR, D3D11_BLEND_BLEND_FACTOR }, // FACTOR + { D3D11_BLEND_INV_BLEND_FACTOR, D3D11_BLEND_INV_BLEND_FACTOR }, // INV_FACTOR }; static const D3D11_BLEND_OP s_blendEquation[] = @@ -259,6 +261,10 @@ namespace bgfx { namespace d3d11 { DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32I { DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32U { DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32F + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8I + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8U + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8S { DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB9E5F { DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB }, // BGRA8 { DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8 @@ -586,13 +592,14 @@ namespace bgfx { namespace d3d11 , m_currentDepthStencil(NULL) , m_captureTexture(NULL) , m_captureResolve(NULL) - , m_wireframe(false) , m_maxAnisotropy(1) , m_depthClamp(false) + , m_wireframe(false) , m_currentProgram(NULL) , m_vsChanges(0) , m_fsChanges(0) , m_rtMsaa(false) + , m_timerQuerySupport(false) , m_ovrRtv(NULL) , m_ovrDsv(NULL) { @@ -790,9 +797,12 @@ namespace bgfx { namespace d3d11 #if BX_PLATFORM_WINRT // WinRT requires the IDXGIFactory2 interface, which isn't supported on older platforms hr = CreateDXGIFactory1(__uuidof(IDXGIFactory2), (void**)&factory); -#else +#elif BX_PLATFORM_WINDOWS hr = CreateDXGIFactory(IID_IDXGIFactory, (void**)&factory); -#endif // BX_PLATFORM_WINRT +#else + hr = S_OK; + factory = NULL; +#endif // BX_PLATFORM_* BX_WARN(SUCCEEDED(hr), "Unable to create DXGI factory."); if (FAILED(hr) ) { @@ -811,60 +821,63 @@ namespace bgfx { namespace d3d11 : D3D_DRIVER_TYPE_HARDWARE ; - IDXGIAdapter* adapter; - for (uint32_t ii = 0 - ; DXGI_ERROR_NOT_FOUND != factory->EnumAdapters(ii, &adapter) && ii < BX_COUNTOF(g_caps.gpu) - ; ++ii - ) + if (NULL != factory) { - DXGI_ADAPTER_DESC desc; - hr = adapter->GetDesc(&desc); - if (SUCCEEDED(hr) ) + IDXGIAdapter* adapter; + for (uint32_t ii = 0 + ; DXGI_ERROR_NOT_FOUND != factory->EnumAdapters(ii, &adapter) && ii < BX_COUNTOF(g_caps.gpu) + ; ++ii + ) { - BX_TRACE("Adapter #%d", ii); - - char description[BX_COUNTOF(desc.Description)]; - wcstombs(description, desc.Description, BX_COUNTOF(desc.Description) ); - BX_TRACE("\tDescription: %s", description); - BX_TRACE("\tVendorId: 0x%08x, DeviceId: 0x%08x, SubSysId: 0x%08x, Revision: 0x%08x" - , desc.VendorId - , desc.DeviceId - , desc.SubSysId - , desc.Revision - ); - BX_TRACE("\tMemory: %" PRIi64 " (video), %" PRIi64 " (system), %" PRIi64 " (shared)" - , desc.DedicatedVideoMemory - , desc.DedicatedSystemMemory - , desc.SharedSystemMemory - ); + DXGI_ADAPTER_DESC desc; + hr = adapter->GetDesc(&desc); + if (SUCCEEDED(hr) ) + { + BX_TRACE("Adapter #%d", ii); + + char description[BX_COUNTOF(desc.Description)]; + wcstombs(description, desc.Description, BX_COUNTOF(desc.Description) ); + BX_TRACE("\tDescription: %s", description); + BX_TRACE("\tVendorId: 0x%08x, DeviceId: 0x%08x, SubSysId: 0x%08x, Revision: 0x%08x" + , desc.VendorId + , desc.DeviceId + , desc.SubSysId + , desc.Revision + ); + BX_TRACE("\tMemory: %" PRIi64 " (video), %" PRIi64 " (system), %" PRIi64 " (shared)" + , desc.DedicatedVideoMemory + , desc.DedicatedSystemMemory + , desc.SharedSystemMemory + ); - g_caps.gpu[ii].vendorId = (uint16_t)desc.VendorId; - g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId; - ++g_caps.numGPUs; + g_caps.gpu[ii].vendorId = (uint16_t)desc.VendorId; + g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId; + ++g_caps.numGPUs; - if (NULL == m_adapter) - { - if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) - && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) - && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) + if (NULL == m_adapter) { - m_adapter = adapter; - m_adapter->AddRef(); - m_driverType = D3D_DRIVER_TYPE_UNKNOWN; - } + if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) + && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) + && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) + { + m_adapter = adapter; + m_adapter->AddRef(); + m_driverType = D3D_DRIVER_TYPE_UNKNOWN; + } - if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != strstr(description, "PerfHUD") ) - { - m_adapter = adapter; - m_driverType = D3D_DRIVER_TYPE_REFERENCE; + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) + && 0 != strstr(description, "PerfHUD") ) + { + m_adapter = adapter; + m_driverType = D3D_DRIVER_TYPE_REFERENCE; + } } } - } - DX_RELEASE(adapter, adapter == m_adapter ? 1 : 0); + DX_RELEASE(adapter, adapter == m_adapter ? 1 : 0); + } + DX_RELEASE(factory, NULL != m_adapter ? 1 : 0); } - DX_RELEASE(factory, NULL != m_adapter ? 1 : 0); D3D_FEATURE_LEVEL featureLevel[] = { @@ -1023,7 +1036,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (NULL == g_platformData.backBuffer) { -#if BX_PLATFORM_WINRT +#if !BX_PLATFORM_WINDOWS hr = adapter->GetParent(__uuidof(IDXGIFactory2), (void**)&m_factory); BX_WARN(SUCCEEDED(hr), "Unable to create Direct3D11 device."); DX_RELEASE(adapter, 2); @@ -1068,6 +1081,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ); BX_WARN(SUCCEEDED(hr), "Unable to create Direct3D11 swap chain."); +# if BX_PLATFORM_WINRT IInspectable* nativeWindow = reinterpret_cast<IInspectable *>(g_platformData.nwh); ISwapChainBackgroundPanelNative* panel = NULL; hr = nativeWindow->QueryInterface(__uuidof(ISwapChainBackgroundPanelNative), (void**)&panel); @@ -1080,6 +1094,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); panel->Release(); } +# endif // BX_PLATFORM_WINRT } #else hr = adapter->GetParent(IID_IDXGIFactory, (void**)&m_factory); @@ -1112,7 +1127,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); | DXGI_MWA_NO_WINDOW_CHANGES | DXGI_MWA_NO_ALT_ENTER ) ); -#endif // BX_PLATFORM_WINRT +#endif // BX_PLATFORM_* BX_WARN(SUCCEEDED(hr), "Failed to create swap chain."); if (FAILED(hr) ) { @@ -1179,6 +1194,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); | BGFX_CAPS_OCCLUSION_QUERY ); + m_timerQuerySupport = m_featureLevel >= D3D_FEATURE_LEVEL_9_3; + if (m_featureLevel <= D3D_FEATURE_LEVEL_9_2) { g_caps.maxTextureSize = D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; @@ -2007,7 +2024,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { ovrPreReset(); - m_gpuTimer.preReset(); + if (m_timerQuerySupport) + { + m_gpuTimer.preReset(); + } m_occlusionQuery.preReset(); if (NULL == g_platformData.backBufferDS) @@ -2052,7 +2072,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_RELEASE(color, 0); } - m_gpuTimer.postReset(); + if (m_timerQuerySupport) + { + m_gpuTimer.postReset(); + } m_occlusionQuery.postReset(); ovrPostReset(); @@ -2106,7 +2129,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (NULL != m_swapChain) { HRESULT hr = S_OK; - uint32_t syncInterval = BX_ENABLED(BX_PLATFORM_WINRT) + uint32_t syncInterval = BX_ENABLED(!BX_PLATFORM_WINDOWS) ? 1 // sync interval of 0 is not supported on WinRT : !!(m_resolution.m_flags & BGFX_RESET_VSYNC) ; @@ -2222,7 +2245,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); flags &= ~BGFX_RESET_INTERNAL_FORCE; bool resize = true - && !BX_ENABLED(BX_PLATFORM_WINRT) // can't use ResizeBuffers on Windows Phone + && !BX_ENABLED(BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT) // can't use ResizeBuffers on Windows Phone && (m_resolution.m_flags&BGFX_RESET_MSAA_MASK) == (flags&BGFX_RESET_MSAA_MASK) ; @@ -2274,7 +2297,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); scd = &swapChainScd; } -#if BX_PLATFORM_WINRT +#if !BX_PLATFORM_WINDOWS HRESULT hr; if (g_platformData.ndt == 0) { @@ -2297,6 +2320,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ); BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 swap chain."); +# if BX_PLATFORM_WINRT IInspectable *nativeWindow = reinterpret_cast<IInspectable *>(g_platformData.nwh); ISwapChainBackgroundPanelNative* panel = NULL; hr = nativeWindow->QueryInterface(__uuidof(ISwapChainBackgroundPanelNative), (void **)&panel); @@ -2309,6 +2333,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); panel->Release(); } +# endif // BX_PLATFORM_WINRT } #else HRESULT hr; @@ -2316,7 +2341,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); , scd , &m_swapChain ); -#endif // BX_PLATFORM_WINRT +#endif // !BX_PLATFORM_WINDOWS BGFX_FATAL(SUCCEEDED(hr), bgfx::Fatal::UnableToInitialize, "Failed to create swap chain."); } } @@ -2789,39 +2814,39 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DXGI_FORMAT getBufferFormat() { -#if BX_PLATFORM_WINRT - return m_scd.Format; -#else +#if BX_PLATFORM_WINDOWS return m_scd.BufferDesc.Format; +#else + return m_scd.Format; #endif } uint32_t getBufferWidth() { -#if BX_PLATFORM_WINRT - return m_scd.Width; -#else +#if BX_PLATFORM_WINDOWS return m_scd.BufferDesc.Width; +#else + return m_scd.Width; #endif } uint32_t getBufferHeight() { -#if BX_PLATFORM_WINRT - return m_scd.Height; -#else +#if BX_PLATFORM_WINDOWS return m_scd.BufferDesc.Height; +#else + return m_scd.Height; #endif } void setBufferSize(uint32_t _width, uint32_t _height) { -#if BX_PLATFORM_WINRT - m_scd.Width = _width; - m_scd.Height = _height; -#else +#if BX_PLATFORM_WINDOWS m_scd.BufferDesc.Width = _width; m_scd.BufferDesc.Height = _height; +#else + m_scd.Width = _width; + m_scd.Height = _height; #endif } @@ -3348,13 +3373,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); D3D_FEATURE_LEVEL m_featureLevel; IDXGIAdapter* m_adapter; DXGI_ADAPTER_DESC m_adapterDesc; -#if BX_PLATFORM_WINRT - IDXGIFactory2* m_factory; - IDXGISwapChain1* m_swapChain; -#else +#if BX_PLATFORM_WINDOWS IDXGIFactory* m_factory; IDXGISwapChain* m_swapChain; -#endif // BX_PLATFORM_WINRT +#else + IDXGIFactory2* m_factory; + IDXGISwapChain1* m_swapChain; +#endif // BX_PLATFORM_WINDOWS uint16_t m_lost; uint16_t m_numWindows; @@ -3375,17 +3400,17 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ID3D11Texture2D* m_captureResolve; Resolution m_resolution; - bool m_wireframe; -#if BX_PLATFORM_WINRT - typedef DXGI_SWAP_CHAIN_DESC1 SwapChainDesc; -#else +#if BX_PLATFORM_WINDOWS typedef DXGI_SWAP_CHAIN_DESC SwapChainDesc; -#endif // BX_PLATFORM_WINRT +#else + typedef DXGI_SWAP_CHAIN_DESC1 SwapChainDesc; +#endif // BX_PLATFORM_WINDOWS SwapChainDesc m_scd; uint32_t m_maxAnisotropy; bool m_depthClamp; + bool m_wireframe; IndexBufferD3D11 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS]; VertexBufferD3D11 m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS]; @@ -3418,6 +3443,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); FrameBufferHandle m_fbh; bool m_rtMsaa; + bool m_timerQuerySupport; OVR m_ovr; TextureD3D11 m_ovrRT; @@ -3712,8 +3738,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { bx::MemoryReader rd(_code, _size); + bx::Error err; DxbcContext dxbc; - read(&rd, dxbc); + read(&rd, dxbc, &err); struct FindDepthOp { @@ -3856,7 +3883,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); uint16_t shaderSize; bx::read(&reader, shaderSize); - const DWORD* code = (const DWORD*)reader.getDataPtr(); + const void* code = reader.getDataPtr(); bx::skip(&reader, shaderSize+1); if (BGFX_CHUNK_MAGIC_FSH == magic) @@ -3930,22 +3957,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_width = textureWidth; m_height = textureHeight; m_depth = imageContainer.m_depth; - m_requestedFormat = (uint8_t)imageContainer.m_format; - m_textureFormat = (uint8_t)imageContainer.m_format; - - const TextureFormatInfo& tfi = s_textureFormat[m_requestedFormat]; - const bool convert = DXGI_FORMAT_UNKNOWN == tfi.m_fmt; - - uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); - if (convert) - { - m_textureFormat = (uint8_t)TextureFormat::BGRA8; - bpp = 32; - } + m_requestedFormat = uint8_t(imageContainer.m_format); + m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); + const bool convert = m_textureFormat != m_requestedFormat; + const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); if (imageContainer.m_cubeMap) { - m_type = TextureCube; + m_type = TextureCube; } else if (imageContainer.m_depth > 1) { @@ -4056,7 +4075,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (format == DXGI_FORMAT_UNKNOWN) { // not swizzled and not sRGB, or sRGB unsupported - format = s_textureFormat[m_textureFormat].m_fmt; + format = s_textureFormat[m_textureFormat].m_fmt; srvd.Format = s_textureFormat[m_textureFormat].m_fmtSrv; } @@ -4717,7 +4736,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); int64_t elapsed = -bx::getHPCounter(); int64_t captureElapsed = 0; - m_gpuTimer.begin(); + if (m_timerQuerySupport) + { + m_gpuTimer.begin(); + } if (0 < _render->m_iboffset) { @@ -5627,15 +5649,18 @@ BX_PRAGMA_DIAGNOSTIC_POP(); static double maxGpuElapsed = 0.0f; double elapsedGpuMs = 0.0; - m_gpuTimer.end(); - - while (m_gpuTimer.get() ) + if (m_timerQuerySupport) { - double toGpuMs = 1000.0 / double(m_gpuTimer.m_frequency); - elapsedGpuMs = m_gpuTimer.m_elapsed * toGpuMs; - maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed; + m_gpuTimer.end(); + + while (m_gpuTimer.get() ) + { + double toGpuMs = 1000.0 / double(m_gpuTimer.m_frequency); + elapsedGpuMs = m_gpuTimer.m_elapsed * toGpuMs; + maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed; + } + maxGpuLatency = bx::uint32_imax(maxGpuLatency, m_gpuTimer.m_control.available()-1); } - maxGpuLatency = bx::uint32_imax(maxGpuLatency, m_gpuTimer.m_control.available()-1); const int64_t timerFreq = bx::getHPFrequency(); diff --git a/3rdparty/bgfx/src/renderer_d3d11.h b/3rdparty/bgfx/src/renderer_d3d11.h index 833eda40e1a..f4a92e4abb0 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.h +++ b/3rdparty/bgfx/src/renderer_d3d11.h @@ -6,7 +6,7 @@ #ifndef BGFX_RENDERER_D3D11_H_HEADER_GUARD #define BGFX_RENDERER_D3D11_H_HEADER_GUARD -#define USE_D3D11_DYNAMIC_LIB !BX_PLATFORM_WINRT +#define USE_D3D11_DYNAMIC_LIB BX_PLATFORM_WINDOWS #if !USE_D3D11_DYNAMIC_LIB # undef BGFX_CONFIG_DEBUG_PIX @@ -19,11 +19,13 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wpragmas"); BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4005) // warning C4005: '' : macro redefinition #include <sal.h> #define D3D11_NO_HELPERS -#if BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS +# include <d3d11.h> +#elif BX_PLATFORM_WINRT # include <d3d11_3.h> #else -# include <d3d11.h> -#endif // BX_PLATFORM_WINRT +# include <d3d11_x.h> +#endif // BX_PLATFORM_* BX_PRAGMA_DIAGNOSTIC_POP() #include "renderer.h" @@ -118,7 +120,6 @@ namespace bgfx { namespace d3d11 } void create(const Memory* _mem); - DWORD* getShaderCode(uint8_t _fragmentBit, const Memory* _mem); void destroy() { @@ -275,10 +276,11 @@ namespace bgfx { namespace d3d11 IDXGISwapChain* m_swapChain; uint32_t m_width; uint32_t m_height; + + Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; uint16_t m_denseIdx; uint8_t m_num; uint8_t m_numTh; - Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; }; struct TimerQueryD3D11 diff --git a/3rdparty/bgfx/src/renderer_d3d12.cpp b/3rdparty/bgfx/src/renderer_d3d12.cpp index 409d33bce10..06bc0632536 100644 --- a/3rdparty/bgfx/src/renderer_d3d12.cpp +++ b/3rdparty/bgfx/src/renderer_d3d12.cpp @@ -18,7 +18,7 @@ namespace bgfx { namespace d3d12 struct PrimInfo { - D3D_PRIMITIVE_TOPOLOGY m_toplogy; + D3D_PRIMITIVE_TOPOLOGY m_topology; D3D12_PRIMITIVE_TOPOLOGY_TYPE m_topologyType; uint32_t m_min; uint32_t m_div; @@ -63,20 +63,20 @@ namespace bgfx { namespace d3d12 static const D3D12_BLEND s_blendFactor[][2] = { - { (D3D12_BLEND)0, (D3D12_BLEND)0 }, // ignored + { D3D12_BLEND(0), D3D12_BLEND(0) }, // ignored { D3D12_BLEND_ZERO, D3D12_BLEND_ZERO }, // ZERO - { D3D12_BLEND_ONE, D3D12_BLEND_ONE }, // ONE - { D3D12_BLEND_SRC_COLOR, D3D12_BLEND_SRC_ALPHA }, // SRC_COLOR - { D3D12_BLEND_INV_SRC_COLOR, D3D12_BLEND_INV_SRC_ALPHA }, // INV_SRC_COLOR - { D3D12_BLEND_SRC_ALPHA, D3D12_BLEND_SRC_ALPHA }, // SRC_ALPHA - { D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_INV_SRC_ALPHA }, // INV_SRC_ALPHA - { D3D12_BLEND_DEST_ALPHA, D3D12_BLEND_DEST_ALPHA }, // DST_ALPHA - { D3D12_BLEND_INV_DEST_ALPHA, D3D12_BLEND_INV_DEST_ALPHA }, // INV_DST_ALPHA - { D3D12_BLEND_DEST_COLOR, D3D12_BLEND_DEST_ALPHA }, // DST_COLOR - { D3D12_BLEND_INV_DEST_COLOR, D3D12_BLEND_INV_DEST_ALPHA }, // INV_DST_COLOR - { D3D12_BLEND_SRC_ALPHA_SAT, D3D12_BLEND_ONE }, // SRC_ALPHA_SAT - { D3D12_BLEND_BLEND_FACTOR, D3D12_BLEND_BLEND_FACTOR }, // FACTOR - { D3D12_BLEND_INV_BLEND_FACTOR, D3D12_BLEND_INV_BLEND_FACTOR }, // INV_FACTOR + { D3D12_BLEND_ONE, D3D12_BLEND_ONE }, // ONE + { D3D12_BLEND_SRC_COLOR, D3D12_BLEND_SRC_ALPHA }, // SRC_COLOR + { D3D12_BLEND_INV_SRC_COLOR, D3D12_BLEND_INV_SRC_ALPHA }, // INV_SRC_COLOR + { D3D12_BLEND_SRC_ALPHA, D3D12_BLEND_SRC_ALPHA }, // SRC_ALPHA + { D3D12_BLEND_INV_SRC_ALPHA, D3D12_BLEND_INV_SRC_ALPHA }, // INV_SRC_ALPHA + { D3D12_BLEND_DEST_ALPHA, D3D12_BLEND_DEST_ALPHA }, // DST_ALPHA + { D3D12_BLEND_INV_DEST_ALPHA, D3D12_BLEND_INV_DEST_ALPHA }, // INV_DST_ALPHA + { D3D12_BLEND_DEST_COLOR, D3D12_BLEND_DEST_ALPHA }, // DST_COLOR + { D3D12_BLEND_INV_DEST_COLOR, D3D12_BLEND_INV_DEST_ALPHA }, // INV_DST_COLOR + { D3D12_BLEND_SRC_ALPHA_SAT, D3D12_BLEND_ONE }, // SRC_ALPHA_SAT + { D3D12_BLEND_BLEND_FACTOR, D3D12_BLEND_BLEND_FACTOR }, // FACTOR + { D3D12_BLEND_INV_BLEND_FACTOR, D3D12_BLEND_INV_BLEND_FACTOR }, // INV_FACTOR }; static const D3D12_BLEND_OP s_blendEquation[] = @@ -221,6 +221,10 @@ namespace bgfx { namespace d3d12 { DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32I { DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32U { DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32F + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8I + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8U + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8S { DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB9E5F { DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB }, // BGRA8 { DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8 @@ -556,7 +560,12 @@ namespace bgfx { namespace d3d12 HRESULT hr; +#if BX_PLATFORM_WINDOWS hr = CreateDXGIFactory1(IID_IDXGIFactory4, (void**)&m_factory); +#else + hr = S_OK; + m_factory = NULL; +#endif // BX_PLATFORM_* BX_WARN(SUCCEEDED(hr), "Unable to create DXGI factory."); if (FAILED(hr) ) @@ -570,7 +579,11 @@ namespace bgfx { namespace d3d12 m_driverType = D3D_DRIVER_TYPE_HARDWARE; { +#if BX_PLATFORM_WINDOWS IDXGIAdapter3* adapter; +#else + IDXGIAdapter* adapter; +#endif // BX_PLATFORM_* for (uint32_t ii = 0; DXGI_ERROR_NOT_FOUND != m_factory->EnumAdapters(ii, reinterpret_cast<IDXGIAdapter**>(&adapter) ); ++ii) { DXGI_ADAPTER_DESC desc; @@ -663,7 +676,11 @@ namespace bgfx { namespace d3d12 { memset(&m_adapterDesc, 0, sizeof(m_adapterDesc) ); luid = m_device->GetAdapterLuid(); +#if BX_PLATFORM_WINDOWS IDXGIAdapter3* adapter; +#else + IDXGIAdapter* adapter; +#endif // BX_PLATFORM_* for (uint32_t ii = 0; DXGI_ERROR_NOT_FOUND != m_factory->EnumAdapters(ii, reinterpret_cast<IDXGIAdapter**>(&adapter) ); ++ii) { adapter->GetDesc(&m_adapterDesc); @@ -756,14 +773,15 @@ namespace bgfx { namespace d3d12 m_resolution.m_width = BGFX_DEFAULT_WIDTH; m_resolution.m_height = BGFX_DEFAULT_HEIGHT; + m_numWindows = 1; + +#if BX_PLATFORM_WINDOWS DX_CHECK(m_factory->MakeWindowAssociation( (HWND)g_platformData.nwh , 0 | DXGI_MWA_NO_WINDOW_CHANGES | DXGI_MWA_NO_ALT_ENTER ) ); - m_numWindows = 1; - if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) { hr = m_device->QueryInterface(IID_ID3D12InfoQueue, (void**)&m_infoQueue); @@ -789,6 +807,7 @@ namespace bgfx { namespace d3d12 DX_RELEASE_WARNONLY(m_infoQueue, 0); } } +#endif // BX_PLATFORM_WINDOWS D3D12_DESCRIPTOR_HEAP_DESC rtvDescHeap; rtvDescHeap.NumDescriptors = 0 @@ -1772,6 +1791,8 @@ data.NumQualityLevels = 0; preReset(); + BX_UNUSED(resize); +#if BX_PLATFORM_WINDOWS if (resize) { uint32_t nodeMask[] = { 1, 1, 1, 1 }; @@ -1789,6 +1810,7 @@ data.NumQualityLevels = 0; ) ); } else +#endif // BX_PLATFORM_WINDOWS { updateMsaa(); m_scd.SampleDesc = s_msaa[(m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; @@ -1943,13 +1965,14 @@ data.NumQualityLevels = 0; m_rtMsaa = _msaa; } - void setBlendState(D3D12_BLEND_DESC& desc, uint64_t _state, uint32_t _rgba = 0) + void setBlendState(D3D12_BLEND_DESC& _desc, uint64_t _state, uint32_t _rgba = 0) { - memset(&desc, 0, sizeof(desc) ); - desc.IndependentBlendEnable = !!(BGFX_STATE_BLEND_INDEPENDENT & _state); + _desc.AlphaToCoverageEnable = false; + _desc.IndependentBlendEnable = !!(BGFX_STATE_BLEND_INDEPENDENT & _state); - D3D12_RENDER_TARGET_BLEND_DESC* drt = &desc.RenderTarget[0]; - drt->BlendEnable = !!(BGFX_STATE_BLEND_MASK & _state); + D3D12_RENDER_TARGET_BLEND_DESC* drt = &_desc.RenderTarget[0]; + drt->BlendEnable = !!(BGFX_STATE_BLEND_MASK & _state); + drt->LogicOpEnable = false; { const uint32_t blend = uint32_t( (_state & BGFX_STATE_BLEND_MASK ) >> BGFX_STATE_BLEND_SHIFT); @@ -1983,14 +2006,16 @@ data.NumQualityLevels = 0; : 0 ; + drt->LogicOp = D3D12_LOGIC_OP_CLEAR; drt->RenderTargetWriteMask = writeMask; - if (desc.IndependentBlendEnable) + if (_desc.IndependentBlendEnable) { for (uint32_t ii = 1, rgba = _rgba; ii < BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS; ++ii, rgba >>= 11) { - drt = &desc.RenderTarget[ii]; + drt = &_desc.RenderTarget[ii]; drt->BlendEnable = 0 != (rgba & 0x7ff); + drt->LogicOpEnable = false; const uint32_t src = (rgba ) & 0xf; const uint32_t dst = (rgba >> 4) & 0xf; @@ -2004,6 +2029,7 @@ data.NumQualityLevels = 0; drt->DestBlendAlpha = s_blendFactor[dst][1]; drt->BlendOpAlpha = s_blendEquation[equation]; + drt->LogicOp = D3D12_LOGIC_OP_CLEAR; drt->RenderTargetWriteMask = writeMask; } } @@ -2011,61 +2037,61 @@ data.NumQualityLevels = 0; { for (uint32_t ii = 1; ii < BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS; ++ii) { - memcpy(&desc.RenderTarget[ii], drt, sizeof(D3D12_RENDER_TARGET_BLEND_DESC) ); + memcpy(&_desc.RenderTarget[ii], drt, sizeof(D3D12_RENDER_TARGET_BLEND_DESC) ); } } } - void setRasterizerState(D3D12_RASTERIZER_DESC& desc, uint64_t _state, bool _wireframe = false) + void setRasterizerState(D3D12_RASTERIZER_DESC& _desc, uint64_t _state, bool _wireframe = false) { const uint32_t cull = (_state&BGFX_STATE_CULL_MASK) >> BGFX_STATE_CULL_SHIFT; - desc.FillMode = _wireframe + _desc.FillMode = _wireframe ? D3D12_FILL_MODE_WIREFRAME : D3D12_FILL_MODE_SOLID ; - desc.CullMode = s_cullMode[cull]; - desc.FrontCounterClockwise = false; - desc.DepthBias = 0; - desc.DepthBiasClamp = 0.0f; - desc.SlopeScaledDepthBias = 0.0f; - desc.DepthClipEnable = !m_depthClamp; - desc.MultisampleEnable = !!(_state&BGFX_STATE_MSAA); - desc.AntialiasedLineEnable = false; - desc.ForcedSampleCount = 0; - desc.ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; + _desc.CullMode = s_cullMode[cull]; + _desc.FrontCounterClockwise = false; + _desc.DepthBias = 0; + _desc.DepthBiasClamp = 0.0f; + _desc.SlopeScaledDepthBias = 0.0f; + _desc.DepthClipEnable = !m_depthClamp; + _desc.MultisampleEnable = !!(_state&BGFX_STATE_MSAA); + _desc.AntialiasedLineEnable = false; + _desc.ForcedSampleCount = 0; + _desc.ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; } - void setDepthStencilState(D3D12_DEPTH_STENCIL_DESC& desc, uint64_t _state, uint64_t _stencil = 0) + void setDepthStencilState(D3D12_DEPTH_STENCIL_DESC& _desc, uint64_t _state, uint64_t _stencil = 0) { const uint32_t fstencil = unpackStencil(0, _stencil); - memset(&desc, 0, sizeof(desc) ); + memset(&_desc, 0, sizeof(_desc) ); uint32_t func = (_state&BGFX_STATE_DEPTH_TEST_MASK)>>BGFX_STATE_DEPTH_TEST_SHIFT; - desc.DepthEnable = 0 != func; - desc.DepthWriteMask = !!(BGFX_STATE_DEPTH_WRITE & _state) + _desc.DepthEnable = 0 != func; + _desc.DepthWriteMask = !!(BGFX_STATE_DEPTH_WRITE & _state) ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO ; - desc.DepthFunc = s_cmpFunc[func]; + _desc.DepthFunc = s_cmpFunc[func]; uint32_t bstencil = unpackStencil(1, _stencil); uint32_t frontAndBack = bstencil != BGFX_STENCIL_NONE && bstencil != fstencil; bstencil = frontAndBack ? bstencil : fstencil; - desc.StencilEnable = 0 != _stencil; - desc.StencilReadMask = (fstencil & BGFX_STENCIL_FUNC_RMASK_MASK) >> BGFX_STENCIL_FUNC_RMASK_SHIFT; - desc.StencilWriteMask = 0xff; + _desc.StencilEnable = 0 != _stencil; + _desc.StencilReadMask = (fstencil & BGFX_STENCIL_FUNC_RMASK_MASK) >> BGFX_STENCIL_FUNC_RMASK_SHIFT; + _desc.StencilWriteMask = 0xff; - desc.FrontFace.StencilFailOp = s_stencilOp[(fstencil & BGFX_STENCIL_OP_FAIL_S_MASK) >> BGFX_STENCIL_OP_FAIL_S_SHIFT]; - desc.FrontFace.StencilDepthFailOp = s_stencilOp[(fstencil & BGFX_STENCIL_OP_FAIL_Z_MASK) >> BGFX_STENCIL_OP_FAIL_Z_SHIFT]; - desc.FrontFace.StencilPassOp = s_stencilOp[(fstencil & BGFX_STENCIL_OP_PASS_Z_MASK) >> BGFX_STENCIL_OP_PASS_Z_SHIFT]; - desc.FrontFace.StencilFunc = s_cmpFunc[(fstencil & BGFX_STENCIL_TEST_MASK) >> BGFX_STENCIL_TEST_SHIFT]; + _desc.FrontFace.StencilFailOp = s_stencilOp[(fstencil & BGFX_STENCIL_OP_FAIL_S_MASK) >> BGFX_STENCIL_OP_FAIL_S_SHIFT]; + _desc.FrontFace.StencilDepthFailOp = s_stencilOp[(fstencil & BGFX_STENCIL_OP_FAIL_Z_MASK) >> BGFX_STENCIL_OP_FAIL_Z_SHIFT]; + _desc.FrontFace.StencilPassOp = s_stencilOp[(fstencil & BGFX_STENCIL_OP_PASS_Z_MASK) >> BGFX_STENCIL_OP_PASS_Z_SHIFT]; + _desc.FrontFace.StencilFunc = s_cmpFunc[(fstencil & BGFX_STENCIL_TEST_MASK) >> BGFX_STENCIL_TEST_SHIFT]; - desc.BackFace.StencilFailOp = s_stencilOp[(bstencil & BGFX_STENCIL_OP_FAIL_S_MASK) >> BGFX_STENCIL_OP_FAIL_S_SHIFT]; - desc.BackFace.StencilDepthFailOp = s_stencilOp[(bstencil & BGFX_STENCIL_OP_FAIL_Z_MASK) >> BGFX_STENCIL_OP_FAIL_Z_SHIFT]; - desc.BackFace.StencilPassOp = s_stencilOp[(bstencil & BGFX_STENCIL_OP_PASS_Z_MASK) >> BGFX_STENCIL_OP_PASS_Z_SHIFT]; - desc.BackFace.StencilFunc = s_cmpFunc[(bstencil&BGFX_STENCIL_TEST_MASK) >> BGFX_STENCIL_TEST_SHIFT]; + _desc.BackFace.StencilFailOp = s_stencilOp[(bstencil & BGFX_STENCIL_OP_FAIL_S_MASK) >> BGFX_STENCIL_OP_FAIL_S_SHIFT]; + _desc.BackFace.StencilDepthFailOp = s_stencilOp[(bstencil & BGFX_STENCIL_OP_FAIL_Z_MASK) >> BGFX_STENCIL_OP_FAIL_Z_SHIFT]; + _desc.BackFace.StencilPassOp = s_stencilOp[(bstencil & BGFX_STENCIL_OP_PASS_Z_MASK) >> BGFX_STENCIL_OP_PASS_Z_SHIFT]; + _desc.BackFace.StencilFunc = s_cmpFunc[(bstencil&BGFX_STENCIL_TEST_MASK) >> BGFX_STENCIL_TEST_SHIFT]; } uint32_t setInputLayout(D3D12_INPUT_ELEMENT_DESC* _vertexElements, const VertexDecl& _vertexDecl, const ProgramD3D12& _program, uint8_t _numInstanceData) @@ -2230,7 +2256,8 @@ data.NumQualityLevels = 0; bx::StaticMemoryBlockWriter wr(temp->data, temp->size); DxbcContext dxbc; - read(&rd, dxbc); + bx::Error err; + read(&rd, dxbc, &err); bool patchShader = true; if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) @@ -2238,7 +2265,7 @@ data.NumQualityLevels = 0; union { uint32_t offset; void* ptr; } cast = { 0 }; filter(dxbc.shader, dxbc.shader, patchCb0, cast.ptr); - write(&wr, dxbc); + write(&wr, dxbc, &err); dxbcHash(temp->data + 20, temp->size - 20, temp->data + 4); @@ -2272,7 +2299,7 @@ data.NumQualityLevels = 0; uint32_t(program.m_vsh->m_size)/16 }; filter(dxbc.shader, dxbc.shader, patchCb0, cast.ptr); - write(&wr, dxbc); + write(&wr, dxbc, &err); dxbcHash(temp->data + 20, temp->size - 20, temp->data + 4); desc.PS.pShaderBytecode = temp->data; @@ -2616,21 +2643,27 @@ data.NumQualityLevels = 0; void* m_dxgidll; D3D_DRIVER_TYPE m_driverType; - IDXGIAdapter3* m_adapter; DXGI_ADAPTER_DESC m_adapterDesc; D3D12_FEATURE_DATA_ARCHITECTURE m_architecture; D3D12_FEATURE_DATA_D3D12_OPTIONS m_options; - IDXGIFactory4* m_factory; - +#if BX_PLATFORM_WINDOWS + IDXGIAdapter3* m_adapter; + IDXGIFactory4* m_factory; IDXGISwapChain3* m_swapChain; + ID3D12InfoQueue* m_infoQueue; +#else + IDXGIAdapter* m_adapter; + IDXGIFactory2* m_factory; + IDXGISwapChain1* m_swapChain; +#endif // BX_PLATFORM_WINDOWS + int64_t m_presentElapsed; uint16_t m_lost; uint16_t m_numWindows; FrameBufferHandle m_windows[BGFX_CONFIG_MAX_FRAME_BUFFERS]; ID3D12Device* m_device; - ID3D12InfoQueue* m_infoQueue; TimerQueryD3D12 m_gpuTimer; OcclusionQueryD3D12 m_occlusionQuery; @@ -3718,7 +3751,7 @@ data.NumQualityLevels = 0; uint16_t shaderSize; bx::read(&reader, shaderSize); - const DWORD* code = (const DWORD*)reader.getDataPtr(); + const void* code = reader.getDataPtr(); bx::skip(&reader, shaderSize+1); m_code = copy(code, shaderSize); @@ -3769,18 +3802,10 @@ data.NumQualityLevels = 0; m_width = textureWidth; m_height = textureHeight; m_depth = imageContainer.m_depth; - m_requestedFormat = (uint8_t)imageContainer.m_format; - m_textureFormat = (uint8_t)imageContainer.m_format; - - const TextureFormatInfo& tfi = s_textureFormat[m_requestedFormat]; - const bool convert = DXGI_FORMAT_UNKNOWN == tfi.m_fmt; - - uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); - if (convert) - { - m_textureFormat = (uint8_t)TextureFormat::BGRA8; - bpp = 32; - } + m_requestedFormat = uint8_t(imageContainer.m_format); + m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); + const bool convert = m_textureFormat != m_requestedFormat; + const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); if (imageContainer.m_cubeMap) { @@ -4578,7 +4603,9 @@ data.NumQualityLevels = 0; uint32_t statsNumIndices = 0; uint32_t statsKeyType[2] = {}; +#if BX_PLATFORM_WINDOWS m_backBufferColorIdx = m_swapChain->GetCurrentBackBufferIndex(); +#endif // BX_PLATFORM_WINDOWS const uint64_t f0 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_FACTOR, BGFX_STATE_BLEND_FACTOR); const uint64_t f1 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_INV_FACTOR, BGFX_STATE_BLEND_INV_FACTOR); @@ -4992,7 +5019,7 @@ data.NumQualityLevels = 0; || 0 != changedStencil || (hasFactor && blendFactor != draw.m_rgba) || (0 != (BGFX_STATE_PT_MASK & changedFlags) - || prim.m_toplogy != s_primInfo[primIndex].m_toplogy) + || prim.m_topology != s_primInfo[primIndex].m_topology) || currentState.m_scissor != scissor || pso != currentPso || hasOcclusionQuery) @@ -5083,12 +5110,12 @@ data.NumQualityLevels = 0; } if (0 != (BGFX_STATE_PT_MASK & changedFlags) - || prim.m_toplogy != s_primInfo[primIndex].m_toplogy) + || prim.m_topology != s_primInfo[primIndex].m_topology) { const uint64_t pt = newFlags&BGFX_STATE_PT_MASK; primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT); prim = s_primInfo[primIndex]; - m_commandList->IASetPrimitiveTopology(prim.m_toplogy); + m_commandList->IASetPrimitiveTopology(prim.m_topology); } if (currentState.m_scissor != scissor) @@ -5272,6 +5299,7 @@ data.NumQualityLevels = 0; , processMemoryUsed ); +#if BX_PLATFORM_WINDOWS DXGI_QUERY_VIDEO_MEMORY_INFO memInfo; DX_CHECK(m_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &memInfo) ); @@ -5293,6 +5321,7 @@ data.NumQualityLevels = 0; , availableForReservation , currentReservation ); +#endif // BX_PLATFORM_WINDOWS pos = 10; tvm.printf(10, pos++, 0x8e, " Frame: % 7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " diff --git a/3rdparty/bgfx/src/renderer_d3d12.h b/3rdparty/bgfx/src/renderer_d3d12.h index 39f165a03da..e78e0c52b62 100644 --- a/3rdparty/bgfx/src/renderer_d3d12.h +++ b/3rdparty/bgfx/src/renderer_d3d12.h @@ -6,10 +6,14 @@ #ifndef BGFX_RENDERER_D3D12_H_HEADER_GUARD #define BGFX_RENDERER_D3D12_H_HEADER_GUARD -#define USE_D3D12_DYNAMIC_LIB 1 +#define USE_D3D12_DYNAMIC_LIB BX_PLATFORM_WINDOWS #include <sal.h> -#include <d3d12.h> +#if BX_PLATFORM_XBOXONE +# include <d3d12_x.h> +#else +# include <d3d12.h> +#endif // BX_PLATFORM_XBOXONE #if defined(__MINGW32__) // BK - temp workaround for MinGW until I nuke d3dx12 usage. extern "C++" { @@ -27,10 +31,20 @@ extern "C++" { BX_PRAGMA_DIAGNOSTIC_PUSH(); BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wmissing-field-initializers"); -#include <d3dx12.h> +#if BX_PLATFORM_XBOXONE +# include <d3dx12_x.h> +#else +# include <d3dx12.h> +#endif // BX_PLATFORM_XBOXONE BX_PRAGMA_DIAGNOSTIC_POP(); -#include <dxgi1_4.h> +#if BX_PLATFORM_WINDOWS +# include <dxgi1_4.h> +#endif // BX_PLATFORM_WINDOWS + +#ifndef D3D12_TEXTURE_DATA_PITCH_ALIGNMENT +# define D3D12_TEXTURE_DATA_PITCH_ALIGNMENT 1024 +#endif // D3D12_TEXTURE_DATA_PITCH_ALIGNMENT #include "renderer.h" #include "renderer_d3d.h" @@ -173,7 +187,6 @@ namespace bgfx { namespace d3d12 } void create(const Memory* _mem); - DWORD* getShaderCode(uint8_t _fragmentBit, const Memory* _mem); void destroy() { diff --git a/3rdparty/bgfx/src/renderer_d3d9.cpp b/3rdparty/bgfx/src/renderer_d3d9.cpp index 919a952260b..8b52ff2d6b6 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.cpp +++ b/3rdparty/bgfx/src/renderer_d3d9.cpp @@ -215,6 +215,10 @@ namespace bgfx { namespace d3d9 { D3DFMT_UNKNOWN }, // RG32I { D3DFMT_UNKNOWN }, // RG32U { D3DFMT_G32R32F }, // RG32F + { D3DFMT_UNKNOWN }, // RGB8 + { D3DFMT_UNKNOWN }, // RGB8I + { D3DFMT_UNKNOWN }, // RGB8U + { D3DFMT_UNKNOWN }, // RGB8S { D3DFMT_UNKNOWN }, // RGB9E5F { D3DFMT_A8R8G8B8 }, // BGRA8 { D3DFMT_UNKNOWN }, // RGBA8 @@ -340,10 +344,10 @@ namespace bgfx { namespace d3d9 m_params.BackBufferHeight = rect.bottom-rect.top; m_d3d9dll = bx::dlopen("d3d9.dll"); - BX_WARN(NULL != m_d3d9dll, "Failed to load d3d9.dll."); if (NULL == m_d3d9dll) { + BX_TRACE("Failed to load d3d9.dll."); goto error; } @@ -370,16 +374,25 @@ namespace bgfx { namespace d3d9 && NULL != Direct3DCreate9Ex) { Direct3DCreate9Ex(D3D_SDK_VERSION, &m_d3d9ex); - DX_CHECK(m_d3d9ex->QueryInterface(IID_IDirect3D9, (void**)&m_d3d9) ); - m_pool = D3DPOOL_DEFAULT; + HRESULT hr = m_d3d9ex->QueryInterface(IID_IDirect3D9, (void**)&m_d3d9); + if (FAILED(hr) ) + { + BX_TRACE("Failed to query D3D9 interface 0x%08x.", hr); + DX_RELEASE(m_d3d9ex, 0); + } + else + { + m_pool = D3DPOOL_DEFAULT; + } } - else + + if (NULL == m_d3d9) { Direct3DCreate9 = (Direct3DCreate9Fn)bx::dlsym(m_d3d9dll, "Direct3DCreate9"); - BX_WARN(NULL != Direct3DCreate9, "Function Direct3DCreate9 not found."); if (NULL == Direct3DCreate9) { + BX_TRACE("Function Direct3DCreate9 not found."); goto error; } @@ -387,10 +400,9 @@ namespace bgfx { namespace d3d9 m_pool = D3DPOOL_MANAGED; } - BX_WARN(NULL != m_d3d9, "Unable to create Direct3D."); - if (NULL == m_d3d9) { + BX_TRACE("Unable to create Direct3D."); goto error; } @@ -487,10 +499,9 @@ namespace bgfx { namespace d3d9 } } - BX_WARN(NULL != m_device, "Unable to create Direct3D9 device."); - if (NULL == m_device) { + BX_TRACE("Unable to create Direct3D9 device."); goto error; } @@ -1317,21 +1328,30 @@ namespace bgfx { namespace d3d9 // If frame buffer has only depth attachment D3DFMT_NULL // render target is created. - uint32_t fbnum = bx::uint32_max(1, frameBuffer.m_num); + const uint32_t fbnum = bx::uint32_max(2, frameBuffer.m_numTh); + const uint8_t dsIdx = frameBuffer.m_dsIdx; + DX_CHECK(m_device->SetDepthStencilSurface(UINT8_MAX == dsIdx + ? m_backBufferDepthStencil + : frameBuffer.m_surface[dsIdx] + ) ); + + uint32_t rtIdx = 0; for (uint32_t ii = 0; ii < fbnum; ++ii) { - DX_CHECK(m_device->SetRenderTarget(ii, frameBuffer.m_color[ii]) ); + IDirect3DSurface9* surface = frameBuffer.m_surface[ii]; + if (ii != dsIdx) + { + DX_CHECK(m_device->SetRenderTarget(rtIdx, surface) ); + ++rtIdx; + } } - for (uint32_t ii = fbnum, num = g_caps.maxFBAttachments; ii < num; ++ii) + for (uint32_t ii = rtIdx, num = g_caps.maxFBAttachments; ii < num; ++ii) { DX_CHECK(m_device->SetRenderTarget(ii, NULL) ); } - IDirect3DSurface9* depthStencil = frameBuffer.m_depthStencil; - DX_CHECK(m_device->SetDepthStencilSurface(NULL != depthStencil ? depthStencil : m_backBufferDepthStencil) ); - DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE) ); } @@ -2819,16 +2839,11 @@ namespace bgfx { namespace d3d9 m_height = textureHeight; m_depth = imageContainer.m_depth; m_numMips = numMips; - m_requestedFormat = - m_textureFormat = uint8_t(imageContainer.m_format); + m_requestedFormat = uint8_t(imageContainer.m_format); + m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); + const bool convert = m_textureFormat != m_requestedFormat; - const TextureFormatInfo& tfi = s_textureFormat[m_requestedFormat]; uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); - if (D3DFMT_UNKNOWN == tfi.m_fmt) - { - m_textureFormat = (uint8_t)TextureFormat::BGRA8; - bpp = 32; - } if (imageContainer.m_cubeMap) { @@ -2871,8 +2886,6 @@ namespace bgfx { namespace d3d9 && imageContainer.m_format != TextureFormat::BC5 ; - const bool convert = m_textureFormat != m_requestedFormat; - for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side) { uint32_t width = textureWidth; @@ -2925,7 +2938,20 @@ namespace bgfx { namespace d3d9 else { uint32_t size = useMipSize ? mip.m_size : mipSize; - memcpy(bits, mip.m_data, size); + switch (m_textureFormat) + { + case TextureFormat::RGB5A1: + imageConvert(bits, 16, packBgr5a1, mip.m_data, unpackRgb5a1, size); + break; + + case TextureFormat::RGBA4: + imageConvert(bits, 16, packBgra4, mip.m_data, unpackRgba4, size); + break; + + default: + memcpy(bits, mip.m_data, size); + break; + } } unlock(side, lod); @@ -2974,7 +3000,20 @@ namespace bgfx { namespace d3d9 uint8_t* dst = bits; for (uint32_t yy = 0, height = _rect.m_height; yy < height; ++yy) { - memcpy(dst, src, rectpitch); + switch (m_textureFormat) + { + case TextureFormat::RGB5A1: + imageConvert(dst, 16, packBgr5a1, src, unpackRgb5a1, rectpitch); + break; + + case TextureFormat::RGBA4: + imageConvert(dst, 16, packBgra4, src, unpackRgba4, rectpitch); + break; + + default: + memcpy(dst, src, rectpitch); + break; + } src += srcpitch; dst += dstpitch; } @@ -3064,50 +3103,53 @@ namespace bgfx { namespace d3d9 void FrameBufferD3D9::create(uint8_t _num, const Attachment* _attachment) { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_color); ++ii) + for (uint32_t ii = 0; ii < BX_COUNTOF(m_surface); ++ii) { - m_color[ii] = NULL; + m_surface[ii] = NULL; } - m_depthStencil = NULL; - m_num = 0; + m_dsIdx = UINT8_MAX; + m_num = 0; + m_numTh = _num; m_needResolve = false; + memcpy(m_attachment, _attachment, _num*sizeof(Attachment) ); + for (uint32_t ii = 0; ii < _num; ++ii) { - TextureHandle handle = _attachment[ii].handle; + TextureHandle handle = m_attachment[ii].handle; if (isValid(handle) ) { const TextureD3D9& texture = s_renderD3D9->m_textures[handle.idx]; + if (NULL != texture.m_surface) + { + m_surface[ii] = texture.m_surface; + m_surface[ii]->AddRef(); + } + else + { + m_surface[ii] = texture.getSurface(uint8_t(m_attachment[ii].layer), uint8_t(m_attachment[ii].mip) ); + } + + if (0 == m_num) + { + m_width = texture.m_width; + m_height = texture.m_height; + } + if (isDepth( (TextureFormat::Enum)texture.m_textureFormat) ) { - m_depthHandle = handle; - if (NULL != texture.m_surface) - { - m_depthStencil = texture.m_surface; - m_depthStencil->AddRef(); - } - else - { - m_depthStencil = texture.getSurface(); - } + m_dsIdx = uint8_t(ii); } else { - m_colorHandle[m_num] = handle; - if (NULL != texture.m_surface) - { - m_color[m_num] = texture.m_surface; - m_color[m_num]->AddRef(); - } - else - { - m_color[m_num] = texture.getSurface(uint8_t(_attachment[ii].layer) ); - } - m_num++; + ++m_num; } - m_needResolve |= (NULL != texture.m_surface) && (NULL != texture.m_texture2d); + m_needResolve |= true + && (NULL != texture.m_surface) + && (NULL != texture.m_texture2d) + ; } } @@ -3132,7 +3174,7 @@ namespace bgfx { namespace d3d9 params.BackBufferHeight = m_height; DX_CHECK(s_renderD3D9->m_device->CreateAdditionalSwapChain(¶ms, &m_swapChain) ); - DX_CHECK(m_swapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_color[0]) ); + DX_CHECK(m_swapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_surface[0]) ); DX_CHECK(s_renderD3D9->m_device->CreateDepthStencilSurface( params.BackBufferWidth @@ -3141,11 +3183,11 @@ namespace bgfx { namespace d3d9 , params.MultiSampleType , params.MultiSampleQuality , FALSE - , &m_depthStencil + , &m_surface[1] , NULL ) ); - m_colorHandle[0].idx = invalidHandle; + m_dsIdx = 1; m_denseIdx = _denseIdx; m_num = 1; m_needResolve = false; @@ -3155,44 +3197,29 @@ namespace bgfx { namespace d3d9 { if (NULL != m_hwnd) { - DX_RELEASE(m_depthStencil, 0); - DX_RELEASE(m_color[0], 0); - DX_RELEASE(m_swapChain, 0); + DX_RELEASE(m_surface[0], 0); + DX_RELEASE(m_surface[1], 0); + DX_RELEASE(m_swapChain, 0); } else { - for (uint32_t ii = 0, num = m_num; ii < num; ++ii) - { - m_colorHandle[ii].idx = invalidHandle; + uint32_t num = m_numTh; + num += uint32_t(0 < m_numTh && 0 == m_num); - IDirect3DSurface9* ptr = m_color[ii]; + for (uint32_t ii = 0; ii < num; ++ii) + { + IDirect3DSurface9* ptr = m_surface[ii]; if (NULL != ptr) { ptr->Release(); - m_color[ii] = NULL; + m_surface[ii] = NULL; } } - - if (NULL != m_depthStencil) - { - if (0 == m_num) - { - IDirect3DSurface9* ptr = m_color[0]; - if (NULL != ptr) - { - ptr->Release(); - m_color[0] = NULL; - } - } - - m_depthStencil->Release(); - m_depthStencil = NULL; - } } - m_hwnd = NULL; - m_num = 0; - m_depthHandle.idx = invalidHandle; + m_hwnd = NULL; + m_num = 0; + m_numTh = 0; uint16_t denseIdx = m_denseIdx; m_denseIdx = UINT16_MAX; @@ -3209,15 +3236,9 @@ namespace bgfx { namespace d3d9 { if (m_needResolve) { - if (isValid(m_depthHandle) ) - { - const TextureD3D9& texture = s_renderD3D9->m_textures[m_depthHandle.idx]; - texture.resolve(); - } - - for (uint32_t ii = 0, num = m_num; ii < num; ++ii) + for (uint32_t ii = 0, num = m_numTh; ii < num; ++ii) { - const TextureD3D9& texture = s_renderD3D9->m_textures[m_colorHandle[ii].idx]; + const TextureD3D9& texture = s_renderD3D9->m_textures[m_attachment[ii].handle.idx]; texture.resolve(); } } @@ -3227,28 +3248,19 @@ namespace bgfx { namespace d3d9 { if (NULL != m_hwnd) { - DX_RELEASE(m_color[0], 0); - DX_RELEASE(m_depthStencil, 0); + DX_RELEASE(m_surface[0], 0); + DX_RELEASE(m_surface[1], 0); DX_RELEASE(m_swapChain, 0); } else { - for (uint32_t ii = 0, num = m_num; ii < num; ++ii) - { - m_color[ii]->Release(); - m_color[ii] = NULL; - } + uint32_t num = m_numTh; + num += uint32_t(0 < m_numTh && 0 == m_num); - if (isValid(m_depthHandle) ) + for (uint32_t ii = 0; ii < num; ++ii) { - if (0 == m_num) - { - m_color[0]->Release(); - m_color[0] = NULL; - } - - m_depthStencil->Release(); - m_depthStencil = NULL; + m_surface[ii]->Release(); + m_surface[ii] = NULL; } } } @@ -3263,69 +3275,55 @@ namespace bgfx { namespace d3d9 params.BackBufferHeight = m_height; DX_CHECK(s_renderD3D9->m_device->CreateAdditionalSwapChain(¶ms, &m_swapChain) ); - DX_CHECK(m_swapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_color[0]) ); + DX_CHECK(m_swapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_surface[0]) ); DX_CHECK(s_renderD3D9->m_device->CreateDepthStencilSurface(params.BackBufferWidth , params.BackBufferHeight , params.AutoDepthStencilFormat , params.MultiSampleType , params.MultiSampleQuality , FALSE - , &m_depthStencil + , &m_surface[1] , NULL ) ); } - else + else if (0 < m_numTh) { - for (uint32_t ii = 0, num = m_num; ii < num; ++ii) + for (uint32_t ii = 0, num = m_numTh; ii < num; ++ii) { - TextureHandle th = m_colorHandle[ii]; + TextureHandle th = m_attachment[ii].handle; if (isValid(th) ) { TextureD3D9& texture = s_renderD3D9->m_textures[th.idx]; if (NULL != texture.m_surface) { - m_color[ii] = texture.m_surface; - m_color[ii]->AddRef(); + m_surface[ii] = texture.m_surface; + m_surface[ii]->AddRef(); } else { - m_color[ii] = texture.getSurface(); + m_surface[ii] = texture.getSurface(uint8_t(m_attachment[ii].layer), uint8_t(m_attachment[ii].mip) ); } } } - if (isValid(m_depthHandle) ) + if (0 == m_num) { - TextureD3D9& texture = s_renderD3D9->m_textures[m_depthHandle.idx]; - if (NULL != texture.m_surface) - { - m_depthStencil = texture.m_surface; - m_depthStencil->AddRef(); - } - else - { - m_depthStencil = texture.getSurface(); - } - - if (0 == m_num) - { - createNullColorRT(); - } + createNullColorRT(); } } } void FrameBufferD3D9::createNullColorRT() { - const TextureD3D9& texture = s_renderD3D9->m_textures[m_depthHandle.idx]; - DX_CHECK(s_renderD3D9->m_device->CreateRenderTarget(texture.m_width - , texture.m_height + DX_CHECK(s_renderD3D9->m_device->CreateRenderTarget( + m_width + , m_height , D3DFMT_NULL , D3DMULTISAMPLE_NONE , 0 , false - , &m_color[0] + , &m_surface[1] , NULL ) ); } diff --git a/3rdparty/bgfx/src/renderer_d3d9.h b/3rdparty/bgfx/src/renderer_d3d9.h index 0b0e030dc5c..e93022ae660 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.h +++ b/3rdparty/bgfx/src/renderer_d3d9.h @@ -236,7 +236,6 @@ namespace bgfx { namespace d3d9 } void create(const Memory* _mem); - DWORD* getShaderCode(uint8_t _fragmentBit, const Memory* _mem); void destroy() { @@ -383,10 +382,11 @@ namespace bgfx { namespace d3d9 FrameBufferD3D9() : m_hwnd(NULL) , m_denseIdx(UINT16_MAX) - , m_num(0) , m_needResolve(0) + , m_num(0) + , m_numTh(0) + , m_dsIdx(UINT8_MAX) { - m_depthHandle.idx = invalidHandle; } void create(uint8_t _num, const Attachment* _attachment); @@ -398,18 +398,18 @@ namespace bgfx { namespace d3d9 void postReset(); void createNullColorRT(); - IDirect3DSurface9* m_color[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1]; - IDirect3DSurface9* m_depthStencil; + IDirect3DSurface9* m_surface[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1]; IDirect3DSwapChain9* m_swapChain; HWND m_hwnd; uint32_t m_width; uint32_t m_height; - TextureHandle m_colorHandle[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1]; - TextureHandle m_depthHandle; + Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; uint16_t m_denseIdx; - uint8_t m_num; bool m_needResolve; + uint8_t m_num; + uint8_t m_numTh; + uint8_t m_dsIdx; }; struct TimerQueryD3D9 diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp index 0feccaf9680..7fc65a3dbd8 100644 --- a/3rdparty/bgfx/src/renderer_gl.cpp +++ b/3rdparty/bgfx/src/renderer_gl.cpp @@ -246,6 +246,10 @@ namespace bgfx { namespace gl { GL_RG32I, GL_ZERO, GL_RG, GL_INT, false }, // RG32I { GL_RG32UI, GL_ZERO, GL_RG, GL_UNSIGNED_INT, false }, // RG32U { GL_RG32F, GL_ZERO, GL_RG, GL_FLOAT, false }, // RG32F + { GL_RGB8, GL_SRGB8, GL_RGB, GL_UNSIGNED_BYTE, false }, // RGB8 + { GL_RGB8I, GL_ZERO, GL_RGB, GL_BYTE, false }, // RGB8I + { GL_RGB8UI, GL_ZERO, GL_RGB, GL_UNSIGNED_BYTE, false }, // RGB8U + { GL_RGB8_SNORM, GL_ZERO, GL_RGB, GL_BYTE, false }, // RGB8S { GL_RGB9_E5, GL_ZERO, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, false }, // RGB9E5F { GL_RGBA8, GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE, false }, // BGRA8 { GL_RGBA8, GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, false }, // RGBA8 @@ -260,7 +264,7 @@ namespace bgfx { namespace gl { GL_RGBA32I, GL_ZERO, GL_RGBA, GL_INT, false }, // RGBA32I { GL_RGBA32UI, GL_ZERO, GL_RGBA, GL_UNSIGNED_INT, false }, // RGBA32U { GL_RGBA32F, GL_ZERO, GL_RGBA, GL_FLOAT, false }, // RGBA32F - { GL_RGB565, GL_ZERO, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false }, // R5G6B5 + { GL_RGB565, GL_ZERO, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, false }, // R5G6B5 { GL_RGBA4, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, false }, // RGBA4 { GL_RGB5_A1, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false }, // RGB5A1 { GL_RGB10_A2, GL_ZERO, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false }, // RGB10A2 @@ -325,6 +329,10 @@ namespace bgfx { namespace gl GL_RG32I, // RG32I GL_RG32UI, // RG32U GL_RG32F, // RG32F + GL_RGB8, // RGB8 + GL_RGB8I, // RGB8I + GL_RGB8UI, // RGB8UI + GL_RGB8_SNORM, // RGB8S GL_RGB9_E5, // RGB9E5F GL_RGBA8, // BGRA8 GL_RGBA8, // RGBA8 @@ -402,6 +410,10 @@ namespace bgfx { namespace gl GL_RG32I, // RG32I GL_RG32UI, // RG32U GL_RG32F, // RG32F + GL_RGB8, // RGB8 + GL_RGB8I, // RGB8I + GL_RGB8UI, // RGB8UI + GL_RGB8_SNORM, // RGB8S GL_RGB9_E5, // RGB9E5F GL_RGBA8, // BGRA8 GL_RGBA8, // RGBA8 @@ -1551,6 +1563,8 @@ namespace bgfx { namespace gl if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) { + setTextureFormat(TextureFormat::R8I, GL_R8I, GL_RED_INTEGER, GL_BYTE); + setTextureFormat(TextureFormat::R8U, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE); setTextureFormat(TextureFormat::R16I, GL_R16I, GL_RED_INTEGER, GL_SHORT); setTextureFormat(TextureFormat::R16U, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT); // setTextureFormat(TextureFormat::RG16, GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT); @@ -3692,9 +3706,19 @@ namespace bgfx { namespace gl case GL_IMAGE_CUBE: case GL_INT_IMAGE_CUBE: case GL_UNSIGNED_INT_IMAGE_CUBE: - BX_TRACE("Sampler #%d at location %d.", m_numSamplers, loc); - m_sampler[m_numSamplers] = loc; - m_numSamplers++; + if (m_numSamplers < BX_COUNTOF(m_sampler) ) + { + BX_TRACE("Sampler #%d at location %d.", m_numSamplers, loc); + m_sampler[m_numSamplers] = loc; + m_numSamplers++; + } + else + { + BX_TRACE("Too many samplers (max: %d)! Sampler at location %d." + , BX_COUNTOF(m_sampler) + , loc + ); + } break; default: @@ -3949,7 +3973,7 @@ namespace bgfx { namespace gl } } - bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, uint8_t _numMips, uint32_t _flags) + bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, uint32_t _flags) { m_target = _target; m_numMips = _numMips; @@ -3957,9 +3981,7 @@ namespace bgfx { namespace gl m_width = _width; m_height = _height; m_depth = _depth; - m_currentSamplerHash = UINT32_MAX; - m_requestedFormat = - m_textureFormat = uint8_t(_format); + m_currentSamplerHash = UINT32_MAX; const bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY); const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE ); @@ -3970,7 +3992,7 @@ namespace bgfx { namespace gl BX_CHECK(0 != m_id, "Failed to generate texture id."); GL_CHECK(glBindTexture(_target, m_id) ); - const TextureFormatInfo& tfi = s_textureFormat[_format]; + const TextureFormatInfo& tfi = s_textureFormat[m_textureFormat]; m_fmt = tfi.m_fmt; m_type = tfi.m_type; @@ -3979,11 +4001,9 @@ namespace bgfx { namespace gl && !s_textureFormat[m_requestedFormat].m_supported && !s_renderGL->m_textureSwizzleSupport ; - const bool compressed = isCompressed(TextureFormat::Enum(m_requestedFormat) ); - const bool convert = false - || (compressed && m_textureFormat != m_requestedFormat) + const bool convert = false + || m_textureFormat != m_requestedFormat || swizzle - || !s_textureFormat[m_requestedFormat].m_supported ; if (convert) @@ -4095,6 +4115,9 @@ namespace bgfx { namespace gl textureDepth = imageContainer.m_depth; } + m_requestedFormat = uint8_t(imageContainer.m_format); + m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); + GLenum target = GL_TEXTURE_2D; if (imageContainer.m_cubeMap) { @@ -4109,7 +4132,6 @@ namespace bgfx { namespace gl , textureWidth , textureHeight , textureDepth - , imageContainer.m_format , numMips , _flags ) ) @@ -4590,7 +4612,7 @@ namespace bgfx { namespace gl for (uint32_t ii = 0; ii < count; ++ii) { - uint8_t nameSize; + uint8_t nameSize = 0; bx::read(&reader, nameSize); char name[256]; @@ -6638,4 +6660,3 @@ namespace bgfx { namespace gl } /* namespace gl */ } // namespace bgfx #endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL) - diff --git a/3rdparty/bgfx/src/renderer_gl.h b/3rdparty/bgfx/src/renderer_gl.h index 91c49c22f02..884cc614ce5 100644 --- a/3rdparty/bgfx/src/renderer_gl.h +++ b/3rdparty/bgfx/src/renderer_gl.h @@ -222,6 +222,30 @@ typedef uint64_t GLuint64; # define GL_RG32F 0x8230 #endif // GL_RG32F +#ifndef GL_RGB8 +# define GL_RGB8 0x8051 +#endif // GL_RGB8 + +#ifndef GL_SRGB +# define GL_SRGB 0x8C40 +#endif // GL_SRGB + +#ifndef GL_SRGB8 +# define GL_SRGB8 0x8C41 +#endif // GL_SRGB8 + +#ifndef GL_RGB8I +# define GL_RGB8I 0x8D8F +#endif // GL_RGB8I + +#ifndef GL_RGB8UI +# define GL_RGB8UI 0x8D7D +#endif // GL_RGB8UI + +#ifndef GL_RGB8_SNORM +# define GL_RGB8_SNORM 0x8F96 +#endif // GL_RGB8_SNORM + #ifndef GL_RGBA8I # define GL_RGBA8I 0x8D8E #endif // GL_RGBA8I @@ -1120,7 +1144,7 @@ namespace bgfx { namespace gl { } - bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, uint8_t _numMips, uint32_t _flags); + bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, uint32_t _flags); void create(const Memory* _mem, uint32_t _flags, uint8_t _skip); void destroy(); void overrideInternal(uintptr_t _ptr); diff --git a/3rdparty/bgfx/src/renderer_mtl.mm b/3rdparty/bgfx/src/renderer_mtl.mm index 08faee495f7..ffb2c38a793 100644 --- a/3rdparty/bgfx/src/renderer_mtl.mm +++ b/3rdparty/bgfx/src/renderer_mtl.mm @@ -1855,20 +1855,10 @@ namespace bgfx { namespace mtl const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod); m_flags = _flags; - m_requestedFormat = (uint8_t)imageContainer.m_format; - m_textureFormat = MTLPixelFormatInvalid == s_textureFormat[m_requestedFormat].m_fmt - ? uint8_t(TextureFormat::BGRA8) - : m_requestedFormat - ; - - const bool convert = m_requestedFormat != m_textureFormat; - - uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); - if (convert) - { - m_textureFormat = (uint8_t)TextureFormat::RGBA8; - bpp = 32; - } + m_requestedFormat = uint8_t(imageContainer.m_format); + m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); + const bool convert = m_textureFormat != m_requestedFormat; + const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) ); TextureDescriptor desc = s_renderMtl->m_textureDescriptor; diff --git a/3rdparty/bgfx/src/renderer_vk.cpp b/3rdparty/bgfx/src/renderer_vk.cpp index 31455c1992f..e885b84e58f 100644 --- a/3rdparty/bgfx/src/renderer_vk.cpp +++ b/3rdparty/bgfx/src/renderer_vk.cpp @@ -6,7 +6,7 @@ #include "bgfx_p.h" #if BGFX_CONFIG_RENDERER_VULKAN -# include "../../bgfx-ext/src/renderer_vk.cpp" +# include "../../bgfx-ext/src/renderer_vk1.cpp" #else namespace bgfx { namespace vk diff --git a/3rdparty/bgfx/src/shader_dx9bc.cpp b/3rdparty/bgfx/src/shader_dx9bc.cpp index 071a9e2705e..bb2b6a0e4db 100644 --- a/3rdparty/bgfx/src/shader_dx9bc.cpp +++ b/3rdparty/bgfx/src/shader_dx9bc.cpp @@ -274,12 +274,12 @@ namespace bgfx }; BX_STATIC_ASSERT(BX_COUNTOF(s_dx9bcDeclUsage) == Dx9bcDeclUsage::Count); - int32_t read(bx::ReaderI* _reader, Dx9bcSubOperand& _subOperand) + int32_t read(bx::ReaderI* _reader, Dx9bcSubOperand& _subOperand, bx::Error* _err) { int32_t size = 0; uint32_t token; - size += bx::read(_reader, token); + size += bx::read(_reader, token, _err); _subOperand.type = Dx9bcOperandType::Enum( ( (token & UINT32_C(0x70000000) ) >> 28) | ( (token & UINT32_C(0x00001800) ) >> 8) ); @@ -289,7 +289,7 @@ namespace bgfx return size; } - int32_t write(bx::WriterI* _writer, const Dx9bcSubOperand& _subOperand) + int32_t write(bx::WriterI* _writer, const Dx9bcSubOperand& _subOperand, bx::Error* _err) { int32_t size = 0; @@ -298,17 +298,17 @@ namespace bgfx token |= (_subOperand.type << 8) & UINT32_C(0x00001800); token |= _subOperand.regIndex & UINT32_C(0x000007ff); token |= (_subOperand.swizzleBits << 16) & UINT32_C(0x00ff0000); - size += bx::write(_writer, token); + size += bx::write(_writer, token, _err); return size; } - int32_t read(bx::ReaderI* _reader, Dx9bcOperand& _operand) + int32_t read(bx::ReaderI* _reader, Dx9bcOperand& _operand, bx::Error* _err) { int32_t size = 0; uint32_t token; - size += bx::read(_reader, token); + size += bx::read(_reader, token, _err); _operand.type = Dx9bcOperandType::Enum( ( (token & UINT32_C(0x70000000) ) >> 28) | ( (token & UINT32_C(0x00001800) ) >> 8) ); @@ -339,13 +339,13 @@ namespace bgfx if (Dx9bcOperandAddrMode::Relative == _operand.addrMode) { - size += read(_reader, _operand.subOperand); + size += read(_reader, _operand.subOperand, _err); } return size; } - int32_t write(bx::WriterI* _writer, const Dx9bcOperand& _operand) + int32_t write(bx::WriterI* _writer, const Dx9bcOperand& _operand, bx::Error* _err) { int32_t size = 0; @@ -354,22 +354,22 @@ namespace bgfx token |= (_operand.type << 8) & UINT32_C(0x00001800); token |= _operand.regIndex & UINT32_C(0x000007ff); token |= (_operand.addrMode << 13) & UINT32_C(0x00002000); - size += bx::write(_writer, token); + size += bx::write(_writer, token, _err); if (Dx9bcOperandAddrMode::Relative == _operand.addrMode) { - size += write(_writer, _operand.subOperand); + size += write(_writer, _operand.subOperand, _err); } return size; } - int32_t read(bx::ReaderI* _reader, Dx9bcInstruction& _instruction) + int32_t read(bx::ReaderI* _reader, Dx9bcInstruction& _instruction, bx::Error* _err) { int32_t size = 0; uint32_t token; - size += bx::read(_reader, token); + size += bx::read(_reader, token, _err); _instruction.opcode = Dx9bcOpcode::Enum( (token & UINT32_C(0x0000ffff) ) ); @@ -395,7 +395,7 @@ namespace bgfx for (int32_t ii = 0, num = _instruction.length-1; ii < num; ++ii) { uint32_t tmp; - size += bx::read(_reader, tmp); + size += bx::read(_reader, tmp, _err); } } @@ -436,24 +436,24 @@ namespace bgfx if (valuesBeforeOpcode && 0 < info.numValues) { - size += read(_reader, _instruction.value, info.numValues*sizeof(uint32_t) ); + size += read(_reader, _instruction.value, info.numValues*sizeof(uint32_t), _err); } _instruction.operand[0].destination = true; switch (_instruction.numOperands) { - case 6: size += read(_reader, _instruction.operand[currOp++]); - case 5: size += read(_reader, _instruction.operand[currOp++]); - case 4: size += read(_reader, _instruction.operand[currOp++]); - case 3: size += read(_reader, _instruction.operand[currOp++]); - case 2: size += read(_reader, _instruction.operand[currOp++]); - case 1: size += read(_reader, _instruction.operand[currOp++]); + case 6: size += read(_reader, _instruction.operand[currOp++], _err); + case 5: size += read(_reader, _instruction.operand[currOp++], _err); + case 4: size += read(_reader, _instruction.operand[currOp++], _err); + case 3: size += read(_reader, _instruction.operand[currOp++], _err); + case 2: size += read(_reader, _instruction.operand[currOp++], _err); + case 1: size += read(_reader, _instruction.operand[currOp++], _err); case 0: if (!valuesBeforeOpcode && 0 < info.numValues) { - size += read(_reader, _instruction.value, info.numValues*sizeof(uint32_t) ); + size += read(_reader, _instruction.value, info.numValues*sizeof(uint32_t), _err); } break; @@ -469,7 +469,7 @@ namespace bgfx return size; } - int32_t write(bx::WriterI* _writer, const Dx9bcInstruction& _instruction) + int32_t write(bx::WriterI* _writer, const Dx9bcInstruction& _instruction, bx::Error* _err) { int32_t size = 0; @@ -477,17 +477,17 @@ namespace bgfx token |= _instruction.opcode & UINT32_C(0x0000ffff); token |= (_instruction.specific << 16) & UINT32_C(0x00ff0000); token |= ( (_instruction.length - 1) << 24) & UINT32_C(0x0f000000); - size += bx::write(_writer, token); + size += bx::write(_writer, token, _err); uint32_t currOp = 0; switch (_instruction.numOperands) { - case 6: size += write(_writer, _instruction.operand[currOp++]); - case 5: size += write(_writer, _instruction.operand[currOp++]); - case 4: size += write(_writer, _instruction.operand[currOp++]); - case 3: size += write(_writer, _instruction.operand[currOp++]); - case 2: size += write(_writer, _instruction.operand[currOp++]); - case 1: size += write(_writer, _instruction.operand[currOp++]); + case 6: size += write(_writer, _instruction.operand[currOp++], _err); + case 5: size += write(_writer, _instruction.operand[currOp++], _err); + case 4: size += write(_writer, _instruction.operand[currOp++], _err); + case 3: size += write(_writer, _instruction.operand[currOp++], _err); + case 2: size += write(_writer, _instruction.operand[currOp++], _err); + case 1: size += write(_writer, _instruction.operand[currOp++], _err); case 0: break; } @@ -626,7 +626,7 @@ namespace bgfx return size; } - int32_t read(bx::ReaderSeekerI* _reader, Dx9bcShader& _shader) + int32_t read(bx::ReaderSeekerI* _reader, Dx9bcShader& _shader, bx::Error* _err) { int32_t size = 0; int64_t offset = bx::seek(_reader); @@ -634,7 +634,7 @@ namespace bgfx for (;;) { Dx9bcInstruction instruction; - int32_t length = read(_reader, instruction); + int32_t length = read(_reader, instruction, _err); size += length; if (Dx9bcOpcode::Count > instruction.opcode) @@ -662,22 +662,22 @@ namespace bgfx bx::seek(_reader, offset, bx::Whence::Begin); _shader.byteCode.resize(size); - bx::read(_reader, _shader.byteCode.data(), size); + bx::read(_reader, _shader.byteCode.data(), size, _err); return size; } - int32_t write(bx::WriterI* _writer, const Dx9bcShader& _shader) + int32_t write(bx::WriterI* _writer, const Dx9bcShader& _shader, bx::Error* _err) { - BX_UNUSED(_writer, _shader); + BX_UNUSED(_writer, _shader, _err); return 0; } - int32_t read(bx::ReaderSeekerI* _reader, Dx9bc& _bc) + int32_t read(bx::ReaderSeekerI* _reader, Dx9bc& _bc, bx::Error* _err) { int32_t size = 0; - size += bx::read(_reader, _bc.version); + size += bx::read(_reader, _bc.version, _err); bool pixelShader = (0xffff0000 == (_bc.version & 0xffff0000) ); uint32_t versionMajor = (_bc.version>>8)&0xff; @@ -689,37 +689,45 @@ namespace bgfx , versionMinor ); - size += read(_reader, _bc.shader); + size += read(_reader, _bc.shader, _err); return size; } - int32_t write(bx::WriterSeekerI* _writer, const Dx9bc& _dxbc) + int32_t write(bx::WriterSeekerI* _writer, const Dx9bc& _dxbc, bx::Error* _err) { - BX_UNUSED(_writer, _dxbc); + BX_UNUSED(_writer, _dxbc, _err); return 0; } - void parse(const Dx9bcShader& _src, Dx9bcParseFn _fn, void* _userData) + void parse(const Dx9bcShader& _src, Dx9bcParseFn _fn, void* _userData, bx::Error* _err) { + BX_ERROR_SCOPE(_err); + bx::MemoryReader reader(_src.byteCode.data(), uint32_t(_src.byteCode.size() ) ); -//BX_TRACE("parse %d", _src.byteCode.size()); + bx::Error err; for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;) { Dx9bcInstruction instruction; - uint32_t size = read(&reader, instruction); + uint32_t size = read(&reader, instruction, _err); 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; } } - void filter(Dx9bcShader& _dst, const Dx9bcShader& _src, Dx9bcFilterFn _fn, void* _userData) + void filter(Dx9bcShader& _dst, const Dx9bcShader& _src, Dx9bcFilterFn _fn, void* _userData, bx::Error* _err) { + BX_ERROR_SCOPE(_err); + bx::MemoryReader reader(_src.byteCode.data(), uint32_t(_src.byteCode.size() ) ); bx::MemoryBlock mb(g_allocator); @@ -728,7 +736,7 @@ namespace bgfx for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;) { Dx9bcInstruction instruction; - uint32_t size = read(&reader, instruction); + uint32_t size = read(&reader, instruction, _err); BX_CHECK(size/4 == instruction.length, "read %d, expected %d", size/4, instruction.length); BX_UNUSED(size); _fn(instruction, _userData); diff --git a/3rdparty/bgfx/src/shader_dx9bc.h b/3rdparty/bgfx/src/shader_dx9bc.h index d7b6b381dc3..0680d641a12 100644 --- a/3rdparty/bgfx/src/shader_dx9bc.h +++ b/3rdparty/bgfx/src/shader_dx9bc.h @@ -226,8 +226,8 @@ namespace bgfx int32_t value[4]; }; - int32_t read(bx::ReaderI* _reader, Dx9bcInstruction& _instruction); - int32_t write(bx::WriterI* _writer, const Dx9bcInstruction& _instruction); + int32_t read(bx::ReaderI* _reader, Dx9bcInstruction& _instruction, bx::Error* _err); + int32_t write(bx::WriterI* _writer, const Dx9bcInstruction& _instruction, bx::Error* _err); int32_t toString(char* _out, int32_t _size, const Dx9bcInstruction& _instruction); struct Dx9bcShader @@ -235,8 +235,8 @@ namespace bgfx stl::vector<uint8_t> byteCode; }; - int32_t read(bx::ReaderSeekerI* _reader, Dx9bcShader& _shader); - int32_t write(bx::WriterI* _writer, const Dx9bcShader& _shader); + int32_t read(bx::ReaderSeekerI* _reader, Dx9bcShader& _shader, bx::Error* _err); + int32_t write(bx::WriterI* _writer, const Dx9bcShader& _shader, bx::Error* _err); struct Dx9bc { @@ -244,14 +244,14 @@ namespace bgfx Dx9bcShader shader; }; - int32_t read(bx::ReaderSeekerI* _reader, Dx9bc& _dx9bc); - int32_t write(bx::WriterSeekerI* _writer, const Dx9bc& _dx9bc); + int32_t read(bx::ReaderSeekerI* _reader, Dx9bc& _dx9bc, bx::Error* _err); + int32_t write(bx::WriterSeekerI* _writer, const Dx9bc& _dx9bc, bx::Error* _err); - typedef void (*Dx9bcParseFn)(uint32_t _offset, const Dx9bcInstruction& _instruction, void* _userData); - void parse(const Dx9bcShader& _src, Dx9bcParseFn _fn, void* _userData); + typedef bool (*Dx9bcParseFn)(uint32_t _offset, const Dx9bcInstruction& _instruction, void* _userData); + void parse(const Dx9bcShader& _src, Dx9bcParseFn _fn, void* _userData, bx::Error* _err = NULL); typedef void (*Dx9bcFilterFn)(Dx9bcInstruction& _instruction, void* _userData); - void filter(Dx9bcShader& _dst, const Dx9bcShader& _src, Dx9bcFilterFn _fn, void* _userData); + void filter(Dx9bcShader& _dst, const Dx9bcShader& _src, Dx9bcFilterFn _fn, void* _userData, bx::Error* _err = NULL); } // namespace bgfx diff --git a/3rdparty/bgfx/src/shader_dxbc.cpp b/3rdparty/bgfx/src/shader_dxbc.cpp index 36d81842c8d..9f8b351e76a 100644 --- a/3rdparty/bgfx/src/shader_dxbc.cpp +++ b/3rdparty/bgfx/src/shader_dxbc.cpp @@ -552,7 +552,7 @@ namespace bgfx #define DXBC_MAX_NAME_STRING 512 - int32_t readString(bx::ReaderSeekerI* _reader, int64_t _offset, char* _out, uint32_t _max = DXBC_MAX_NAME_STRING) + int32_t readString(bx::ReaderSeekerI* _reader, int64_t _offset, char* _out, uint32_t _max, bx::Error* _err) { int64_t oldOffset = bx::seek(_reader); bx::seek(_reader, _offset, bx::Whence::Begin); @@ -562,7 +562,7 @@ namespace bgfx for (uint32_t ii = 0; ii < _max-1; ++ii) { char ch; - size += bx::read(_reader, ch); + size += bx::read(_reader, ch, _err); *_out++ = ch; if ('\0' == ch) @@ -755,7 +755,7 @@ namespace bgfx memcpy(_digest, hash, 16); } - int32_t read(bx::ReaderI* _reader, DxbcSubOperand& _subOperand) + int32_t read(bx::ReaderI* _reader, DxbcSubOperand& _subOperand, bx::Error* _err) { uint32_t token; int32_t size = 0; @@ -773,7 +773,7 @@ namespace bgfx // |+------------------------------- addressing mode 2 // +-------------------------------- extended - size += bx::read(_reader, token); + size += bx::read(_reader, token, _err); _subOperand.type = DxbcOperandType::Enum( (token & UINT32_C(0x000ff000) ) >> 12); _subOperand.numAddrModes = uint8_t( (token & UINT32_C(0x00300000) ) >> 20); _subOperand.addrMode = uint8_t( (token & UINT32_C(0x01c00000) ) >> 22); @@ -784,7 +784,7 @@ namespace bgfx switch (_subOperand.addrMode) { case DxbcOperandAddrMode::Imm32: - size += bx::read(_reader, _subOperand.regIndex); + size += bx::read(_reader, _subOperand.regIndex, _err); break; case DxbcOperandAddrMode::Reg: @@ -796,7 +796,7 @@ namespace bgfx case DxbcOperandAddrMode::RegImm32: { - size += bx::read(_reader, _subOperand.regIndex); + size += bx::read(_reader, _subOperand.regIndex, _err); DxbcSubOperand subOperand; size += read(_reader, subOperand); @@ -805,8 +805,8 @@ namespace bgfx case DxbcOperandAddrMode::RegImm64: { - size += bx::read(_reader, _subOperand.regIndex); - size += bx::read(_reader, _subOperand.regIndex); + size += bx::read(_reader, _subOperand.regIndex, _err); + size += bx::read(_reader, _subOperand.regIndex, _err); DxbcSubOperand subOperand; size += read(_reader, subOperand); @@ -821,7 +821,7 @@ namespace bgfx return size; } - int32_t write(bx::WriterI* _writer, const DxbcSubOperand& _subOperand) + int32_t write(bx::WriterI* _writer, const DxbcSubOperand& _subOperand, bx::Error* _err) { int32_t size = 0; @@ -832,12 +832,12 @@ namespace bgfx token |= (_subOperand.mode << 2) & UINT32_C(0x0000000c); token |= (_subOperand.modeBits << 4) & UINT32_C(0x00000ff0); token |= _subOperand.num & UINT32_C(0x00000003); - size += bx::write(_writer, token); + size += bx::write(_writer, token, _err); switch (_subOperand.addrMode) { case DxbcOperandAddrMode::Imm32: - size += bx::write(_writer, _subOperand.regIndex); + size += bx::write(_writer, _subOperand.regIndex, _err); break; case DxbcOperandAddrMode::Reg: @@ -849,7 +849,7 @@ namespace bgfx case DxbcOperandAddrMode::RegImm32: { - size += bx::write(_writer, _subOperand.regIndex); + size += bx::write(_writer, _subOperand.regIndex, _err); DxbcSubOperand subOperand; size += write(_writer, subOperand); @@ -858,8 +858,8 @@ namespace bgfx case DxbcOperandAddrMode::RegImm64: { - size += bx::write(_writer, _subOperand.regIndex); - size += bx::write(_writer, _subOperand.regIndex); + size += bx::write(_writer, _subOperand.regIndex, _err); + size += bx::write(_writer, _subOperand.regIndex, _err); DxbcSubOperand subOperand; size += write(_writer, subOperand); @@ -874,12 +874,12 @@ namespace bgfx return size; } - int32_t read(bx::ReaderI* _reader, DxbcOperand& _operand) + int32_t read(bx::ReaderI* _reader, DxbcOperand& _operand, bx::Error* _err) { int32_t size = 0; uint32_t token; - size += bx::read(_reader, token); + size += bx::read(_reader, token, _err); // 0 1 2 3 // 76543210765432107654321076543210 @@ -906,7 +906,7 @@ namespace bgfx if (_operand.extended) { - size += bx::read(_reader, _operand.extBits); + size += bx::read(_reader, _operand.extBits, _err); } switch (_operand.type) @@ -915,7 +915,7 @@ namespace bgfx _operand.num = 2 == _operand.num ? 4 : _operand.num; for (uint32_t ii = 0; ii < _operand.num; ++ii) { - size += bx::read(_reader, _operand.un.imm32[ii]); + size += bx::read(_reader, _operand.un.imm32[ii], _err); } break; @@ -923,7 +923,7 @@ namespace bgfx _operand.num = 2 == _operand.num ? 4 : _operand.num; for (uint32_t ii = 0; ii < _operand.num; ++ii) { - size += bx::read(_reader, _operand.un.imm64[ii]); + size += bx::read(_reader, _operand.un.imm64[ii], _err); } break; @@ -936,16 +936,16 @@ namespace bgfx switch (_operand.addrMode[ii]) { case DxbcOperandAddrMode::Imm32: - size += bx::read(_reader, _operand.regIndex[ii]); + size += bx::read(_reader, _operand.regIndex[ii], _err); break; case DxbcOperandAddrMode::Reg: - size += read(_reader, _operand.subOperand[ii]); + size += read(_reader, _operand.subOperand[ii], _err); break; case DxbcOperandAddrMode::RegImm32: - size += bx::read(_reader, _operand.regIndex[ii]); - size += read(_reader, _operand.subOperand[ii]); + size += bx::read(_reader, _operand.regIndex[ii], _err); + size += read(_reader, _operand.subOperand[ii], _err); break; default: @@ -957,7 +957,7 @@ namespace bgfx return size; } - int32_t write(bx::WriterI* _writer, const DxbcOperand& _operand) + int32_t write(bx::WriterI* _writer, const DxbcOperand& _operand, bx::Error* _err) { int32_t size = 0; @@ -973,7 +973,7 @@ namespace bgfx token |= (4 == _operand.num ? 2 : _operand.num) & UINT32_C(0x00000003); token |= ( (_operand.modeBits & "\x0f\xff\x03\x00"[_operand.mode]) << 4) & UINT32_C(0x00000ff0); - size += bx::write(_writer, token); + size += bx::write(_writer, token, _err); if (_operand.extended) { @@ -985,14 +985,14 @@ namespace bgfx case DxbcOperandType::Imm32: for (uint32_t ii = 0; ii < _operand.num; ++ii) { - size += bx::write(_writer, _operand.un.imm32[ii]); + size += bx::write(_writer, _operand.un.imm32[ii], _err); } break; case DxbcOperandType::Imm64: for (uint32_t ii = 0; ii < _operand.num; ++ii) { - size += bx::write(_writer, _operand.un.imm64[ii]); + size += bx::write(_writer, _operand.un.imm64[ii], _err); } break; @@ -1005,16 +1005,16 @@ namespace bgfx switch (_operand.addrMode[ii]) { case DxbcOperandAddrMode::Imm32: - size += bx::write(_writer, _operand.regIndex[ii]); + size += bx::write(_writer, _operand.regIndex[ii], _err); break; case DxbcOperandAddrMode::Reg: - size += write(_writer, _operand.subOperand[ii]); + size += write(_writer, _operand.subOperand[ii], _err); break; case DxbcOperandAddrMode::RegImm32: - size += bx::write(_writer, _operand.regIndex[ii]); - size += write(_writer, _operand.subOperand[ii]); + size += bx::write(_writer, _operand.regIndex[ii], _err); + size += write(_writer, _operand.subOperand[ii], _err); break; default: @@ -1026,12 +1026,12 @@ namespace bgfx return size; } - int32_t read(bx::ReaderI* _reader, DxbcInstruction& _instruction) + int32_t read(bx::ReaderI* _reader, DxbcInstruction& _instruction, bx::Error* _err) { uint32_t size = 0; uint32_t token; - size += bx::read(_reader, token); + size += bx::read(_reader, token, _err); // 0 1 2 3 // 76543210765432107654321076543210 @@ -1077,7 +1077,7 @@ namespace bgfx for (uint32_t ii = 0, num = (_instruction.length-2)/4; ii < num; ++ii) { char temp[16]; - size += bx::read(_reader, temp, 16); + size += bx::read(_reader, temp, 16, _err); } } @@ -1190,7 +1190,7 @@ namespace bgfx uint32_t extBits; size += bx::read(_reader, extBits); extended = 0 != (extBits & UINT32_C(0x80000000) ); - _instruction.extended[ii] = DxbcInstruction::ExtendedType::Enum(extBits & UINT32_C(0x0000001f) ); + _instruction.extended[ii ] = DxbcInstruction::ExtendedType::Enum(extBits & UINT32_C(0x0000001f) ); _instruction.extended[ii+1] = DxbcInstruction::ExtendedType::Count; switch (_instruction.extended[ii]) @@ -1244,7 +1244,7 @@ namespace bgfx case DxbcOpcode::DCL_FUNCTION_TABLE: { uint32_t tableId; - size += read(_reader, tableId); + size += read(_reader, tableId, _err); uint32_t num; size += read(_reader, num); @@ -1252,7 +1252,7 @@ namespace bgfx for (uint32_t ii = 0; ii < num; ++ii) { uint32_t bodyId; - size += read(_reader, bodyId); + size += read(_reader, bodyId, _err); } } break; @@ -1260,10 +1260,10 @@ namespace bgfx case DxbcOpcode::DCL_INTERFACE: { uint32_t interfaceId; - size += read(_reader, interfaceId); + size += read(_reader, interfaceId, _err); uint32_t num; - size += read(_reader, num); + size += read(_reader, num, _err); BX_CHECK(false, "not implemented."); } @@ -1279,16 +1279,16 @@ namespace bgfx _instruction.numOperands = info.numOperands; switch (info.numOperands) { - case 6: size += read(_reader, _instruction.operand[currOp++]); - case 5: size += read(_reader, _instruction.operand[currOp++]); - case 4: size += read(_reader, _instruction.operand[currOp++]); - case 3: size += read(_reader, _instruction.operand[currOp++]); - case 2: size += read(_reader, _instruction.operand[currOp++]); - case 1: size += read(_reader, _instruction.operand[currOp++]); + case 6: size += read(_reader, _instruction.operand[currOp++], _err); + case 5: size += read(_reader, _instruction.operand[currOp++], _err); + case 4: size += read(_reader, _instruction.operand[currOp++], _err); + case 3: size += read(_reader, _instruction.operand[currOp++], _err); + case 2: size += read(_reader, _instruction.operand[currOp++], _err); + case 1: size += read(_reader, _instruction.operand[currOp++], _err); case 0: if (0 < info.numValues) { - size += read(_reader, _instruction.value, info.numValues*sizeof(uint32_t) ); + size += read(_reader, _instruction.value, info.numValues*sizeof(uint32_t), _err); } break; @@ -1304,7 +1304,7 @@ namespace bgfx return size; } - int32_t write(bx::WriterI* _writer, const DxbcInstruction& _instruction) + int32_t write(bx::WriterI* _writer, const DxbcInstruction& _instruction, bx::Error* _err) { uint32_t token = 0; token |= (_instruction.opcode ) & UINT32_C(0x000007ff); @@ -1366,7 +1366,7 @@ namespace bgfx uint32_t size =0; size += bx::write(_writer, token); -; + for (uint32_t ii = 0; _instruction.extended[ii] != DxbcInstruction::ExtendedType::Count; ++ii) { // 0 1 2 3 @@ -1427,18 +1427,18 @@ namespace bgfx break; } - size += bx::write(_writer, token); + size += bx::write(_writer, token, _err); } for (uint32_t ii = 0; ii < _instruction.numOperands; ++ii) { - size += write(_writer, _instruction.operand[ii]); + size += write(_writer, _instruction.operand[ii], _err); } const DxbcOpcodeInfo& info = s_dxbcOpcodeInfo[_instruction.opcode]; if (0 < info.numValues) { - size += bx::write(_writer, _instruction.value, info.numValues*sizeof(uint32_t) ); + size += bx::write(_writer, _instruction.value, info.numValues*sizeof(uint32_t), _err); } return size; @@ -1609,15 +1609,15 @@ namespace bgfx return size; } - int32_t read(bx::ReaderSeekerI* _reader, DxbcSignature& _signature) + int32_t read(bx::ReaderSeekerI* _reader, DxbcSignature& _signature, bx::Error* _err) { int32_t size = 0; int64_t offset = bx::seek(_reader); uint32_t num; - size += bx::read(_reader, num); - size += bx::read(_reader, _signature.key); + size += bx::read(_reader, num, _err); + size += bx::read(_reader, _signature.key, _err); for (uint32_t ii = 0; ii < num; ++ii) { @@ -1627,20 +1627,20 @@ namespace bgfx size += bx::read(_reader, nameOffset); char name[DXBC_MAX_NAME_STRING]; - readString(_reader, offset + nameOffset, name); + readString(_reader, offset + nameOffset, name, DXBC_MAX_NAME_STRING, _err); element.name = name; - size += bx::read(_reader, element.semanticIndex); - size += bx::read(_reader, element.valueType); - size += bx::read(_reader, element.componentType); - size += bx::read(_reader, element.registerIndex); - size += bx::read(_reader, element.mask); - size += bx::read(_reader, element.readWriteMask); - size += bx::read(_reader, element.stream); + size += bx::read(_reader, element.semanticIndex, _err); + size += bx::read(_reader, element.valueType, _err); + size += bx::read(_reader, element.componentType, _err); + size += bx::read(_reader, element.registerIndex, _err); + size += bx::read(_reader, element.mask, _err); + size += bx::read(_reader, element.readWriteMask, _err); + size += bx::read(_reader, element.stream, _err); // padding uint8_t padding; - size += bx::read(_reader, padding); + size += bx::read(_reader, padding, _err); _signature.elements.push_back(element); } @@ -1648,13 +1648,13 @@ namespace bgfx return size; } - int32_t write(bx::WriterI* _writer, const DxbcSignature& _signature) + int32_t write(bx::WriterI* _writer, const DxbcSignature& _signature, bx::Error* _err) { int32_t size = 0; const uint32_t num = uint32_t(_signature.elements.size() ); - size += bx::write(_writer, num); - size += bx::write(_writer, _signature.key); + size += bx::write(_writer, num, _err); + size += bx::write(_writer, _signature.key, _err); typedef stl::unordered_map<stl::string, uint32_t> NameOffsetMap; NameOffsetMap nom; @@ -1669,7 +1669,7 @@ namespace bgfx if (it == nom.end() ) { nom.insert(stl::make_pair(element.name, nameOffset) ); - size += bx::write(_writer, nameOffset); + size += bx::write(_writer, nameOffset, _err); nameOffset += uint32_t(element.name.size() + 1); } else @@ -1677,15 +1677,14 @@ namespace bgfx size += bx::write(_writer, it->second); } - size += bx::write(_writer, element.semanticIndex); - size += bx::write(_writer, element.valueType); - size += bx::write(_writer, element.componentType); - size += bx::write(_writer, element.registerIndex); - size += bx::write(_writer, element.mask); - size += bx::write(_writer, element.readWriteMask); - size += bx::write(_writer, element.stream); - size += bx::write(_writer, pad); - + size += bx::write(_writer, element.semanticIndex, _err); + size += bx::write(_writer, element.valueType, _err); + size += bx::write(_writer, element.componentType, _err); + size += bx::write(_writer, element.registerIndex, _err); + size += bx::write(_writer, element.mask, _err); + size += bx::write(_writer, element.readWriteMask, _err); + size += bx::write(_writer, element.stream, _err); + size += bx::write(_writer, pad, _err); } uint32_t len = 0; @@ -1696,42 +1695,42 @@ namespace bgfx if (it != nom.end() ) { nom.erase(it); - size += bx::write(_writer, element.name.c_str(), uint32_t(element.name.size() + 1) ); + size += bx::write(_writer, element.name.c_str(), uint32_t(element.name.size() + 1), _err); len += uint32_t(element.name.size() + 1); } } // align 4 bytes - size += bx::writeRep(_writer, 0xab, (len+3)/4*4 - len); + size += bx::writeRep(_writer, 0xab, (len+3)/4*4 - len, _err); return size; } - int32_t read(bx::ReaderSeekerI* _reader, DxbcShader& _shader) + int32_t read(bx::ReaderSeekerI* _reader, DxbcShader& _shader, bx::Error* _err) { int32_t size = 0; - size += bx::read(_reader, _shader.version); + size += bx::read(_reader, _shader.version, _err); uint32_t bcLength; - size += bx::read(_reader, bcLength); + size += bx::read(_reader, bcLength, _err); uint32_t len = (bcLength-2)*sizeof(uint32_t); _shader.byteCode.resize(len); - size += bx::read(_reader, _shader.byteCode.data(), len); + size += bx::read(_reader, _shader.byteCode.data(), len, _err); return size; } - int32_t write(bx::WriterI* _writer, const DxbcShader& _shader) + int32_t write(bx::WriterI* _writer, const DxbcShader& _shader, bx::Error* _err) { const uint32_t len = uint32_t(_shader.byteCode.size() ); const uint32_t bcLength = len / sizeof(uint32_t) + 2; int32_t size = 0; - size += bx::write(_writer, _shader.version); - size += bx::write(_writer, bcLength); - size += bx::write(_writer, _shader.byteCode.data(), len); + size += bx::write(_writer, _shader.version, _err); + size += bx::write(_writer, bcLength, _err); + size += bx::write(_writer, _shader.byteCode.data(), len, _err); return size; } @@ -1743,10 +1742,10 @@ namespace bgfx #define DXBC_CHUNK_INPUT_SIGNATURE BX_MAKEFOURCC('I', 'S', 'G', 'N') #define DXBC_CHUNK_OUTPUT_SIGNATURE BX_MAKEFOURCC('O', 'S', 'G', 'N') - int32_t read(bx::ReaderSeekerI* _reader, DxbcContext& _dxbc) + int32_t read(bx::ReaderSeekerI* _reader, DxbcContext& _dxbc, bx::Error* _err) { int32_t size = 0; - size += bx::read(_reader, _dxbc.header); + size += bx::read(_reader, _dxbc.header, _err); _dxbc.shader.shex = false; for (uint32_t ii = 0; ii < _dxbc.header.numChunks; ++ii) @@ -1754,15 +1753,15 @@ namespace bgfx bx::seek(_reader, sizeof(DxbcContext::Header) + ii*sizeof(uint32_t), bx::Whence::Begin); uint32_t chunkOffset; - size += bx::read(_reader, chunkOffset); + size += bx::read(_reader, chunkOffset, _err); bx::seek(_reader, chunkOffset, bx::Whence::Begin); uint32_t fourcc; - size += bx::read(_reader, fourcc); + size += bx::read(_reader, fourcc, _err); uint32_t chunkSize; - size += bx::read(_reader, chunkSize); + size += bx::read(_reader, chunkSize, _err); switch (fourcc) { @@ -1771,18 +1770,18 @@ namespace bgfx // fallthrough case DXBC_CHUNK_SHADER: - size += read(_reader, _dxbc.shader); + size += read(_reader, _dxbc.shader, _err); break; case BX_MAKEFOURCC('I', 'S', 'G', '1'): case DXBC_CHUNK_INPUT_SIGNATURE: - size += read(_reader, _dxbc.inputSignature); + size += read(_reader, _dxbc.inputSignature, _err); break; case BX_MAKEFOURCC('O', 'S', 'G', '1'): case BX_MAKEFOURCC('O', 'S', 'G', '5'): case DXBC_CHUNK_OUTPUT_SIGNATURE: - size += read(_reader, _dxbc.outputSignature); + size += read(_reader, _dxbc.outputSignature, _err); break; case BX_MAKEFOURCC('A', 'o', 'n', '9'): // Contains DX9BC for feature level 9.x (*s_4_0_level_9_*) shaders. @@ -1816,43 +1815,43 @@ namespace bgfx return size; } - int32_t write(bx::WriterSeekerI* _writer, const DxbcContext& _dxbc) + int32_t write(bx::WriterSeekerI* _writer, const DxbcContext& _dxbc, bx::Error* _err) { int32_t size = 0; int64_t dxbcOffset = bx::seek(_writer); size += bx::write(_writer, DXBC_CHUNK_HEADER); - size += bx::writeRep(_writer, 0, 16); + size += bx::writeRep(_writer, 0, 16, _err); - size += bx::write(_writer, UINT32_C(1) ); + size += bx::write(_writer, UINT32_C(1), _err); int64_t sizeOffset = bx::seek(_writer); - size += bx::writeRep(_writer, 0, 4); + size += bx::writeRep(_writer, 0, 4, _err); uint32_t numChunks = 3; - size += bx::write(_writer, numChunks); + size += bx::write(_writer, numChunks, _err); int64_t chunksOffsets = bx::seek(_writer); - size += bx::writeRep(_writer, 0, numChunks*sizeof(uint32_t) ); + size += bx::writeRep(_writer, 0, numChunks*sizeof(uint32_t), _err); uint32_t chunkOffset[3]; uint32_t chunkSize[3]; chunkOffset[0] = uint32_t(bx::seek(_writer) - dxbcOffset); - size += write(_writer, DXBC_CHUNK_INPUT_SIGNATURE); - size += write(_writer, UINT32_C(0) ); - chunkSize[0] = write(_writer, _dxbc.inputSignature); + size += write(_writer, DXBC_CHUNK_INPUT_SIGNATURE, _err); + size += write(_writer, UINT32_C(0), _err); + chunkSize[0] = write(_writer, _dxbc.inputSignature, _err); chunkOffset[1] = uint32_t(bx::seek(_writer) - dxbcOffset); - size += write(_writer, DXBC_CHUNK_OUTPUT_SIGNATURE); - size += write(_writer, UINT32_C(0) ); - chunkSize[1] = write(_writer, _dxbc.outputSignature); + size += write(_writer, DXBC_CHUNK_OUTPUT_SIGNATURE, _err); + size += write(_writer, UINT32_C(0), _err); + chunkSize[1] = write(_writer, _dxbc.outputSignature, _err); chunkOffset[2] = uint32_t(bx::seek(_writer) - dxbcOffset); - size += write(_writer, _dxbc.shader.shex ? DXBC_CHUNK_SHADER_EX : DXBC_CHUNK_SHADER); - size += write(_writer, UINT32_C(0) ); - chunkSize[2] = write(_writer, _dxbc.shader); + size += write(_writer, _dxbc.shader.shex ? DXBC_CHUNK_SHADER_EX : DXBC_CHUNK_SHADER, _err); + size += write(_writer, UINT32_C(0), _err); + chunkSize[2] = write(_writer, _dxbc.shader, _err); size += 0 + chunkSize[0] @@ -1863,15 +1862,15 @@ namespace bgfx int64_t eof = bx::seek(_writer); bx::seek(_writer, sizeOffset, bx::Whence::Begin); - bx::write(_writer, size); + bx::write(_writer, size, _err); bx::seek(_writer, chunksOffsets, bx::Whence::Begin); - bx::write(_writer, chunkOffset, sizeof(chunkOffset) ); + bx::write(_writer, chunkOffset, sizeof(chunkOffset), _err); for (uint32_t ii = 0; ii < BX_COUNTOF(chunkOffset); ++ii) { bx::seek(_writer, chunkOffset[ii]+4, bx::Whence::Begin); - bx::write(_writer, chunkSize[ii]); + bx::write(_writer, chunkSize[ii], _err); } bx::seek(_writer, eof, bx::Whence::Begin); @@ -1879,14 +1878,16 @@ namespace bgfx return size; } - void parse(const DxbcShader& _src, DxbcParseFn _fn, void* _userData) + void parse(const DxbcShader& _src, DxbcParseFn _fn, void* _userData, bx::Error* _err) { + BX_ERROR_SCOPE(_err); + bx::MemoryReader reader(_src.byteCode.data(), uint32_t(_src.byteCode.size() ) ); for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;) { DxbcInstruction instruction; - uint32_t size = read(&reader, instruction); + uint32_t size = read(&reader, instruction, _err); BX_CHECK(size/4 == instruction.length, "read %d, expected %d", size/4, instruction.length); BX_UNUSED(size); bool cont = _fn(token * sizeof(uint32_t), instruction, _userData); @@ -1899,8 +1900,10 @@ namespace bgfx } } - void filter(DxbcShader& _dst, const DxbcShader& _src, DxbcFilterFn _fn, void* _userData) + void filter(DxbcShader& _dst, const DxbcShader& _src, DxbcFilterFn _fn, void* _userData, bx::Error* _err) { + BX_ERROR_SCOPE(_err); + bx::MemoryReader reader(_src.byteCode.data(), uint32_t(_src.byteCode.size() ) ); bx::MemoryBlock mb(g_allocator); @@ -1909,12 +1912,12 @@ namespace bgfx for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;) { DxbcInstruction instruction; - uint32_t size = read(&reader, instruction); + uint32_t size = read(&reader, instruction, _err); BX_CHECK(size/4 == instruction.length, "read %d, expected %d", size/4, instruction.length); BX_UNUSED(size); _fn(instruction, _userData); - write(&writer, instruction); + write(&writer, instruction, _err); token += instruction.length; } diff --git a/3rdparty/bgfx/src/shader_dxbc.h b/3rdparty/bgfx/src/shader_dxbc.h index 4aa3420fd89..381fd2f79cc 100644 --- a/3rdparty/bgfx/src/shader_dxbc.h +++ b/3rdparty/bgfx/src/shader_dxbc.h @@ -540,8 +540,8 @@ namespace bgfx DxbcOperand operand[6]; }; - int32_t read(bx::ReaderI* _reader, DxbcInstruction& _instruction); - int32_t write(bx::WriterI* _writer, const DxbcInstruction& _instruction); + int32_t read(bx::ReaderI* _reader, DxbcInstruction& _instruction, bx::Error* _err); + int32_t write(bx::WriterI* _writer, const DxbcInstruction& _instruction, bx::Error* _err); int32_t toString(char* _out, int32_t _size, const DxbcInstruction& _instruction); struct DxbcSignature @@ -562,8 +562,8 @@ namespace bgfx stl::vector<Element> elements; }; - int32_t read(bx::ReaderSeekerI* _reader, DxbcSignature& _signature); - int32_t write(bx::WriterI* _writer, const DxbcSignature& _signature); + int32_t read(bx::ReaderSeekerI* _reader, DxbcSignature& _signature, bx::Error* _err); + int32_t write(bx::WriterI* _writer, const DxbcSignature& _signature, bx::Error* _err); struct DxbcShader { @@ -572,14 +572,14 @@ namespace bgfx bool shex; }; - int32_t read(bx::ReaderSeekerI* _reader, DxbcShader& _shader); - int32_t write(bx::WriterI* _writer, const DxbcShader& _shader); + int32_t read(bx::ReaderSeekerI* _reader, DxbcShader& _shader, bx::Error* _err); + int32_t write(bx::WriterI* _writer, const DxbcShader& _shader, bx::Error* _err); typedef bool (*DxbcParseFn)(uint32_t _offset, const DxbcInstruction& _instruction, void* _userData); - void parse(const DxbcShader& _src, DxbcParseFn _fn, void* _userData); + void parse(const DxbcShader& _src, DxbcParseFn _fn, void* _userData, bx::Error* _err = NULL); typedef void (*DxbcFilterFn)(DxbcInstruction& _instruction, void* _userData); - void filter(DxbcShader& _dst, const DxbcShader& _src, DxbcFilterFn _fn, void* _userData); + void filter(DxbcShader& _dst, const DxbcShader& _src, DxbcFilterFn _fn, void* _userData, bx::Error* _err = NULL); struct DxbcContext { @@ -598,8 +598,8 @@ namespace bgfx DxbcShader shader; }; - int32_t read(bx::ReaderSeekerI* _reader, DxbcContext& _dxbc); - int32_t write(bx::WriterSeekerI* _writer, const DxbcContext& _dxbc); + int32_t read(bx::ReaderSeekerI* _reader, DxbcContext& _dxbc, bx::Error* _err); + int32_t write(bx::WriterSeekerI* _writer, const DxbcContext& _dxbc, bx::Error* _err); /// Calculate DXBC hash from data. void dxbcHash(const void* _data, uint32_t _size, void* _digest); diff --git a/3rdparty/bgfx/src/shader_spirv.cpp b/3rdparty/bgfx/src/shader_spirv.cpp index 63a8b0aa1d7..2fec1c0b0e4 100644 --- a/3rdparty/bgfx/src/shader_spirv.cpp +++ b/3rdparty/bgfx/src/shader_spirv.cpp @@ -8,303 +8,387 @@ namespace bgfx { - struct SpirvOpcodeInfo + struct SpvOpcodeInfo { - uint8_t numOperands; - uint8_t numValues; - bool hasVariable; + bool hasType; + bool hasResult; + SpvOperand::Enum operands[8]; }; - static const SpirvOpcodeInfo s_sprivOpcodeInfo[] = + static const SpvOpcodeInfo s_spvOpcodeInfo[] = { - { 0, 0, false }, // Nop, - { 0, 0, true }, // Source - { 0, 0, true }, // SourceExtension - { 0, 0, false }, // Extension - { 0, 1, true }, // ExtInstImport - { 0, 2, false }, // MemoryModel - { 0, 2, false }, // EntryPoint - { 0, 0, false }, // ExecutionMode - { 0, 1, false }, // TypeVoid - { 0, 1, false }, // TypeBool - { 0, 3, false }, // TypeInt - { 0, 2, false }, // TypeFloat - { 0, 3, false }, // TypeVector - { 0, 3, false }, // TypeMatrix - { 1, 7, false }, // TypeSampler - { 0, 0, false }, // TypeFilter - { 0, 0, false }, // TypeArray - { 0, 0, false }, // TypeRuntimeArray - { 0, 0, false }, // TypeStruct - { 0, 0, false }, // TypeOpaque - { 0, 3, false }, // TypePointer - { 0, 2, true }, // TypeFunction - { 0, 0, false }, // TypeEvent - { 0, 0, false }, // TypeDeviceEvent - { 0, 0, false }, // TypeReserveId - { 0, 0, false }, // TypeQueue - { 0, 0, false }, // TypePipe - { 0, 0, false }, // ConstantTrue - { 0, 0, false }, // ConstantFalse - { 0, 2, true }, // Constant - { 0, 2, true }, // ConstantComposite - { 0, 0, false }, // ConstantSampler - { 0, 0, false }, // ConstantNullPointer - { 0, 0, false }, // ConstantNullObject - { 0, 0, false }, // SpecConstantTrue - { 0, 0, false }, // SpecConstantFalse - { 0, 0, false }, // SpecConstant - { 0, 0, false }, // SpecConstantComposite - { 0, 3, true }, // Variable - { 0, 0, false }, // VariableArray - { 0, 4, false }, // Function - { 0, 0, false }, // FunctionParameter - { 0, 0, false }, // FunctionEnd - { 0, 0, false }, // FunctionCall - { 0, 0, false }, // ExtInst - { 0, 0, false }, // Undef - { 0, 0, false }, // Load - { 0, 2, true }, // Store - { 0, 0, false }, // Phi - { 0, 0, false }, // DecorationGroup - { 0, 2, true }, // Decorate - { 0, 0, false }, // MemberDecorate - { 0, 0, false }, // GroupDecorate - { 0, 0, false }, // GroupMemberDecorate - { 0, 1, true }, // Name - { 0, 1, true }, // MemberName - { 0, 0, false }, // String - { 0, 0, false }, // Line - { 0, 0, false }, // VectorExtractDynamic - { 0, 0, false }, // VectorInsertDynamic - { 0, 0, false }, // VectorShuffle - { 0, 0, false }, // CompositeConstruct - { 0, 0, false }, // CompositeExtract - { 0, 0, false }, // CompositeInsert - { 0, 0, false }, // CopyObject - { 0, 0, false }, // CopyMemory - { 0, 0, false }, // CopyMemorySized - { 0, 0, false }, // Sampler - { 0, 0, false }, // TextureSample - { 0, 0, false }, // TextureSampleDref - { 0, 0, false }, // TextureSampleLod - { 0, 0, false }, // TextureSampleProj - { 0, 0, false }, // TextureSampleGrad - { 0, 0, false }, // TextureSampleOffset - { 0, 0, false }, // TextureSampleProjLod - { 0, 0, false }, // TextureSampleProjGrad - { 0, 0, false }, // TextureSampleLodOffset - { 0, 0, false }, // TextureSampleProjOffset - { 0, 0, false }, // TextureSampleGradOffset - { 0, 0, false }, // TextureSampleProjLodOffset - { 0, 0, false }, // TextureSampleProjGradOffset - { 0, 0, false }, // TextureFetchTexelLod - { 0, 0, false }, // TextureFetchTexelOffset - { 0, 0, false }, // TextureFetchSample - { 0, 0, false }, // TextureFetchTexel - { 0, 0, false }, // TextureGather - { 0, 0, false }, // TextureGatherOffset - { 0, 0, false }, // TextureGatherOffsets - { 0, 0, false }, // TextureQuerySizeLod - { 0, 0, false }, // TextureQuerySize - { 0, 0, false }, // TextureQueryLod - { 0, 0, false }, // TextureQueryLevels - { 0, 0, false }, // TextureQuerySamples - { 0, 0, false }, // AccessChain - { 0, 0, false }, // InBoundsAccessChain - { 0, 0, false }, // SNegate - { 0, 0, false }, // FNegate - { 0, 0, false }, // Not - { 0, 0, false }, // Any - { 0, 0, false }, // All - { 0, 0, false }, // ConvertFToU - { 0, 0, false }, // ConvertFToS - { 0, 0, false }, // ConvertSToF - { 0, 0, false }, // ConvertUToF - { 0, 0, false }, // UConvert - { 0, 0, false }, // SConvert - { 0, 0, false }, // FConvert - { 0, 0, false }, // ConvertPtrToU - { 0, 0, false }, // ConvertUToPtr - { 0, 0, false }, // PtrCastToGeneric - { 0, 0, false }, // GenericCastToPtr - { 0, 0, false }, // Bitcast - { 0, 0, false }, // Transpose - { 0, 0, false }, // IsNan - { 0, 0, false }, // IsInf - { 0, 0, false }, // IsFinite - { 0, 0, false }, // IsNormal - { 0, 0, false }, // SignBitSet - { 0, 0, false }, // LessOrGreater - { 0, 0, false }, // Ordered - { 0, 0, false }, // Unordered - { 0, 0, false }, // ArrayLength - { 0, 0, false }, // IAdd - { 0, 0, false }, // FAdd - { 0, 0, false }, // ISub - { 0, 0, false }, // FSub - { 0, 0, false }, // IMul - { 0, 0, false }, // FMul - { 0, 0, false }, // UDiv - { 0, 0, false }, // SDiv - { 0, 0, false }, // FDiv - { 0, 0, false }, // UMod - { 0, 0, false }, // SRem - { 0, 0, false }, // SMod - { 0, 0, false }, // FRem - { 0, 0, false }, // FMod - { 0, 0, false }, // VectorTimesScalar - { 0, 0, false }, // MatrixTimesScalar - { 0, 0, false }, // VectorTimesMatrix - { 0, 0, false }, // MatrixTimesVector - { 0, 0, false }, // MatrixTimesMatrix - { 0, 0, false }, // OuterProduct - { 0, 0, false }, // Dot - { 0, 0, false }, // ShiftRightLogical - { 0, 0, false }, // ShiftRightArithmetic - { 0, 0, false }, // ShiftLeftLogical - { 0, 0, false }, // LogicalOr - { 0, 0, false }, // LogicalXor - { 0, 0, false }, // LogicalAnd - { 0, 0, false }, // BitwiseOr - { 0, 0, false }, // BitwiseXor - { 0, 0, false }, // BitwiseAnd - { 0, 0, false }, // Select - { 0, 0, false }, // IEqual - { 0, 0, false }, // FOrdEqual - { 0, 0, false }, // FUnordEqual - { 0, 0, false }, // INotEqual - { 0, 0, false }, // FOrdNotEqual - { 0, 0, false }, // FUnordNotEqual - { 0, 0, false }, // ULessThan - { 0, 0, false }, // SLessThan - { 0, 0, false }, // FOrdLessThan - { 0, 0, false }, // FUnordLessThan - { 0, 0, false }, // UGreaterThan - { 0, 0, false }, // SGreaterThan - { 0, 0, false }, // FOrdGreaterThan - { 0, 0, false }, // FUnordGreaterThan - { 0, 0, false }, // ULessThanEqual - { 0, 0, false }, // SLessThanEqual - { 0, 0, false }, // FOrdLessThanEqual - { 0, 0, false }, // FUnordLessThanEqual - { 0, 0, false }, // UGreaterThanEqual - { 0, 0, false }, // SGreaterThanEqual - { 0, 0, false }, // FOrdGreaterThanEqual - { 0, 0, false }, // FUnordGreaterThanEqual - { 0, 0, false }, // DPdx - { 0, 0, false }, // DPdy - { 0, 0, false }, // Fwidth - { 0, 0, false }, // DPdxFine - { 0, 0, false }, // DPdyFine - { 0, 0, false }, // FwidthFine - { 0, 0, false }, // DPdxCoarse - { 0, 0, false }, // DPdyCoarse - { 0, 0, false }, // FwidthCoarse - { 0, 0, false }, // EmitVertex - { 0, 0, false }, // EndPrimitive - { 0, 0, false }, // EmitStreamVertex - { 0, 0, false }, // EndStreamPrimitive - { 0, 0, false }, // ControlBarrier - { 0, 0, false }, // MemoryBarrier - { 0, 0, false }, // ImagePointer - { 0, 0, false }, // AtomicInit - { 0, 0, false }, // AtomicLoad - { 0, 0, false }, // AtomicStore - { 0, 0, false }, // AtomicExchange - { 0, 0, false }, // AtomicCompareExchange - { 0, 0, false }, // AtomicCompareExchangeWeak - { 0, 0, false }, // AtomicIIncrement - { 0, 0, false }, // AtomicIDecrement - { 0, 0, false }, // AtomicIAdd - { 0, 0, false }, // AtomicISub - { 0, 0, false }, // AtomicUMin - { 0, 0, false }, // AtomicUMax - { 0, 0, false }, // AtomicAnd - { 0, 0, false }, // AtomicOr - { 0, 0, false }, // AtomicXor - { 0, 0, false }, // LoopMerge - { 0, 0, false }, // SelectionMerge - { 0, 1, false }, // Label - { 0, 1, false }, // Branch - { 0, 0, false }, // BranchConditional - { 0, 0, false }, // Switch - { 0, 0, false }, // Kill - { 0, 0, false }, // Return - { 0, 0, false }, // ReturnValue - { 0, 0, false }, // Unreachable - { 0, 0, false }, // LifetimeStart - { 0, 0, false }, // LifetimeStop - { 0, 0, false }, // CompileFlag - { 0, 0, false }, // AsyncGroupCopy - { 0, 0, false }, // WaitGroupEvents - { 0, 0, false }, // GroupAll - { 0, 0, false }, // GroupAny - { 0, 0, false }, // GroupBroadcast - { 0, 0, false }, // GroupIAdd - { 0, 0, false }, // GroupFAdd - { 0, 0, false }, // GroupFMin - { 0, 0, false }, // GroupUMin - { 0, 0, false }, // GroupSMin - { 0, 0, false }, // GroupFMax - { 0, 0, false }, // GroupUMax - { 0, 0, false }, // GroupSMax - { 0, 0, false }, // GenericCastToPtrExplicit - { 0, 0, false }, // GenericPtrMemSemantics - { 0, 0, false }, // ReadPipe - { 0, 0, false }, // WritePipe - { 0, 0, false }, // ReservedReadPipe - { 0, 0, false }, // ReservedWritePipe - { 0, 0, false }, // ReserveReadPipePackets - { 0, 0, false }, // ReserveWritePipePackets - { 0, 0, false }, // CommitReadPipe - { 0, 0, false }, // CommitWritePipe - { 0, 0, false }, // IsValidReserveId - { 0, 0, false }, // GetNumPipePackets - { 0, 0, false }, // GetMaxPipePackets - { 0, 0, false }, // GroupReserveReadPipePackets - { 0, 0, false }, // GroupReserveWritePipePackets - { 0, 0, false }, // GroupCommitReadPipe - { 0, 0, false }, // GroupCommitWritePipe - { 0, 0, false }, // EnqueueMarker - { 0, 0, false }, // EnqueueKernel - { 0, 0, false }, // GetKernelNDrangeSubGroupCount - { 0, 0, false }, // GetKernelNDrangeMaxSubGroupSize - { 0, 0, false }, // GetKernelWorkGroupSize - { 0, 0, false }, // GetKernelPreferredWorkGroupSizeMultiple - { 0, 0, false }, // RetainEvent - { 0, 0, false }, // ReleaseEvent - { 0, 0, false }, // CreateUserEvent - { 0, 0, false }, // IsValidEvent - { 0, 0, false }, // SetUserEventStatus - { 0, 0, false }, // CaptureEventProfilingInfo - { 0, 0, false }, // GetDefaultQueue - { 0, 0, false }, // BuildNDRange - { 0, 0, false }, // SatConvertSToU - { 0, 0, false }, // SatConvertUToS - { 0, 0, false }, // AtomicIMin - { 0, 0, false }, // AtomicIMax +#define SPV_OPERAND_1(_a0) SpvOperand::_a0 +#define SPV_OPERAND_2(_a0, _a1) SPV_OPERAND_1(_a0), SPV_OPERAND_1(_a1) +#define SPV_OPERAND_3(_a0, _a1, _a2) SPV_OPERAND_1(_a0), SPV_OPERAND_2(_a1, _a2) +#define SPV_OPERAND_4(_a0, _a1, _a2, _a3) SPV_OPERAND_1(_a0), SPV_OPERAND_3(_a1, _a2, _a3) +#define SPV_OPERAND_5(_a0, _a1, _a2, _a3, _a4) SPV_OPERAND_1(_a0), SPV_OPERAND_4(_a1, _a2, _a3, _a4) +#define SPV_OPERAND_6(_a0, _a1, _a2, _a3, _a4, _a5) SPV_OPERAND_1(_a0), SPV_OPERAND_5(_a1, _a2, _a3, _a4, _a5) +#define SPV_OPERAND_7(_a0, _a1, _a2, _a3, _a4, _a5, _a6) SPV_OPERAND_1(_a0), SPV_OPERAND_6(_a1, _a2, _a3, _a4, _a5, _a6) +#define SPV_OPERAND_8(_a0, _a1, _a2, _a3, _a4, _a5, _a6, _a7) SPV_OPERAND_1(_a0), SPV_OPERAND_7(_a1, _a2, _a3, _a4, _a5, _a6, _a7) +#define SPV_OPERAND_9(_a0, _a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8) SPV_OPERAND_1(_a0), SPV_OPERAND_8(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8) +#if BX_COMPILER_MSVC +// Workaround MSVS bug... +# define SPV_OPERAND(...) { BX_MACRO_DISPATCHER(SPV_OPERAND_, __VA_ARGS__) BX_VA_ARGS_PASS(__VA_ARGS__) } +#else +# define SPV_OPERAND(...) { BX_MACRO_DISPATCHER(SPV_OPERAND_, __VA_ARGS__)(__VA_ARGS__) } +#endif // BX_COMPILER_MSVC +#define _ Count + { false, false, /* Nop, // 0 */ SPV_OPERAND(_) }, + { true, true, /* Undef, // 1 */ SPV_OPERAND(_) }, + { false, false, /* SourceContinued, // 2 */ SPV_OPERAND(_) }, + { false, false, /* Source, // 3 */ SPV_OPERAND(SourceLanguage, LiteralNumber, Id, LiteralString) }, + { false, false, /* SourceExtension, // 4 */ SPV_OPERAND(LiteralString) }, + { false, true, /* Name, // 5 */ SPV_OPERAND(LiteralString) }, + { false, true, /* MemberName, // 6 */ SPV_OPERAND(LiteralNumber, LiteralString) }, + { false, false, /* String, // 7 */ SPV_OPERAND(_) }, + { false, false, /* Line, // 8 */ SPV_OPERAND(_) }, + { false, false, /* ------------------------------- Invalid9 // 9 */ SPV_OPERAND(_) }, + { false, false, /* Extension, // 10 */ SPV_OPERAND(LiteralString) }, + { false, true, /* ExtInstImport, // 11 */ SPV_OPERAND(LiteralString) }, + { true, true, /* ExtInst, // 12 */ SPV_OPERAND(LiteralNumber) }, + { false, false, /* ------------------------------ Invalid13 // 13 */ SPV_OPERAND(_) }, + { false, false, /* MemoryModel, // 14 */ SPV_OPERAND(AddressingModel, MemoryModel) }, + { false, false, /* EntryPoint, // 15 */ SPV_OPERAND(ExecutionModel, Id, LiteralString) }, + { true, true, /* ExecutionMode, // 16 */ SPV_OPERAND(_) }, + { false, false, /* Capability, // 17 */ SPV_OPERAND(Capability ) }, + { false, false, /* ------------------------------ Invalid18 // 18 */ SPV_OPERAND(_) }, + { false, true, /* TypeVoid, // 19 */ SPV_OPERAND(LiteralNumber) }, + { false, true, /* TypeBool, // 20 */ SPV_OPERAND(LiteralNumber) }, + { false, true, /* TypeInt, // 21 */ SPV_OPERAND(LiteralNumber) }, + { false, true, /* TypeFloat, // 22 */ SPV_OPERAND(LiteralNumber) }, + { false, true, /* TypeVector, // 23 */ SPV_OPERAND(ComponentType, LiteralNumber) }, + { false, true, /* TypeMatrix, // 24 */ SPV_OPERAND(LiteralNumber) }, + { false, true, /* TypeImage, // 25 */ SPV_OPERAND(SampledType, Dim, LiteralNumber, LiteralNumber, LiteralNumber, LiteralNumber, ImageFormat, AccessQualifier) }, + { false, true, /* TypeSampler, // 26 */ SPV_OPERAND(LiteralNumber) }, + { false, true, /* TypeSampledImage, // 27 */ SPV_OPERAND(LiteralNumber) }, + { false, true, /* TypeArray, // 28 */ SPV_OPERAND(LiteralNumber) }, + { false, true, /* TypeRuntimeArray, // 29 */ SPV_OPERAND(_) }, + { false, true, /* TypeStruct, // 30 */ SPV_OPERAND(_) }, + { false, true, /* TypeOpaque, // 31 */ SPV_OPERAND(_) }, + { false, true, /* TypePointer, // 32 */ SPV_OPERAND(StorageClass, Id) }, + { false, true, /* TypeFunction, // 33 */ SPV_OPERAND(Id, Id, Id, Id, Id) }, + { false, true, /* TypeEvent, // 34 */ SPV_OPERAND(_) }, + { false, true, /* TypeDeviceEvent, // 35 */ SPV_OPERAND(_) }, + { false, true, /* TypeReserveId, // 36 */ SPV_OPERAND(_) }, + { false, true, /* TypeQueue, // 37 */ SPV_OPERAND(_) }, + { false, true, /* TypePipe, // 38 */ SPV_OPERAND(_) }, + { false, true, /* TypeForwardPointer, // 39 */ SPV_OPERAND(_) }, + { false, false, /* ------------------------------ Invalid40 // 40 */ SPV_OPERAND(_) }, + { true, true, /* ConstantTrue, // 41 */ SPV_OPERAND(_) }, + { true, true, /* ConstantFalse, // 42 */ SPV_OPERAND(_) }, + { true, true, /* Constant, // 43 */ SPV_OPERAND(LiteralRep) }, + { true, true, /* ConstantComposite, // 44 */ SPV_OPERAND(LiteralRep) }, + { true, true, /* ConstantSampler, // 45 */ SPV_OPERAND(SamplerAddressingMode, LiteralNumber, SamplerFilterMode) }, + { true, true, /* ConstantNull, // 46 */ SPV_OPERAND(_) }, + { false, false, /* ------------------------------ Invalid47 // 47 */ SPV_OPERAND(_) }, + { true, true, /* SpecConstantTrue, // 48 */ SPV_OPERAND(_) }, + { true, true, /* SpecConstantFalse, // 49 */ SPV_OPERAND(_) }, + { true, true, /* SpecConstant, // 50 */ SPV_OPERAND(_) }, + { true, true, /* SpecConstantComposite, // 51 */ SPV_OPERAND(_) }, + { true, true, /* SpecConstantOp, // 52 */ SPV_OPERAND(_) }, + { false, false, /* ------------------------------ Invalid53 // 53 */ SPV_OPERAND(_) }, + { true, true, /* Function, // 54 */ SPV_OPERAND(FunctionControl, Id) }, + { true, true, /* FunctionParameter, // 55 */ SPV_OPERAND(_) }, + { false, false, /* FunctionEnd, // 56 */ SPV_OPERAND(_) }, + { true, true, /* FunctionCall, // 57 */ SPV_OPERAND(Function, IdRep) }, + { false, false, /* ------------------------------ Invalid58 // 58 */ SPV_OPERAND(_) }, + { true, true, /* Variable, // 59 */ SPV_OPERAND(StorageClass, Id) }, + { true, true, /* ImageTexelPointer, // 60 */ SPV_OPERAND(_) }, + { true, true, /* Load, // 61 */ SPV_OPERAND(Pointer, MemoryAccess) }, + { false, false, /* Store, // 62 */ SPV_OPERAND(Pointer, Object, MemoryAccess) }, + { false, false, /* CopyMemory, // 63 */ SPV_OPERAND(_) }, + { false, false, /* CopyMemorySized, // 64 */ SPV_OPERAND(_) }, + { true, true, /* AccessChain, // 65 */ SPV_OPERAND(Base, IdRep) }, + { true, true, /* InBoundsAccessChain, // 66 */ SPV_OPERAND(Base, IdRep) }, + { true, true, /* PtrAccessChain, // 67 */ SPV_OPERAND(_) }, + { true, true, /* ArrayLength, // 68 */ SPV_OPERAND(_) }, + { true, true, /* GenericPtrMemSemantics, // 69 */ SPV_OPERAND(_) }, + { true, true, /* InBoundsPtrAccessChain, // 70 */ SPV_OPERAND(_) }, + { false, false, /* Decorate, // 71 */ SPV_OPERAND(Id, Decoration, LiteralRep) }, + { false, false, /* MemberDecorate, // 72 */ SPV_OPERAND(StructureType, LiteralNumber, Decoration, LiteralRep) }, + { false, false, /* DecorationGroup, // 73 */ SPV_OPERAND(_) }, + { false, false, /* GroupDecorate, // 74 */ SPV_OPERAND(_) }, + { false, false, /* GroupMemberDecorate, // 75 */ SPV_OPERAND(_) }, + { false, false, /* ------------------------------ Invalid76 // 76 */ SPV_OPERAND(_) }, + { true, true, /* VectorExtractDynamic, // 77 */ SPV_OPERAND(_) }, + { true, true, /* VectorInsertDynamic, // 78 */ SPV_OPERAND(_) }, + { true, true, /* VectorShuffle, // 79 */ SPV_OPERAND(Id, Id, LiteralRep) }, + { true, true, /* CompositeConstruct, // 80 */ SPV_OPERAND(IdRep) }, + { true, true, /* CompositeExtract, // 81 */ SPV_OPERAND(Composite, LiteralRep) }, + { true, true, /* CompositeInsert, // 82 */ SPV_OPERAND(Id, Composite, LiteralRep) }, + { true, true, /* CopyObject, // 83 */ SPV_OPERAND(Id) }, + { true, true, /* Transpose, // 84 */ SPV_OPERAND(Matrix) }, + { false, false, /* ------------------------------ Invalid85 // 85 */ SPV_OPERAND(_) }, + { true, true, /* SampledImage, // 86 */ SPV_OPERAND(_) }, + { true, true, /* ImageSampleImplicitLod, // 87 */ SPV_OPERAND(SampledImage, Coordinate, ImageOperands, IdRep) }, + { true, true, /* ImageSampleExplicitLod, // 88 */ SPV_OPERAND(SampledImage, Coordinate, ImageOperands, Id, IdRep) }, + { true, true, /* ImageSampleDrefImplicitLod, // 89 */ SPV_OPERAND(_) }, + { true, true, /* ImageSampleDrefExplicitLod, // 90 */ SPV_OPERAND(_) }, + { true, true, /* ImageSampleProjImplicitLod, // 91 */ SPV_OPERAND(_) }, + { true, true, /* ImageSampleProjExplicitLod, // 92 */ SPV_OPERAND(_) }, + { true, true, /* ImageSampleProjDrefImplicitLod, // 93 */ SPV_OPERAND(_) }, + { true, true, /* ImageSampleProjDrefExplicitLod, // 94 */ SPV_OPERAND(_) }, + { true, true, /* ImageFetch, // 95 */ SPV_OPERAND(_) }, + { true, true, /* ImageGather, // 96 */ SPV_OPERAND(SampledImage, Coordinate, Component, ImageOperands, IdRep) }, + { true, true, /* ImageDrefGather, // 97 */ SPV_OPERAND(SampledImage, Coordinate, Dref, ImageOperands, IdRep) }, + { true, true, /* ImageRead, // 98 */ SPV_OPERAND(_) }, + { false, false, /* ImageWrite, // 99 */ SPV_OPERAND(_) }, + { true, true, /* Image, // 100 */ SPV_OPERAND(_) }, + { true, true, /* ImageQueryFormat, // 101 */ SPV_OPERAND(_) }, + { true, true, /* ImageQueryOrder, // 102 */ SPV_OPERAND(_) }, + { true, true, /* ImageQuerySizeLod, // 103 */ SPV_OPERAND(_) }, + { true, true, /* ImageQuerySize, // 104 */ SPV_OPERAND(_) }, + { true, true, /* ImageQueryLod, // 105 */ SPV_OPERAND(_) }, + { true, true, /* ImageQueryLevels, // 106 */ SPV_OPERAND(_) }, + { true, true, /* ImageQuerySamples, // 107 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid108 // 108 */ SPV_OPERAND(_) }, + { true, true, /* ConvertFToU, // 109 */ SPV_OPERAND(_) }, + { true, true, /* ConvertFToS, // 110 */ SPV_OPERAND(_) }, + { true, true, /* ConvertSToF, // 111 */ SPV_OPERAND(_) }, + { true, true, /* ConvertUToF, // 112 */ SPV_OPERAND(_) }, + { true, true, /* UConvert, // 113 */ SPV_OPERAND(Id) }, + { true, true, /* SConvert, // 114 */ SPV_OPERAND(Id) }, + { true, true, /* FConvert, // 115 */ SPV_OPERAND(Id) }, + { true, true, /* QuantizeToF16, // 116 */ SPV_OPERAND(_) }, + { true, true, /* ConvertPtrToU, // 117 */ SPV_OPERAND(_) }, + { true, true, /* SatConvertSToU, // 118 */ SPV_OPERAND(_) }, + { true, true, /* SatConvertUToS, // 119 */ SPV_OPERAND(_) }, + { true, true, /* ConvertUToPtr, // 120 */ SPV_OPERAND(_) }, + { true, true, /* PtrCastToGeneric, // 121 */ SPV_OPERAND(_) }, + { true, true, /* GenericCastToPtr, // 122 */ SPV_OPERAND(_) }, + { true, true, /* GenericCastToPtrExplicit, // 123 */ SPV_OPERAND(_) }, + { true, true, /* Bitcast, // 124 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid125 // 125 */ SPV_OPERAND(_) }, + { true, true, /* SNegate, // 126 */ SPV_OPERAND(Id) }, + { true, true, /* FNegate, // 127 */ SPV_OPERAND(Id) }, + { true, true, /* IAdd, // 128 */ SPV_OPERAND(Id, Id) }, + { true, true, /* FAdd, // 129 */ SPV_OPERAND(Id, Id) }, + { true, true, /* ISub, // 130 */ SPV_OPERAND(Id, Id) }, + { true, true, /* FSub, // 131 */ SPV_OPERAND(Id, Id) }, + { true, true, /* IMul, // 132 */ SPV_OPERAND(Id, Id) }, + { true, true, /* FMul, // 133 */ SPV_OPERAND(Id, Id) }, + { true, true, /* UDiv, // 134 */ SPV_OPERAND(Id, Id) }, + { true, true, /* SDiv, // 135 */ SPV_OPERAND(Id, Id) }, + { true, true, /* FDiv, // 136 */ SPV_OPERAND(Id, Id) }, + { true, true, /* UMod, // 137 */ SPV_OPERAND(Id, Id) }, + { true, true, /* SRem, // 138 */ SPV_OPERAND(Id, Id) }, + { true, true, /* SMod, // 139 */ SPV_OPERAND(Id, Id) }, + { true, true, /* FRem, // 140 */ SPV_OPERAND(Id, Id) }, + { true, true, /* FMod, // 141 */ SPV_OPERAND(Id, Id) }, + { true, true, /* VectorTimesScalar, // 142 */ SPV_OPERAND(Vector, Scalar) }, + { true, true, /* MatrixTimesScalar, // 143 */ SPV_OPERAND(Matrix, Scalar) }, + { true, true, /* VectorTimesMatrix, // 144 */ SPV_OPERAND(Vector, Matrix) }, + { true, true, /* MatrixTimesVector, // 145 */ SPV_OPERAND(Matrix, Vector) }, + { true, true, /* MatrixTimesMatrix, // 146 */ SPV_OPERAND(Matrix, Matrix) }, + { true, true, /* OuterProduct, // 147 */ SPV_OPERAND(Vector, Vector) }, + { true, true, /* Dot, // 148 */ SPV_OPERAND(Vector, Vector) }, + { true, true, /* IAddCarry, // 149 */ SPV_OPERAND(Id, Id) }, + { true, true, /* ISubBorrow, // 150 */ SPV_OPERAND(Id, Id) }, + { true, true, /* UMulExtended, // 151 */ SPV_OPERAND(Id, Id) }, + { true, true, /* SMulExtended, // 152 */ SPV_OPERAND(Id, Id) }, + { false, false, /* ----------------------------- Invalid153 // 153 */ SPV_OPERAND(_) }, + { true, true, /* Any, // 154 */ SPV_OPERAND(Vector) }, + { true, true, /* All, // 155 */ SPV_OPERAND(Vector) }, + { true, true, /* IsNan, // 156 */ SPV_OPERAND(Id) }, + { true, true, /* IsInf, // 157 */ SPV_OPERAND(Id) }, + { true, true, /* IsFinite, // 158 */ SPV_OPERAND(Id) }, + { true, true, /* IsNormal, // 159 */ SPV_OPERAND(Id) }, + { true, true, /* SignBitSet, // 160 */ SPV_OPERAND(Id) }, + { true, true, /* LessOrGreater, // 161 */ SPV_OPERAND(Id, Id) }, + { true, true, /* Ordered, // 162 */ SPV_OPERAND(Id, Id) }, + { true, true, /* Unordered, // 163 */ SPV_OPERAND(_) }, + { true, true, /* LogicalEqual, // 164 */ SPV_OPERAND(_) }, + { true, true, /* LogicalNotEqual, // 165 */ SPV_OPERAND(_) }, + { true, true, /* LogicalOr, // 166 */ SPV_OPERAND(_) }, + { true, true, /* LogicalAnd, // 167 */ SPV_OPERAND(_) }, + { true, true, /* LogicalNot, // 168 */ SPV_OPERAND(_) }, + { true, true, /* Select, // 169 */ SPV_OPERAND(Condition, Id, Id) }, + { true, true, /* IEqual, // 170 */ SPV_OPERAND(_) }, + { true, true, /* INotEqual, // 171 */ SPV_OPERAND(_) }, + { true, true, /* UGreaterThan, // 172 */ SPV_OPERAND(_) }, + { true, true, /* SGreaterThan, // 173 */ SPV_OPERAND(_) }, + { true, true, /* UGreaterThanEqual, // 174 */ SPV_OPERAND(_) }, + { true, true, /* SGreaterThanEqual, // 175 */ SPV_OPERAND(_) }, + { true, true, /* ULessThan, // 176 */ SPV_OPERAND(_) }, + { true, true, /* SLessThan, // 177 */ SPV_OPERAND(_) }, + { true, true, /* ULessThanEqual, // 178 */ SPV_OPERAND(_) }, + { true, true, /* SLessThanEqual, // 179 */ SPV_OPERAND(_) }, + { true, true, /* FOrdEqual, // 180 */ SPV_OPERAND(_) }, + { true, true, /* FUnordEqual, // 181 */ SPV_OPERAND(_) }, + { true, true, /* FOrdNotEqual, // 182 */ SPV_OPERAND(_) }, + { true, true, /* FUnordNotEqual, // 183 */ SPV_OPERAND(_) }, + { true, true, /* FOrdLessThan, // 184 */ SPV_OPERAND(_) }, + { true, true, /* FUnordLessThan, // 185 */ SPV_OPERAND(_) }, + { true, true, /* FOrdGreaterThan, // 186 */ SPV_OPERAND(_) }, + { true, true, /* FUnordGreaterThan, // 187 */ SPV_OPERAND(_) }, + { true, true, /* FOrdLessThanEqual, // 188 */ SPV_OPERAND(_) }, + { true, true, /* FUnordLessThanEqual, // 189 */ SPV_OPERAND(_) }, + { true, true, /* FOrdGreaterThanEqual, // 190 */ SPV_OPERAND(_) }, + { true, true, /* FUnordGreaterThanEqual, // 191 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid192 // 192 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid193 // 193 */ SPV_OPERAND(_) }, + { true, true, /* ShiftRightLogical, // 194 */ SPV_OPERAND(_) }, + { true, true, /* ShiftRightArithmetic, // 195 */ SPV_OPERAND(_) }, + { true, true, /* ShiftLeftLogical, // 196 */ SPV_OPERAND(_) }, + { true, true, /* BitwiseOr, // 197 */ SPV_OPERAND(_) }, + { true, true, /* BitwiseXor, // 198 */ SPV_OPERAND(_) }, + { true, true, /* BitwiseAnd, // 199 */ SPV_OPERAND(_) }, + { true, true, /* Not, // 200 */ SPV_OPERAND(_) }, + { true, true, /* BitFieldInsert, // 201 */ SPV_OPERAND(_) }, + { true, true, /* BitFieldSExtract, // 202 */ SPV_OPERAND(_) }, + { true, true, /* BitFieldUExtract, // 203 */ SPV_OPERAND(_) }, + { true, true, /* BitReverse, // 204 */ SPV_OPERAND(_) }, + { true, true, /* BitCount, // 205 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid206 // 206 */ SPV_OPERAND(_) }, + { true, true, /* DPdx, // 207 */ SPV_OPERAND(_) }, + { true, true, /* DPdy, // 208 */ SPV_OPERAND(_) }, + { true, true, /* Fwidth, // 209 */ SPV_OPERAND(_) }, + { true, true, /* DPdxFine, // 210 */ SPV_OPERAND(_) }, + { true, true, /* DPdyFine, // 211 */ SPV_OPERAND(_) }, + { true, true, /* FwidthFine, // 212 */ SPV_OPERAND(_) }, + { true, true, /* DPdxCoarse, // 213 */ SPV_OPERAND(_) }, + { true, true, /* DPdyCoarse, // 214 */ SPV_OPERAND(_) }, + { true, true, /* FwidthCoarse, // 215 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid216 // 216 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid217 // 217 */ SPV_OPERAND(_) }, + { false, false, /* EmitVertex, // 218 */ SPV_OPERAND(_) }, + { false, false, /* EndPrimitive, // 219 */ SPV_OPERAND(_) }, + { false, false, /* EmitStreamVertex, // 220 */ SPV_OPERAND(_) }, + { false, false, /* EndStreamPrimitive, // 221 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid222 // 222 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid223 // 223 */ SPV_OPERAND(_) }, + { false, false, /* ControlBarrier, // 224 */ SPV_OPERAND(_) }, + { false, false, /* MemoryBarrier, // 225 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid226 // 226 */ SPV_OPERAND(_) }, + { true, true, /* AtomicLoad, // 227 */ SPV_OPERAND(_) }, + { false, false, /* AtomicStore, // 228 */ SPV_OPERAND(_) }, + { true, true, /* AtomicExchange, // 229 */ SPV_OPERAND(_) }, + { true, true, /* AtomicCompareExchange, // 230 */ SPV_OPERAND(_) }, + { true, true, /* AtomicCompareExchangeWeak, // 231 */ SPV_OPERAND(_) }, + { true, true, /* AtomicIIncrement, // 232 */ SPV_OPERAND(_) }, + { true, true, /* AtomicIDecrement, // 233 */ SPV_OPERAND(_) }, + { true, true, /* AtomicIAdd, // 234 */ SPV_OPERAND(_) }, + { true, true, /* AtomicISub, // 235 */ SPV_OPERAND(_) }, + { true, true, /* AtomicSMin, // 236 */ SPV_OPERAND(_) }, + { true, true, /* AtomicUMin, // 237 */ SPV_OPERAND(_) }, + { true, true, /* AtomicSMax, // 238 */ SPV_OPERAND(_) }, + { true, true, /* AtomicUMax, // 239 */ SPV_OPERAND(_) }, + { true, true, /* AtomicAnd, // 240 */ SPV_OPERAND(_) }, + { true, true, /* AtomicOr, // 241 */ SPV_OPERAND(_) }, + { true, true, /* AtomicXor, // 242 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid243 // 243 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid244 // 244 */ SPV_OPERAND(_) }, + { true, true, /* Phi, // 245 */ SPV_OPERAND(_) }, + { false, false, /* LoopMerge, // 246 */ SPV_OPERAND(_) }, + { false, false, /* SelectionMerge, // 247 */ SPV_OPERAND(_) }, + { false, true, /* Label, // 248 */ SPV_OPERAND(_) }, + { false, false, /* Branch, // 249 */ SPV_OPERAND(Id) }, + { false, false, /* BranchConditional, // 250 */ SPV_OPERAND(Condition, Id, Id, LiteralRep) }, + { false, false, /* Switch, // 251 */ SPV_OPERAND(_) }, + { false, false, /* Kill, // 252 */ SPV_OPERAND(_) }, + { false, false, /* Return, // 253 */ SPV_OPERAND(_) }, + { false, false, /* ReturnValue, // 254 */ SPV_OPERAND(Id) }, + { false, false, /* Unreachable, // 255 */ SPV_OPERAND(_) }, + { false, false, /* LifetimeStart, // 256 */ SPV_OPERAND(_) }, + { false, false, /* LifetimeStop, // 257 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid258 // 258 */ SPV_OPERAND(_) }, + { true, true, /* GroupAsyncCopy, // 259 */ SPV_OPERAND(_) }, + { false, false, /* GroupWaitEvents, // 260 */ SPV_OPERAND(_) }, + { true, true, /* GroupAll, // 261 */ SPV_OPERAND(_) }, + { true, true, /* GroupAny, // 262 */ SPV_OPERAND(_) }, + { true, true, /* GroupBroadcast, // 263 */ SPV_OPERAND(_) }, + { true, true, /* GroupIAdd, // 264 */ SPV_OPERAND(_) }, + { true, true, /* GroupFAdd, // 265 */ SPV_OPERAND(_) }, + { true, true, /* GroupFMin, // 266 */ SPV_OPERAND(_) }, + { true, true, /* GroupUMin, // 267 */ SPV_OPERAND(_) }, + { true, true, /* GroupSMin, // 268 */ SPV_OPERAND(_) }, + { true, true, /* GroupFMax, // 269 */ SPV_OPERAND(_) }, + { true, true, /* GroupUMax, // 270 */ SPV_OPERAND(_) }, + { true, true, /* GroupSMax, // 271 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid272 // 272 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid273 // 273 */ SPV_OPERAND(_) }, + { true, true, /* ReadPipe, // 274 */ SPV_OPERAND(_) }, + { true, true, /* WritePipe, // 275 */ SPV_OPERAND(_) }, + { true, true, /* ReservedReadPipe, // 276 */ SPV_OPERAND(_) }, + { true, true, /* ReservedWritePipe, // 277 */ SPV_OPERAND(_) }, + { true, true, /* ReserveReadPipePackets, // 278 */ SPV_OPERAND(_) }, + { true, true, /* ReserveWritePipePackets, // 279 */ SPV_OPERAND(_) }, + { false, false, /* CommitReadPipe, // 280 */ SPV_OPERAND(_) }, + { false, false, /* CommitWritePipe, // 281 */ SPV_OPERAND(_) }, + { true, true, /* IsValidReserveId, // 282 */ SPV_OPERAND(_) }, + { true, true, /* GetNumPipePackets, // 283 */ SPV_OPERAND(_) }, + { true, true, /* GetMaxPipePackets, // 284 */ SPV_OPERAND(_) }, + { true, true, /* GroupReserveReadPipePackets, // 285 */ SPV_OPERAND(_) }, + { true, true, /* GroupReserveWritePipePackets, // 286 */ SPV_OPERAND(_) }, + { false, false, /* GroupCommitReadPipe, // 287 */ SPV_OPERAND(_) }, + { false, false, /* GroupCommitWritePipe, // 288 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid289 // 289 */ SPV_OPERAND(_) }, + { false, false, /* ----------------------------- Invalid290 // 290 */ SPV_OPERAND(_) }, + { true, true, /* EnqueueMarker, // 291 */ SPV_OPERAND(_) }, + { true, true, /* EnqueueKernel, // 292 */ SPV_OPERAND(_) }, + { true, true, /* GetKernelNDrangeSubGroupCount, // 293 */ SPV_OPERAND(_) }, + { true, true, /* GetKernelNDrangeMaxSubGroupSize, // 294 */ SPV_OPERAND(_) }, + { true, true, /* GetKernelWorkGroupSize, // 295 */ SPV_OPERAND(_) }, + { true, true, /* GetKernelPreferredWorkGroupSizeMultiple, // 296 */ SPV_OPERAND(_) }, + { false, false, /* RetainEvent, // 297 */ SPV_OPERAND(_) }, + { false, false, /* ReleaseEvent, // 298 */ SPV_OPERAND(_) }, + { true, true, /* CreateUserEvent, // 299 */ SPV_OPERAND(_) }, + { true, true, /* IsValidEvent, // 300 */ SPV_OPERAND(_) }, + { false, false, /* SetUserEventStatus, // 301 */ SPV_OPERAND(_) }, + { false, false, /* CaptureEventProfilingInfo, // 302 */ SPV_OPERAND(_) }, + { true, true, /* GetDefaultQueue, // 303 */ SPV_OPERAND(_) }, + { true, true, /* BuildNDRange, // 304 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseSampleImplicitLod, // 305 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseSampleExplicitLod, // 306 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseSampleDrefImplicitLod, // 307 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseSampleDrefExplicitLod, // 308 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseSampleProjImplicitLod, // 309 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseSampleProjExplicitLod, // 310 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseSampleProjDrefImplicitLod, // 311 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseSampleProjDrefExplicitLod, // 312 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseFetch, // 313 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseGather, // 314 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseDrefGather, // 315 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseTexelsResident, // 316 */ SPV_OPERAND(_) }, + { false, false, /* NoLine, // 317 */ SPV_OPERAND(_) }, + { true, true, /* AtomicFlagTestAndSet, // 318 */ SPV_OPERAND(_) }, + { false, false, /* AtomicFlagClear, // 319 */ SPV_OPERAND(_) }, + { true, true, /* ImageSparseRead, // 320 */ SPV_OPERAND(_) }, +#undef _ +#undef SPV_OPERAND }; - BX_STATIC_ASSERT(BX_COUNTOF(s_sprivOpcodeInfo) == SpirvOpcode::Count); + BX_STATIC_ASSERT(BX_COUNTOF(s_spvOpcodeInfo) == SpvOpcode::Count); - const char* s_spirvOpcode[] = + const char* s_spvOpcode[] = { "Nop", + "Undef", + "SourceContinued", "Source", "SourceExtension", + "Name", + "MemberName", + "String", + "Line", + "Invalid9", "Extension", "ExtInstImport", + "ExtInst", + "Invalid13", "MemoryModel", "EntryPoint", "ExecutionMode", + "Capability", + "Invalid18", "TypeVoid", "TypeBool", "TypeInt", "TypeFloat", "TypeVector", "TypeMatrix", + "TypeImage", "TypeSampler", - "TypeFilter", + "TypeSampledImage", "TypeArray", "TypeRuntimeArray", "TypeStruct", @@ -316,37 +400,44 @@ namespace bgfx "TypeReserveId", "TypeQueue", "TypePipe", + "TypeForwardPointer", + "Invalid40", "ConstantTrue", "ConstantFalse", "Constant", "ConstantComposite", "ConstantSampler", - "ConstantNullPointer", - "ConstantNullObject", + "ConstantNull", + "Invalid47", "SpecConstantTrue", "SpecConstantFalse", "SpecConstant", "SpecConstantComposite", - "Variable", - "VariableArray", + "SpecConstantOp", + "Invalid53", "Function", "FunctionParameter", "FunctionEnd", "FunctionCall", - "ExtInst", - "Undef", + "Invalid58", + "Variable", + "ImageTexelPointer", "Load", "Store", - "Phi", - "DecorationGroup", + "CopyMemory", + "CopyMemorySized", + "AccessChain", + "InBoundsAccessChain", + "PtrAccessChain", + "ArrayLength", + "GenericPtrMemSemantics", + "InBoundsPtrAccessChain", "Decorate", "MemberDecorate", + "DecorationGroup", "GroupDecorate", "GroupMemberDecorate", - "Name", - "MemberName", - "String", - "Line", + "Invalid76", "VectorExtractDynamic", "VectorInsertDynamic", "VectorShuffle", @@ -354,41 +445,31 @@ namespace bgfx "CompositeExtract", "CompositeInsert", "CopyObject", - "CopyMemory", - "CopyMemorySized", - "Sampler", - "TextureSample", - "TextureSampleDref", - "TextureSampleLod", - "TextureSampleProj", - "TextureSampleGrad", - "TextureSampleOffset", - "TextureSampleProjLod", - "TextureSampleProjGrad", - "TextureSampleLodOffset", - "TextureSampleProjOffset", - "TextureSampleGradOffset", - "TextureSampleProjLodOffset", - "TextureSampleProjGradOffset", - "TextureFetchTexelLod", - "TextureFetchTexelOffset", - "TextureFetchSample", - "TextureFetchTexel", - "TextureGather", - "TextureGatherOffset", - "TextureGatherOffsets", - "TextureQuerySizeLod", - "TextureQuerySize", - "TextureQueryLod", - "TextureQueryLevels", - "TextureQuerySamples", - "AccessChain", - "InBoundsAccessChain", - "SNegate", - "FNegate", - "Not", - "Any", - "All", + "Transpose", + "Invalid85", + "SampledImage", + "ImageSampleImplicitLod", + "ImageSampleExplicitLod", + "ImageSampleDrefImplicitLod", + "ImageSampleDrefExplicitLod", + "ImageSampleProjImplicitLod", + "ImageSampleProjExplicitLod", + "ImageSampleProjDrefImplicitLod", + "ImageSampleProjDrefExplicitLod", + "ImageFetch", + "ImageGather", + "ImageDrefGather", + "ImageRead", + "ImageWrite", + "Image", + "ImageQueryFormat", + "ImageQueryOrder", + "ImageQuerySizeLod", + "ImageQuerySize", + "ImageQueryLod", + "ImageQueryLevels", + "ImageQuerySamples", + "Invalid108", "ConvertFToU", "ConvertFToS", "ConvertSToF", @@ -396,21 +477,18 @@ namespace bgfx "UConvert", "SConvert", "FConvert", + "QuantizeToF16", "ConvertPtrToU", + "SatConvertSToU", + "SatConvertUToS", "ConvertUToPtr", "PtrCastToGeneric", "GenericCastToPtr", + "GenericCastToPtrExplicit", "Bitcast", - "Transpose", - "IsNan", - "IsInf", - "IsFinite", - "IsNormal", - "SignBitSet", - "LessOrGreater", - "Ordered", - "Unordered", - "ArrayLength", + "Invalid125", + "SNegate", + "FNegate", "IAdd", "FAdd", "ISub", @@ -432,38 +510,64 @@ namespace bgfx "MatrixTimesMatrix", "OuterProduct", "Dot", - "ShiftRightLogical", - "ShiftRightArithmetic", - "ShiftLeftLogical", + "IAddCarry", + "ISubBorrow", + "UMulExtended", + "SMulExtended", + "Invalid153", + "Any", + "All", + "IsNan", + "IsInf", + "IsFinite", + "IsNormal", + "SignBitSet", + "LessOrGreater", + "Ordered", + "Unordered", + "LogicalEqual", + "LogicalNotEqual", "LogicalOr", - "LogicalXor", "LogicalAnd", - "BitwiseOr", - "BitwiseXor", - "BitwiseAnd", + "LogicalNot", "Select", "IEqual", + "INotEqual", + "UGreaterThan", + "SGreaterThan", + "UGreaterThanEqual", + "SGreaterThanEqual", + "ULessThan", + "SLessThan", + "ULessThanEqual", + "SLessThanEqual", "FOrdEqual", "FUnordEqual", - "INotEqual", "FOrdNotEqual", "FUnordNotEqual", - "ULessThan", - "SLessThan", "FOrdLessThan", "FUnordLessThan", - "UGreaterThan", - "SGreaterThan", "FOrdGreaterThan", "FUnordGreaterThan", - "ULessThanEqual", - "SLessThanEqual", "FOrdLessThanEqual", "FUnordLessThanEqual", - "UGreaterThanEqual", - "SGreaterThanEqual", "FOrdGreaterThanEqual", "FUnordGreaterThanEqual", + "Invalid192", + "Invalid193", + "ShiftRightLogical", + "ShiftRightArithmetic", + "ShiftLeftLogical", + "BitwiseOr", + "BitwiseXor", + "BitwiseAnd", + "Not", + "BitFieldInsert", + "BitFieldSExtract", + "BitFieldUExtract", + "BitReverse", + "BitCount", + "Invalid206", "DPdx", "DPdy", "Fwidth", @@ -473,14 +577,17 @@ namespace bgfx "DPdxCoarse", "DPdyCoarse", "FwidthCoarse", + "Invalid216", + "Invalid217", "EmitVertex", "EndPrimitive", "EmitStreamVertex", + "Invalid222", + "Invalid223", "EndStreamPrimitive", "ControlBarrier", "MemoryBarrier", - "ImagePointer", - "AtomicInit", + "Invalid226", "AtomicLoad", "AtomicStore", "AtomicExchange", @@ -490,11 +597,16 @@ namespace bgfx "AtomicIDecrement", "AtomicIAdd", "AtomicISub", + "AtomicSMin", "AtomicUMin", + "AtomicSMax", "AtomicUMax", "AtomicAnd", "AtomicOr", "AtomicXor", + "Invalid243", + "Invalid244", + "Phi", "LoopMerge", "SelectionMerge", "Label", @@ -507,9 +619,9 @@ namespace bgfx "Unreachable", "LifetimeStart", "LifetimeStop", - "CompileFlag", - "AsyncGroupCopy", - "WaitGroupEvents", + "Invalid258", + "GroupAsyncCopy", + "GroupWaitEvents", "GroupAll", "GroupAny", "GroupBroadcast", @@ -521,8 +633,8 @@ namespace bgfx "GroupFMax", "GroupUMax", "GroupSMax", - "GenericCastToPtrExplicit", - "GenericPtrMemSemantics", + "Invalid272", + "Invalid273", "ReadPipe", "WritePipe", "ReservedReadPipe", @@ -538,6 +650,8 @@ namespace bgfx "GroupReserveWritePipePackets", "GroupCommitReadPipe", "GroupCommitWritePipe", + "Invalid289", + "Invalid290", "EnqueueMarker", "EnqueueKernel", "GetKernelNDrangeSubGroupCount", @@ -552,170 +666,318 @@ namespace bgfx "CaptureEventProfilingInfo", "GetDefaultQueue", "BuildNDRange", - "SatConvertSToU", - "SatConvertUToS", - "AtomicIMin", - "AtomicIMax", + "ImageSparseSampleImplicitLod", + "ImageSparseSampleExplicitLod", + "ImageSparseSampleDrefImplicitLod", + "ImageSparseSampleDrefExplicitLod", + "ImageSparseSampleProjImplicitLod", + "ImageSparseSampleProjExplicitLod", + "ImageSparseSampleProjDrefImplicitLod", + "ImageSparseSampleProjDrefExplicitLod", + "ImageSparseFetch", + "ImageSparseGather", + "ImageSparseDrefGather", + "ImageSparseTexelsResident", + "NoLine", + "AtomicFlagTestAndSet", + "AtomicFlagClear", + "ImageSparseRead", + }; + BX_STATIC_ASSERT(BX_COUNTOF(s_spvOpcode) == SpvOpcode::Count); + + const char* getName(SpvOpcode::Enum _opcode) + { + BX_WARN(_opcode < SpvOpcode::Count, "Unknown opcode id %d.", _opcode); + return _opcode < SpvOpcode::Count + ? s_spvOpcode[_opcode] + : "?SpvOpcode?" + ; + } + + static const char* s_spvStorageClass[] = + { + "UniformConstant", + "Input", + "Uniform", + "Output", + "Workgroup", + "CrossWorkgroup", + "Private", + "Function", + "Generic", + "PushConstant", + "AtomicCounter", + "Image", }; - BX_STATIC_ASSERT(BX_COUNTOF(s_spirvOpcode) == SpirvOpcode::Count); + BX_STATIC_ASSERT(BX_COUNTOF(s_spvStorageClass) == SpvStorageClass::Count); - const char* getName(SpirvOpcode::Enum _opcode) + const char* getName(SpvStorageClass::Enum _enum) { - BX_CHECK(_opcode < SpirvOpcode::Count, "Unknown opcode id %d.", _opcode); - return s_spirvOpcode[_opcode]; + BX_CHECK(_enum < SpvStorageClass::Count, "Unknown storage class id %d.", _enum); + return _enum < SpvStorageClass::Count + ? s_spvStorageClass[_enum] + : "?SpvStorageClass?" + ; } - int32_t read(bx::ReaderI* _reader, SpirvOperand& _operand) + int32_t read(bx::ReaderI* _reader, SpvOperand& _operand, bx::Error* _err) { int32_t size = 0; - BX_UNUSED(_operand); uint32_t token; - size += bx::read(_reader, token); + _operand.literalString = ""; + + switch (_operand.type) + { + case SpvOperand::LiteralString: + do + { + size += bx::read(_reader, token, _err); + _operand.literalString.append( (char*)&token, (char*)&token + sizeof(token) ); + } + while (0 != (token & 0xff000000) && _err->isOk() ); + break; + + default: + size += bx::read(_reader, _operand.data[0], _err); + break; + } return size; } - int32_t read(bx::ReaderI* _reader, SpirvInstruction& _instruction) + int32_t read(bx::ReaderI* _reader, SpvInstruction& _instruction, bx::Error* _err) { int32_t size = 0; uint32_t token; - size += bx::read(_reader, token); + size += bx::read(_reader, token, _err); + + _instruction.opcode = SpvOpcode::Enum( (token & UINT32_C(0x0000ffff) ) ); + _instruction.length = uint16_t( (token & UINT32_C(0xffff0000) ) >> 16); - _instruction.opcode = SpirvOpcode::Enum( (token & UINT32_C(0x0000ffff) ) ); - _instruction.length = uint16_t( (token & UINT32_C(0xffff0000) ) >> 16); + if (_instruction.opcode >= SpvOpcode::Count) + { + BX_ERROR_SET(_err, BGFX_SHADER_SPIRV_INVALID_INSTRUCTION, "SPIR-V: Invalid instruction."); + return size; + } - uint32_t currOp = 0; + if (0 == _instruction.length) + { + return size; + } - const SpirvOpcodeInfo& info = s_sprivOpcodeInfo[_instruction.opcode]; + const SpvOpcodeInfo& info = s_spvOpcodeInfo[_instruction.opcode]; + _instruction.hasType = info.hasType; + _instruction.hasResult = info.hasResult; - if (0 < info.numValues) + if (info.hasType) { - size += read(_reader, _instruction.un.value, info.numValues*sizeof(uint32_t) ); + size += read(_reader, _instruction.type, _err); } - if (info.hasVariable) + if (info.hasResult) { - while (size/4 != _instruction.length) - { - uint32_t tmp; - size += bx::read(_reader, tmp); - } + size += read(_reader, _instruction.result, _err); } - else + + uint16_t currOp = 0; + switch (_instruction.opcode) { - _instruction.numOperands = info.numOperands; - switch (info.numOperands) + case SpvOpcode::EntryPoint: + _instruction.operand[currOp].type = info.operands[currOp]; + size += read(_reader, _instruction.operand[currOp++], _err); + _instruction.operand[currOp].type = info.operands[currOp]; + size += read(_reader, _instruction.operand[currOp++], _err); + _instruction.operand[currOp].type = info.operands[currOp]; + size += read(_reader, _instruction.operand[currOp++], _err); + + _instruction.operand[currOp].type = SpvOperand::Id; + for (uint32_t ii = 0, num = _instruction.length - size/4; ii < num; ++ii) { - case 6: size += read(_reader, _instruction.operand[currOp++]); - case 5: size += read(_reader, _instruction.operand[currOp++]); - case 4: size += read(_reader, _instruction.operand[currOp++]); - case 3: size += read(_reader, _instruction.operand[currOp++]); - case 2: size += read(_reader, _instruction.operand[currOp++]); - case 1: size += read(_reader, _instruction.operand[currOp++]); - case 0: - break; - - default: - BX_WARN(false, "Instruction %s with invalid number of operands %d (numValues %d)." - , getName(_instruction.opcode) - , info.numOperands - , info.numValues - ); - break; + size += read(_reader, _instruction.operand[currOp], _err); } + break; - BX_WARN(size/4 == _instruction.length, "read %d, expected %d, %s" - , size/4 - , _instruction.length - , getName(_instruction.opcode) - ); - while (size/4 != _instruction.length) + default: + for (;size/4 != _instruction.length && _err->isOk(); ++currOp) { - uint32_t tmp; - size += bx::read(_reader, tmp); + _instruction.operand[currOp].type = info.operands[currOp]; + size += read(_reader, _instruction.operand[currOp], _err); } + break; } + _instruction.numOperands = currOp; + return size; } - int32_t write(bx::WriterI* _writer, const SpirvInstruction& _instruction) + int32_t write(bx::WriterI* _writer, const SpvInstruction& _instruction, bx::Error* _err) { int32_t size = 0; - BX_UNUSED(_writer, _instruction); + BX_UNUSED(_writer, _instruction, _err); return size; } - int32_t toString(char* _out, int32_t _size, const SpirvInstruction& _instruction) + int32_t toString(char* _out, int32_t _size, const SpvInstruction& _instruction) { int32_t size = 0; + + if (_instruction.hasResult) + { + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , " %%%d = " + , _instruction.result + ); + } + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%s %d (%d, %d)" + , "%s" , getName(_instruction.opcode) - , _instruction.numOperands - , _instruction.un.value[0] - , _instruction.un.value[1] ); + for (uint32_t ii = 0, num = _instruction.numOperands; ii < num; ++ii) + { + const SpvOperand& operand = _instruction.operand[ii]; + switch (operand.type) + { + case SpvOperand::AddressingModel: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%sAddressingModel(%d)" + , 0 == ii ? " " : ", " + , operand.data[0] + ); + break; + + case SpvOperand::FunctionControl: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%s0x%08x" + , 0 == ii ? " " : ", " + , operand.data[0] + ); + break; + + case SpvOperand::LiteralNumber: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%s%d" + , 0 == ii ? " " : ", " + , operand.data[0] + ); + break; + + case SpvOperand::LiteralString: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%s%s" + , 0 == ii ? " " : ", " + , operand.literalString.c_str() + ); + break; + + case SpvOperand::MemoryModel: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%sMemoryModel(%d)" + , 0 == ii ? " " : ", " + , operand.data[0] + ); + break; + + case SpvOperand::StorageClass: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%s%s" + , 0 == ii ? " " : ", " + , getName(SpvStorageClass::Enum(operand.data[0]) ) + ); + break; + + case SpvOperand::Count: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%s__%d__" + , 0 == ii ? " " : ", " + , operand.data[0] + ); + break; + + default: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%s%%%d" + , 0 == ii ? " " : ", " + , operand.data[0] + ); + break; + + } + } + return size; } - int32_t read(bx::ReaderSeekerI* _reader, SpirvShader& _shader) + int32_t read(bx::ReaderSeekerI* _reader, SpvShader& _shader, bx::Error* _err) { int32_t size = 0; - uint32_t len = uint32_t(bx::getSize(_reader) - bx::seek(_reader) ); - _shader.byteCode.resize(len); - size += bx::read(_reader, _shader.byteCode.data(), len); + uint32_t numBytes = uint32_t(bx::getSize(_reader) - bx::seek(_reader) ); + _shader.byteCode.resize(numBytes); + size += bx::read(_reader, _shader.byteCode.data(), numBytes, _err); return size; } - int32_t write(bx::WriterI* _writer, const SpirvShader& _shader) + int32_t write(bx::WriterI* _writer, const SpvShader& _shader, bx::Error* _err) { int32_t size = 0; - BX_UNUSED(_writer, _shader); + BX_UNUSED(_writer, _shader, _err); return size; } #define SPIRV_MAGIC 0x07230203 - int32_t read(bx::ReaderSeekerI* _reader, Spirv& _spirv) + int32_t read(bx::ReaderSeekerI* _reader, SpirV& _spirv, bx::Error* _err) { + BX_ERROR_SCOPE(_err); + int32_t size = 0; - size += bx::read(_reader, _spirv.header); + size += bx::read(_reader, _spirv.header, _err); - if (size != sizeof(Spirv::Header) + if (!_err->isOk() + || size != sizeof(SpirV::Header) || _spirv.header.magic != SPIRV_MAGIC ) { - // error - return -size; + BX_ERROR_SET(_err, BGFX_SHADER_SPIRV_INVALID_HEADER, "SPIR-V: Invalid header."); + return size; } - size += read(_reader, _spirv.shader); + size += read(_reader, _spirv.shader, _err); return size; } - int32_t write(bx::WriterSeekerI* _writer, const Spirv& _spirv) + int32_t write(bx::WriterSeekerI* _writer, const SpirV& _spirv, bx::Error* _err) { int32_t size = 0; - BX_UNUSED(_writer, _spirv); + BX_UNUSED(_writer, _spirv, _err); return size; } - void parse(const SpirvShader& _src, SpirvParseFn _fn, void* _userData) + void parse(const SpvShader& _src, SpirvParseFn _fn, void* _userData, bx::Error* _err) { - bx::MemoryReader reader(_src.byteCode.data(), uint32_t(_src.byteCode.size() ) ); + BX_ERROR_SCOPE(_err); + + uint32_t numBytes = uint32_t(_src.byteCode.size() ); + bx::MemoryReader reader(_src.byteCode.data(), numBytes); for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;) { - SpirvInstruction instruction; - uint32_t size = read(&reader, instruction); + SpvInstruction instruction; + uint32_t size = read(&reader, instruction, _err); + + if (!_err->isOk() ) + { + return; + } + BX_CHECK(size/4 == instruction.length, "read %d, expected %d, %s" , size/4 , instruction.length @@ -723,7 +985,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/3rdparty/bgfx/src/shader_spirv.h b/3rdparty/bgfx/src/shader_spirv.h index 73577e77030..9a7c81b1ac2 100644 --- a/3rdparty/bgfx/src/shader_spirv.h +++ b/3rdparty/bgfx/src/shader_spirv.h @@ -8,30 +8,45 @@ #include <bx/readerwriter.h> +BX_ERROR_RESULT(BGFX_SHADER_SPIRV_INVALID_HEADER, BX_MAKEFOURCC('S', 'H', 0, 1) ); +BX_ERROR_RESULT(BGFX_SHADER_SPIRV_INVALID_INSTRUCTION, BX_MAKEFOURCC('S', 'H', 0, 2) ); + namespace bgfx { // Reference: https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.html - struct SpirvOpcode + struct SpvOpcode { enum Enum { Nop, + Undef, + SourceContinued, Source, SourceExtension, + Name, + MemberName, + String, + Line, + Invalid9, Extension, ExtInstImport, + ExtInst, + Invalid13, MemoryModel, EntryPoint, ExecutionMode, + Capability, + Invalid18, TypeVoid, TypeBool, TypeInt, TypeFloat, TypeVector, TypeMatrix, + TypeImage, TypeSampler, - TypeFilter, + TypeSampledImage, TypeArray, TypeRuntimeArray, TypeStruct, @@ -43,37 +58,44 @@ namespace bgfx TypeReserveId, TypeQueue, TypePipe, + TypeForwardPointer, + Invalid40, ConstantTrue, ConstantFalse, Constant, ConstantComposite, ConstantSampler, - ConstantNullPointer, - ConstantNullObject, + ConstantNull, + Invalid47, SpecConstantTrue, SpecConstantFalse, SpecConstant, SpecConstantComposite, - Variable, - VariableArray, + SpecConstantOp, + Invalid53, Function, FunctionParameter, FunctionEnd, FunctionCall, - ExtInst, - Undef, + Invalid58, + Variable, + ImageTexelPointer, Load, Store, - Phi, - DecorationGroup, + CopyMemory, + CopyMemorySized, + AccessChain, + InBoundsAccessChain, + PtrAccessChain, + ArrayLength, + GenericPtrMemSemantics, + InBoundsPtrAccessChain, Decorate, MemberDecorate, + DecorationGroup, GroupDecorate, GroupMemberDecorate, - Name, - MemberName, - String, - Line, + Invalid76, VectorExtractDynamic, VectorInsertDynamic, VectorShuffle, @@ -81,41 +103,31 @@ namespace bgfx CompositeExtract, CompositeInsert, CopyObject, - CopyMemory, - CopyMemorySized, - Sampler, - TextureSample, - TextureSampleDref, - TextureSampleLod, - TextureSampleProj, - TextureSampleGrad, - TextureSampleOffset, - TextureSampleProjLod, - TextureSampleProjGrad, - TextureSampleLodOffset, - TextureSampleProjOffset, - TextureSampleGradOffset, - TextureSampleProjLodOffset, - TextureSampleProjGradOffset, - TextureFetchTexelLod, - TextureFetchTexelOffset, - TextureFetchSample, - TextureFetchTexel, - TextureGather, - TextureGatherOffset, - TextureGatherOffsets, - TextureQuerySizeLod, - TextureQuerySize, - TextureQueryLod, - TextureQueryLevels, - TextureQuerySamples, - AccessChain, - InBoundsAccessChain, - SNegate, - FNegate, - Not, - Any, - All, + Transpose, + Invalid85, + SampledImage, + ImageSampleImplicitLod, + ImageSampleExplicitLod, + ImageSampleDrefImplicitLod, + ImageSampleDrefExplicitLod, + ImageSampleProjImplicitLod, + ImageSampleProjExplicitLod, + ImageSampleProjDrefImplicitLod, + ImageSampleProjDrefExplicitLod, + ImageFetch, + ImageGather, + ImageDrefGather, + ImageRead, + ImageWrite, + Image, + ImageQueryFormat, + ImageQueryOrder, + ImageQuerySizeLod, + ImageQuerySize, + ImageQueryLod, + ImageQueryLevels, + ImageQuerySamples, + Invalid108, ConvertFToU, ConvertFToS, ConvertSToF, @@ -123,21 +135,18 @@ namespace bgfx UConvert, SConvert, FConvert, + QuantizeToF16, ConvertPtrToU, + SatConvertSToU, + SatConvertUToS, ConvertUToPtr, PtrCastToGeneric, GenericCastToPtr, + GenericCastToPtrExplicit, Bitcast, - Transpose, - IsNan, - IsInf, - IsFinite, - IsNormal, - SignBitSet, - LessOrGreater, - Ordered, - Unordered, - ArrayLength, + Invalid125, + SNegate, + FNegate, IAdd, FAdd, ISub, @@ -159,38 +168,64 @@ namespace bgfx MatrixTimesMatrix, OuterProduct, Dot, - ShiftRightLogical, - ShiftRightArithmetic, - ShiftLeftLogical, + IAddCarry, + ISubBorrow, + UMulExtended, + SMulExtended, + Invalid153, + Any, + All, + IsNan, + IsInf, + IsFinite, + IsNormal, + SignBitSet, + LessOrGreater, + Ordered, + Unordered, + LogicalEqual, + LogicalNotEqual, LogicalOr, - LogicalXor, LogicalAnd, - BitwiseOr, - BitwiseXor, - BitwiseAnd, + LogicalNot, Select, IEqual, + INotEqual, + UGreaterThan, + SGreaterThan, + UGreaterThanEqual, + SGreaterThanEqual, + ULessThan, + SLessThan, + ULessThanEqual, + SLessThanEqual, FOrdEqual, FUnordEqual, - INotEqual, FOrdNotEqual, FUnordNotEqual, - ULessThan, - SLessThan, FOrdLessThan, FUnordLessThan, - UGreaterThan, - SGreaterThan, FOrdGreaterThan, FUnordGreaterThan, - ULessThanEqual, - SLessThanEqual, FOrdLessThanEqual, FUnordLessThanEqual, - UGreaterThanEqual, - SGreaterThanEqual, FOrdGreaterThanEqual, FUnordGreaterThanEqual, + Invalid192, + Invalid193, + ShiftRightLogical, + ShiftRightArithmetic, + ShiftLeftLogical, + BitwiseOr, + BitwiseXor, + BitwiseAnd, + Not, + BitFieldInsert, + BitFieldSExtract, + BitFieldUExtract, + BitReverse, + BitCount, + Invalid206, DPdx, DPdy, Fwidth, @@ -200,14 +235,17 @@ namespace bgfx DPdxCoarse, DPdyCoarse, FwidthCoarse, + Invalid216, + Invalid217, EmitVertex, EndPrimitive, EmitStreamVertex, EndStreamPrimitive, + Invalid222, + Invalid223, ControlBarrier, MemoryBarrier, - ImagePointer, - AtomicInit, + Invalid226, AtomicLoad, AtomicStore, AtomicExchange, @@ -217,11 +255,16 @@ namespace bgfx AtomicIDecrement, AtomicIAdd, AtomicISub, + AtomicSMin, AtomicUMin, + AtomicSMax, AtomicUMax, AtomicAnd, AtomicOr, AtomicXor, + Invalid243, + Invalid244, + Phi, LoopMerge, SelectionMerge, Label, @@ -234,9 +277,9 @@ namespace bgfx Unreachable, LifetimeStart, LifetimeStop, - CompileFlag, - AsyncGroupCopy, - WaitGroupEvents, + Invalid258, + GroupAsyncCopy, + GroupWaitEvents, GroupAll, GroupAny, GroupBroadcast, @@ -248,8 +291,8 @@ namespace bgfx GroupFMax, GroupUMax, GroupSMax, - GenericCastToPtrExplicit, - GenericPtrMemSemantics, + Invalid272, + Invalid273, ReadPipe, WritePipe, ReservedReadPipe, @@ -265,6 +308,8 @@ namespace bgfx GroupReserveWritePipePackets, GroupCommitReadPipe, GroupCommitWritePipe, + Invalid289, + Invalid290, EnqueueMarker, EnqueueKernel, GetKernelNDrangeSubGroupCount, @@ -279,10 +324,22 @@ namespace bgfx CaptureEventProfilingInfo, GetDefaultQueue, BuildNDRange, - SatConvertSToU, - SatConvertUToS, - AtomicIMin, - AtomicIMax, + ImageSparseSampleImplicitLod, + ImageSparseSampleExplicitLod, + ImageSparseSampleDrefImplicitLod, + ImageSparseSampleDrefExplicitLod, + ImageSparseSampleProjImplicitLod, + ImageSparseSampleProjExplicitLod, + ImageSparseSampleProjDrefImplicitLod, + ImageSparseSampleProjDrefExplicitLod, + ImageSparseFetch, + ImageSparseGather, + ImageSparseDrefGather, + ImageSparseTexelsResident, + NoLine, + AtomicFlagTestAndSet, + AtomicFlagClear, + ImageSparseRead, Count }; @@ -294,12 +351,11 @@ namespace bgfx { Position, PointSize, - ClipVertex, ClipDistance, CullDistance, VertexId, InstanceId, - BuiltInPrimitiveId, + PrimitiveId, InvocationId, Layer, ViewportIndex, @@ -313,7 +369,6 @@ namespace bgfx SampleId, SamplePosition, SampleMask, - FragColor, FragDepth, HelperInvocation, NumWorkgroups, @@ -327,17 +382,20 @@ namespace bgfx EnqueuedWorkgroupSize, GlobalOffset, GlobalLinearId, - WorkgroupLinearId, SubgroupSize, SubgroupMaxSize, NumSubgroups, NumEnqueuedSubgroups, SubgroupId, SubgroupLocalInvocationId, + VertexIndex, + InstanceIndex, + + Count }; }; - struct SpirvExecutionModel + struct SpvExecutionModel { enum Enum { @@ -353,21 +411,31 @@ namespace bgfx }; }; - struct SpirvMemoryModel + struct SpvAddressingModel + { + enum Enum + { + Logical, + Physical32, + Physical64, + + Count + }; + }; + + struct SpvMemoryModel { enum Enum { Simple, GLSL450, - OpenCL12, - OpenCL20, - OpenCL21, + OpenCL, Count }; }; - struct SpirvStorageClass + struct SpvStorageClass { enum Enum { @@ -375,17 +443,20 @@ namespace bgfx Input, Uniform, Output, - WorkgroupLocal, - WorkgroupGlobal, - PrivateGlobal, + Workgroup, + CrossWorkgroup, + Private, Function, Generic, - Private, + PushConstant, AtomicCounter, + Image, + + Count }; }; - struct SpirvResourceDim + struct SpvResourceDim { enum Enum { @@ -395,26 +466,27 @@ namespace bgfx TextureCube, TextureRect, Buffer, + SubpassData, }; }; - struct SpirvDecoration + struct SpvDecoration { enum Enum { - PrecisionLow, - PrecisionMedium, - PrecisionHigh, + RelaxedPrecision, + SpecId, Block, BufferBlock, RowMajor, ColMajor, + ArrayStride, + MatrixStride, GLSLShared, - GLSLStd140, - GLSLStd430, GLSLPacked, - Smooth, - Noperspective, + CPacked, + BuiltIn, + NoPerspective, Flat, Patch, Centroid, @@ -425,11 +497,9 @@ namespace bgfx Volatile, Constant, Coherent, - Nonwritable, - Nonreadable, + NonWritable, + NonReadable, Uniform, - NoStaticUse, - CPacked, SaturatedConversion, Stream, Location, @@ -438,66 +508,104 @@ namespace bgfx Binding, DescriptorSet, Offset, - Alignment, XfbBuffer, - Stride, - BuiltIn, + XfbStride, FuncParamAttr, FPRoundingMode, FPFastMathMode, LinkageAttributes, - SpecId, + NoContraction, + InputAttachmentIndex, + Alignment, Count }; }; - struct SpirvOperand + struct SpvOperand { + enum Enum + { + AccessQualifier, + AddressingModel, + Base, + Capability, + Component, + ComponentType, + Composite, + Condition, + Coordinate, + Decoration, + Dim, + Dref, + ExecutionModel, + Function, + FunctionControl, + Id, + IdRep, + ImageFormat, + ImageOperands, + LiteralNumber, + LiteralRep, + LiteralString, + Matrix, + MemoryAccess, + MemoryModel, + Object, + Pointer, + SampledType, + SampledImage, + SamplerAddressingMode, + SamplerFilterMode, + Scalar, + SourceLanguage, + StorageClass, + StructureType, + Vector, + + Count + }; + + Enum type; + uint32_t data[4]; + + uint32_t target; + stl::string literalString; }; - struct SpirvInstruction + struct SpvInstruction { - SpirvOpcode::Enum opcode; + SpvOpcode::Enum opcode; uint16_t length; + uint16_t numOperands; - uint8_t numOperands; - SpirvOperand operand[6]; - - union - { - struct ResultTypeId - { - uint32_t resultType; - uint32_t id; - }; - - ResultTypeId constant; - ResultTypeId constantComposite; + uint32_t type; + uint32_t result; + bool hasType; + bool hasResult; - uint32_t value[8]; - } un; + SpvOperand operand[8]; }; - int32_t read(bx::ReaderI* _reader, SpirvInstruction& _instruction); - int32_t write(bx::WriterI* _writer, const SpirvInstruction& _instruction); - int32_t toString(char* _out, int32_t _size, const SpirvInstruction& _instruction); + int32_t read(bx::ReaderI* _reader, SpvInstruction& _instruction, bx::Error* _err); + int32_t write(bx::WriterI* _writer, const SpvInstruction& _instruction, bx::Error* _err); + int32_t toString(char* _out, int32_t _size, const SpvInstruction& _instruction); - struct SpirvShader + struct SpvShader { stl::vector<uint8_t> byteCode; }; - int32_t read(bx::ReaderSeekerI* _reader, SpirvShader& _shader); - int32_t write(bx::WriterI* _writer, const SpirvShader& _shader); + int32_t read(bx::ReaderSeekerI* _reader, SpvShader& _shader, bx::Error* _err); + int32_t write(bx::WriterI* _writer, const SpvShader& _shader, bx::Error* _err); - typedef void (*SpirvParseFn)(uint32_t _offset, const SpirvInstruction& _instruction, void* _userData); - void parse(const SpirvShader& _src, SpirvParseFn _fn, void* _userData); + typedef bool (*SpirvParseFn)(uint32_t _offset, const SpvInstruction& _instruction, void* _userData); + void parse(const SpvShader& _src, SpirvParseFn _fn, void* _userData, bx::Error* _err = NULL); - typedef void (*SpirvFilterFn)(SpirvInstruction& _instruction, void* _userData); - void filter(SpirvShader& _dst, const SpirvShader& _src, SpirvFilterFn _fn, void* _userData); + typedef void (*SpirvFilterFn)(SpvInstruction& _instruction, void* _userData); + void filter(SpvShader& _dst, const SpvShader& _src, SpirvFilterFn _fn, void* _userData, bx::Error* _err = NULL); - struct Spirv + struct SpirV { struct Header { @@ -509,11 +617,11 @@ namespace bgfx }; Header header; - SpirvShader shader; + SpvShader shader; }; - int32_t read(bx::ReaderSeekerI* _reader, Spirv& _spirv); - int32_t write(bx::WriterSeekerI* _writer, const Spirv& _spirv); + int32_t read(bx::ReaderSeekerI* _reader, SpirV& _spirv, bx::Error* _err); + int32_t write(bx::WriterSeekerI* _writer, const SpirV& _spirv, bx::Error* _err); } // namespace bgfx diff --git a/3rdparty/bgfx/src/topology.cpp b/3rdparty/bgfx/src/topology.cpp new file mode 100644 index 00000000000..767e4995772 --- /dev/null +++ b/3rdparty/bgfx/src/topology.cpp @@ -0,0 +1,216 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include <bx/debug.h> +#include <bx/allocator.h> +#include <bx/radixsort.h> + +#include "config.h" +#include "topology.h" + +namespace bgfx +{ + template<typename IndexT> + static uint32_t topologyConvertTriListFlipWinding(void* _dst, uint32_t _dstSize, const IndexT* _indices, uint32_t _numIndices) + { + if (NULL == _dst) + { + return _numIndices; + } + + IndexT* dst = (IndexT*)_dst; + IndexT* end = &dst[_dstSize/sizeof(IndexT)]; + for (uint32_t ii = 0; ii < _numIndices && dst < end; ii += 3, dst += 3) + { + const IndexT* tri = &_indices[ii]; + IndexT i0 = tri[0], i1 = tri[1], i2 = tri[2]; + + dst[0] = i0; + dst[1] = i2; + dst[2] = i1; + } + + return _numIndices; + } + + template<typename IndexT, typename SortT> + static uint32_t topologyConvertTriListToLineList(void* _dst, uint32_t _dstSize, const IndexT* _indices, uint32_t _numIndices, IndexT* _temp, SortT* _tempSort) + { + // Create all line pairs and sort indices. + IndexT* dst = _temp; + for (uint32_t ii = 0; ii < _numIndices; ii += 3) + { + const IndexT* tri = &_indices[ii]; + IndexT i0 = tri[0], i1 = tri[1], i2 = tri[2]; + + if (i0 > i1) { bx::xchg(i0, i1); } + if (i1 > i2) { bx::xchg(i1, i2); } + if (i0 > i1) { bx::xchg(i0, i1); } + BX_CHECK(i0 < i1 && i1 < i2, ""); + + dst[0] = i0; dst[1] = i1; + dst[2] = i1; dst[3] = i2; + dst[4] = i0; dst[5] = i2; + dst += 6; + } + + // Sort all line pairs. + SortT* sorted = (SortT*)_temp; + bx::radixSort(sorted, _tempSort, _numIndices); + + uint32_t num = 0; + + // Remove all line pair duplicates. + if (NULL == _dst) + { + SortT last = sorted[0]; + for (uint32_t ii = 1; ii < _numIndices; ++ii) + { + if (last != sorted[ii]) + { + num += 2; + last = sorted[ii]; + } + } + num += 2; + } + else + { + dst = (IndexT*)_dst; + IndexT* end = &dst[_dstSize/sizeof(IndexT)]; + SortT last = sorted[0]; + for (uint32_t ii = 1; ii < _numIndices && dst < end; ++ii) + { + if (last != sorted[ii]) + { + union Un { SortT key; struct { IndexT i0; IndexT i1; } u16; } un = { last }; + dst[0] = un.u16.i0; + dst[1] = un.u16.i1; + dst += 2; + last = sorted[ii]; + } + } + + if (dst < end) + { + union Un { SortT key; struct { IndexT i0; IndexT i1; } u16; } un = { last }; + dst[0] = un.u16.i0; + dst[1] = un.u16.i1; + dst += 2; + } + + num = uint32_t(dst - (IndexT*)_dst); + } + + return num; + } + + template<typename IndexT, typename SortT> + static uint32_t topologyConvertTriListToLineList(void* _dst, uint32_t _dstSize, const IndexT* _indices, uint32_t _numIndices, bx::AllocatorI* _allocator) + { + IndexT* temp = (IndexT*)BX_ALLOC(_allocator, _numIndices*2*sizeof(IndexT)*2); + SortT* tempSort = (SortT*)&temp[_numIndices*2]; + uint32_t num = topologyConvertTriListToLineList(_dst, _dstSize, _indices, _numIndices, temp, tempSort); + BX_FREE(_allocator, temp); + return num; + } + + template<typename IndexT> + static uint32_t topologyConvertTriStripToTriList(void* _dst, uint32_t _dstSize, const IndexT* _indices, uint32_t _numIndices) + { + IndexT* dst = (IndexT*)_dst; + IndexT* end = &dst[_dstSize/sizeof(IndexT)]; + + for (uint32_t ii = 0, num = _numIndices-2; ii < num && dst < end; ++ii) + { + IndexT i0 = _indices[ii+0]; + IndexT i1 = _indices[ii+1]; + IndexT i2 = _indices[ii+2]; + if (i0 != i1 + && i1 != i2) + { + dst[0] = i0; + dst[1] = i1; + dst[2] = i2; + dst += 3; + } + } + + return uint32_t(dst - (IndexT*)_dst); + } + + template<typename IndexT> + static uint32_t topologyConvertLineStripToLineList(void* _dst, uint32_t _dstSize, const IndexT* _indices, uint32_t _numIndices) + { + IndexT* dst = (IndexT*)_dst; + IndexT* end = &dst[_dstSize/sizeof(IndexT)]; + + IndexT i0 = _indices[0]; + + for (uint32_t ii = 1; ii < _numIndices && dst < end; ++ii) + { + IndexT i1 = _indices[ii]; + if (i0 != i1) + { + dst[0] = i0; + dst[1] = i1; + dst += 2; + + i0 = i1; + } + } + + return uint32_t(dst - (IndexT*)_dst); + } + + uint32_t topologyConvert(TopologyConvert::Enum _conversion, void* _dst, uint32_t _dstSize, const void* _indices, uint32_t _numIndices, bool _index32, bx::AllocatorI* _allocator) + { + switch (_conversion) + { + case TopologyConvert::TriStripToTriList: + if (_index32) + { + return topologyConvertTriStripToTriList(_dst, _dstSize, (const uint32_t*)_indices, _numIndices); + } + + return topologyConvertTriStripToTriList(_dst, _dstSize, (const uint16_t*)_indices, _numIndices); + + case TopologyConvert::TriListFlipWinding: + if (_index32) + { + return topologyConvertTriListFlipWinding(_dst, _dstSize, (const uint32_t*)_indices, _numIndices); + } + + return topologyConvertTriListFlipWinding(_dst, _dstSize, (const uint16_t*)_indices, _numIndices); + + case TopologyConvert::TriListToLineList: + if (NULL == _allocator) + { + return 0; + } + + if (_index32) + { + return topologyConvertTriListToLineList<uint32_t, uint64_t>(_dst, _dstSize, (const uint32_t*)_indices, _numIndices, _allocator); + } + + return topologyConvertTriListToLineList<uint16_t, uint32_t>(_dst, _dstSize, (const uint16_t*)_indices, _numIndices, _allocator); + + case TopologyConvert::LineStripToLineList: + if (_index32) + { + return topologyConvertLineStripToLineList(_dst, _dstSize, (const uint32_t*)_indices, _numIndices); + } + + return topologyConvertLineStripToLineList(_dst, _dstSize, (const uint16_t*)_indices, _numIndices); + + default: + break; + } + + return 0; + } + +} //namespace bgfx diff --git a/3rdparty/bgfx/src/topology.h b/3rdparty/bgfx/src/topology.h new file mode 100644 index 00000000000..014d67559df --- /dev/null +++ b/3rdparty/bgfx/src/topology.h @@ -0,0 +1,33 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#ifndef BGFX_TOPOLOGY_H_HEADER_GUARD +#define BGFX_TOPOLOGY_H_HEADER_GUARD + +#include <bgfx/bgfx.h> + +namespace bgfx +{ + /// Convert index buffer for use with different primitive topologies. + /// + /// @param[in] _conversion Conversion type, see `TopologyConvert::Enum`. + /// @param[in] _dst Destination index buffer. If this argument it NULL + /// function will return number of indices after conversion. + /// @param[in] _dstSize Destination index buffer in bytes. It must be + /// large enough to contain output indices. If destination size is + /// insufficient index buffer will be truncated. + /// @param[in] _indices Source indices. + /// @param[in] _numIndices Number of input indices. + /// @param[in] _index32 Set to `true` if input indices are 32-bit. + /// + /// @returns Number of output indices after conversion. + /// + /// @attention C99 equivalent is `bgfx_topology_convert`. + /// + uint32_t topologyConvert(TopologyConvert::Enum _conversion, void* _dst, uint32_t _dstSize, const void* _indices, uint32_t _numIndices, bool _index32, bx::AllocatorI* _allocator); + +} // namespace bgfx + +#endif // BGFX_TOPOLOGY_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/vertexdecl.cpp b/3rdparty/bgfx/src/vertexdecl.cpp index 91ef865d0c9..c5fb4b05dec 100644 --- a/3rdparty/bgfx/src/vertexdecl.cpp +++ b/3rdparty/bgfx/src/vertexdecl.cpp @@ -6,9 +6,10 @@ #include <string.h> #include <bx/debug.h> #include <bx/hash.h> -#include <bx/uint32_t.h> -#include <bx/string.h> #include <bx/readerwriter.h> +#include <bx/radixsort.h> +#include <bx/string.h> +#include <bx/uint32_t.h> #include "config.h" #include "vertexdecl.h" @@ -285,8 +286,10 @@ namespace bgfx return s_attribTypeToId[_attr].id; } - int32_t write(bx::WriterI* _writer, const VertexDecl& _decl) + int32_t write(bx::WriterI* _writer, const VertexDecl& _decl, bx::Error* _err) { + BX_ERROR_SCOPE(_err); + int32_t total = 0; uint8_t numAttrs = 0; @@ -295,8 +298,8 @@ namespace bgfx numAttrs += UINT16_MAX == _decl.m_attributes[attr] ? 0 : 1; } - total += bx::write(_writer, numAttrs); - total += bx::write(_writer, _decl.m_stride); + total += bx::write(_writer, numAttrs, _err); + total += bx::write(_writer, _decl.m_stride, _err); for (uint32_t attr = 0; attr < Attrib::Count; ++attr) { @@ -307,49 +310,61 @@ namespace bgfx bool normalized; bool asInt; _decl.decode(Attrib::Enum(attr), num, type, normalized, asInt); - total += bx::write(_writer, _decl.m_offset[attr]); - total += bx::write(_writer, s_attribToId[attr].id); - total += bx::write(_writer, num); - total += bx::write(_writer, s_attribTypeToId[type].id); - total += bx::write(_writer, normalized); - total += bx::write(_writer, asInt); + total += bx::write(_writer, _decl.m_offset[attr], _err); + total += bx::write(_writer, s_attribToId[attr].id, _err); + total += bx::write(_writer, num, _err); + total += bx::write(_writer, s_attribTypeToId[type].id, _err); + total += bx::write(_writer, normalized, _err); + total += bx::write(_writer, asInt, _err); } } return total; } - int32_t read(bx::ReaderI* _reader, VertexDecl& _decl) + int32_t read(bx::ReaderI* _reader, VertexDecl& _decl, bx::Error* _err) { + BX_ERROR_SCOPE(_err); + int32_t total = 0; uint8_t numAttrs; - total += bx::read(_reader, numAttrs); + total += bx::read(_reader, numAttrs, _err); uint16_t stride; - total += bx::read(_reader, stride); + total += bx::read(_reader, stride, _err); + + if (!_err->isOk() ) + { + return total; + } _decl.begin(); for (uint32_t ii = 0; ii < numAttrs; ++ii) { uint16_t offset; - total += bx::read(_reader, offset); + total += bx::read(_reader, offset, _err); uint16_t attribId = 0; - total += bx::read(_reader, attribId); + total += bx::read(_reader, attribId, _err); uint8_t num; - total += bx::read(_reader, num); + total += bx::read(_reader, num, _err); uint16_t attribTypeId; - total += bx::read(_reader, attribTypeId); + total += bx::read(_reader, attribTypeId, _err); bool normalized; - total += bx::read(_reader, normalized); + total += bx::read(_reader, normalized, _err); bool asInt; - total += bx::read(_reader, asInt); + total += bx::read(_reader, asInt, _err); + + if (!_err->isOk() ) + { + return total; + } Attrib::Enum attr = idToAttrib(attribId); AttribType::Enum type = idToAttribType(attribTypeId); @@ -839,4 +854,5 @@ namespace bgfx return (uint16_t)numVertices; } + } // namespace bgfx diff --git a/3rdparty/bgfx/src/vertexdecl.h b/3rdparty/bgfx/src/vertexdecl.h index 642aae35592..866c53a3f22 100644 --- a/3rdparty/bgfx/src/vertexdecl.h +++ b/3rdparty/bgfx/src/vertexdecl.h @@ -30,10 +30,10 @@ namespace bgfx AttribType::Enum idToAttribType(uint16_t id); /// - int32_t write(bx::WriterI* _writer, const bgfx::VertexDecl& _decl); + int32_t write(bx::WriterI* _writer, const bgfx::VertexDecl& _decl, bx::Error* _err = NULL); /// - int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl); + int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl, bx::Error* _err = NULL); } // namespace bgfx diff --git a/3rdparty/bgfx/tools/geometryc/geometryc.cpp b/3rdparty/bgfx/tools/geometryc/geometryc.cpp index 7687f3c5e38..fe4de46ada8 100644 --- a/3rdparty/bgfx/tools/geometryc/geometryc.cpp +++ b/3rdparty/bgfx/tools/geometryc/geometryc.cpp @@ -58,11 +58,11 @@ namespace stl = tinystl; #include <bx/debug.h> #include <bx/commandline.h> #include <bx/timer.h> -#include <bx/readerwriter.h> #include <bx/hash.h> #include <bx/uint32_t.h> #include <bx/fpumath.h> #include <bx/tokenizecmd.h> +#include <bx/crtimpl.h> #include "bounds.h" @@ -81,6 +81,7 @@ struct Index3 int32_t m_texcoord; int32_t m_normal; int32_t m_vertexIndex; + int32_t m_vbc; // Barycentric ID. Holds eigher 0, 1 or 2. }; typedef stl::unordered_map<uint64_t, Index3> Index3Map; @@ -387,6 +388,7 @@ void help(const char* _error = NULL) " 0 - unpacked 8 bytes (default).\n" " 1 - packed 4 bytes.\n" " --tangent Calculate tangent vectors (packing mode is the same as normal).\n" + " --barycentric Adds barycentric vertex attribute (packed in bgfx::Attrib::Color1).\n" " -c, --compress Compress indices.\n" "\n" @@ -450,6 +452,7 @@ int main(int _argc, const char* _argv[]) bool ccw = cmdLine.hasArg("ccw"); bool flipV = cmdLine.hasArg("flipv"); bool hasTangent = cmdLine.hasArg("tangent"); + bool hasBc = cmdLine.hasArg("barycentric"); FILE* file = fopen(filePath, "r"); if (NULL == file) @@ -513,6 +516,14 @@ int main(int _argc, const char* _argv[]) index.m_texcoord = -1; index.m_normal = -1; index.m_vertexIndex = -1; + if (hasBc) + { + index.m_vbc = edge < 3 ? edge : (1+(edge+1) )&1; + } + else + { + index.m_vbc = 0; + } char* vertex = argv[edge+1]; char* texcoord = strchr(vertex, '/'); @@ -542,7 +553,8 @@ int main(int _argc, const char* _argv[]) uint64_t hash0 = index.m_position; uint64_t hash1 = uint64_t(index.m_texcoord)<<20; uint64_t hash2 = uint64_t(index.m_normal)<<40; - uint64_t hash = hash0^hash1^hash2; + uint64_t hash3 = uint64_t(index.m_vbc)<<60; + uint64_t hash = hash0^hash1^hash2^hash3; stl::pair<Index3Map::iterator, bool> result = indexMap.insert(stl::make_pair(hash, index) ); if (!result.second) @@ -755,6 +767,11 @@ int main(int _argc, const char* _argv[]) decl.add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true); } + if (hasBc) + { + decl.add(bgfx::Attrib::Color1, 4, bgfx::AttribType::Uint8, true); + } + if (hasTexcoord) { switch (packUv) @@ -914,6 +931,17 @@ int main(int _argc, const char* _argv[]) *color0 = rgbaToAbgr(numVertices%255, numIndices%255, 0, 0xff); } + if (hasBc) + { + const float bc[3] = + { + (index.m_vbc == 0) ? 1.0f : 0.0f, + (index.m_vbc == 1) ? 1.0f : 0.0f, + (index.m_vbc == 2) ? 1.0f : 0.0f, + }; + bgfx::vertexPack(bc, true, bgfx::Attrib::Color1, decl, vertices); + } + if (hasTexcoord) { float uv[2]; diff --git a/3rdparty/bgfx/tools/shaderc/shaderc.h b/3rdparty/bgfx/tools/shaderc/shaderc.h index 29bf450e474..47bae98c3aa 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc.h +++ b/3rdparty/bgfx/tools/shaderc/shaderc.h @@ -59,9 +59,9 @@ namespace bgfx #include <bx/commandline.h> #include <bx/endian.h> #include <bx/uint32_t.h> -#include <bx/readerwriter.h> #include <bx/string.h> #include <bx/hash.h> +#include <bx/crtimpl.h> #include "../../src/vertexdecl.h" namespace bgfx diff --git a/3rdparty/bgfx/tools/texturec/texturec.cpp b/3rdparty/bgfx/tools/texturec/texturec.cpp index 81bccfeb6f6..35983dc9849 100644 --- a/3rdparty/bgfx/tools/texturec/texturec.cpp +++ b/3rdparty/bgfx/tools/texturec/texturec.cpp @@ -27,8 +27,8 @@ #endif // DEBUG #include <bx/bx.h> -#include <bx/allocator.h> #include <bx/commandline.h> +#include <bx/crtimpl.h> #include <bx/uint32_t.h> namespace bgfx @@ -117,7 +117,7 @@ namespace bgfx case TextureFormat::PTC14: { using namespace Javelin; - RgbBitmap bmp; + RgbaBitmap bmp; bmp.width = _width; bmp.height = _height; bmp.data = (uint8_t*)const_cast<void*>(_src); @@ -511,6 +511,8 @@ int main(int _argc, const char* _argv[]) { imageRgba32fDownsample2x2NormalMap(mip.m_width, mip.m_height, mip.m_width*16, rgba, rgba); imageRgba32f11to01(rgbaDst, mip.m_width, mip.m_height, mip.m_width*16, rgba); + mip.m_width = bx::uint32_max(1, mip.m_width >> 1); + mip.m_height = bx::uint32_max(1, mip.m_height >> 1); ImageMip dstMip; imageGetRawData(imageContainer, 0, lod, output->data, output->size, dstMip); @@ -541,6 +543,8 @@ int main(int _argc, const char* _argv[]) for (uint8_t lod = 1; lod < numMips; ++lod) { imageRgba8Downsample2x2(mip.m_width, mip.m_height, mip.m_width*4, rgba, rgba); + mip.m_width = bx::uint32_max(1, mip.m_width >> 1); + mip.m_height = bx::uint32_max(1, mip.m_height >> 1); ImageMip dstMip; imageGetRawData(imageContainer, 0, lod, output->data, output->size, dstMip); diff --git a/3rdparty/bx/include/bx/allocator.h b/3rdparty/bx/include/bx/allocator.h index 50d526535b6..61356321134 100644 --- a/3rdparty/bx/include/bx/allocator.h +++ b/3rdparty/bx/include/bx/allocator.h @@ -12,10 +12,6 @@ #include <string.h> //::memmove #include <new> -#if BX_CONFIG_ALLOCATOR_CRT -# include <malloc.h> -#endif // BX_CONFIG_ALLOCATOR_CRT - #if BX_CONFIG_ALLOCATOR_DEBUG # define BX_ALLOC(_allocator, _size) bx::alloc(_allocator, _size, 0, __FILE__, __LINE__) # define BX_REALLOC(_allocator, _ptr, _size) bx::realloc(_allocator, _ptr, _size, 0, __FILE__, __LINE__) @@ -145,70 +141,6 @@ namespace bx } } -#if BX_CONFIG_ALLOCATOR_CRT - class CrtAllocator : public AllocatorI - { - public: - CrtAllocator() - { - } - - virtual ~CrtAllocator() - { - } - - virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE - { - if (0 == _size) - { - if (NULL != _ptr) - { - if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) - { - ::free(_ptr); - return NULL; - } - -# if BX_COMPILER_MSVC - BX_UNUSED(_file, _line); - _aligned_free(_ptr); -# else - bx::alignedFree(this, _ptr, _align, _file, _line); -# endif // BX_ - } - - return NULL; - } - else if (NULL == _ptr) - { - if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) - { - return ::malloc(_size); - } - -# if BX_COMPILER_MSVC - BX_UNUSED(_file, _line); - return _aligned_malloc(_size, _align); -# else - return bx::alignedAlloc(this, _size, _align, _file, _line); -# endif // BX_ - } - - if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) - { - return ::realloc(_ptr, _size); - } - -# if BX_COMPILER_MSVC - BX_UNUSED(_file, _line); - return _aligned_realloc(_ptr, _size, _align); -# else - return bx::alignedRealloc(this, _ptr, _size, _align, _file, _line); -# endif // BX_ - } - }; -#endif // BX_CONFIG_ALLOCATOR_CRT - } // namespace bx #endif // BX_ALLOCATOR_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/config.h b/3rdparty/bx/include/bx/config.h index 6b8cfe45a7f..72a6dc3e4af 100644 --- a/3rdparty/bx/include/bx/config.h +++ b/3rdparty/bx/include/bx/config.h @@ -21,19 +21,7 @@ #endif // BX_CONFIG_SPSCQUEUE_USE_MUTEX #ifndef BX_CONFIG_CRT_FILE_READER_WRITER -# define BX_CONFIG_CRT_FILE_READER_WRITER (0 \ - || BX_PLATFORM_ANDROID \ - || BX_PLATFORM_BSD \ - || BX_PLATFORM_EMSCRIPTEN \ - || BX_PLATFORM_IOS \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_OSX \ - || BX_PLATFORM_QNX \ - || BX_PLATFORM_RPI \ - || BX_PLATFORM_STEAMLINK \ - || BX_PLATFORM_WINDOWS \ - || BX_PLATFORM_WINRT \ - ? 1 : 0) +# define BX_CONFIG_CRT_FILE_READER_WRITER !(BX_PLATFORM_NACL) #endif // BX_CONFIG_CRT_FILE_READER_WRITER #ifndef BX_CONFIG_SEMAPHORE_PTHREAD diff --git a/3rdparty/bx/include/bx/crtimpl.h b/3rdparty/bx/include/bx/crtimpl.h new file mode 100644 index 00000000000..70cee21d028 --- /dev/null +++ b/3rdparty/bx/include/bx/crtimpl.h @@ -0,0 +1,197 @@ +/* + * Copyright 2010-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause + */ + +#ifndef BX_CRTIMPL_H_HEADER_GUARD +#define BX_CRTIMPL_H_HEADER_GUARD + +#if BX_CONFIG_ALLOCATOR_CRT +# include <malloc.h> +# include "allocator.h" +#endif // BX_CONFIG_ALLOCATOR_CRT + +#if BX_CONFIG_CRT_FILE_READER_WRITER +# include "readerwriter.h" +#endif // BX_CONFIG_CRT_FILE_READER_WRITER + +namespace bx +{ +#if BX_CONFIG_ALLOCATOR_CRT + class CrtAllocator : public AllocatorI + { + public: + CrtAllocator() + { + } + + virtual ~CrtAllocator() + { + } + + virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE + { + if (0 == _size) + { + if (NULL != _ptr) + { + if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) + { + ::free(_ptr); + return NULL; + } + +# if BX_COMPILER_MSVC + BX_UNUSED(_file, _line); + _aligned_free(_ptr); +# else + bx::alignedFree(this, _ptr, _align, _file, _line); +# endif // BX_ + } + + return NULL; + } + else if (NULL == _ptr) + { + if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) + { + return ::malloc(_size); + } + +# if BX_COMPILER_MSVC + BX_UNUSED(_file, _line); + return _aligned_malloc(_size, _align); +# else + return bx::alignedAlloc(this, _size, _align, _file, _line); +# endif // BX_ + } + + if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align) + { + return ::realloc(_ptr, _size); + } + +# if BX_COMPILER_MSVC + BX_UNUSED(_file, _line); + return _aligned_realloc(_ptr, _size, _align); +# else + return bx::alignedRealloc(this, _ptr, _size, _align, _file, _line); +# endif // BX_ + } + }; +#endif // BX_CONFIG_ALLOCATOR_CRT + +#if BX_CONFIG_CRT_FILE_READER_WRITER + class CrtFileReader : public FileReaderI + { + public: + CrtFileReader() + : m_file(NULL) + { + } + + virtual ~CrtFileReader() + { + } + + virtual bool open(const char* _filePath, Error* _err) BX_OVERRIDE + { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + m_file = fopen(_filePath, "rb"); + if (NULL == m_file) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileReader: Failed to open file."); + return false; + } + + return true; + } + + virtual void close() BX_OVERRIDE + { + fclose(m_file); + } + + virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE + { + fseeko64(m_file, _offset, _whence); + return ftello64(m_file); + } + + virtual int32_t read(void* _data, int32_t _size, Error* _err) BX_OVERRIDE + { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + int32_t size = (int32_t)fread(_data, 1, _size, m_file); + if (size != _size) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "CrtFileReader: read failed."); + return size >= 0 ? size : 0; + } + + return size; + } + + private: + FILE* m_file; + }; + + class CrtFileWriter : public FileWriterI + { + public: + CrtFileWriter() + : m_file(NULL) + { + } + + virtual ~CrtFileWriter() + { + } + + virtual bool open(const char* _filePath, bool _append, Error* _err) BX_OVERRIDE + { + m_file = fopen(_filePath, _append ? "ab" : "wb"); + + if (NULL == m_file) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileWriter: Failed to open file."); + return false; + } + + return true; + } + + virtual void close() BX_OVERRIDE + { + fclose(m_file); + } + + virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE + { + fseeko64(m_file, _offset, _whence); + return ftello64(m_file); + } + + virtual int32_t write(const void* _data, int32_t _size, Error* _err) BX_OVERRIDE + { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + int32_t size = (int32_t)fwrite(_data, 1, _size, m_file); + if (size != _size) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "CrtFileWriter: write failed."); + return size >= 0 ? size : 0; + } + + return size; + } + + private: + FILE* m_file; + }; +#endif // BX_CONFIG_CRT_FILE_READER_WRITER + +} // namespace bx + +#endif // BX_CRTIMPL_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/fpumath.h b/3rdparty/bx/include/bx/fpumath.h index be125aa69eb..0dd274feb24 100644 --- a/3rdparty/bx/include/bx/fpumath.h +++ b/3rdparty/bx/include/bx/fpumath.h @@ -607,7 +607,7 @@ namespace bx inline void mtxLookAtLh(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up = NULL) { float tmp[4]; - vec3Sub(tmp, _eye, _at); + vec3Sub(tmp, _at, _eye); float view[4]; vec3Norm(view, tmp); @@ -618,7 +618,7 @@ namespace bx inline void mtxLookAtRh(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up = NULL) { float tmp[4]; - vec3Sub(tmp, _at, _eye); + vec3Sub(tmp, _eye, _at); float view[4]; vec3Norm(view, tmp); @@ -628,7 +628,7 @@ namespace bx inline void mtxLookAt(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up = NULL) { - mtxLookAtRh(_result, _eye, _at, _up); + mtxLookAtLh(_result, _eye, _at, _up); } inline void mtxProjRhXYWH(float* _result, float _x, float _y, float _width, float _height, float _near, float _far, bool _oglNdc = false) @@ -640,19 +640,21 @@ namespace bx memset(_result, 0, sizeof(float)*16); _result[ 0] = _width; _result[ 5] = _height; - _result[ 8] = _x; - _result[ 9] = -_y; - _result[10] = aa; - _result[11] = 1.0f; + _result[ 8] = _x; + _result[ 9] = _y; + _result[10] = -aa; + _result[11] = -1.0f; _result[14] = -bb; } inline void mtxProjRh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false) { - const float width = 2.0f / (_lt + _rt); - const float height = 2.0f / (_ut + _dt); - const float xx = (_lt - _rt) * width * 0.5f; - const float yy = (_ut - _dt) * height * 0.5f; + const float invDiffRl = 1.0f/(_rt - _lt); + const float invDiffUd = 1.0f/(_ut - _dt); + const float width = 2.0f*_near * invDiffRl; + const float height = 2.0f*_near * invDiffUd; + const float xx = (_rt + _lt) * invDiffRl; + const float yy = (_ut + _dt) * invDiffUd; mtxProjRhXYWH(_result, xx, yy, width, height, _near, _far, _oglNdc); } @@ -677,19 +679,21 @@ namespace bx memset(_result, 0, sizeof(float)*16); _result[ 0] = _width; _result[ 5] = _height; - _result[ 8] = _x; + _result[ 8] = -_x; _result[ 9] = -_y; - _result[10] = -aa; - _result[11] = -1.0f; + _result[10] = aa; + _result[11] = 1.0f; _result[14] = -bb; } inline void mtxProjLh(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false) { - const float width = 2.0f / (_lt + _rt); - const float height = 2.0f / (_ut + _dt); - const float xx = (_lt - _rt) * width * 0.5f; - const float yy = (_ut - _dt) * height * 0.5f; + const float invDiffRl = 1.0f/(_rt - _lt); + const float invDiffUd = 1.0f/(_ut - _dt); + const float width = 2.0f*_near * invDiffRl; + const float height = 2.0f*_near * invDiffUd; + const float xx = (_rt + _lt) * invDiffRl; + const float yy = (_ut + _dt) * invDiffUd; mtxProjLhXYWH(_result, xx, yy, width, height, _near, _far, _oglNdc); } @@ -707,20 +711,20 @@ namespace bx inline void mtxProj(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc = false) { - mtxProjRh(_result, _ut, _dt, _lt, _rt, _near, _far, _oglNdc); + mtxProjLh(_result, _ut, _dt, _lt, _rt, _near, _far, _oglNdc); } inline void mtxProj(float* _result, const float _fov[4], float _near, float _far, bool _oglNdc = false) { - mtxProjRh(_result, _fov, _near, _far, _oglNdc); + mtxProjLh(_result, _fov, _near, _far, _oglNdc); } inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc = false) { - mtxProjRh(_result, _fovy, _aspect, _near, _far, _oglNdc); + mtxProjLh(_result, _fovy, _aspect, _near, _far, _oglNdc); } - inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) + inline void mtxOrthoLh(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) { const float aa = 2.0f/(_right - _left); const float bb = 2.0f/(_top - _bottom); @@ -739,6 +743,30 @@ namespace bx _result[15] = 1.0f; } + inline void mtxOrthoRh(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) + { + const float aa = 2.0f/(_right - _left); + const float bb = 2.0f/(_top - _bottom); + const float cc = (_oglNdc ? 2.0f : 1.0f) / (_far - _near); + const float dd = (_left + _right)/(_left - _right); + const float ee = (_top + _bottom)/(_bottom - _top); + const float ff = _oglNdc ? (_near + _far)/(_near - _far) : _near/(_near - _far); + + memset(_result, 0, sizeof(float)*16); + _result[ 0] = aa; + _result[ 5] = bb; + _result[10] = -cc; + _result[12] = dd + _offset; + _result[13] = ee; + _result[14] = ff; + _result[15] = 1.0f; + } + + inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far, float _offset = 0.0f, bool _oglNdc = false) + { + return mtxOrthoLh(_result, _left, _right, _bottom, _top, _near, _far, _offset, _oglNdc); + } + inline void mtxRotateX(float* _result, float _ax) { const float sx = fsin(_ax); diff --git a/3rdparty/bx/include/bx/mutex.h b/3rdparty/bx/include/bx/mutex.h index a68525f14cd..b01be030bf4 100644 --- a/3rdparty/bx/include/bx/mutex.h +++ b/3rdparty/bx/include/bx/mutex.h @@ -21,7 +21,7 @@ namespace bx { -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT typedef CRITICAL_SECTION pthread_mutex_t; typedef unsigned pthread_mutexattr_t; @@ -70,7 +70,7 @@ namespace bx Mutex() { pthread_mutexattr_t attr; -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT #else pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); diff --git a/3rdparty/bx/include/bx/os.h b/3rdparty/bx/include/bx/os.h index 074ec0e513c..314ef0607cc 100644 --- a/3rdparty/bx/include/bx/os.h +++ b/3rdparty/bx/include/bx/os.h @@ -75,7 +75,7 @@ namespace bx { #if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 ::Sleep(_ms); -#elif BX_PLATFORM_WINRT +#elif BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT BX_UNUSED(_ms); debugOutput("sleep is not implemented"); debugBreak(); #else @@ -91,7 +91,7 @@ namespace bx ::SwitchToThread(); #elif BX_PLATFORM_XBOX360 ::Sleep(0); -#elif BX_PLATFORM_WINRT +#elif BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT debugOutput("yield is not implemented"); debugBreak(); #else ::sched_yield(); @@ -180,6 +180,7 @@ namespace bx #elif BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_NACL \ || BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_filePath); return NULL; @@ -195,6 +196,7 @@ namespace bx #elif BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_NACL \ || BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_handle); #else @@ -209,6 +211,7 @@ namespace bx #elif BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_NACL \ || BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_handle, _symbol); return NULL; @@ -222,6 +225,7 @@ namespace bx #if BX_PLATFORM_WINDOWS ::SetEnvironmentVariableA(_name, _value); #elif BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_name, _value); #else @@ -234,6 +238,7 @@ namespace bx #if BX_PLATFORM_WINDOWS ::SetEnvironmentVariableA(_name, NULL); #elif BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_name); #else @@ -244,6 +249,7 @@ namespace bx inline int chdir(const char* _path) { #if BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_path); return -1; @@ -257,6 +263,7 @@ namespace bx inline char* pwd(char* _buffer, uint32_t _size) { #if BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT BX_UNUSED(_buffer, _size); return NULL; diff --git a/3rdparty/bx/include/bx/platform.h b/3rdparty/bx/include/bx/platform.h index 3f245d5dff9..d07e031de34 100644 --- a/3rdparty/bx/include/bx/platform.h +++ b/3rdparty/bx/include/bx/platform.h @@ -123,7 +123,7 @@ #if defined(_XBOX_VER) # undef BX_PLATFORM_XBOX360 # define BX_PLATFORM_XBOX360 1 -#elif defined (_DURANGO) +#elif defined(_DURANGO) || defined(_XBOX_ONE) # undef BX_PLATFORM_XBOXONE # define BX_PLATFORM_XBOXONE 1 #elif defined(_WIN32) || defined(_WIN64) diff --git a/3rdparty/bx/include/bx/radixsort.h b/3rdparty/bx/include/bx/radixsort.h index 8118a0aa0bf..d14398cacc8 100644 --- a/3rdparty/bx/include/bx/radixsort.h +++ b/3rdparty/bx/include/bx/radixsort.h @@ -14,7 +14,7 @@ namespace bx #define BX_RADIXSORT_HISTOGRAM_SIZE (1<<BX_RADIXSORT_BITS) #define BX_RADIXSORT_BIT_MASK (BX_RADIXSORT_HISTOGRAM_SIZE-1) - inline void radixSort32(uint32_t* __restrict _keys, uint32_t* __restrict _tempKeys, uint32_t _size) + inline void radixSort(uint32_t* __restrict _keys, uint32_t* __restrict _tempKeys, uint32_t _size) { uint32_t* __restrict keys = _keys; uint32_t* __restrict tempKeys = _tempKeys; @@ -76,7 +76,7 @@ done: } template <typename Ty> - inline void radixSort32(uint32_t* __restrict _keys, uint32_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size) + inline void radixSort(uint32_t* __restrict _keys, uint32_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size) { uint32_t* __restrict keys = _keys; uint32_t* __restrict tempKeys = _tempKeys; @@ -148,7 +148,7 @@ done: } } - inline void radixSort64(uint64_t* __restrict _keys, uint64_t* __restrict _tempKeys, uint32_t _size) + inline void radixSort(uint64_t* __restrict _keys, uint64_t* __restrict _tempKeys, uint32_t _size) { uint64_t* __restrict keys = _keys; uint64_t* __restrict tempKeys = _tempKeys; @@ -210,7 +210,7 @@ done: } template <typename Ty> - inline void radixSort64(uint64_t* __restrict _keys, uint64_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size) + inline void radixSort(uint64_t* __restrict _keys, uint64_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size) { uint64_t* __restrict keys = _keys; uint64_t* __restrict tempKeys = _tempKeys; diff --git a/3rdparty/bx/include/bx/readerwriter.h b/3rdparty/bx/include/bx/readerwriter.h index ef8c810a870..13fe205399e 100644 --- a/3rdparty/bx/include/bx/readerwriter.h +++ b/3rdparty/bx/include/bx/readerwriter.h @@ -6,6 +6,7 @@ #ifndef BX_READERWRITER_H_HEADER_GUARD #define BX_READERWRITER_H_HEADER_GUARD +#include <alloca.h> #include <stdarg.h> // va_list #include <stdio.h> #include <string.h> @@ -359,8 +360,8 @@ namespace bx m_top += morecore; } - int64_t reminder = m_top-m_pos; - int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) ); + int64_t remainder = m_top-m_pos; + int32_t size = uint32_min(_size, int32_t(remainder > INT32_MAX ? INT32_MAX : remainder) ); m_pos += size; if (size != _size) { @@ -412,8 +413,8 @@ namespace bx { BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); - int64_t reminder = m_top-m_pos; - int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) ); + int64_t remainder = m_top-m_pos; + int32_t size = uint32_min(_size, int32_t(remainder > INT32_MAX ? INT32_MAX : remainder) ); memcpy(_data, &m_data[m_pos], size); m_pos += size; if (size != _size) @@ -493,8 +494,8 @@ namespace bx m_size = m_memBlock->getSize(); } - int64_t reminder = m_size-m_pos; - int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) ); + int64_t remainder = m_size-m_pos; + int32_t size = uint32_min(_size, int32_t(remainder > INT32_MAX ? INT32_MAX : remainder) ); memcpy(&m_data[m_pos], _data, size); m_pos += size; m_top = int64_max(m_top, m_pos); @@ -530,117 +531,6 @@ namespace bx StaticMemoryBlock m_smb; }; -#if BX_CONFIG_CRT_FILE_READER_WRITER - class CrtFileReader : public FileReaderI - { - public: - CrtFileReader() - : m_file(NULL) - { - } - - virtual ~CrtFileReader() - { - } - - virtual bool open(const char* _filePath, Error* _err) BX_OVERRIDE - { - BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); - - m_file = fopen(_filePath, "rb"); - if (NULL == m_file) - { - BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileReader: Failed to open file."); - return false; - } - - return true; - } - - virtual void close() BX_OVERRIDE - { - fclose(m_file); - } - - virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE - { - fseeko64(m_file, _offset, _whence); - return ftello64(m_file); - } - - virtual int32_t read(void* _data, int32_t _size, Error* _err) BX_OVERRIDE - { - BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); - - int32_t size = (int32_t)fread(_data, 1, _size, m_file); - if (size != _size) - { - BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "CrtFileReader: read failed."); - return size >= 0 ? size : 0; - } - - return size; - } - - private: - FILE* m_file; - }; - - class CrtFileWriter : public FileWriterI - { - public: - CrtFileWriter() - : m_file(NULL) - { - } - - virtual ~CrtFileWriter() - { - } - - virtual bool open(const char* _filePath, bool _append, Error* _err) BX_OVERRIDE - { - m_file = fopen(_filePath, _append ? "ab" : "wb"); - - if (NULL == m_file) - { - BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "CrtFileWriter: Failed to open file."); - return false; - } - - return true; - } - - virtual void close() BX_OVERRIDE - { - fclose(m_file); - } - - virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE - { - fseeko64(m_file, _offset, _whence); - return ftello64(m_file); - } - - virtual int32_t write(const void* _data, int32_t _size, Error* _err) BX_OVERRIDE - { - BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); - - int32_t size = (int32_t)fwrite(_data, 1, _size, m_file); - if (size != _size) - { - BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "CrtFileWriter: write failed."); - return size >= 0 ? size : 0; - } - - return size; - } - - private: - FILE* m_file; - }; -#endif // BX_CONFIG_CRT_FILE_READER_WRITER - } // namespace bx #endif // BX_READERWRITER_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/sem.h b/3rdparty/bx/include/bx/sem.h index 85c66168d58..37141c53614 100644 --- a/3rdparty/bx/include/bx/sem.h +++ b/3rdparty/bx/include/bx/sem.h @@ -16,7 +16,9 @@ # include <semaphore.h> # include <time.h> # include <pthread.h> -#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#elif BX_PLATFORM_XBOXONE +# include <synchapi.h> +#elif BX_PLATFORM_XBOX360 || BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT # include <windows.h> # include <limits.h> #endif // BX_PLATFORM_ @@ -211,7 +213,7 @@ namespace bx }; # endif // BX_CONFIG_SEMAPHORE_PTHREAD -#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#elif BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT class Semaphore { @@ -223,10 +225,10 @@ namespace bx public: Semaphore() { -#if BX_PLATFORM_WINRT - m_handle = CreateSemaphoreEx(NULL, 0, LONG_MAX, NULL, 0, SEMAPHORE_ALL_ACCESS); +#if BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT + m_handle = CreateSemaphoreExW(NULL, 0, LONG_MAX, NULL, 0, SEMAPHORE_ALL_ACCESS); #else - m_handle = CreateSemaphore(NULL, 0, LONG_MAX, NULL); + m_handle = CreateSemaphoreA(NULL, 0, LONG_MAX, NULL); #endif BX_CHECK(NULL != m_handle, "Failed to create Semaphore!"); } @@ -244,7 +246,7 @@ namespace bx bool wait(int32_t _msecs = -1) const { DWORD milliseconds = (0 > _msecs) ? INFINITE : _msecs; -#if BX_PLATFORM_WINRT +#if BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT return WAIT_OBJECT_0 == WaitForSingleObjectEx(m_handle, milliseconds, FALSE); #else return WAIT_OBJECT_0 == WaitForSingleObject(m_handle, milliseconds); diff --git a/3rdparty/bx/include/bx/thread.h b/3rdparty/bx/include/bx/thread.h index 015bd57eff8..5e3a920c1ce 100644 --- a/3rdparty/bx/include/bx/thread.h +++ b/3rdparty/bx/include/bx/thread.h @@ -34,7 +34,7 @@ namespace bx public: Thread() -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT : m_handle(INVALID_HANDLE_VALUE) , m_threadId(UINT32_MAX) #elif BX_PLATFORM_POSIX @@ -224,7 +224,7 @@ namespace bx } #endif // BX_PLATFORM_ -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT HANDLE m_handle; DWORD m_threadId; #elif BX_PLATFORM_POSIX @@ -269,7 +269,7 @@ namespace bx uint32_t m_id; }; -#elif !BX_PLATFORM_WINRT +#elif !(BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT) class TlsData { diff --git a/3rdparty/bx/include/bx/timer.h b/3rdparty/bx/include/bx/timer.h index c3d16d29793..462d9757a60 100644 --- a/3rdparty/bx/include/bx/timer.h +++ b/3rdparty/bx/include/bx/timer.h @@ -12,7 +12,7 @@ # include <time.h> // clock, clock_gettime #elif BX_PLATFORM_EMSCRIPTEN # include <emscripten.h> -#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT +#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT # include <windows.h> #else # include <sys/time.h> // gettimeofday @@ -22,7 +22,7 @@ namespace bx { inline int64_t getHPCounter() { -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT LARGE_INTEGER li; // Performance counter value may unexpectedly leap forward // http://support.microsoft.com/kb/274323 @@ -44,7 +44,7 @@ namespace bx inline int64_t getHPFrequency() { -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT LARGE_INTEGER li; QueryPerformanceFrequency(&li); return li.QuadPart; diff --git a/3rdparty/bx/include/bx/uint32_t.h b/3rdparty/bx/include/bx/uint32_t.h index 411ac28ee6b..50f8e097a22 100644 --- a/3rdparty/bx/include/bx/uint32_t.h +++ b/3rdparty/bx/include/bx/uint32_t.h @@ -29,7 +29,7 @@ #include "bx.h" #if BX_COMPILER_MSVC -# if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT +# if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT # include <math.h> // math.h is included because VS bitches: // warning C4985: 'ceil': attributes not present on previous declaration. // must be included before intrin.h. diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua index fc674de9570..0cabfae5a9d 100644 --- a/3rdparty/bx/scripts/toolchain.lua +++ b/3rdparty/bx/scripts/toolchain.lua @@ -18,14 +18,14 @@ function toolchain(_buildDir, _libDir) { "android-x86", "Android - x86" }, { "asmjs", "Emscripten/asm.js" }, { "freebsd", "FreeBSD" }, + { "ios-arm", "iOS - ARM" }, + { "ios-simulator", "iOS - Simulator" }, { "linux-gcc", "Linux (GCC compiler)" }, { "linux-gcc-5", "Linux (GCC-5 compiler)" }, { "linux-clang", "Linux (Clang compiler)" }, { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" }, { "linux-arm-gcc", "Linux (ARM, GCC compiler)" }, { "linux-steamlink", "Steam Link" }, - { "ios-arm", "iOS - ARM" }, - { "ios-simulator", "iOS - Simulator" }, { "tvos-arm64", "tvOS - ARM64" }, { "tvos-simulator", "tvOS - Simulator" }, { "mingw-gcc", "MinGW" }, @@ -54,6 +54,7 @@ function toolchain(_buildDir, _libDir) { "winphone81", "Windows Phone 8.1" }, { "winstore81", "Windows Store 8.1" }, { "winstore82", "Universal Windows App" }, + { "durango", "Durango" }, }, } @@ -363,18 +364,28 @@ function toolchain(_buildDir, _libDir) platforms { "ARM" } location (path.join(_buildDir, "projects", _ACTION .. "-winstore82")) + elseif "durango" == _OPTIONS["vs"] then + if not os.getenv("DurangoXDK") then + print("DurangoXDK not found.") + end + + premake.vstudio.toolset = "v140" + premake.vstudio.storeapp = "durango" + platforms { "Durango" } + location (path.join(_buildDir, "projects", _ACTION .. "-durango")) + end + elseif ("vs2012-xp") == _OPTIONS["vs"] then premake.vstudio.toolset = ("v110_xp") location (path.join(_buildDir, "projects", _ACTION .. "-xp")) - elseif ("vs2013-xp") == _OPTIONS["vs"] then + elseif "vs2013-xp" == _OPTIONS["vs"] then premake.vstudio.toolset = ("v120_xp") location (path.join(_buildDir, "projects", _ACTION .. "-xp")) - elseif ("vs2015-xp") == _OPTIONS["vs"] then + elseif "vs2015-xp" == _OPTIONS["vs"] then premake.vstudio.toolset = ("v140_xp") location (path.join(_buildDir, "projects", _ACTION .. "-xp")) - end elseif _ACTION == "xcode4" then @@ -664,6 +675,7 @@ function toolchain(_buildDir, _libDir) } configuration { "android-*" } + targetprefix ("lib") flags { "NoImportLib", } @@ -800,7 +812,7 @@ function toolchain(_buildDir, _libDir) linkoptions { "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"), path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"), - path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "/arch-x86/usr/lib/crtend_so.o"), + path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtend_so.o"), } configuration { "asmjs" } @@ -899,14 +911,23 @@ function toolchain(_buildDir, _libDir) configuration { "pnacl", "Release" } libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" } - configuration { "Xbox360" } + configuration { "xbox360" } targetdir (path.join(_buildDir, "xbox360/bin")) objdir (path.join(_buildDir, "xbox360/obj")) includedirs { path.join(bxDir, "include/compat/msvc") } libdirs { path.join(_libDir, "lib/xbox360") } defines { "NOMINMAX", - "_XBOX", + } + + configuration { "durango" } + targetdir (path.join(_buildDir, "durango/bin")) + objdir (path.join(_buildDir, "durango/obj")) + includedirs { path.join(bxDir, "include/compat/msvc") } + libdirs { path.join(_libDir, "lib/durango") } + removeflags { "StaticRuntime" } + defines { + "NOMINMAX", } configuration { "osx", "x32" } diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie Binary files differindex a7c61b7300e..9113b07986b 100644 --- a/3rdparty/bx/tools/bin/darwin/genie +++ b/3rdparty/bx/tools/bin/darwin/genie diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie Binary files differindex 223ef23852e..c7be887f7d6 100644 --- a/3rdparty/bx/tools/bin/linux/genie +++ b/3rdparty/bx/tools/bin/linux/genie diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe Binary files differindex 59575ce272e..fb46691d96f 100644 --- a/3rdparty/bx/tools/bin/windows/genie.exe +++ b/3rdparty/bx/tools/bin/windows/genie.exe diff --git a/3rdparty/bx/tools/bin2c/bin2c.cpp b/3rdparty/bx/tools/bin2c/bin2c.cpp index bdb92a4c04f..8aa1b9f9142 100644 --- a/3rdparty/bx/tools/bin2c/bin2c.cpp +++ b/3rdparty/bx/tools/bin2c/bin2c.cpp @@ -7,7 +7,7 @@ #include <vector> #include <bx/commandline.h> -#include <bx/readerwriter.h> +#include <bx/crtimpl.h> #include <bx/string.h> class Bin2cWriter : public bx::WriterI |