diff options
955 files changed, 9801 insertions, 7797 deletions
diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/Changelog.md b/3rdparty/bgfx/3rdparty/glsl-optimizer/Changelog.md index 92206386f12..95d4149f340 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/Changelog.md +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/Changelog.md @@ -1,6 +1,13 @@ GLSL optimizer Change Log ========================= +2016 09 +------- + +* Metal: Fixed constant precision propagation in some cases. +* Metal: Fixed shadowmap sampling when reference Z value is outside of 0..1 range (now clamps to match GLES specs). + + 2016 06 ------- diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp index 1d0fcb37203..d31c53465fc 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/ast_to_hir.cpp @@ -3046,6 +3046,11 @@ process_initializer(ir_variable *var, ast_declaration *decl, if (type->qualifier.flags.q.constant) { ir_constant *constant_value = rhs->constant_expression_value(); constant_value->set_precision((glsl_precision)type->qualifier.precision); + if (constant_value->type->is_array()) { + for (unsigned i = 0; i < constant_value->type->length; i++) { + constant_value->get_array_element(i)->set_precision((glsl_precision)type->qualifier.precision); + } + } } /* Calculate the constant value if this is a const or uniform 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 c7919a4c568..b56d04b4383 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 @@ -677,6 +677,20 @@ void ir_print_metal_visitor::visit(ir_variable *ir) buffer.asprintf_append (" = "); visit (ir->constant_value); } + + if ((ir->data.mode == ir_var_auto || ir->data.mode == ir_var_temporary) && (ir->type->matrix_columns == 1)) { + switch (ir->type->base_type) { + case GLSL_TYPE_INT: + case GLSL_TYPE_FLOAT: + buffer.asprintf_append (" = 0"); + break; + case GLSL_TYPE_BOOL: + buffer.asprintf_append (" = false"); + break; + default: + break; + } + } } @@ -1110,9 +1124,10 @@ void ir_print_metal_visitor::visit(ir_expression *ir) else if (op0cast) { print_cast (buffer, arg_prec, ir->operands[0]); + buffer.asprintf_append ("("); } ir->operands[0]->accept(this); - if (op0castTo1) + if (op0castTo1 || op0cast) { buffer.asprintf_append (")"); } @@ -1131,9 +1146,10 @@ void ir_print_metal_visitor::visit(ir_expression *ir) else if (op1cast) { print_cast (buffer, arg_prec, ir->operands[1]); + buffer.asprintf_append ("("); } ir->operands[1]->accept(this); - if (op1castTo0) + if (op1castTo0 || op1cast) { buffer.asprintf_append (")"); } @@ -1214,14 +1230,17 @@ static void print_texture_uv (ir_print_metal_visitor* vis, ir_texture* ir, bool } else if (is_shadow) { + // Note that on metal sample_compare works differently than shadow2DEXT on GLES: + // it does not clamp neither the pixel value nor compare value to the [0.0, 1.0] range. To + // preserve same behavior we're clamping the argument explicitly. if (!is_proj) { // regular shadow vis->buffer.asprintf_append (uv_dim == 4 ? "(float3)(" : "(float2)("); ir->coordinate->accept(vis); - vis->buffer.asprintf_append (uv_dim == 4 ? ").xyz, (" : ").xy, (float)("); + vis->buffer.asprintf_append (uv_dim == 4 ? ").xyz, (" : ").xy, saturate((float)("); ir->coordinate->accept(vis); - vis->buffer.asprintf_append (uv_dim == 4 ? ").w" : ").z"); + vis->buffer.asprintf_append (uv_dim == 4 ? ").w" : ").z)"); } else { @@ -1230,11 +1249,11 @@ static void print_texture_uv (ir_print_metal_visitor* vis, ir_texture* ir, bool ir->coordinate->accept(vis); vis->buffer.asprintf_append (").xy / (float)("); ir->coordinate->accept(vis); - vis->buffer.asprintf_append (").w, (float)("); + vis->buffer.asprintf_append (").w, saturate((float)("); ir->coordinate->accept(vis); vis->buffer.asprintf_append (").z / (float)("); ir->coordinate->accept(vis); - vis->buffer.asprintf_append (").w"); + vis->buffer.asprintf_append (").w)"); } } } @@ -1258,7 +1277,7 @@ void ir_print_metal_visitor::visit(ir_texture *ir) // For shadow sampling, Metal right now needs a hardcoded sampler state :| if (!ctx.shadowSamplerDone) { - ctx.prefixStr.asprintf_append("constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less);\n"); + ctx.prefixStr.asprintf_append("constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less_equal);\n"); ctx.shadowSamplerDone = true; } buffer.asprintf_append (".sample_compare(_mtl_xl_shadow_sampler"); 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 3021d1f2eb8..6c3681aebe9 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 @@ -11,7 +11,7 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; + half4 c_1 = 0; c_1.zw = half2(float2(0.0, 0.0)); c_1.xy = half2(float2(-0.3441301, 0.05004501)); _mtl_o._fragData = c_1; 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 3021d1f2eb8..6c3681aebe9 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 @@ -11,7 +11,7 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; + half4 c_1 = 0; c_1.zw = half2(float2(0.0, 0.0)); c_1.xy = half2(float2(-0.3441301, 0.05004501)); _mtl_o._fragData = c_1; 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 4bd58f3258f..d2dd3471a20 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ast-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ast-outES3Metal.txt @@ -12,7 +12,7 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - float a_2; + float a_2 = 0; if ((_mtl_i.gl_FragCoord.x == 1.0)) { discard_fragment(); }; 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 c794c125922..cdaf06ad014 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 @@ -18,57 +18,57 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 t_1; - half4 tmpvar_2; + half4 t_1 = 0; + half4 tmpvar_2 = 0; tmpvar_2 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); t_1 = tmpvar_2; - if ((_mtl_u._NumPasses > (half)0.0)) { - half passes_3; + if ((_mtl_u._NumPasses > (half)(0.0))) { + half passes_3 = 0; passes_3 = _mtl_u._NumPasses; - float i_4; - half3 res_5; + float i_4 = 0; + half3 res_5 = 0; res_5 = tmpvar_2.xyz; i_4 = 0.0; while (true) { if ((i_4 >= 4.0)) { break; }; - if ((i_4 == (float)passes_3)) { + if ((i_4 == (float)(passes_3))) { break; }; if ((i_4 == 0.0)) { - half3 tmpvar_6; - half val_7; - val_7 = ((_mtl_u._ContrastShift.x * (half)3.0) + (half)12.0); - half tmpvar_8; - tmpvar_8 = pow ((cos(val_7) + (half)1.0), val_7); - tmpvar_6 = ((res_5 - (half)0.5) * tmpvar_8); + half3 tmpvar_6 = 0; + half val_7 = 0; + val_7 = ((_mtl_u._ContrastShift.x * (half)(3.0)) + (half)(12.0)); + half tmpvar_8 = 0; + tmpvar_8 = pow ((cos(val_7) + (half)(1.0)), val_7); + tmpvar_6 = ((res_5 - (half)(0.5)) * tmpvar_8); res_5 = tmpvar_6; } else { if ((i_4 == 1.0)) { - half3 tmpvar_9; - half val_10; - val_10 = ((_mtl_u._SaturationShift.y * (half)3.0) + (half)12.0); - half tmpvar_11; - tmpvar_11 = pow ((cos(val_10) + (half)1.0), val_10); - tmpvar_9 = ((res_5 - (half)0.5) * tmpvar_11); + half3 tmpvar_9 = 0; + half val_10 = 0; + val_10 = ((_mtl_u._SaturationShift.y * (half)(3.0)) + (half)(12.0)); + half tmpvar_11 = 0; + tmpvar_11 = pow ((cos(val_10) + (half)(1.0)), val_10); + tmpvar_9 = ((res_5 - (half)(0.5)) * tmpvar_11); res_5 = tmpvar_9; } else { if ((i_4 == 2.0)) { - half3 tmpvar_12; - half val_13; - val_13 = ((_mtl_u._HueShift.z * (half)3.0) + (half)12.0); - half tmpvar_14; - tmpvar_14 = pow ((cos(val_13) + (half)1.0), val_13); - tmpvar_12 = ((res_5 - (half)0.5) * tmpvar_14); + half3 tmpvar_12 = 0; + half val_13 = 0; + val_13 = ((_mtl_u._HueShift.z * (half)(3.0)) + (half)(12.0)); + half tmpvar_14 = 0; + tmpvar_14 = pow ((cos(val_13) + (half)(1.0)), val_13); + tmpvar_12 = ((res_5 - (half)(0.5)) * tmpvar_14); res_5 = tmpvar_12; } else { - half3 tmpvar_15; - half val_16; - val_16 = ((_mtl_u._LuminosityShift.x * (half)3.0) + (half)12.0); - half tmpvar_17; - tmpvar_17 = pow ((cos(val_16) + (half)1.0), val_16); - tmpvar_15 = ((res_5 - (half)0.5) * tmpvar_17); + half3 tmpvar_15 = 0; + half val_16 = 0; + val_16 = ((_mtl_u._LuminosityShift.x * (half)(3.0)) + (half)(12.0)); + half tmpvar_17 = 0; + tmpvar_17 = pow ((cos(val_16) + (half)(1.0)), val_16); + tmpvar_15 = ((res_5 - (half)(0.5)) * tmpvar_17); res_5 = tmpvar_15; }; }; @@ -77,7 +77,7 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] }; t_1.xyz = res_5; }; - half4 tmpvar_18; + half4 tmpvar_18 = 0; tmpvar_18.w = half(1.0); tmpvar_18.xyz = t_1.xyz; _mtl_o._fragData = tmpvar_18; 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 424ef01645f..015ffb28841 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 @@ -13,7 +13,7 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<float> _CameraDepthTexture [[texture(0)]], sampler _mtlsmp__CameraDepthTexture [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - float4 tmpvar_1; + float4 tmpvar_1 = 0; tmpvar_1 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(_mtl_i.varUV), level(0.0)).xxxx; _mtl_o._fragData = half4(tmpvar_1); return _mtl_o; 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 f6753627729..f42f92e6768 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 @@ -23,48 +23,48 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _NoiseTex [[texture(4)]], sampler _mtlsmp__NoiseTex [[sampler(4)]]) { xlatMtlShaderOutput _mtl_o; - float2 tmpvar_1; + float2 tmpvar_1 = 0; tmpvar_1 = _mtl_i.xlv_TEXCOORD0; - float4 jitteredDir_3; - float4 sum_4; - float weight_5; - float zx_6; - float2 vx_7; - float2 x_8; - float2 xf_9; + float4 jitteredDir_3 = 0; + float4 sum_4 = 0; + float weight_5 = 0; + float zx_6 = 0; + float2 vx_7 = 0; + float2 x_8 = 0; + float2 xf_9 = 0; xf_9 = _mtl_i.xlv_TEXCOORD0; x_8 = _mtl_i.xlv_TEXCOORD0; if ((_mtl_u._MainTex_TexelSize.y < 0.0)) { xf_9.y = (1.0 - _mtl_i.xlv_TEXCOORD0.y); }; - half4 tmpvar_10; + half4 tmpvar_10 = 0; tmpvar_10 = _NeighbourMaxTex.sample(_mtlsmp__NeighbourMaxTex, (float2)(xf_9), level(0.0)); - float2 tmpvar_11; + float2 tmpvar_11 = 0; tmpvar_11 = float2(tmpvar_10.xy); - half4 tmpvar_12; + half4 tmpvar_12 = 0; tmpvar_12 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0), level(0.0)); - float4 tmpvar_13; + float4 tmpvar_13 = 0; tmpvar_13 = float4(tmpvar_12); - half4 tmpvar_14; + half4 tmpvar_14 = 0; tmpvar_14 = _VelTex.sample(_mtlsmp__VelTex, (float2)(xf_9), level(0.0)); - float2 tmpvar_15; + float2 tmpvar_15 = 0; tmpvar_15 = float2(tmpvar_14.xy); vx_7 = tmpvar_15; - float4 tmpvar_16; + float4 tmpvar_16 = 0; tmpvar_16.zw = float2(0.0, 0.0); tmpvar_16.xy = _mtl_i.xlv_TEXCOORD0; - float4 coord_17; + float4 coord_17 = 0; coord_17 = (tmpvar_16 * 11.0); - half4 tmpvar_18; + half4 tmpvar_18 = 0; tmpvar_18 = _NoiseTex.sample(_mtlsmp__NoiseTex, (float2)(coord_17.xy), level(coord_17.w)); - float4 tmpvar_19; - tmpvar_19 = float4(((tmpvar_18 * (half)2.0) - (half)1.0)); + float4 tmpvar_19 = 0; + tmpvar_19 = float4(((tmpvar_18 * (half)(2.0)) - (half)(1.0))); zx_6 = -((1.0/(( (_mtl_u._ZBufferParams.x * _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(_mtl_i.xlv_TEXCOORD0), level(0.0)).x) + _mtl_u._ZBufferParams.y)))); weight_5 = 1.0; sum_4 = tmpvar_13; - float4 tmpvar_20; + float4 tmpvar_20 = 0; tmpvar_20 = (tmpvar_11.xyxy + (tmpvar_19 * (_mtl_u._MainTex_TexelSize.xyxy * _mtl_u._Jitter)).xyyz); jitteredDir_3 = ((max ( abs(tmpvar_20.xyxy) @@ -72,50 +72,50 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] ((_mtl_u._MainTex_TexelSize.xyxy * _mtl_u._MaxVelocity) * 0.15) ) * sign(tmpvar_20.xyxy)) * float4(1.0, 1.0, -1.0, -1.0)); for (int l_2 = 0; l_2 < 12; l_2++) { - float zy_21; - float4 yf_22; - float4 tmpvar_23; + float zy_21 = 0; + float4 yf_22 = 0; + float4 tmpvar_23 = 0; tmpvar_23 = (tmpvar_1.xyxy + ((jitteredDir_3.xyxy * _xlat_mtl_const1[l_2].xyxy) * float4(1.0, 1.0, -1.0, -1.0))); yf_22 = tmpvar_23; if ((_mtl_u._MainTex_TexelSize.y < 0.0)) { yf_22.yw = (1.0 - tmpvar_23.yw); }; - half4 tmpvar_24; + half4 tmpvar_24 = 0; tmpvar_24 = _VelTex.sample(_mtlsmp__VelTex, (float2)(yf_22.xy), level(0.0)); - float2 tmpvar_25; + float2 tmpvar_25 = 0; tmpvar_25 = float2(tmpvar_24.xy); zy_21 = -((1.0/(( (_mtl_u._ZBufferParams.x * _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(tmpvar_23.xy), level(0.0)).x) + _mtl_u._ZBufferParams.y)))); - float2 x_26; + float2 x_26 = 0; x_26 = (x_8 - tmpvar_23.xy); - float2 x_27; + float2 x_27 = 0; x_27 = (tmpvar_23.xy - x_8); - float tmpvar_28; + float tmpvar_28 = 0; tmpvar_28 = sqrt(dot (tmpvar_25, tmpvar_25)); - float2 x_29; + float2 x_29 = 0; x_29 = (tmpvar_23.xy - x_8); - float edge0_30; + float edge0_30 = 0; edge0_30 = (0.95 * tmpvar_28); - float tmpvar_31; + float tmpvar_31 = 0; tmpvar_31 = clamp ((( sqrt(dot (x_29, x_29)) - edge0_30) / ( (1.05 * tmpvar_28) - edge0_30)), 0.0, 1.0); - float tmpvar_32; + float tmpvar_32 = 0; tmpvar_32 = sqrt(dot (vx_7, vx_7)); - float2 x_33; + float2 x_33 = 0; x_33 = (x_8 - tmpvar_23.xy); - float edge0_34; + float edge0_34 = 0; edge0_34 = (0.95 * tmpvar_32); - float tmpvar_35; + float tmpvar_35 = 0; tmpvar_35 = clamp ((( sqrt(dot (x_33, x_33)) - edge0_34) / ( (1.05 * tmpvar_32) - edge0_34)), 0.0, 1.0); - float tmpvar_36; + float tmpvar_36 = 0; tmpvar_36 = ((( clamp ((1.0 - ((zy_21 - zx_6) / _mtl_u._SoftZDistance)), 0.0, 1.0) * @@ -141,14 +141,14 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] (2.0 * tmpvar_35) )))) ) * 2.0)); - half4 tmpvar_37; + half4 tmpvar_37 = 0; tmpvar_37 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_23.xy), level(0.0)); - float4 tmpvar_38; + float4 tmpvar_38 = 0; tmpvar_38 = float4(tmpvar_37); sum_4 = (sum_4 + (tmpvar_38 * tmpvar_36)); weight_5 = (weight_5 + tmpvar_36); }; - float4 tmpvar_39; + float4 tmpvar_39 = 0; tmpvar_39 = (sum_4 / weight_5); _mtl_o._fragData = half4(tmpvar_39); return _mtl_o; 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 82058c2372d..bd2b7469c21 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 @@ -15,16 +15,16 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; - c_1 = half4(((float4)_mtl_i.uv + _mtl_i.gl_FragCoord)); - float tmpvar_2; + half4 c_1 = 0; + c_1 = half4(((float4)(_mtl_i.uv) + _mtl_i.gl_FragCoord)); + float tmpvar_2 = 0; if (_mtl_i.gl_FrontFacing) { tmpvar_2 = 1.0; } else { tmpvar_2 = 0.0; }; - c_1.x = (c_1.x + (half)tmpvar_2); - c_1.xy = half2(((float2)c_1.xy + _mtl_i.gl_PointCoord)); + c_1.x = (c_1.x + (half)(tmpvar_2)); + c_1.xy = half2(((float2)(c_1.xy) + _mtl_i.gl_PointCoord)); _mtl_o._fragData = c_1; return _mtl_o; } diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-inES3.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-inES3.txt index a1eb058d651..0063401d18c 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-inES3.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-inES3.txt @@ -24,6 +24,7 @@ mediump vec4 frag( in v2f i ) { h += ha[j]; f += fa[j]; f += (p * ha[0]); + f += (ha[1] * p); } return vec4( h.xy, f.xy); } diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-outES3.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-outES3.txt index 6676a2e8857..813962a5b3f 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-outES3.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-outES3.txt @@ -19,6 +19,7 @@ void main () h_6 = (h_6 + vec3[3](vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0), vec3(7.0, 8.0, 9.0))[j_3]); f_5 = (f_5 + vec3[3](vec3(11.0, 12.0, 13.0), vec3(14.0, 15.0, 16.0), vec3(17.0, 18.0, 19.0))[j_3]); f_5 = (f_5 + (p_4 * vec3(1.0, 2.0, 3.0))); + f_5 = (f_5 + (vec3(4.0, 5.0, 6.0) * p_4)); }; highp vec4 tmpvar_8; tmpvar_8.xy = h_6.xy; @@ -28,6 +29,6 @@ void main () } -// stats: 12 alu 0 tex 2 flow +// stats: 14 alu 0 tex 2 flow // inputs: 1 // #0: xlv_TEXCOORD0 (medium float) 2x1 [-1] diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-outES3Metal.txt index 78a6ad1bf92..29c302b6378 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/const-precision-outES3Metal.txt @@ -1,7 +1,7 @@ #include <metal_stdlib> #pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; -constant half3 _xlat_mtl_const1[3] = {float3(1.0, 2.0, 3.0), float3(4.0, 5.0, 6.0), float3(7.0, 8.0, 9.0)}; +constant half3 _xlat_mtl_const1[3] = {half3(1.0, 2.0, 3.0), half3(4.0, 5.0, 6.0), half3(7.0, 8.0, 9.0)}; constant float3 _xlat_mtl_const2[3] = {float3(11.0, 12.0, 13.0), float3(14.0, 15.0, 16.0), float3(17.0, 18.0, 19.0)}; struct xlatMtlShaderInput { half2 xlv_TEXCOORD0; @@ -14,24 +14,25 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 tmpvar_1; - half2 tmpvar_2; + half4 tmpvar_1 = 0; + half2 tmpvar_2 = 0; tmpvar_2 = _mtl_i.xlv_TEXCOORD0; - float3 p_4; - float3 f_5; - half3 h_6; + float3 p_4 = 0; + float3 f_5 = 0; + half3 h_6 = 0; h_6 = half3(float3(0.0, 0.0, 0.0)); f_5 = float3(0.0, 0.0, 0.0); - half3 tmpvar_7; + half3 tmpvar_7 = 0; tmpvar_7.z = half(1.0); tmpvar_7.xy = _mtl_i.xlv_TEXCOORD0; p_4 = float3(tmpvar_7); - for (int j_3 = 0; j_3 < short((tmpvar_2.x * (half)3.0)); j_3++) { + for (int j_3 = 0; j_3 < short((tmpvar_2.x * (half)(3.0))); j_3++) { h_6 = (h_6 + _xlat_mtl_const1[j_3]); f_5 = (f_5 + _xlat_mtl_const2[j_3]); - f_5 = (f_5 + (p_4 * float3(1.0, 2.0, 3.0))); + f_5 = (f_5 + (p_4 * (float3)(half3(1.0, 2.0, 3.0)))); + f_5 = (f_5 + ((float3)(half3(4.0, 5.0, 6.0)) * p_4)); }; - float4 tmpvar_8; + float4 tmpvar_8 = 0; tmpvar_8.xy = float2(h_6.xy); tmpvar_8.zw = f_5.xy; tmpvar_1 = half4(tmpvar_8); @@ -40,6 +41,6 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] } -// stats: 12 alu 0 tex 2 flow +// stats: 14 alu 0 tex 2 flow // inputs: 1 // #0: xlv_TEXCOORD0 (medium float) 2x1 [-1] 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 c2470caf352..5108de97f2a 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 @@ -13,12 +13,12 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 xlt_ocol_1; + half4 xlt_ocol_1 = 0; xlt_ocol_1 = _mtl_i._glesFragData_0; - half4 ocol_2; + half4 ocol_2 = 0; ocol_2.w = xlt_ocol_1.w; ocol_2.xy = _mtl_i.xlv_TEXCOORD0.xy; - ocol_2.z = (xlt_ocol_1.z * (half)2.0); + ocol_2.z = (xlt_ocol_1.z * (half)(2.0)); xlt_ocol_1 = ocol_2; _mtl_o._glesFragData_0 = ocol_2; return _mtl_o; diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/global-struct-constant-init-metal-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/global-struct-constant-init-metal-outES3Metal.txt index ca71d1d321c..db672169baa 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/global-struct-constant-init-metal-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/global-struct-constant-init-metal-outES3Metal.txt @@ -1,7 +1,7 @@ #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); +constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less_equal); struct FragmentCommonData { half3 diffColor; half3 specColor; @@ -45,125 +45,125 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , depth2d<float> _ShadowMapTexture [[texture(3)]], sampler _mtlsmp__ShadowMapTexture [[sampler(3)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; - half atten_2; - half4 tmpvar_3; + half4 c_1 = 0; + half atten_2 = 0; + half4 tmpvar_3 = 0; tmpvar_3 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0.xy)); - half2 tmpvar_4; + half2 tmpvar_4 = 0; tmpvar_4.x = _mtl_u._Metallic; tmpvar_4.y = _mtl_u._Glossiness; - half3 tmpvar_5; + half3 tmpvar_5 = 0; tmpvar_5 = (_mtl_u._Color.xyz * tmpvar_3.xyz); - half3 tmpvar_6; - half3 tmpvar_7; + half3 tmpvar_6 = 0; + half3 tmpvar_7 = 0; tmpvar_7 = mix (_mtl_u.unity_ColorSpaceDielectricSpec.xyz, tmpvar_5, half3(_mtl_u._Metallic)); - half tmpvar_8; + half tmpvar_8 = 0; tmpvar_8 = (_mtl_u.unity_ColorSpaceDielectricSpec.w - (_mtl_u._Metallic * _mtl_u.unity_ColorSpaceDielectricSpec.w)); tmpvar_6 = (tmpvar_5 * tmpvar_8); - half3 tmpvar_9; + half3 tmpvar_9 = 0; tmpvar_9 = normalize(_mtl_i.xlv_TEXCOORD2_2.xyz); - half3 tmpvar_10; + half3 tmpvar_10 = 0; tmpvar_10 = normalize(_mtl_i.xlv_TEXCOORD1); - half3 tmpvar_11; + half3 tmpvar_11 = 0; tmpvar_11 = _mtl_u._LightColor0.xyz; - half shadow_12; - half tmpvar_13; + half shadow_12 = 0; + half tmpvar_13 = 0; tmpvar_13 = _ShadowMapTexture.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.xlv_TEXCOORD6.xyz).xy, (float)(_mtl_i.xlv_TEXCOORD6.xyz).z); - half tmpvar_14; + half tmpvar_14 = 0; tmpvar_14 = tmpvar_13; - shadow_12 = (_mtl_u._LightShadowData.x + (tmpvar_14 * ((half)1.0 - _mtl_u._LightShadowData.x))); + shadow_12 = (_mtl_u._LightShadowData.x + (tmpvar_14 * ((half)(1.0) - _mtl_u._LightShadowData.x))); atten_2 = shadow_12; - half occ_15; - half tmpvar_16; + half occ_15 = 0; + half tmpvar_16 = 0; tmpvar_16 = _OcclusionMap.sample(_mtlsmp__OcclusionMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).y; occ_15 = tmpvar_16; - half tmpvar_17; - tmpvar_17 = (((half)1.0 - _mtl_u._OcclusionStrength) + (occ_15 * _mtl_u._OcclusionStrength)); + half tmpvar_17 = 0; + tmpvar_17 = (((half)(1.0) - _mtl_u._OcclusionStrength) + (occ_15 * _mtl_u._OcclusionStrength)); FragmentCommonData s_18; s_18 = _xlat_mtl_const1; s_18.oneMinusRoughness = tmpvar_4.y; s_18.normalWorld = tmpvar_9; s_18.eyeVec = tmpvar_10; s_18.posWorld = half3(float3(0.0, 0.0, 0.0)); - half3 tmpvar_19; - half3 tmpvar_20; + half3 tmpvar_19 = 0; + half3 tmpvar_20 = 0; tmpvar_19 = s_18.normalWorld; tmpvar_20 = s_18.eyeVec; - float4 tmpvar_21; + float4 tmpvar_21 = 0; tmpvar_21 = float4(_mtl_u.unity_SpecCube0_HDR); - half tmpvar_22; - tmpvar_22 = ((half)1.0 - s_18.oneMinusRoughness); - half3 tmpvar_23; - tmpvar_23 = (tmpvar_20 - ((half)2.0 * ( + half tmpvar_22 = 0; + tmpvar_22 = ((half)(1.0) - s_18.oneMinusRoughness); + half3 tmpvar_23 = 0; + tmpvar_23 = (tmpvar_20 - ((half)(2.0) * ( dot (tmpvar_19, tmpvar_20) * tmpvar_19))); - half4 tmpvar_24; + half4 tmpvar_24 = 0; tmpvar_24.w = half(1.0); tmpvar_24.xyz = tmpvar_19; - half3 x_25; + half3 x_25 = 0; x_25.x = dot (_mtl_u.unity_SHAr, tmpvar_24); x_25.y = dot (_mtl_u.unity_SHAg, tmpvar_24); x_25.z = dot (_mtl_u.unity_SHAb, tmpvar_24); - half4 hdr_26; + half4 hdr_26 = 0; hdr_26 = half4(tmpvar_21); - half4 tmpvar_27; + half4 tmpvar_27 = 0; tmpvar_27.xyz = tmpvar_23; - tmpvar_27.w = ((tmpvar_22 * ((half)1.7 - - ((half)0.7 * tmpvar_22) - )) * (half)6.0); - half4 tmpvar_28; + tmpvar_27.w = ((tmpvar_22 * ((half)(1.7) - + ((half)(0.7) * tmpvar_22) + )) * (half)(6.0)); + half4 tmpvar_28 = 0; tmpvar_28 = unity_SpecCube0.sample(_mtlsmp_unity_SpecCube0, (float3)(tmpvar_23), level(tmpvar_27.w)); - half4 tmpvar_29; + half4 tmpvar_29 = 0; tmpvar_29 = tmpvar_28; - half3 viewDir_30; + half3 viewDir_30 = 0; viewDir_30 = -(tmpvar_10); - half3 tmpvar_31; - half3 inVec_32; + half3 tmpvar_31 = 0; + half3 inVec_32 = 0; inVec_32 = (_mtl_u._WorldSpaceLightPos0.xyz + viewDir_30); tmpvar_31 = (inVec_32 * rsqrt(max ((half)0.001, dot (inVec_32, inVec_32) ))); - half tmpvar_33; + half tmpvar_33 = 0; tmpvar_33 = max ((half)0.0, dot (_mtl_u._WorldSpaceLightPos0.xyz, tmpvar_31)); - half tmpvar_34; - tmpvar_34 = ((half)1.0 - _mtl_u._Glossiness); - half tmpvar_35; + half tmpvar_34 = 0; + tmpvar_34 = ((half)(1.0) - _mtl_u._Glossiness); + half tmpvar_35 = 0; tmpvar_35 = max ((half)0.0001, (tmpvar_34 * tmpvar_34)); - half tmpvar_36; - tmpvar_36 = max ((((half)2.0 / + half tmpvar_36 = 0; + tmpvar_36 = max ((((half)(2.0) / (tmpvar_35 * tmpvar_35) - ) - (half)2.0), (half)0.0001); - half x_37; - x_37 = ((half)1.0 - max ((half)0.0, dot (tmpvar_9, viewDir_30))); - half4 tmpvar_38; + ) - (half)(2.0)), (half)0.0001); + half x_37 = 0; + x_37 = ((half)(1.0) - max ((half)0.0, dot (tmpvar_9, viewDir_30))); + half4 tmpvar_38 = 0; tmpvar_38.w = half(1.0); tmpvar_38.xyz = ((( ((tmpvar_6 + (sqrt( - max ((half)0.0001, (((tmpvar_36 + (half)1.0) * pow ( + max ((half)0.0001, (((tmpvar_36 + (half)(1.0)) * pow ( max ((half)0.0, dot (tmpvar_9, tmpvar_31)) , tmpvar_36)) / (( - ((half)8.0 * (((tmpvar_33 * tmpvar_33) * _mtl_u._Glossiness) + (tmpvar_34 * tmpvar_34))) - * tmpvar_33) + (half)0.0001))) + ((half)(8.0) * (((tmpvar_33 * tmpvar_33) * _mtl_u._Glossiness) + (tmpvar_34 * tmpvar_34))) + * tmpvar_33) + (half)(0.0001)))) ) * tmpvar_7)) * (tmpvar_11 * atten_2)) * max ((half)0.0, dot (tmpvar_9, _mtl_u._WorldSpaceLightPos0.xyz)) ) + ( - (max ((((half)1.055 * + (max ((((half)(1.055) * pow (max ((half3)float3(0.0, 0.0, 0.0), (_mtl_i.xlv_TEXCOORD5.xyz + x_25)), (half3)float3(0.4166667, 0.4166667, 0.4166667)) - ) - (half)0.055), (half3)float3(0.0, 0.0, 0.0)) * tmpvar_17) + ) - (half)(0.055)), (half3)float3(0.0, 0.0, 0.0)) * tmpvar_17) * tmpvar_6)) + (( - ((half)1.0 - ((tmpvar_34 * tmpvar_34) * (tmpvar_34 * (half)0.28))) + ((half)(1.0) - ((tmpvar_34 * tmpvar_34) * (tmpvar_34 * (half)(0.28)))) * (((hdr_26.x * tmpvar_29.w) * tmpvar_29.xyz) * tmpvar_17) ) * mix (tmpvar_7, half3( - clamp ((_mtl_u._Glossiness + ((half)1.0 - tmpvar_8)), (half)0.0, (half)1.0) + clamp ((_mtl_u._Glossiness + ((half)(1.0) - tmpvar_8)), (half)0.0, (half)1.0) ), half3( ((x_37 * x_37) * (x_37 * x_37)) )))); c_1 = (tmpvar_38 * _mtl_i.xlv_COLOR); c_1.xyz = c_1.xyz; c_1.xyz = c_1.xyz; - half4 xlat_varoutput_39; + half4 xlat_varoutput_39 = 0; xlat_varoutput_39.xyz = c_1.xyz; xlat_varoutput_39.w = half(1.0); _mtl_o.FragData_0 = xlat_varoutput_39; 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 4f5521cde7d..f8b9ff1d2d9 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 @@ -12,7 +12,7 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 v_1; + half4 v_1 = 0; v_1.w = half(-1.0); v_1.x = ((half)(1.2 + _mtl_u.nonSqMat[0].x)); v_1.y = half(6.0); 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 223b512f488..b00448b0232 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/intrinsics-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/intrinsics-outES3Metal.txt @@ -12,148 +12,148 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; + half4 c_1 = 0; c_1 = half4(float4(0.0, 0.0, 0.0, 0.0)); - float tmpvar_2; + float tmpvar_2 = 0; tmpvar_2 = (_mtl_i.xlv_TEXCOORD0.x / 2.0); - float tmpvar_3; + float tmpvar_3 = 0; tmpvar_3 = (fract(abs(tmpvar_2)) * 2.0); - float tmpvar_4; + float tmpvar_4 = 0; if ((tmpvar_2 >= 0.0)) { tmpvar_4 = tmpvar_3; } else { tmpvar_4 = -(tmpvar_3); }; c_1.x = half(tmpvar_4); - float2 tmpvar_5; + float2 tmpvar_5 = 0; tmpvar_5 = (_mtl_i.xlv_TEXCOORD0.xy / float2(2.0, 2.0)); - float2 tmpvar_6; + float2 tmpvar_6 = 0; tmpvar_6 = (fract(abs(tmpvar_5)) * float2(2.0, 2.0)); - float tmpvar_7; + float tmpvar_7 = 0; if ((tmpvar_5.x >= 0.0)) { tmpvar_7 = tmpvar_6.x; } else { tmpvar_7 = -(tmpvar_6.x); }; - float tmpvar_8; + float tmpvar_8 = 0; if ((tmpvar_5.y >= 0.0)) { tmpvar_8 = tmpvar_6.y; } else { tmpvar_8 = -(tmpvar_6.y); }; - float2 tmpvar_9; + float2 tmpvar_9 = 0; tmpvar_9.x = tmpvar_7; tmpvar_9.y = tmpvar_8; - c_1.xy = ((half2)((float2)c_1.xy + tmpvar_9)); - float3 tmpvar_10; + c_1.xy = ((half2)((float2)(c_1.xy) + tmpvar_9)); + float3 tmpvar_10 = 0; tmpvar_10 = (_mtl_i.xlv_TEXCOORD0.xyz / float3(2.0, 2.0, 2.0)); - float3 tmpvar_11; + float3 tmpvar_11 = 0; tmpvar_11 = (fract(abs(tmpvar_10)) * float3(2.0, 2.0, 2.0)); - float tmpvar_12; + float tmpvar_12 = 0; if ((tmpvar_10.x >= 0.0)) { tmpvar_12 = tmpvar_11.x; } else { tmpvar_12 = -(tmpvar_11.x); }; - float tmpvar_13; + float tmpvar_13 = 0; if ((tmpvar_10.y >= 0.0)) { tmpvar_13 = tmpvar_11.y; } else { tmpvar_13 = -(tmpvar_11.y); }; - float tmpvar_14; + float tmpvar_14 = 0; if ((tmpvar_10.z >= 0.0)) { tmpvar_14 = tmpvar_11.z; } else { tmpvar_14 = -(tmpvar_11.z); }; - float3 tmpvar_15; + float3 tmpvar_15 = 0; tmpvar_15.x = tmpvar_12; tmpvar_15.y = tmpvar_13; tmpvar_15.z = tmpvar_14; - c_1.xyz = ((half3)((float3)c_1.xyz + tmpvar_15)); - float4 tmpvar_16; + c_1.xyz = ((half3)((float3)(c_1.xyz) + tmpvar_15)); + float4 tmpvar_16 = 0; tmpvar_16 = (_mtl_i.xlv_TEXCOORD0 / float4(2.0, 2.0, 2.0, 2.0)); - float4 tmpvar_17; + float4 tmpvar_17 = 0; tmpvar_17 = (fract(abs(tmpvar_16)) * float4(2.0, 2.0, 2.0, 2.0)); - float tmpvar_18; + float tmpvar_18 = 0; if ((tmpvar_16.x >= 0.0)) { tmpvar_18 = tmpvar_17.x; } else { tmpvar_18 = -(tmpvar_17.x); }; - float tmpvar_19; + float tmpvar_19 = 0; if ((tmpvar_16.y >= 0.0)) { tmpvar_19 = tmpvar_17.y; } else { tmpvar_19 = -(tmpvar_17.y); }; - float tmpvar_20; + float tmpvar_20 = 0; if ((tmpvar_16.z >= 0.0)) { tmpvar_20 = tmpvar_17.z; } else { tmpvar_20 = -(tmpvar_17.z); }; - float tmpvar_21; + float tmpvar_21 = 0; if ((tmpvar_16.w >= 0.0)) { tmpvar_21 = tmpvar_17.w; } else { tmpvar_21 = -(tmpvar_17.w); }; - float4 tmpvar_22; + float4 tmpvar_22 = 0; tmpvar_22.x = tmpvar_18; tmpvar_22.y = tmpvar_19; tmpvar_22.z = tmpvar_20; tmpvar_22.w = tmpvar_21; - c_1 = ((half4)((float4)c_1 + tmpvar_22)); - float tmpvar_23; - half ip_24; - int tmpvar_25; + c_1 = ((half4)((float4)(c_1) + tmpvar_22)); + float tmpvar_23 = 0; + half ip_24 = 0; + int tmpvar_25 = 0; tmpvar_25 = int(_mtl_i.xlv_TEXCOORD0.x); ip_24 = half(float(tmpvar_25)); - tmpvar_23 = (_mtl_i.xlv_TEXCOORD0.x - (float)ip_24); - c_1.x = ((half)((float)c_1.x + tmpvar_23)); - float2 tmpvar_26; - int2 tmpvar_27; + tmpvar_23 = (_mtl_i.xlv_TEXCOORD0.x - (float)(ip_24)); + c_1.x = ((half)((float)(c_1.x) + tmpvar_23)); + float2 tmpvar_26 = 0; + int2 tmpvar_27 = 0; tmpvar_27 = int2(_mtl_i.xlv_TEXCOORD0.xy); - half2 tmpvar_28; + half2 tmpvar_28 = 0; tmpvar_28 = half2(float2(tmpvar_27)); - tmpvar_26 = (_mtl_i.xlv_TEXCOORD0.xy - (float2)tmpvar_28); - c_1.xy = ((half2)((float2)c_1.xy + tmpvar_26)); - float3 tmpvar_29; - int3 tmpvar_30; + tmpvar_26 = (_mtl_i.xlv_TEXCOORD0.xy - (float2)(tmpvar_28)); + c_1.xy = ((half2)((float2)(c_1.xy) + tmpvar_26)); + float3 tmpvar_29 = 0; + int3 tmpvar_30 = 0; tmpvar_30 = int3(_mtl_i.xlv_TEXCOORD0.xyz); - half3 tmpvar_31; + half3 tmpvar_31 = 0; tmpvar_31 = half3(float3(tmpvar_30)); - tmpvar_29 = (_mtl_i.xlv_TEXCOORD0.xyz - (float3)tmpvar_31); - c_1.xyz = ((half3)((float3)c_1.xyz + tmpvar_29)); - float4 tmpvar_32; - int4 tmpvar_33; + tmpvar_29 = (_mtl_i.xlv_TEXCOORD0.xyz - (float3)(tmpvar_31)); + c_1.xyz = ((half3)((float3)(c_1.xyz) + tmpvar_29)); + float4 tmpvar_32 = 0; + int4 tmpvar_33 = 0; tmpvar_33 = int4(_mtl_i.xlv_TEXCOORD0); - half4 tmpvar_34; + half4 tmpvar_34 = 0; tmpvar_34 = half4(float4(tmpvar_33)); - tmpvar_32 = (_mtl_i.xlv_TEXCOORD0 - (float4)tmpvar_34); - c_1 = ((half4)((float4)c_1 + tmpvar_32)); - float tmpvar_35; + tmpvar_32 = (_mtl_i.xlv_TEXCOORD0 - (float4)(tmpvar_34)); + c_1 = ((half4)((float4)(c_1) + tmpvar_32)); + float tmpvar_35 = 0; tmpvar_35 = (float(fmod (_mtl_i.xlv_TEXCOORD0.x, (float)tmpvar_34.x))); - c_1.x = half(((float)c_1.x + tmpvar_35)); - float2 tmpvar_36; + c_1.x = half(((float)(c_1.x) + tmpvar_35)); + float2 tmpvar_36 = 0; tmpvar_36 = (float2(fmod (_mtl_i.xlv_TEXCOORD0.xy, (float2)tmpvar_34.xy))); - c_1.xy = half2(((float2)c_1.xy + tmpvar_36)); - float3 tmpvar_37; + c_1.xy = half2(((float2)(c_1.xy) + tmpvar_36)); + float3 tmpvar_37 = 0; tmpvar_37 = (float3(fmod (_mtl_i.xlv_TEXCOORD0.xyz, (float3)tmpvar_34.xyz))); - c_1.xyz = half3(((float3)c_1.xyz + tmpvar_37)); - float tmpvar_38; + c_1.xyz = half3(((float3)(c_1.xyz) + tmpvar_37)); + float tmpvar_38 = 0; tmpvar_38 = (1.0/(_mtl_i.xlv_TEXCOORD0.x)); - c_1.x = half(((float)c_1.x + tmpvar_38)); - float tmpvar_39; + c_1.x = half(((float)(c_1.x) + tmpvar_38)); + float tmpvar_39 = 0; tmpvar_39 = max (0.0, tmpvar_38); - c_1.x = half(((float)c_1.x + tmpvar_39)); + c_1.x = half(((float)(c_1.x) + tmpvar_39)); c_1.y = (c_1.y + ((half)1.0/(c_1.z))); c_1.y = (c_1.y + max ((half)0.0, ((half)1.0/(c_1.w)))); - float tmpvar_40; + float tmpvar_40 = 0; tmpvar_40 = max (_mtl_i.xlv_TEXCOORD0.x, (float)c_1.z); - c_1.x = half(((float)c_1.x + tmpvar_40)); + c_1.x = half(((float)(c_1.x) + tmpvar_40)); _mtl_o._fragData = c_1; return _mtl_o; } 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 87ded88ac8e..8a798b045a4 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 @@ -15,14 +15,14 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 tmpvar_1; - half3 light_2; - half4 col_3; + half4 tmpvar_1 = 0; + half3 light_2 = 0; + half4 col_3 = 0; col_3 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_uv)); light_2 = ((col_3.xyz * _mtl_i.xlv_nl.x) * _mtl_u._TerrainTreeLightColors[0].xyz); light_2 = (light_2 + ((col_3.xyz * _mtl_i.xlv_nl.y) * _mtl_u._TerrainTreeLightColors[1].xyz)); light_2 = (light_2 + ((col_3.xyz * _mtl_i.xlv_nl.z) * _mtl_u._TerrainTreeLightColors[2].xyz)); - half4 tmpvar_4; + half4 tmpvar_4 = 0; tmpvar_4.w = half(1.0); tmpvar_4.xyz = light_2; tmpvar_1 = tmpvar_4; 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 562cb9acb7c..7cef1f3b0d9 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 @@ -15,17 +15,17 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 tmpvar_1; - half3 light_2; - half4 tmpvar_3; + half4 tmpvar_1 = 0; + half3 light_2 = 0; + half4 tmpvar_3 = 0; tmpvar_3 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_uv)); - if ((tmpvar_3.w < (half)0.5)) { + if ((tmpvar_3.w < (half)(0.5))) { discard_fragment(); }; light_2 = ((tmpvar_3.xyz * _mtl_i.xlv_nl.x) * _mtl_u._TerrainTreeLightColors[0].xyz); light_2 = (light_2 + ((tmpvar_3.xyz * _mtl_i.xlv_nl.y) * _mtl_u._TerrainTreeLightColors[1].xyz)); light_2 = (light_2 + ((tmpvar_3.xyz * _mtl_i.xlv_nl.z) * _mtl_u._TerrainTreeLightColors[2].xyz)); - half4 tmpvar_4; + half4 tmpvar_4 = 0; tmpvar_4.w = half(1.0); tmpvar_4.xyz = light_2; tmpvar_1 = tmpvar_4; 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 f0df5674877..0714a7cd94d 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 @@ -23,18 +23,18 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _DecalNorm [[texture(1)]], sampler _mtlsmp__DecalNorm [[sampler(1)]]) { xlatMtlShaderOutput _mtl_o; - half4 res_1; - half3 worldN_2; - half3 combinedNormal_3; - half3 tmpvar_4; - tmpvar_4 = ((_DecalNorm.sample(_mtlsmp__DecalNorm, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).xyz * (half)2.0) - (half)1.0); - half3 tmpvar_5; - tmpvar_5 = ((_PanelNorm.sample(_mtlsmp__PanelNorm, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz * (half)2.0) - (half)1.0); - half3 tmpvar_6; + half4 res_1 = 0; + half3 worldN_2 = 0; + half3 combinedNormal_3 = 0; + half3 tmpvar_4 = 0; + tmpvar_4 = ((_DecalNorm.sample(_mtlsmp__DecalNorm, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).xyz * (half)(2.0)) - (half)(1.0)); + half3 tmpvar_5 = 0; + tmpvar_5 = ((_PanelNorm.sample(_mtlsmp__PanelNorm, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz * (half)(2.0)) - (half)(1.0)); + half3 tmpvar_6 = 0; tmpvar_6.x = tmpvar_4.z; tmpvar_6.y = tmpvar_4.y; tmpvar_6.z = -(tmpvar_4.x); - half3 tmpvar_7; + half3 tmpvar_7 = 0; tmpvar_7.x = tmpvar_4.x; tmpvar_7.y = tmpvar_4.z; tmpvar_7.z = -(tmpvar_4.y); @@ -50,33 +50,33 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] tmpvar_9[2].y = tmpvar_7.z; tmpvar_9[2].z = tmpvar_4.z; tmpvar_8 = _xlcast_float3x3(tmpvar_9); - float3 v_10; + float3 v_10 = 0; v_10.x = tmpvar_8[0].x; v_10.y = tmpvar_8[1].x; v_10.z = tmpvar_8[2].x; - float3 v_11; + float3 v_11 = 0; v_11.x = tmpvar_8[0].y; v_11.y = tmpvar_8[1].y; v_11.z = tmpvar_8[2].y; - float3 v_12; + float3 v_12 = 0; v_12.x = tmpvar_8[0].z; v_12.y = tmpvar_8[1].z; v_12.z = tmpvar_8[2].z; combinedNormal_3 = normalize((( - ((half3)((float)tmpvar_5.x * v_10)) + ((half3)((float)(tmpvar_5.x) * v_10)) + - ((half3)((float)tmpvar_5.y * v_11)) - ) + ((half3)((float)tmpvar_5.z * v_12)))); - float tmpvar_13; + ((half3)((float)(tmpvar_5.y) * v_11)) + ) + ((half3)((float)(tmpvar_5.z) * v_12)))); + float tmpvar_13 = 0; tmpvar_13 = dot (_mtl_i.xlv_TEXCOORD1.xyz, (float3)combinedNormal_3); worldN_2.x = half(tmpvar_13); - float tmpvar_14; + float tmpvar_14 = 0; tmpvar_14 = dot (_mtl_i.xlv_TEXCOORD2.xyz, (float3)combinedNormal_3); worldN_2.y = half(tmpvar_14); - float tmpvar_15; + float tmpvar_15 = 0; tmpvar_15 = dot (_mtl_i.xlv_TEXCOORD3.xyz, (float3)combinedNormal_3); worldN_2.z = half(tmpvar_15); - res_1.xyz = ((worldN_2 * (half)0.5) + (half)0.5); + res_1.xyz = ((worldN_2 * (half)(0.5)) + (half)(0.5)); res_1.w = half(0.0); _mtl_o._fragData = res_1; return _mtl_o; 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 1fbb32d9b16..ea699afd5e9 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 @@ -28,11 +28,11 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] xlatMtlShaderOutput _mtl_o; half2x2 halfMatrix_1; float2x2 rotationMatrix_2; - float tmpvar_3; - float tmpvar_4; + float tmpvar_3 = 0; + float tmpvar_4 = 0; tmpvar_4 = (_mtl_u._Speed * _mtl_u._Time.x); tmpvar_3 = sin(tmpvar_4); - float tmpvar_5; + float tmpvar_5 = 0; tmpvar_5 = cos(tmpvar_4); float2x2 tmpvar_6; tmpvar_6[0].x = tmpvar_5; @@ -50,14 +50,14 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] tmpvar_7[1].x = -(tmpvar_3); tmpvar_7[1].y = tmpvar_5; halfMatrix_1 = _xlcast_half2x2(tmpvar_7); - halfMatrix_1 = (halfMatrix_1 * (half)2.0); + halfMatrix_1 = (halfMatrix_1 * (half)(2.0)); halfMatrix_1 = (halfMatrix_1 - _xlinit_half2x2(1.0)); halfMatrix_1 = _xlcast_half2x2(((float2x2)(_xlinit_half2x2(tmpvar_3) - halfMatrix_1))); halfMatrix_1 = _xlcast_half2x2(((float2x2)(_xlinit_half2x2(tmpvar_5) + halfMatrix_1))); halfMatrix_1 = _xlcast_half2x2(((float2x2)(halfMatrix_1 * (1.0h/half(tmpvar_3))))); - float4 tmpvar_8; + float4 tmpvar_8 = 0; tmpvar_8.xy = (rotationMatrix_2 * _mtl_i.uv); - tmpvar_8.zw = ((float2)(halfMatrix_1 * (half2)_mtl_i.uv)); + tmpvar_8.zw = ((float2)(halfMatrix_1 * (half2)(_mtl_i.uv))); _mtl_o._fragData = half4(tmpvar_8); return _mtl_o; } 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 a39c1b7d7af..92c49d1fd94 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 @@ -13,9 +13,9 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; - float4 tmpvar_2; - tmpvar_2 = ((float4)_mtl_i.xlv_COLOR0 * _mtl_u._Color); + half4 c_1 = 0; + float4 tmpvar_2 = 0; + tmpvar_2 = ((float4)(_mtl_i.xlv_COLOR0) * _mtl_u._Color); c_1 = half4(tmpvar_2); _mtl_o._glesFragData_0 = c_1; return _mtl_o; 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 0d959ebe648..e6b85706ee2 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 @@ -14,10 +14,10 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; - half tmpvar_2; + half4 c_1 = 0; + half tmpvar_2 = 0; tmpvar_2 = dot (_mtl_i.normal, _mtl_i.halfDir); - half4 tmpvar_3; + half4 tmpvar_3 = 0; tmpvar_3 = half4(pow (tmpvar_2, _mtl_u.specPower)); c_1 = tmpvar_3; _mtl_o._fragData = c_1; 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 eb189493adb..1d56e351e7b 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 @@ -13,13 +13,13 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 r_1; - half3 lightCoord_2; - float4 tmpvar_3; + half4 r_1 = 0; + half3 lightCoord_2 = 0; + float4 tmpvar_3 = 0; tmpvar_3.w = 1.0; tmpvar_3.xyz = _mtl_u._WorldPos; - float3 tmpvar_4; - tmpvar_4 = ((float4)(_mtl_u._LightMatrix * (half4)tmpvar_3)).xyz; + float3 tmpvar_4 = 0; + tmpvar_4 = ((float4)(_mtl_u._LightMatrix * (half4)(tmpvar_3))).xyz; lightCoord_2 = half3(tmpvar_4); r_1.xyz = lightCoord_2; r_1.w = half(1.0); 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 3462062ac51..002b1233541 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 @@ -12,7 +12,7 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; + half4 c_1 = 0; half3x3 tmpvar_2; tmpvar_2[0].x = half(0.8164966); tmpvar_2[0].y = half(-0.4082483); 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 82d78249c8b..24ac7348b5b 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 @@ -18,21 +18,21 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texturecube<float> cubehigh [[texture(5)]], sampler _mtlsmp_cubehigh [[sampler(5)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; - half4 tmpvar_2; + half4 c_1 = 0; + half4 tmpvar_2 = 0; tmpvar_2 = texlow.sample(_mtlsmp_texlow, (float2)(_mtl_i.varUV.xy)); c_1 = tmpvar_2; c_1 = (c_1 + texmed.sample(_mtlsmp_texmed, (float2)(_mtl_i.varUV.xy))); - float4 tmpvar_3; + float4 tmpvar_3 = 0; tmpvar_3 = texhigh.sample(_mtlsmp_texhigh, (float2)(_mtl_i.varUV.xy)); - c_1 = half4(((float4)c_1 + tmpvar_3)); - half4 tmpvar_4; + c_1 = half4(((float4)(c_1) + tmpvar_3)); + half4 tmpvar_4 = 0; tmpvar_4 = cubelow.sample(_mtlsmp_cubelow, (float3)(_mtl_i.varUV.xyz)); c_1 = (c_1 + tmpvar_4); c_1 = (c_1 + cubemed.sample(_mtlsmp_cubemed, (float3)(_mtl_i.varUV.xyz))); - float4 tmpvar_5; + float4 tmpvar_5 = 0; tmpvar_5 = cubehigh.sample(_mtlsmp_cubehigh, (float3)(_mtl_i.varUV.xyz)); - c_1 = half4(((float4)c_1 + tmpvar_5)); + c_1 = half4(((float4)(c_1) + tmpvar_5)); _mtl_o._fragData = c_1; return _mtl_o; } 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 ca234064fb3..b50458537e5 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ternary-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/ternary-outES3Metal.txt @@ -12,45 +12,45 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; + half4 c_1 = 0; c_1 = half4(float4(0.0, 0.0, 0.0, 0.0)); - float tmpvar_2; + float tmpvar_2 = 0; if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) { tmpvar_2 = 0.9; } else { tmpvar_2 = 0.1; }; c_1 = half4(float4(tmpvar_2)); - float4 tmpvar_3; + float4 tmpvar_3 = 0; if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) { tmpvar_3 = float4(0.9, 0.9, 0.9, 0.9); } else { tmpvar_3 = float4(0.1, 0.1, 0.1, 0.1); }; c_1 = ((half4)(float4(tmpvar_2) + tmpvar_3)); - float3 tmpvar_4; + float3 tmpvar_4 = 0; if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) { tmpvar_4 = float3(0.9, 0.9, 0.9); } else { tmpvar_4 = float3(0.1, 0.1, 0.1); }; - c_1.xyz = (c_1.xyz + (half3)tmpvar_4); - float2 tmpvar_5; + c_1.xyz = (c_1.xyz + (half3)(tmpvar_4)); + float2 tmpvar_5 = 0; if ((_mtl_i.xlv_TEXCOORD0.x > 0.5)) { tmpvar_5 = float2(0.9, 0.9); } else { tmpvar_5 = float2(0.1, 0.1); }; - c_1.xy = (c_1.xy + (half2)tmpvar_5); - float tmpvar_6; + c_1.xy = (c_1.xy + (half2)(tmpvar_5)); + float tmpvar_6 = 0; tmpvar_6 = fract(_mtl_i.xlv_TEXCOORD0.x); - float tmpvar_7; + float tmpvar_7 = 0; if (bool(tmpvar_6)) { tmpvar_7 = 0.9; } else { tmpvar_7 = 0.1; }; - c_1.x = (c_1.x + (half)tmpvar_7); + c_1.x = (c_1.x + (half)(tmpvar_7)); _mtl_o._fragData = c_1; return _mtl_o; } 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 4471023a756..04bf455cd7b 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 @@ -12,164 +12,164 @@ struct xlatMtlShaderUniform { fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 tmpvar_1; - float4 a_2; + half4 tmpvar_1 = 0; + float4 a_2 = 0; a_2 = float4(0.0, 0.0, 0.0, 0.0); - bool4 tmpvar_3; + bool4 tmpvar_3 = false; tmpvar_3 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5))); - float tmpvar_4; + float tmpvar_4 = 0; if (tmpvar_3.x) { tmpvar_4 = 1.0; } else { tmpvar_4 = 5.0; }; - float tmpvar_5; + float tmpvar_5 = 0; if (tmpvar_3.y) { tmpvar_5 = 2.0; } else { tmpvar_5 = 6.0; }; - float tmpvar_6; + float tmpvar_6 = 0; if (tmpvar_3.z) { tmpvar_6 = 3.0; } else { tmpvar_6 = 7.0; }; - float tmpvar_7; + float tmpvar_7 = 0; if (tmpvar_3.w) { tmpvar_7 = 4.0; } else { tmpvar_7 = 8.0; }; - float4 tmpvar_8; + float4 tmpvar_8 = 0; tmpvar_8.x = tmpvar_4; tmpvar_8.y = tmpvar_5; tmpvar_8.z = tmpvar_6; tmpvar_8.w = tmpvar_7; a_2 = tmpvar_8; - bool4 tmpvar_9; + bool4 tmpvar_9 = false; tmpvar_9 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5))); - float tmpvar_10; + float tmpvar_10 = 0; if (tmpvar_9.x) { tmpvar_10 = 1.0; } else { tmpvar_10 = 5.0; }; - float tmpvar_11; + float tmpvar_11 = 0; if (tmpvar_9.y) { tmpvar_11 = 2.0; } else { tmpvar_11 = 6.0; }; - float tmpvar_12; + float tmpvar_12 = 0; if (tmpvar_9.z) { tmpvar_12 = 3.0; } else { tmpvar_12 = 7.0; }; - float tmpvar_13; + float tmpvar_13 = 0; if (tmpvar_9.w) { tmpvar_13 = 4.0; } else { tmpvar_13 = 8.0; }; - float4 tmpvar_14; + float4 tmpvar_14 = 0; tmpvar_14.x = tmpvar_10; tmpvar_14.y = tmpvar_11; tmpvar_14.z = tmpvar_12; tmpvar_14.w = tmpvar_13; a_2 = (tmpvar_8 + tmpvar_14); - bool4 tmpvar_15; + bool4 tmpvar_15 = false; tmpvar_15 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5))); - float tmpvar_16; + float tmpvar_16 = 0; if (tmpvar_15.x) { tmpvar_16 = 1.0; } else { tmpvar_16 = 2.0; }; - float tmpvar_17; + float tmpvar_17 = 0; if (tmpvar_15.y) { tmpvar_17 = 1.0; } else { tmpvar_17 = 2.0; }; - float tmpvar_18; + float tmpvar_18 = 0; if (tmpvar_15.z) { tmpvar_18 = 1.0; } else { tmpvar_18 = 2.0; }; - float tmpvar_19; + float tmpvar_19 = 0; if (tmpvar_15.w) { tmpvar_19 = 1.0; } else { tmpvar_19 = 2.0; }; - float4 tmpvar_20; + float4 tmpvar_20 = 0; tmpvar_20.x = tmpvar_16; tmpvar_20.y = tmpvar_17; tmpvar_20.z = tmpvar_18; tmpvar_20.w = tmpvar_19; a_2 = (a_2 + tmpvar_20); - bool4 tmpvar_21; + bool4 tmpvar_21 = false; tmpvar_21 = bool4((_mtl_i.xlv_TEXCOORD0 > float4(0.5, 0.5, 0.5, 0.5))); - float tmpvar_22; + float tmpvar_22 = 0; if (tmpvar_21.x) { tmpvar_22 = 1.0; } else { tmpvar_22 = 2.0; }; - float tmpvar_23; + float tmpvar_23 = 0; if (tmpvar_21.y) { tmpvar_23 = 1.0; } else { tmpvar_23 = 2.0; }; - float tmpvar_24; + float tmpvar_24 = 0; if (tmpvar_21.z) { tmpvar_24 = 1.0; } else { tmpvar_24 = 2.0; }; - float tmpvar_25; + float tmpvar_25 = 0; if (tmpvar_21.w) { tmpvar_25 = 1.0; } else { tmpvar_25 = 2.0; }; - float4 tmpvar_26; + float4 tmpvar_26 = 0; tmpvar_26.x = tmpvar_22; tmpvar_26.y = tmpvar_23; tmpvar_26.z = tmpvar_24; tmpvar_26.w = tmpvar_25; a_2 = (a_2 + tmpvar_26); - bool4 tmpvar_27; + bool4 tmpvar_27 = false; tmpvar_27 = bool4(fract(_mtl_i.xlv_TEXCOORD0)); - float tmpvar_28; + float tmpvar_28 = 0; if (tmpvar_27.x) { tmpvar_28 = 1.0; } else { tmpvar_28 = 2.0; }; - float tmpvar_29; + float tmpvar_29 = 0; if (tmpvar_27.y) { tmpvar_29 = 1.0; } else { tmpvar_29 = 2.0; }; - float tmpvar_30; + float tmpvar_30 = 0; if (tmpvar_27.z) { tmpvar_30 = 1.0; } else { tmpvar_30 = 2.0; }; - float tmpvar_31; + float tmpvar_31 = 0; if (tmpvar_27.w) { tmpvar_31 = 1.0; } else { tmpvar_31 = 2.0; }; - float4 tmpvar_32; + float4 tmpvar_32 = 0; tmpvar_32.x = tmpvar_28; tmpvar_32.y = tmpvar_29; tmpvar_32.z = tmpvar_30; 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 606d3bb3f82..2ba6f57df4e 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2DArray-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2DArray-outES3Metal.txt @@ -13,21 +13,21 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d_array<half> myarr [[texture(0)]], sampler _mtlsmp_myarr [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 tmpvar_1; - float4 slod_2; - half4 tmpvar_3; + half4 tmpvar_1 = 0; + float4 slod_2 = 0; + half4 tmpvar_3 = 0; tmpvar_3 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyz).xy), (uint)((_mtl_i.uv.xyz).z)); - float4 tmpvar_4; + float4 tmpvar_4 = 0; tmpvar_4 = float4(tmpvar_3); - half4 tmpvar_5; + half4 tmpvar_5 = 0; tmpvar_5 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyw).xy), (uint)((_mtl_i.uv.xyw).z)); - float4 tmpvar_6; + float4 tmpvar_6 = 0; tmpvar_6 = float4(tmpvar_5); - half4 tmpvar_7; + half4 tmpvar_7 = 0; tmpvar_7 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyz).xy), (uint)((_mtl_i.uv.xyz).z), bias(1.5)); - float4 tmpvar_8; + float4 tmpvar_8 = 0; tmpvar_8 = float4(tmpvar_7); - half4 tmpvar_9; + half4 tmpvar_9 = 0; tmpvar_9 = myarr.sample(_mtlsmp_myarr, (float2)((_mtl_i.uv.xyz).xy), (uint)((_mtl_i.uv.xyz).z), level(2.5)); slod_2 = float4(tmpvar_9); tmpvar_1 = half4(((tmpvar_4 + tmpvar_6) + (tmpvar_8 + slod_2))); 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 a070be52ede..f9f48cb6b3f 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dgrad-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dgrad-outES3Metal.txt @@ -15,13 +15,13 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> tex [[texture(0)]], sampler _mtlsmp_tex [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - half2 tmpvar_1; + half2 tmpvar_1 = 0; tmpvar_1 = dfdx(_mtl_i.uv1.xy); - half2 tmpvar_2; + half2 tmpvar_2 = 0; tmpvar_2 = dfdy(_mtl_i.uv1.xy); - float2 tmpvar_3; + float2 tmpvar_3 = 0; tmpvar_3 = dfdx(_mtl_i.uv2.xy); - float2 tmpvar_4; + float2 tmpvar_4 = 0; tmpvar_4 = dfdy(_mtl_i.uv2.xy); _mtl_o._fragColor = ((tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv1.xy), gradient2d((float2)(tmpvar_1), (float2)(tmpvar_2))) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv2.xy), gradient2d((float2)(tmpvar_3), (float2)(tmpvar_4)))) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv2.xy), gradient2d((float2)(_mtl_i.uv1.xy), (float2)(_mtl_i.uv1.xy)))); return _mtl_o; 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 e8f1746eb68..af62fcf4155 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dlod-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dlod-outES3Metal.txt @@ -15,11 +15,11 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> tex [[texture(0)]], sampler _mtlsmp_tex [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 tmpvar_1; - half4 tmpvar_2; + half4 tmpvar_1 = 0; + half4 tmpvar_2 = 0; tmpvar_2 = tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uvHi.xy), level(0.0)); tmpvar_1 = tmpvar_2; - half4 tmpvar_3; + half4 tmpvar_3 = 0; tmpvar_3 = tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uvMed.xy), level(_mtl_i.uvMed.z)); _mtl_o._fragColor = (tmpvar_1 + tmpvar_3); return _mtl_o; 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 3171b51a5a1..45f2f9f1ef9 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dshadow-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/tex2dshadow-outES3Metal.txt @@ -1,7 +1,7 @@ #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); +constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less_equal); struct xlatMtlShaderInput { float4 uvHi; half4 uvMed; @@ -16,11 +16,11 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , depth2d<float> shadowmap [[texture(0)]], sampler _mtlsmp_shadowmap [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 r_1; - half4 tmpvar_2; - tmpvar_2 = half4((shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi.xyz).xy, (float)(_mtl_i.uvHi.xyz).z) + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi).xy / (float)(_mtl_i.uvHi).w, (float)(_mtl_i.uvHi).z / (float)(_mtl_i.uvHi).w))); + half4 r_1 = 0; + half4 tmpvar_2 = 0; + tmpvar_2 = half4((shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi.xyz).xy, saturate((float)(_mtl_i.uvHi.xyz).z)) + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi).xy / (float)(_mtl_i.uvHi).w, saturate((float)(_mtl_i.uvHi).z / (float)(_mtl_i.uvHi).w)))); r_1.yzw = tmpvar_2.yzw; - r_1.x = (tmpvar_2.x + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvMed.xyz).xy, (float)(_mtl_i.uvMed.xyz).z)); + r_1.x = (tmpvar_2.x + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvMed.xyz).xy, saturate((float)(_mtl_i.uvMed.xyz).z))); _mtl_o._fragColor = r_1; return _mtl_o; } 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 e98663c919c..5bd07ee9088 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texCubeShadow-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texCubeShadow-outES3Metal.txt @@ -1,7 +1,7 @@ #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); +constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less_equal); struct xlatMtlShaderInput { half4 uv; }; @@ -15,7 +15,7 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , depthcube<float> shadowmap [[texture(0)]], sampler _mtlsmp_shadowmap [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 tmpvar_1; + half4 tmpvar_1 = 0; tmpvar_1 = half4(shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float3)(_mtl_i.uv).xyz, (_mtl_i.uv).w)); _mtl_o._fragColor = tmpvar_1; return _mtl_o; 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 282db076b6e..a26cd301e09 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texOffset-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texOffset-outES3Metal.txt @@ -14,7 +14,7 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture3d<half> vol [[texture(1)]], sampler _mtlsmp_vol [[sampler(1)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; + half4 c_1 = 0; c_1 = (tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv.xy)) + tex.sample(_mtlsmp_tex, (float2)(_mtl_i.uv.xy), bias(0.5))); c_1 = (c_1 + vol.sample(_mtlsmp_vol, (float3)(_mtl_i.uv))); c_1 = (c_1 + vol.sample(_mtlsmp_vol, (float3)(_mtl_i.uv), bias(-0.5))); 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 454f41277c8..d8dd6c1be0a 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texProj-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/texProj-outES3Metal.txt @@ -1,7 +1,7 @@ #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); +constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less_equal); struct xlatMtlShaderInput { float4 uv; }; @@ -15,12 +15,12 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , depth2d<float> shadowmap [[texture(1)]], sampler _mtlsmp_shadowmap [[sampler(1)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; + half4 c_1 = 0; c_1 = (tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv).xy / (float)(_mtl_i.uv).w)) + tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv.xyz).xy / (float)(_mtl_i.uv.xyz).z))); c_1 = (c_1 + tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv).xy / (float)(_mtl_i.uv).w), level(1.0))); c_1 = (c_1 + tex.sample(_mtlsmp_tex, ((float2)(_mtl_i.uv.xyz).xy / (float)(_mtl_i.uv.xyz).z), level(1.0))); - c_1 = (c_1 + half4(shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uv.xyz).xy, (float)(_mtl_i.uv.xyz).z))); - c_1 = (c_1 + half4(shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uv).xy / (float)(_mtl_i.uv).w, (float)(_mtl_i.uv).z / (float)(_mtl_i.uv).w))); + c_1 = (c_1 + half4(shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uv.xyz).xy, saturate((float)(_mtl_i.uv.xyz).z)))); + c_1 = (c_1 + half4(shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uv).xy / (float)(_mtl_i.uv).w, saturate((float)(_mtl_i.uv).z / (float)(_mtl_i.uv).w)))); _mtl_o._fragData = c_1; return _mtl_o; } diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/variables-initialization-inES3.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/variables-initialization-inES3.txt new file mode 100644 index 00000000000..64881fe105a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/variables-initialization-inES3.txt @@ -0,0 +1,44 @@ +#version 300 es +#define gl_FragData _glesFragData +layout(location = 0) out mediump vec4 _glesFragData[1]; + +uniform sampler2D _MainTex; + +struct u2v { + vec4 pos; + vec2 uv; +}; + +struct v2f { + vec4 pos; + vec2 uv; +}; + +v2f vert (u2v v) { + v2f o; + o.pos = v.pos; + o.uv = v.uv; + return o; +} + +vec4 frag (in v2f i) { + vec4 foo; + bool bar; + mat4 mat; + vec4 leet = vec4(0.5); + vec4 col = texture(_MainTex, i.uv); + col += bar ? foo : leet; + col += mat[0]; + return col; +} + +in mediump vec2 xlv_TEXCOORD0; +void main() { + mediump vec4 xl_retval; + v2f xlt_i; + xlt_i.pos = vec4(0.0); + xlt_i.uv = vec2(xlv_TEXCOORD0); + xl_retval = frag(xlt_i); + gl_FragData[0] = vec4(xl_retval); +} + diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/variables-initialization-outES3.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/variables-initialization-outES3.txt new file mode 100644 index 00000000000..c917d7ea094 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/variables-initialization-outES3.txt @@ -0,0 +1,32 @@ +#version 300 es +layout(location=0) out mediump vec4 _glesFragData[1]; +uniform sampler2D _MainTex; +in mediump vec2 xlv_TEXCOORD0; +void main () +{ + mediump vec4 xl_retval_1; + lowp vec4 col_2; + highp vec4 mat_0_3; + bool bar_4; + highp vec4 foo_5; + lowp vec4 tmpvar_6; + tmpvar_6 = texture (_MainTex, xlv_TEXCOORD0); + col_2 = tmpvar_6; + highp vec4 tmpvar_7; + if (bar_4) { + tmpvar_7 = foo_5; + } else { + tmpvar_7 = vec4(0.5, 0.5, 0.5, 0.5); + }; + col_2 = (tmpvar_6 + tmpvar_7); + col_2 = (col_2 + mat_0_3); + xl_retval_1 = col_2; + _glesFragData[0] = xl_retval_1; +} + + +// stats: 3 alu 1 tex 1 flow +// inputs: 1 +// #0: xlv_TEXCOORD0 (medium float) 2x1 [-1] +// textures: 1 +// #0: _MainTex (low 2d) 0x0 [-1] diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/variables-initialization-outES3Metal.txt b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/variables-initialization-outES3Metal.txt new file mode 100644 index 00000000000..f613ea33045 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/variables-initialization-outES3Metal.txt @@ -0,0 +1,42 @@ +#include <metal_stdlib> +#pragma clang diagnostic ignored "-Wparentheses-equality" +using namespace metal; +struct xlatMtlShaderInput { + half2 xlv_TEXCOORD0; +}; +struct xlatMtlShaderOutput { + half4 _glesFragData_0 [[color(0)]]; +}; +struct xlatMtlShaderUniform { +}; +fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]] + , texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]]) +{ + xlatMtlShaderOutput _mtl_o; + half4 xl_retval_1 = 0; + half4 col_2 = 0; + float4 mat_0_3 = 0; + bool bar_4 = false; + float4 foo_5 = 0; + half4 tmpvar_6 = 0; + tmpvar_6 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); + col_2 = tmpvar_6; + float4 tmpvar_7 = 0; + if (bar_4) { + tmpvar_7 = foo_5; + } else { + tmpvar_7 = float4(0.5, 0.5, 0.5, 0.5); + }; + col_2 = (tmpvar_6 + (half4)(tmpvar_7)); + col_2 = (col_2 + (half4)(mat_0_3)); + xl_retval_1 = col_2; + _mtl_o._glesFragData_0 = xl_retval_1; + return _mtl_o; +} + + +// stats: 3 alu 1 tex 1 flow +// inputs: 1 +// #0: xlv_TEXCOORD0 (medium float) 2x1 [-1] +// textures: 1 +// #0: _MainTex (low 2d) 0x0 [-1] loc 0 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 2fefeb706b1..a7530f4e1dc 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 @@ -16,15 +16,15 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _MainTex [[texture(2)]], sampler _mtlsmp__MainTex [[sampler(2)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; - half3 tmpvar_2; - half3 tmpvar_3; - half4 c_4; - half4 tmpvar_5; + half4 c_1 = 0; + half3 tmpvar_2 = 0; + half3 tmpvar_3 = 0; + half4 c_4 = 0; + half4 tmpvar_5 = 0; tmpvar_5 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); c_4 = tmpvar_5; tmpvar_2 = c_4.xyz; - tmpvar_3 = ((c_4.xyz * (half)2.0) - (half)1.0); + tmpvar_3 = ((c_4.xyz * (half)(2.0)) - (half)(1.0)); half3x3 tmpvar_6; tmpvar_6[0].x = half(0.8164966); tmpvar_6[0].y = half(-0.4082483); @@ -35,15 +35,15 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] tmpvar_6[2].x = half(0.5773503); tmpvar_6[2].y = half(0.5773503); tmpvar_6[2].z = half(0.5773503); - half3 normal_7; + half3 normal_7 = 0; normal_7 = tmpvar_3; - half3 scalePerBasisVector_8; - half3 lm_9; - half3 tmpvar_10; - tmpvar_10 = ((half)2.0 * unity_Lightmap.sample(_mtlsmp_unity_Lightmap, (float2)(_mtl_i.xlv_TEXCOORD4.xy)).xyz); + half3 scalePerBasisVector_8 = 0; + half3 lm_9 = 0; + half3 tmpvar_10 = 0; + tmpvar_10 = ((half)(2.0) * unity_Lightmap.sample(_mtlsmp_unity_Lightmap, (float2)(_mtl_i.xlv_TEXCOORD4.xy)).xyz); lm_9 = tmpvar_10; - half3 tmpvar_11; - tmpvar_11 = ((half)2.0 * unity_LightmapInd.sample(_mtlsmp_unity_LightmapInd, (float2)(_mtl_i.xlv_TEXCOORD4.xy)).xyz); + half3 tmpvar_11 = 0; + tmpvar_11 = ((half)(2.0) * unity_LightmapInd.sample(_mtlsmp_unity_LightmapInd, (float2)(_mtl_i.xlv_TEXCOORD4.xy)).xyz); scalePerBasisVector_8 = tmpvar_11; lm_9 = (lm_9 * dot (clamp ( (tmpvar_6 * normal_7) 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 a336ad7a463..a06acd4448c 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 @@ -20,101 +20,101 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _CameraDepthTexture [[texture(0)]], sampler _mtlsmp__CameraDepthTexture [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - float4 depth_1; - float2 coordTemp_2; - float sampleOnEpipolarLine_3; - float tmpvar_4; + float4 depth_1 = 0; + float2 coordTemp_2 = 0; + float sampleOnEpipolarLine_3 = 0; + float tmpvar_4 = 0; tmpvar_4 = clamp ((_mtl_i.xlv_TEXCOORD0.y - (0.5 / _mtl_u._CoordTexDim.y)), 0.0, 1.0); sampleOnEpipolarLine_3 = ((_mtl_i.xlv_TEXCOORD0.x - (0.5 / _mtl_u._CoordTexDim.x)) * (_mtl_u._CoordTexDim.x / (_mtl_u._CoordTexDim.x - 1.0))); - float tmpvar_5; + float tmpvar_5 = 0; tmpvar_5 = clamp (sampleOnEpipolarLine_3, 0.0, 1.0); sampleOnEpipolarLine_3 = tmpvar_5; - int tmpvar_6; + int tmpvar_6 = 0; tmpvar_6 = int(clamp (floor( (tmpvar_4 * 4.0) ), 0.0, 3.0)); - float tmpvar_7; + float tmpvar_7 = 0; tmpvar_7 = (-1.0 + (2.0 * fract( (tmpvar_4 * 4.0) ))); - float4 tmpvar_8; + float4 tmpvar_8 = 0; tmpvar_8.xz = float2(-1.0, 1.0); tmpvar_8.y = tmpvar_7; tmpvar_8.w = -(tmpvar_7); - float4 tmpvar_9; + float4 tmpvar_9 = 0; tmpvar_9.yw = float2(-1.0, 1.0); tmpvar_9.x = -(tmpvar_7); tmpvar_9.z = tmpvar_7; - bool4 tmpvar_10; + bool4 tmpvar_10 = false; tmpvar_10 = bool4((int4(tmpvar_6) == int4(0, 1, 2, 3))); - half4 tmpvar_11; + half4 tmpvar_11 = 0; tmpvar_11 = half4(tmpvar_10); - half4 tmpvar_12; + half4 tmpvar_12 = 0; tmpvar_12 = half4(tmpvar_10); - float2 tmpvar_13; + float2 tmpvar_13 = 0; tmpvar_13.x = dot (tmpvar_9, (float4)tmpvar_11); tmpvar_13.y = dot (tmpvar_8, (float4)tmpvar_12); coordTemp_2 = ((mix (_mtl_u._LightPos.xy, -(tmpvar_13) , float2(tmpvar_5)) * 0.5) + 0.5); - float4 tmpvar_14; + float4 tmpvar_14 = 0; tmpvar_14.zw = float2(0.0, 0.0); tmpvar_14.xy = coordTemp_2; coordTemp_2 = ((floor( (coordTemp_2 * _mtl_u._ScreenTexDim.xy) ) + 0.5) * _mtl_u._ScreenTexDim.zw); - half4 tmpvar_15; + half4 tmpvar_15 = 0; tmpvar_15 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(coordTemp_2)); - float tmpvar_16; - float z_17; + float tmpvar_16 = 0; + float z_17 = 0; z_17 = float(tmpvar_15.x); tmpvar_16 = (1.0/(((_mtl_u._ZBufferParams.x * z_17) + _mtl_u._ZBufferParams.y))); depth_1 = float4(tmpvar_16); - float4 v_18; + float4 v_18 = 0; v_18.x = _mtl_u._FrustumRays[0].x; v_18.y = _mtl_u._FrustumRays[1].x; v_18.z = _mtl_u._FrustumRays[2].x; v_18.w = _mtl_u._FrustumRays[3].x; - float4 v_19; + float4 v_19 = 0; v_19.x = _mtl_u._FrustumRays[0].y; v_19.y = _mtl_u._FrustumRays[1].y; v_19.z = _mtl_u._FrustumRays[2].y; v_19.w = _mtl_u._FrustumRays[3].y; - float4 v_20; + float4 v_20 = 0; v_20.x = _mtl_u._FrustumRays[0].w; v_20.y = _mtl_u._FrustumRays[1].w; v_20.z = _mtl_u._FrustumRays[2].w; v_20.w = _mtl_u._FrustumRays[3].w; - float4 v_21; + float4 v_21 = 0; v_21.x = _mtl_u._FrustumRays[0].z; v_21.y = _mtl_u._FrustumRays[1].z; v_21.z = _mtl_u._FrustumRays[2].z; v_21.w = _mtl_u._FrustumRays[3].z; - float3 tmpvar_22; + float3 tmpvar_22 = 0; tmpvar_22 = mix (mix (v_18.xyz, v_19.xyz, tmpvar_14.xxx), mix (v_20.xyz, v_21.xyz, tmpvar_14.xxx), tmpvar_14.yyy); - float tmpvar_23; + float tmpvar_23 = 0; tmpvar_23 = sqrt(dot (tmpvar_22, tmpvar_22)); - bool tmpvar_24; - float3 tmpvar_25; + bool tmpvar_24 = false; + float3 tmpvar_25 = 0; tmpvar_25 = (1.0/((tmpvar_22 / tmpvar_23))); - float3 tmpvar_26; + float3 tmpvar_26 = 0; tmpvar_26 = (tmpvar_25 * (-0.5 - _mtl_u._CameraPosLocal.xyz)); - float3 tmpvar_27; + float3 tmpvar_27 = 0; tmpvar_27 = (tmpvar_25 * (0.5 - _mtl_u._CameraPosLocal.xyz)); - float3 tmpvar_28; + float3 tmpvar_28 = 0; tmpvar_28 = min (tmpvar_27, tmpvar_26); - float3 tmpvar_29; + float3 tmpvar_29 = 0; tmpvar_29 = max (tmpvar_27, tmpvar_26); - float2 tmpvar_30; + float2 tmpvar_30 = 0; tmpvar_30 = max (tmpvar_28.xx, tmpvar_28.yz); - float tmpvar_31; + float tmpvar_31 = 0; tmpvar_31 = max (tmpvar_30.x, tmpvar_30.y); - float2 tmpvar_32; + float2 tmpvar_32 = 0; tmpvar_32 = min (tmpvar_29.xx, tmpvar_29.yz); - float tmpvar_33; + float tmpvar_33 = 0; tmpvar_33 = min (tmpvar_32.x, tmpvar_32.y); tmpvar_24 = bool(((tmpvar_31 < tmpvar_33) && (tmpvar_33 > 0.0))); - if (((bool)!(tmpvar_24) || (tmpvar_16 < (tmpvar_31 / tmpvar_23)))) { + if (((bool)(!(tmpvar_24)) || (tmpvar_16 < (tmpvar_31 / tmpvar_23)))) { depth_1 = -(float4(tmpvar_16)); } else { depth_1 = min (depth_1, float4((tmpvar_33 / tmpvar_23))); 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 46530468113..bc86b01a1dc 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 @@ -21,26 +21,26 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _MainTex [[texture(1)]], sampler _mtlsmp__MainTex [[sampler(1)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; - half3 tmpvar_2; - half tmpvar_3; - half4 tmpvar_4; + half4 c_1 = 0; + half3 tmpvar_2 = 0; + half tmpvar_3 = 0; + half4 tmpvar_4 = 0; tmpvar_4 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i._uv0.xy)); tmpvar_2 = (tmpvar_4.xyz * _mtl_u._Color.xyz); tmpvar_3 = (tmpvar_4.w * _mtl_u._Color.w); - half4 tmpvar_5; + half4 tmpvar_5 = 0; tmpvar_5 = _BumpMap.sample(_mtlsmp__BumpMap, (float2)(_mtl_i._uv0.zw)); - half4 packednormal_6; + half4 packednormal_6 = 0; packednormal_6 = tmpvar_5; - half4 normal_7; - normal_7.xy = ((packednormal_6.wy * (half)2.0) - (half)1.0); - normal_7.z = sqrt((((half)1.0 - + half4 normal_7 = 0; + normal_7.xy = ((packednormal_6.wy * (half)(2.0)) - (half)(1.0)); + normal_7.z = sqrt((((half)(1.0) - (normal_7.x * normal_7.x) ) - (normal_7.y * normal_7.y))); - half4 c_8; - half spec_9; - half tmpvar_10; - float y_11; + half4 c_8 = 0; + half spec_9 = 0; + half tmpvar_10 = 0; + float y_11 = 0; y_11 = (_mtl_u._Shininess * 128.0); tmpvar_10 = ((half)pow ((float)max ((half)0.0, dot (normal_7.xyz, normalize((_mtl_i._uv2 + normalize(_mtl_i._uv1))) @@ -52,11 +52,11 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] max ((half)0.0, dot (normal_7.xyz, _mtl_i._uv2)) ) + ( (_mtl_u._LightColor0.xyz * _mtl_u._SpecColor.xyz) - * spec_9)) * (half)2.0); + * spec_9)) * (half)(2.0)); c_8.w = (tmpvar_3 + ((_mtl_u._LightColor0.w * _mtl_u._SpecColor.w) * spec_9)); c_1.xyz = (c_8.xyz + (tmpvar_2 * _mtl_i._uv3)); c_1.w = tmpvar_3; - half4 tmpvar_12; + half4 tmpvar_12 = 0; tmpvar_12 = c_1; _mtl_o._fragData = tmpvar_12; return _mtl_o; 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 1d2fdeaed7e..66162e907d6 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 @@ -23,34 +23,34 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _ShadowMapTexture [[texture(1)]], sampler _mtlsmp__ShadowMapTexture [[sampler(1)]]) { xlatMtlShaderOutput _mtl_o; - half4 tmpvar_1; - float4 res_2; - float depth_3; - half4 tmpvar_4; + half4 tmpvar_1 = 0; + float4 res_2 = 0; + float depth_3 = 0; + half4 tmpvar_4 = 0; tmpvar_4 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(_mtl_i.xlv_TEXCOORD0)); depth_3 = float(tmpvar_4.x); - float tmpvar_5; + float tmpvar_5 = 0; tmpvar_5 = (1.0/(((_mtl_u._ZBufferParams.x * depth_3) + _mtl_u._ZBufferParams.y))); depth_3 = tmpvar_5; - float4 tmpvar_6; + float4 tmpvar_6 = 0; tmpvar_6.w = 1.0; tmpvar_6.xyz = (_mtl_i.xlv_TEXCOORD1 * tmpvar_5); - half shadow_7; - float4 weights_8; - float4 far_9; - float4 near_10; - bool4 tmpvar_11; + half shadow_7 = 0; + float4 weights_8 = 0; + float4 far_9 = 0; + float4 near_10 = 0; + bool4 tmpvar_11 = false; tmpvar_11 = bool4((tmpvar_6.zzzz >= _mtl_u._LightSplitsNear)); - half4 tmpvar_12; + half4 tmpvar_12 = 0; tmpvar_12 = half4(tmpvar_11); near_10 = float4(tmpvar_12); - bool4 tmpvar_13; + bool4 tmpvar_13 = false; tmpvar_13 = bool4((tmpvar_6.zzzz < _mtl_u._LightSplitsFar)); - half4 tmpvar_14; + half4 tmpvar_14 = 0; tmpvar_14 = half4(tmpvar_13); far_9 = float4(tmpvar_14); weights_8 = (near_10 * far_9); - float4 tmpvar_15; + float4 tmpvar_15 = 0; tmpvar_15.w = 1.0; tmpvar_15.xyz = ((( ((_mtl_u._View2Shadow * tmpvar_6).xyz * weights_8.x) @@ -59,10 +59,10 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] ) + ( (_mtl_u._View2Shadow2 * tmpvar_6) .xyz * weights_8.z)) + ((_mtl_u._View2Shadow3 * tmpvar_6).xyz * weights_8.w)); - half4 tmpvar_16; + half4 tmpvar_16 = 0; tmpvar_16 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float2)(tmpvar_15.xy)); - float tmpvar_17; - if (((float)tmpvar_16.x < tmpvar_15.z)) { + float tmpvar_17 = 0; + if (((float)(tmpvar_16.x) < tmpvar_15.z)) { tmpvar_17 = _mtl_u._LightShadowData.x; } else { tmpvar_17 = 1.0; @@ -70,9 +70,9 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] shadow_7 = half(tmpvar_17); res_2.x = float(shadow_7); res_2.y = 1.0; - float2 enc_18; + float2 enc_18 = 0; enc_18 = (float2(1.0, 255.0) * (1.0 - tmpvar_5)); - float2 tmpvar_19; + float2 tmpvar_19 = 0; tmpvar_19 = fract(enc_18); enc_18.y = tmpvar_19.y; enc_18.x = (tmpvar_19.x - (tmpvar_19.y * 0.00392157)); 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 6fa4138a027..7856f19600d 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 @@ -14,119 +14,119 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _MainTex [[texture(0)]], sampler _mtlsmp__MainTex [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - float2 rcpFrame_1; + float2 rcpFrame_1 = 0; rcpFrame_1 = _mtl_u._MainTex_TexelSize.xy; - half3 tmpvar_2; - bool doneP_4; - bool doneN_5; - half lumaEndP_6; - half lumaEndN_7; - float2 offNP_8; - float2 posP_9; - float2 posN_10; - half gradientN_11; - float lengthSign_12; - half3 rgbL_13; - half lumaS_14; - half lumaN_15; - float4 tmpvar_16; + half3 tmpvar_2 = 0; + bool doneP_4 = false; + bool doneN_5 = false; + half lumaEndP_6 = 0; + half lumaEndN_7 = 0; + float2 offNP_8 = 0; + float2 posP_9 = 0; + float2 posN_10 = 0; + half gradientN_11 = 0; + float lengthSign_12 = 0; + half3 rgbL_13 = 0; + half lumaS_14 = 0; + half lumaN_15 = 0; + float4 tmpvar_16 = 0; tmpvar_16.zw = float2(0.0, 0.0); tmpvar_16.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(0.0, -1.0) * _mtl_u._MainTex_TexelSize.xy)); - half4 tmpvar_17; + half4 tmpvar_17 = 0; tmpvar_17 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_16.xy), level(0.0)); - float4 tmpvar_18; + float4 tmpvar_18 = 0; tmpvar_18.zw = float2(0.0, 0.0); tmpvar_18.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(-1.0, 0.0) * _mtl_u._MainTex_TexelSize.xy)); - half4 tmpvar_19; + half4 tmpvar_19 = 0; tmpvar_19 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_18.xy), level(0.0)); - half4 tmpvar_20; + half4 tmpvar_20 = 0; tmpvar_20 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0), level(0.0)); - float4 tmpvar_21; + float4 tmpvar_21 = 0; tmpvar_21.zw = float2(0.0, 0.0); tmpvar_21.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(1.0, 0.0) * _mtl_u._MainTex_TexelSize.xy)); - half4 tmpvar_22; + half4 tmpvar_22 = 0; tmpvar_22 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_21.xy), level(0.0)); - float4 tmpvar_23; + float4 tmpvar_23 = 0; tmpvar_23.zw = float2(0.0, 0.0); tmpvar_23.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(0.0, 1.0) * _mtl_u._MainTex_TexelSize.xy)); - half4 tmpvar_24; + half4 tmpvar_24 = 0; tmpvar_24 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_23.xy), level(0.0)); - half tmpvar_25; - tmpvar_25 = ((tmpvar_17.y * (half)1.963211) + tmpvar_17.x); + half tmpvar_25 = 0; + tmpvar_25 = ((tmpvar_17.y * (half)(1.963211)) + tmpvar_17.x); lumaN_15 = tmpvar_25; - half tmpvar_26; - tmpvar_26 = ((tmpvar_19.y * (half)1.963211) + tmpvar_19.x); - half tmpvar_27; - tmpvar_27 = ((tmpvar_20.y * (half)1.963211) + tmpvar_20.x); - half tmpvar_28; - tmpvar_28 = ((tmpvar_22.y * (half)1.963211) + tmpvar_22.x); - half tmpvar_29; - tmpvar_29 = ((tmpvar_24.y * (half)1.963211) + tmpvar_24.x); + half tmpvar_26 = 0; + tmpvar_26 = ((tmpvar_19.y * (half)(1.963211)) + tmpvar_19.x); + half tmpvar_27 = 0; + tmpvar_27 = ((tmpvar_20.y * (half)(1.963211)) + tmpvar_20.x); + half tmpvar_28 = 0; + tmpvar_28 = ((tmpvar_22.y * (half)(1.963211)) + tmpvar_22.x); + half tmpvar_29 = 0; + tmpvar_29 = ((tmpvar_24.y * (half)(1.963211)) + tmpvar_24.x); lumaS_14 = tmpvar_29; - half tmpvar_30; + half tmpvar_30 = 0; tmpvar_30 = max (max (tmpvar_27, tmpvar_25), max (max (tmpvar_26, tmpvar_29), tmpvar_28)); - half tmpvar_31; + half tmpvar_31 = 0; tmpvar_31 = (tmpvar_30 - min (min (tmpvar_27, tmpvar_25), min ( min (tmpvar_26, tmpvar_29) , tmpvar_28))); - half tmpvar_32; - tmpvar_32 = max ((half)0.04166667, (tmpvar_30 * (half)0.125)); + half tmpvar_32 = 0; + tmpvar_32 = max ((half)0.04166667, (tmpvar_30 * (half)(0.125))); if ((tmpvar_31 < tmpvar_32)) { tmpvar_2 = tmpvar_20.xyz; } else { - half tmpvar_33; + half tmpvar_33 = 0; tmpvar_33 = min ((half)0.75, (max ((half)0.0, ((abs(( - (((tmpvar_25 + tmpvar_26) + (tmpvar_28 + tmpvar_29)) * (half)0.25) - - tmpvar_27)) / tmpvar_31) - (half)0.25) - ) * (half)1.333333)); - float4 tmpvar_34; + (((tmpvar_25 + tmpvar_26) + (tmpvar_28 + tmpvar_29)) * (half)(0.25)) + - tmpvar_27)) / tmpvar_31) - (half)(0.25)) + ) * (half)(1.333333))); + float4 tmpvar_34 = 0; tmpvar_34.zw = float2(0.0, 0.0); tmpvar_34.xy = (_mtl_i.xlv_TEXCOORD0 - _mtl_u._MainTex_TexelSize.xy); - half4 tmpvar_35; + half4 tmpvar_35 = 0; tmpvar_35 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_34.xy), level(0.0)); - float4 tmpvar_36; + float4 tmpvar_36 = 0; tmpvar_36.zw = float2(0.0, 0.0); tmpvar_36.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(1.0, -1.0) * _mtl_u._MainTex_TexelSize.xy)); - half4 tmpvar_37; + half4 tmpvar_37 = 0; tmpvar_37 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_36.xy), level(0.0)); - float4 tmpvar_38; + float4 tmpvar_38 = 0; tmpvar_38.zw = float2(0.0, 0.0); tmpvar_38.xy = (_mtl_i.xlv_TEXCOORD0 + (float2(-1.0, 1.0) * _mtl_u._MainTex_TexelSize.xy)); - half4 tmpvar_39; + half4 tmpvar_39 = 0; tmpvar_39 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_38.xy), level(0.0)); - float4 tmpvar_40; + float4 tmpvar_40 = 0; tmpvar_40.zw = float2(0.0, 0.0); tmpvar_40.xy = (_mtl_i.xlv_TEXCOORD0 + _mtl_u._MainTex_TexelSize.xy); - half4 tmpvar_41; + half4 tmpvar_41 = 0; tmpvar_41 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_40.xy), level(0.0)); rgbL_13 = (((tmpvar_17.xyz + tmpvar_19.xyz) + (tmpvar_20.xyz + tmpvar_22.xyz)) + ((tmpvar_24.xyz + tmpvar_35.xyz) + ( (tmpvar_37.xyz + tmpvar_39.xyz) + tmpvar_41.xyz))); - rgbL_13 = (rgbL_13 * (half3)float3(0.1111111, 0.1111111, 0.1111111)); - half tmpvar_42; - tmpvar_42 = ((tmpvar_35.y * (half)1.963211) + tmpvar_35.x); - half tmpvar_43; - tmpvar_43 = ((tmpvar_37.y * (half)1.963211) + tmpvar_37.x); - half tmpvar_44; - tmpvar_44 = ((tmpvar_39.y * (half)1.963211) + tmpvar_39.x); - half tmpvar_45; - tmpvar_45 = ((tmpvar_41.y * (half)1.963211) + tmpvar_41.x); - bool tmpvar_46; + rgbL_13 = (rgbL_13 * (half3)(float3(0.1111111, 0.1111111, 0.1111111))); + half tmpvar_42 = 0; + tmpvar_42 = ((tmpvar_35.y * (half)(1.963211)) + tmpvar_35.x); + half tmpvar_43 = 0; + tmpvar_43 = ((tmpvar_37.y * (half)(1.963211)) + tmpvar_37.x); + half tmpvar_44 = 0; + tmpvar_44 = ((tmpvar_39.y * (half)(1.963211)) + tmpvar_39.x); + half tmpvar_45 = 0; + tmpvar_45 = ((tmpvar_41.y * (half)(1.963211)) + tmpvar_41.x); + bool tmpvar_46 = false; tmpvar_46 = ((( - abs(((((half)0.25 * tmpvar_42) + ((half)-0.5 * tmpvar_26)) + ((half)0.25 * tmpvar_44))) + abs(((((half)(0.25) * tmpvar_42) + ((half)(-0.5) * tmpvar_26)) + ((half)(0.25) * tmpvar_44))) + - abs(((((half)0.5 * tmpvar_25) - tmpvar_27) + ((half)0.5 * tmpvar_29))) + abs(((((half)(0.5) * tmpvar_25) - tmpvar_27) + ((half)(0.5) * tmpvar_29))) ) + abs( - ((((half)0.25 * tmpvar_43) + ((half)-0.5 * tmpvar_28)) + ((half)0.25 * tmpvar_45)) + ((((half)(0.25) * tmpvar_43) + ((half)(-0.5) * tmpvar_28)) + ((half)(0.25) * tmpvar_45)) )) >= (( - abs(((((half)0.25 * tmpvar_42) + ((half)-0.5 * tmpvar_25)) + ((half)0.25 * tmpvar_43))) + abs(((((half)(0.25) * tmpvar_42) + ((half)(-0.5) * tmpvar_25)) + ((half)(0.25) * tmpvar_43))) + - abs(((((half)0.5 * tmpvar_26) - tmpvar_27) + ((half)0.5 * tmpvar_28))) + abs(((((half)(0.5) * tmpvar_26) - tmpvar_27) + ((half)(0.5) * tmpvar_28))) ) + abs( - ((((half)0.25 * tmpvar_44) + ((half)-0.5 * tmpvar_29)) + ((half)0.25 * tmpvar_45)) + ((((half)(0.25) * tmpvar_44) + ((half)(-0.5) * tmpvar_29)) + ((half)(0.25) * tmpvar_45)) ))); - float tmpvar_47; + float tmpvar_47 = 0; if (tmpvar_46) { tmpvar_47 = -(_mtl_u._MainTex_TexelSize.y); } else { @@ -139,14 +139,14 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] if (!(tmpvar_46)) { lumaS_14 = tmpvar_28; }; - half tmpvar_48; + half tmpvar_48 = 0; tmpvar_48 = abs((lumaN_15 - tmpvar_27)); gradientN_11 = tmpvar_48; - half tmpvar_49; + half tmpvar_49 = 0; tmpvar_49 = abs((lumaS_14 - tmpvar_27)); - lumaN_15 = ((lumaN_15 + tmpvar_27) * (half)0.5); - lumaS_14 = ((lumaS_14 + tmpvar_27) * (half)0.5); - bool tmpvar_50; + lumaN_15 = ((lumaN_15 + tmpvar_27) * (half)(0.5)); + lumaS_14 = ((lumaS_14 + tmpvar_27) * (half)(0.5)); + bool tmpvar_50 = false; tmpvar_50 = (tmpvar_48 >= tmpvar_49); if (!(tmpvar_50)) { lumaN_15 = lumaS_14; @@ -157,30 +157,30 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] if (!(tmpvar_50)) { lengthSign_12 = -(tmpvar_47); }; - float tmpvar_51; + float tmpvar_51 = 0; if (tmpvar_46) { tmpvar_51 = 0.0; } else { tmpvar_51 = (lengthSign_12 * 0.5); }; posN_10.x = (_mtl_i.xlv_TEXCOORD0.x + tmpvar_51); - float tmpvar_52; + float tmpvar_52 = 0; if (tmpvar_46) { tmpvar_52 = (lengthSign_12 * 0.5); } else { tmpvar_52 = 0.0; }; posN_10.y = (_mtl_i.xlv_TEXCOORD0.y + tmpvar_52); - gradientN_11 = (gradientN_11 * (half)0.25); + gradientN_11 = (gradientN_11 * (half)(0.25)); posP_9 = posN_10; - float2 tmpvar_53; + float2 tmpvar_53 = 0; if (tmpvar_46) { - float2 tmpvar_54; + float2 tmpvar_54 = 0; tmpvar_54.y = 0.0; tmpvar_54.x = rcpFrame_1.x; tmpvar_53 = tmpvar_54; } else { - float2 tmpvar_55; + float2 tmpvar_55 = 0; tmpvar_55.x = 0.0; tmpvar_55.y = rcpFrame_1.y; tmpvar_53 = tmpvar_55; @@ -194,23 +194,23 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] posP_9 = (posP_9 + tmpvar_53); for (int i_3 = 0; i_3 < 16; i_3++) { if (!(doneN_5)) { - half4 tmpvar_56; + half4 tmpvar_56 = 0; tmpvar_56 = _MainTex.sample(_mtlsmp__MainTex, (float2)(posN_10), level(0.0)); - lumaEndN_7 = ((tmpvar_56.y * (half)1.963211) + tmpvar_56.x); + lumaEndN_7 = ((tmpvar_56.y * (half)(1.963211)) + tmpvar_56.x); }; if (!(doneP_4)) { - half4 tmpvar_57; + half4 tmpvar_57 = 0; tmpvar_57 = _MainTex.sample(_mtlsmp__MainTex, (float2)(posP_9), level(0.0)); - lumaEndP_6 = ((tmpvar_57.y * (half)1.963211) + tmpvar_57.x); + lumaEndP_6 = ((tmpvar_57.y * (half)(1.963211)) + tmpvar_57.x); }; - bool tmpvar_58; + bool tmpvar_58 = false; if (doneN_5) { tmpvar_58 = bool(bool(1)); } else { tmpvar_58 = (abs((lumaEndN_7 - lumaN_15)) >= gradientN_11); }; doneN_5 = tmpvar_58; - bool tmpvar_59; + bool tmpvar_59 = false; if (doneP_4) { tmpvar_59 = bool(bool(1)); } else { @@ -227,66 +227,66 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] posP_9 = (posP_9 + offNP_8); }; }; - float tmpvar_60; + float tmpvar_60 = 0; if (tmpvar_46) { tmpvar_60 = (_mtl_i.xlv_TEXCOORD0.x - posN_10.x); } else { tmpvar_60 = (_mtl_i.xlv_TEXCOORD0.y - posN_10.y); }; - float tmpvar_61; + float tmpvar_61 = 0; if (tmpvar_46) { tmpvar_61 = (posP_9.x - _mtl_i.xlv_TEXCOORD0.x); } else { tmpvar_61 = (posP_9.y - _mtl_i.xlv_TEXCOORD0.y); }; - bool tmpvar_62; + bool tmpvar_62 = false; tmpvar_62 = (tmpvar_60 < tmpvar_61); - half tmpvar_63; + half tmpvar_63 = 0; if (tmpvar_62) { tmpvar_63 = lumaEndN_7; } else { tmpvar_63 = lumaEndP_6; }; lumaEndN_7 = tmpvar_63; - if ((((tmpvar_27 - lumaN_15) < (half)0.0) == ((tmpvar_63 - lumaN_15) < (half)0.0))) { + if ((((tmpvar_27 - lumaN_15) < (half)(0.0)) == ((tmpvar_63 - lumaN_15) < (half)(0.0)))) { lengthSign_12 = 0.0; }; - float tmpvar_64; + float tmpvar_64 = 0; tmpvar_64 = (tmpvar_61 + tmpvar_60); - float tmpvar_65; + float tmpvar_65 = 0; if (tmpvar_62) { tmpvar_65 = tmpvar_60; } else { tmpvar_65 = tmpvar_61; }; - float tmpvar_66; + float tmpvar_66 = 0; tmpvar_66 = ((0.5 + (tmpvar_65 * (-1.0 / tmpvar_64) )) * lengthSign_12); - float tmpvar_67; + float tmpvar_67 = 0; if (tmpvar_46) { tmpvar_67 = 0.0; } else { tmpvar_67 = tmpvar_66; }; - float tmpvar_68; + float tmpvar_68 = 0; if (tmpvar_46) { tmpvar_68 = tmpvar_66; } else { tmpvar_68 = 0.0; }; - float2 tmpvar_69; + float2 tmpvar_69 = 0; tmpvar_69.x = (_mtl_i.xlv_TEXCOORD0.x + tmpvar_67); tmpvar_69.y = (_mtl_i.xlv_TEXCOORD0.y + tmpvar_68); - half4 tmpvar_70; + half4 tmpvar_70 = 0; tmpvar_70 = _MainTex.sample(_mtlsmp__MainTex, (float2)(tmpvar_69), level(0.0)); - half3 tmpvar_71; + half3 tmpvar_71 = 0; tmpvar_71.x = -(tmpvar_33); tmpvar_71.y = -(tmpvar_33); tmpvar_71.z = -(tmpvar_33); tmpvar_2 = ((tmpvar_71 * tmpvar_70.xyz) + ((rgbL_13 * half3(tmpvar_33)) + tmpvar_70.xyz)); }; - half4 tmpvar_72; + half4 tmpvar_72 = 0; tmpvar_72.w = half(0.0); tmpvar_72.xyz = tmpvar_2; _mtl_o._fragData = tmpvar_72; 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 57b1c341d4d..69c08c6785f 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 @@ -28,138 +28,138 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texturecube<half> _ShadowMapTexture [[texture(4)]], sampler _mtlsmp__ShadowMapTexture [[sampler(4)]]) { xlatMtlShaderOutput _mtl_o; - half4 res_1; - float spec_2; - half3 h_3; - float atten_4; - half3 lightDir_5; - float3 tolight_6; - float3 wpos_7; - float depth_8; - half3 normal_9; - half4 nspec_10; - float2 uv_11; + half4 res_1 = 0; + float spec_2 = 0; + half3 h_3 = 0; + float atten_4 = 0; + half3 lightDir_5 = 0; + float3 tolight_6 = 0; + float3 wpos_7 = 0; + float depth_8 = 0; + half3 normal_9 = 0; + half4 nspec_10 = 0; + float2 uv_11 = 0; uv_11 = (_mtl_i.xlv_TEXCOORD0.xy / _mtl_i.xlv_TEXCOORD0.w); - half4 tmpvar_12; + half4 tmpvar_12 = 0; tmpvar_12 = _CameraNormalsTexture.sample(_mtlsmp__CameraNormalsTexture, (float2)(uv_11)); nspec_10 = tmpvar_12; - normal_9 = ((nspec_10.xyz * (half)2.0) - (half)1.0); + normal_9 = ((nspec_10.xyz * (half)(2.0)) - (half)(1.0)); normal_9 = normalize(normal_9); - half4 tmpvar_13; + half4 tmpvar_13 = 0; tmpvar_13 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(uv_11)); depth_8 = float(tmpvar_13.x); - float tmpvar_14; + float tmpvar_14 = 0; tmpvar_14 = (1.0/(((_mtl_u._ZBufferParams.x * depth_8) + _mtl_u._ZBufferParams.y))); depth_8 = tmpvar_14; - float4 tmpvar_15; + float4 tmpvar_15 = 0; tmpvar_15.w = 1.0; tmpvar_15.xyz = ((_mtl_i.xlv_TEXCOORD1 * (_mtl_u._ProjectionParams.z / _mtl_i.xlv_TEXCOORD1.z)) * tmpvar_14); wpos_7 = (_mtl_u._CameraToWorld * tmpvar_15).xyz; tolight_6 = (wpos_7 - _mtl_u._LightPos.xyz); - float3 tmpvar_16; + float3 tmpvar_16 = 0; tmpvar_16 = normalize(tolight_6); lightDir_5 = half3(-(tmpvar_16)); - float2 tmpvar_17; + float2 tmpvar_17 = 0; tmpvar_17 = float2((dot (tolight_6, tolight_6) * _mtl_u._LightPos.w)); - half4 tmpvar_18; + half4 tmpvar_18 = 0; tmpvar_18 = _LightTextureB0.sample(_mtlsmp__LightTextureB0, (float2)(tmpvar_17)); atten_4 = float(tmpvar_18.w); - float mydist_19; + float mydist_19 = 0; mydist_19 = (sqrt(dot (tolight_6, tolight_6)) * _mtl_u._LightPositionRange.w); mydist_19 = (mydist_19 * 0.97); - float4 shadowVals_20; - float3 vec_21; + float4 shadowVals_20 = 0; + float3 vec_21 = 0; vec_21 = (tolight_6 + float3(0.0078125, 0.0078125, 0.0078125)); - float4 packDist_22; - half4 tmpvar_23; + float4 packDist_22 = 0; + half4 tmpvar_23 = 0; tmpvar_23 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_21)); packDist_22 = float4(tmpvar_23); shadowVals_20.x = dot (packDist_22, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09)); - float3 vec_24; + float3 vec_24 = 0; vec_24 = (tolight_6 + float3(-0.0078125, -0.0078125, 0.0078125)); - float4 packDist_25; - half4 tmpvar_26; + float4 packDist_25 = 0; + half4 tmpvar_26 = 0; tmpvar_26 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_24)); packDist_25 = float4(tmpvar_26); shadowVals_20.y = dot (packDist_25, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09)); - float3 vec_27; + float3 vec_27 = 0; vec_27 = (tolight_6 + float3(-0.0078125, 0.0078125, -0.0078125)); - float4 packDist_28; - half4 tmpvar_29; + float4 packDist_28 = 0; + half4 tmpvar_29 = 0; tmpvar_29 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_27)); packDist_28 = float4(tmpvar_29); shadowVals_20.z = dot (packDist_28, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09)); - float3 vec_30; + float3 vec_30 = 0; vec_30 = (tolight_6 + float3(0.0078125, -0.0078125, -0.0078125)); - float4 packDist_31; - half4 tmpvar_32; + float4 packDist_31 = 0; + half4 tmpvar_32 = 0; tmpvar_32 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float3)(vec_30)); packDist_31 = float4(tmpvar_32); shadowVals_20.w = dot (packDist_31, float4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09)); - bool4 tmpvar_33; + bool4 tmpvar_33 = false; tmpvar_33 = bool4((shadowVals_20 < float4(mydist_19))); - float4 tmpvar_34; + float4 tmpvar_34 = 0; tmpvar_34 = _mtl_u._LightShadowData.xxxx; - float tmpvar_35; + float tmpvar_35 = 0; if (tmpvar_33.x) { tmpvar_35 = tmpvar_34.x; } else { tmpvar_35 = 1.0; }; - float tmpvar_36; + float tmpvar_36 = 0; if (tmpvar_33.y) { tmpvar_36 = tmpvar_34.y; } else { tmpvar_36 = 1.0; }; - float tmpvar_37; + float tmpvar_37 = 0; if (tmpvar_33.z) { tmpvar_37 = tmpvar_34.z; } else { tmpvar_37 = 1.0; }; - float tmpvar_38; + float tmpvar_38 = 0; if (tmpvar_33.w) { tmpvar_38 = tmpvar_34.w; } else { tmpvar_38 = 1.0; }; - half4 tmpvar_39; + half4 tmpvar_39 = 0; tmpvar_39.x = half(tmpvar_35); tmpvar_39.y = half(tmpvar_36); tmpvar_39.z = half(tmpvar_37); tmpvar_39.w = half(tmpvar_38); - half tmpvar_40; + half tmpvar_40 = 0; tmpvar_40 = dot (tmpvar_39, (half4)float4(0.25, 0.25, 0.25, 0.25)); - atten_4 = (atten_4 * (float)tmpvar_40); - float4 tmpvar_41; + atten_4 = (atten_4 * (float)(tmpvar_40)); + float4 tmpvar_41 = 0; tmpvar_41.w = 1.0; tmpvar_41.xyz = wpos_7; - half4 tmpvar_42; - float3 P_43; + half4 tmpvar_42 = 0; + float3 P_43 = 0; P_43 = (_mtl_u._LightMatrix0 * tmpvar_41).xyz; tmpvar_42 = _LightTexture0.sample(_mtlsmp__LightTexture0, (float3)(P_43)); - atten_4 = (atten_4 * (float)tmpvar_42.w); - float3 tmpvar_44; - tmpvar_44 = normalize(((float3)lightDir_5 - normalize( + atten_4 = (atten_4 * (float)(tmpvar_42.w)); + float3 tmpvar_44 = 0; + tmpvar_44 = normalize(((float3)(lightDir_5) - normalize( (wpos_7 - _mtl_u._WorldSpaceCameraPos) ))); h_3 = half3(tmpvar_44); - half tmpvar_45; - tmpvar_45 = pow (max ((half)0.0, dot (h_3, normal_9)), (nspec_10.w * (half)128.0)); + half tmpvar_45 = 0; + tmpvar_45 = pow (max ((half)0.0, dot (h_3, normal_9)), (nspec_10.w * (half)(128.0))); spec_2 = float(tmpvar_45); spec_2 = (spec_2 * clamp (atten_4, 0.0, 1.0)); - res_1.xyz = half3((_mtl_u._LightColor.xyz * ((float)max ((half)0.0, + res_1.xyz = half3((_mtl_u._LightColor.xyz * ((float)(max ((half)0.0, dot (lightDir_5, normal_9) - ) * atten_4))); - half3 c_46; + )) * atten_4))); + half3 c_46 = 0; c_46 = half3(_mtl_u._LightColor.xyz); - res_1.w = half((spec_2 * (float)dot (c_46, (half3)float3(0.22, 0.707, 0.071)))); - float tmpvar_47; + res_1.w = half((spec_2 * (float)(dot (c_46, (half3)float3(0.22, 0.707, 0.071))))); + float tmpvar_47 = 0; tmpvar_47 = clamp ((1.0 - ( (tmpvar_15.z * _mtl_u.unity_LightmapFade.z) + _mtl_u.unity_LightmapFade.w)), 0.0, 1.0); - res_1 = ((half4)((float4)res_1 * tmpvar_47)); + res_1 = ((half4)((float4)(res_1) * tmpvar_47)); _mtl_o._fragData = exp2(-(res_1)); return _mtl_o; } 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 97b273a9011..23a9b2745f0 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 @@ -15,26 +15,26 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _Curve [[texture(1)]], sampler _mtlsmp__Curve [[sampler(1)]]) { xlatMtlShaderOutput _mtl_o; - float newLum_1; - float3 cie_2; - float4 color_3; - half4 tmpvar_4; + float newLum_1 = 0; + float3 cie_2 = 0; + float4 color_3 = 0; + half4 tmpvar_4 = 0; tmpvar_4 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); color_3 = float4(tmpvar_4); - float3 Yxy_5; - float3 tmpvar_6; + float3 Yxy_5 = 0; + float3 tmpvar_6 = 0; tmpvar_6 = (float3x3(float3(0.514136, 0.265068, 0.0241188), float3(0.323879, 0.670234, 0.122818), float3(0.160364, 0.0640916, 0.844427)) * color_3.xyz); Yxy_5.x = tmpvar_6.y; Yxy_5.yz = (tmpvar_6.xy / dot (float3(1.0, 1.0, 1.0), tmpvar_6)); cie_2.yz = Yxy_5.yz; - float2 tmpvar_7; + float2 tmpvar_7 = 0; tmpvar_7.y = 0.5; tmpvar_7.x = (tmpvar_6.y * _mtl_u._RangeScale); - half tmpvar_8; + half tmpvar_8 = 0; tmpvar_8 = _Curve.sample(_mtlsmp__Curve, (float2)(tmpvar_7)).x; newLum_1 = float(tmpvar_8); cie_2.x = newLum_1; - float3 XYZ_9; + float3 XYZ_9 = 0; XYZ_9.x = ((newLum_1 * Yxy_5.y) / Yxy_5.z); XYZ_9.y = cie_2.x; XYZ_9.z = ((newLum_1 * ( 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 4a8dc6d47f1..7d379372097 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 @@ -24,31 +24,31 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _TranslucencyMap [[texture(2)]], sampler _mtlsmp__TranslucencyMap [[sampler(2)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; - half nh_2; - half nl_3; - half3 lightColor_4; - half3 backContribs_5; - half3 light_6; - half gloss_7; - half specular_8; - half3 albedo_9; - half4 tmpvar_10; + half4 c_1 = 0; + half nh_2 = 0; + half nl_3 = 0; + half3 lightColor_4 = 0; + half3 backContribs_5 = 0; + half3 light_6 = 0; + half gloss_7 = 0; + half specular_8 = 0; + half3 albedo_9 = 0; + half4 tmpvar_10 = 0; tmpvar_10 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); - half x_11; + half x_11 = 0; x_11 = (tmpvar_10.w - _mtl_u._Cutoff); - if ((x_11 < (half)0.0)) { + if ((x_11 < (half)(0.0))) { discard_fragment(); }; - albedo_9 = half3(((float3)tmpvar_10.xyz * _mtl_i.xlv_TEXCOORD1)); - half4 tmpvar_12; + albedo_9 = half3(((float3)(tmpvar_10.xyz) * _mtl_i.xlv_TEXCOORD1)); + half4 tmpvar_12 = 0; tmpvar_12 = _BumpSpecMap.sample(_mtlsmp__BumpSpecMap, (float2)(_mtl_i.xlv_TEXCOORD0)); - specular_8 = (tmpvar_12.x * (half)128.0); - half4 tmpvar_13; + specular_8 = (tmpvar_12.x * (half)(128.0)); + half4 tmpvar_13 = 0; tmpvar_13 = _TranslucencyMap.sample(_mtlsmp__TranslucencyMap, (float2)(_mtl_i.xlv_TEXCOORD0)); gloss_7 = tmpvar_13.w; light_6 = (_mtl_u.UNITY_LIGHTMODEL_AMBIENT.xyz * albedo_9); - backContribs_5 = half3((_mtl_i.xlv_TEXCOORD2 * (float)tmpvar_13.z)); + backContribs_5 = half3((_mtl_i.xlv_TEXCOORD2 * (float)(tmpvar_13.z))); lightColor_4 = half3(_mtl_u._TerrainTreeLightColors[0].xyz); nl_3 = half(_mtl_i.xlv_TEXCOORD3.x); nh_2 = half(_mtl_i.xlv_TEXCOORD4.x); @@ -73,7 +73,7 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] + (_mtl_u._SpecColor.xyz * (pow (nh_2, specular_8) * gloss_7)) ) * lightColor_4)); - c_1.xyz = (light_6 * (half)2.0); + c_1.xyz = (light_6 * (half)(2.0)); c_1.w = half(1.0); _mtl_o._fragData = c_1; return _mtl_o; 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 0984cae0fe0..cfbf05ba49b 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 @@ -35,10 +35,10 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _SelfIllum [[texture(11)]], sampler _mtlsmp__SelfIllum [[sampler(11)]]) { xlatMtlShaderOutput _mtl_o; - half3 lightDir_1; - half3 env_2; - float3 tmpvar_3; - float3 tmpvar_4; + half3 lightDir_1 = 0; + half3 env_2 = 0; + float3 tmpvar_3 = 0; + float3 tmpvar_4 = 0; tmpvar_3 = _mtl_i.xlv_TEXCOORD3.xyz; tmpvar_4 = (((_mtl_i.xlv_TEXCOORD2.yzx * _mtl_i.xlv_TEXCOORD3.zxy) - (_mtl_i.xlv_TEXCOORD2.zxy * _mtl_i.xlv_TEXCOORD3.yzx)) * _mtl_i.xlv_TEXCOORD3.www); float3x3 tmpvar_5; @@ -51,51 +51,51 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] tmpvar_5[2].x = tmpvar_3.z; tmpvar_5[2].y = tmpvar_4.z; tmpvar_5[2].z = _mtl_i.xlv_TEXCOORD2.z; - half3 normal_6; - normal_6.xy = ((_BumpMap.sample(_mtlsmp__BumpMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).wy * (half)2.0) - (half)1.0); - normal_6.xy = ((half2)((float2)normal_6.xy * _mtl_u._BumpScale)); - normal_6.z = sqrt(((half)1.0 - clamp ( + half3 normal_6 = 0; + normal_6.xy = ((_BumpMap.sample(_mtlsmp__BumpMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).wy * (half)(2.0)) - (half)(1.0)); + normal_6.xy = ((half2)((float2)(normal_6.xy) * _mtl_u._BumpScale)); + normal_6.z = sqrt(((half)(1.0) - clamp ( dot (normal_6.xy, normal_6.xy) , (half)0.0, (half)1.0))); - half3 normal_7; - normal_7.xy = ((_DetailNormalMap.sample(_mtlsmp__DetailNormalMap, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).wy * (half)2.0) - (half)1.0); - normal_7.xy = ((half2)((float2)normal_7.xy * _mtl_u._DetailNormalMapScale)); - normal_7.z = sqrt(((half)1.0 - clamp ( + half3 normal_7 = 0; + normal_7.xy = ((_DetailNormalMap.sample(_mtlsmp__DetailNormalMap, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).wy * (half)(2.0)) - (half)(1.0)); + normal_7.xy = ((half2)((float2)(normal_7.xy) * _mtl_u._DetailNormalMapScale)); + normal_7.z = sqrt(((half)(1.0) - clamp ( dot (normal_7.xy, normal_7.xy) , (half)0.0, (half)1.0))); - half3 tmpvar_8; + half3 tmpvar_8 = 0; tmpvar_8.xy = (normal_6.xy + normal_7.xy); tmpvar_8.z = (normal_6.z * normal_7.z); - half3 tmpvar_9; + half3 tmpvar_9 = 0; tmpvar_9 = normalize(tmpvar_8); - half3 tmpvar_10; - tmpvar_10 = ((half3)((float3)tmpvar_9 * tmpvar_5)); - float3 tmpvar_11; + half3 tmpvar_10 = 0; + tmpvar_10 = ((half3)((float3)(tmpvar_9) * tmpvar_5)); + float3 tmpvar_11 = 0; tmpvar_11 = normalize((_mtl_i.xlv_TEXCOORD1.xyz - _mtl_u._WorldSpaceCameraPos)); - half4 tmpvar_12; + half4 tmpvar_12 = 0; tmpvar_12 = _SpecGlossMap.sample(_mtlsmp__SpecGlossMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)); - half tmpvar_13; + half tmpvar_13 = 0; tmpvar_13 = dot (tmpvar_12.xyz, (half3)float3(0.299, 0.587, 0.114)); - half tmpvar_14; - tmpvar_14 = ((half)1.0 - tmpvar_12.w); - half4 tmpvar_15; - tmpvar_15.xyz = ((half3)(tmpvar_11 - (float3)((half)2.0 * ( + half tmpvar_14 = 0; + tmpvar_14 = ((half)(1.0) - tmpvar_12.w); + half4 tmpvar_15 = 0; + tmpvar_15.xyz = ((half3)(tmpvar_11 - (float3)(((half)(2.0) * ( ((half)dot ((float3)tmpvar_10, tmpvar_11)) - * tmpvar_10)))); - tmpvar_15.w = (tmpvar_14 * (half)5.0); - half4 tmpvar_16; + * tmpvar_10))))); + tmpvar_15.w = (tmpvar_14 * (half)(5.0)); + half4 tmpvar_16 = 0; tmpvar_16 = _SpecCube.sample(_mtlsmp__SpecCube, (float3)(tmpvar_15.xyz), level(tmpvar_15.w)); - half tmpvar_17; + half tmpvar_17 = 0; tmpvar_17 = (tmpvar_16.w * tmpvar_16.w); - half2 tmpvar_18; + half2 tmpvar_18 = 0; tmpvar_18.x = tmpvar_17; tmpvar_18.y = (tmpvar_16.w * tmpvar_17); - env_2 = (((half3)((float3)(tmpvar_16.xyz * + env_2 = (((half3)((float3)((tmpvar_16.xyz * dot ((half2)float2(0.7532, 0.2468), tmpvar_18) - ) * _mtl_u._Exposure)) * _Occlusion.sample(_mtlsmp__Occlusion, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).x); - half4 tmpvar_19; + )) * _mtl_u._Exposure)) * _Occlusion.sample(_mtlsmp__Occlusion, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).x); + half4 tmpvar_19 = 0; tmpvar_19 = unity_Lightmap.sample(_mtlsmp_unity_Lightmap, (float2)(_mtl_i.xlv_TEXCOORD4.xy)); - half4 tmpvar_20; + half4 tmpvar_20 = 0; tmpvar_20 = unity_LightmapInd.sample(_mtlsmp_unity_LightmapInd, (float2)(_mtl_i.xlv_TEXCOORD4.xy)); float3x3 tmpvar_21; tmpvar_21[0].x = 0.816497; @@ -107,80 +107,80 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] tmpvar_21[2].x = 0.57735; tmpvar_21[2].y = 0.57735; tmpvar_21[2].z = 0.57735; - half3 tmpvar_22; - tmpvar_22 = (((half)8.0 * tmpvar_20.w) * tmpvar_20.xyz); - float3 v_23; + half3 tmpvar_22 = 0; + tmpvar_22 = (((half)(8.0) * tmpvar_20.w) * tmpvar_20.xyz); + float3 v_23 = 0; v_23.x = tmpvar_21[0].x; v_23.y = tmpvar_21[1].x; v_23.z = tmpvar_21[2].x; - float3 v_24; + float3 v_24 = 0; v_24.x = tmpvar_21[0].y; v_24.y = tmpvar_21[1].y; v_24.z = tmpvar_21[2].y; - float3 v_25; + float3 v_25 = 0; v_25.x = tmpvar_21[0].z; v_25.y = tmpvar_21[1].z; v_25.z = tmpvar_21[2].z; - lightDir_1 = ((half3)((float3)normalize(( - ((tmpvar_22.x * (half3)v_23) + (tmpvar_22.y * (half3)v_24)) + lightDir_1 = ((half3)((float3)(normalize(( + ((tmpvar_22.x * (half3)(v_23)) + (tmpvar_22.y * (half3)(v_24))) + - (tmpvar_22.z * (half3)v_25) - )) * tmpvar_5)); - half3 tmpvar_26; + (tmpvar_22.z * (half3)(v_25)) + ))) * tmpvar_5)); + half3 tmpvar_26 = 0; tmpvar_26 = normalize(lightDir_1); lightDir_1 = tmpvar_26; - half3 lightColor_27; + half3 lightColor_27 = 0; lightColor_27 = (_ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, ((float2)(_mtl_i.xlv_TEXCOORD5).xy / (float)(_mtl_i.xlv_TEXCOORD5).w)).x * (( - ((half)8.0 * tmpvar_19.w) + ((half)(8.0) * tmpvar_19.w) * tmpvar_19.xyz) * dot ( - clamp (((half3)(tmpvar_21 * (float3)tmpvar_9)), (half)0.0, (half)1.0) + clamp (((half3)(tmpvar_21 * (float3)(tmpvar_9))), (half)0.0, (half)1.0) , tmpvar_22))); - float3 viewDir_28; + float3 viewDir_28 = 0; viewDir_28 = -(tmpvar_11); - half3 tmpvar_29; - tmpvar_29 = normalize(((half3)((float3)tmpvar_26 + viewDir_28))); - half tmpvar_30; + half3 tmpvar_29 = 0; + tmpvar_29 = normalize(((half3)((float3)(tmpvar_26) + viewDir_28))); + half tmpvar_30 = 0; tmpvar_30 = max ((half)0.0, dot (tmpvar_10, tmpvar_26)); - half tmpvar_31; + half tmpvar_31 = 0; tmpvar_31 = max ((half)0.0, dot (tmpvar_10, tmpvar_29)); - half tmpvar_32; + half tmpvar_32 = 0; tmpvar_32 = max ((half)0.0, ((half)dot ((float3)tmpvar_10, viewDir_28))); - half tmpvar_33; + half tmpvar_33 = 0; tmpvar_33 = max ((half)0.0, ((half)dot (viewDir_28, (float3)tmpvar_29))); - half VdotH_34; - VdotH_34 = (tmpvar_33 + (half)1e-05); - half tmpvar_35; + half VdotH_34 = 0; + VdotH_34 = (tmpvar_33 + (half)(1e-05)); + half tmpvar_35 = 0; tmpvar_35 = (((half)1.0/(( pow (tmpvar_14, (half)4.0) - + (half)1e-05))) - (half)2.0); - half tmpvar_36; - half tmpvar_37; + + (half)(1e-05)))) - (half)(2.0)); + half tmpvar_36 = 0; + half tmpvar_37 = 0; tmpvar_37 = max ((half)0.0, dot (tmpvar_26, tmpvar_29)); - tmpvar_36 = ((half)0.5 + (((half)2.0 * tmpvar_37) * (tmpvar_37 * tmpvar_14))); - half4 tmpvar_38; + tmpvar_36 = ((half)(0.5) + (((half)(2.0) * tmpvar_37) * (tmpvar_37 * tmpvar_14))); + half4 tmpvar_38 = 0; tmpvar_38.xyz = ((( - (min ((((half3)(_mtl_u._Color.xyz * (float3)_MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz)) * ((half)2.0 * _DetailAlbedoMap.sample(_mtlsmp__DetailAlbedoMap, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).xyz)), ((half3)float3(1.0, 1.0, 1.0) - tmpvar_13)) * ((( - ((half)1.0 + ((tmpvar_36 - (half)1.0) * pow (((half)1.00001 - tmpvar_30), (half)5.0))) + (min ((((half3)(_mtl_u._Color.xyz * (float3)(_MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz))) * ((half)(2.0) * _DetailAlbedoMap.sample(_mtlsmp__DetailAlbedoMap, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).xyz)), ((half3)(float3(1.0, 1.0, 1.0)) - tmpvar_13)) * ((( + ((half)(1.0) + ((tmpvar_36 - (half)(1.0)) * pow (((half)(1.00001) - tmpvar_30), (half)5.0))) * - ((half)1.0 + ((tmpvar_36 - (half)1.0) * pow (((half)1.00001 - tmpvar_32), (half)5.0))) + ((half)(1.0) + ((tmpvar_36 - (half)(1.0)) * pow (((half)(1.00001) - tmpvar_32), (half)5.0))) ) * tmpvar_30) * lightColor_27)) + (tmpvar_12.xyz * (env_2 + (lightColor_27 * max ((half)0.0, ((((tmpvar_13 + - (((half)1.0 - tmpvar_13) * pow (abs(((half)1.0 - tmpvar_33)), (half)5.0)) + (((half)(1.0) - tmpvar_13) * pow (abs(((half)(1.0) - tmpvar_33)), (half)5.0)) ) * min ((half)1.0, - min (((((half)2.0 * tmpvar_31) * tmpvar_32) / VdotH_34), ((((half)2.0 * tmpvar_31) * tmpvar_30) / VdotH_34)) + min (((((half)(2.0) * tmpvar_31) * tmpvar_32) / VdotH_34), ((((half)(2.0) * tmpvar_31) * tmpvar_30) / VdotH_34)) )) * max ((half)0.0, ( pow (tmpvar_31, tmpvar_35) * - ((tmpvar_35 + (half)1.0) / (half)6.28318) - ))) / (((half)4.0 * tmpvar_32) + (half)1e-05)) + ((tmpvar_35 + (half)(1.0)) / (half)(6.28318)) + ))) / (((half)(4.0) * tmpvar_32) + (half)(1e-05))) )))) ) + ( - ((((half)1.0 - dot (tmpvar_12.xyz, (half3)float3(0.299, 0.587, 0.114))) * ((half)1.0 - tmpvar_14)) * pow (abs(((half)1.0 - tmpvar_32)), (half)5.0)) - * env_2)) + ((half3)((float3)_SelfIllum.sample(_mtlsmp__SelfIllum, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz * _mtl_u._SelfIllumScale))); - tmpvar_38.w = ((half)((float)_AlphaMap.sample(_mtlsmp__AlphaMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).w * _mtl_u._Color.w)); - half4 tmpvar_39; + ((((half)(1.0) - dot (tmpvar_12.xyz, (half3)float3(0.299, 0.587, 0.114))) * ((half)(1.0) - tmpvar_14)) * pow (abs(((half)(1.0) - tmpvar_32)), (half)5.0)) + * env_2)) + ((half3)((float3)(_SelfIllum.sample(_mtlsmp__SelfIllum, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz) * _mtl_u._SelfIllumScale))); + tmpvar_38.w = ((half)((float)(_AlphaMap.sample(_mtlsmp__AlphaMap, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).w) * _mtl_u._Color.w)); + half4 tmpvar_39 = 0; tmpvar_39 = tmpvar_38; _mtl_o._fragData = tmpvar_39; return _mtl_o; 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 5a77ed42947..1b8314b3cff 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 @@ -20,44 +20,44 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _MainTex [[texture(2)]], sampler _mtlsmp__MainTex [[sampler(2)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; - half atten_2; - half4 lightCoord_3; - float3 tmpvar_4; + half4 c_1 = 0; + half atten_2 = 0; + half4 lightCoord_3 = 0; + float3 tmpvar_4 = 0; tmpvar_4 = normalize((_mtl_u._WorldSpaceLightPos0.xyz - _mtl_i.xlv_TEXCOORD2)); - half3 tmpvar_5; - half tmpvar_6; - half4 c_7; - half4 tmpvar_8; + half3 tmpvar_5 = 0; + half tmpvar_6 = 0; + half4 c_7 = 0; + half4 tmpvar_8 = 0; tmpvar_8 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); c_7 = tmpvar_8; tmpvar_5 = c_7.xyz; tmpvar_6 = c_7.w; - float4 tmpvar_9; + float4 tmpvar_9 = 0; tmpvar_9.w = 1.0; tmpvar_9.xyz = _mtl_i.xlv_TEXCOORD2; - float4 tmpvar_10; - tmpvar_10 = ((float4)(_mtl_u._LightMatrix0 * (half4)tmpvar_9)); + float4 tmpvar_10 = 0; + tmpvar_10 = ((float4)(_mtl_u._LightMatrix0 * (half4)(tmpvar_9))); lightCoord_3 = half4(tmpvar_10); - half4 tmpvar_11; - half2 P_12; - P_12 = ((lightCoord_3.xy / lightCoord_3.w) + (half)0.5); + half4 tmpvar_11 = 0; + half2 P_12 = 0; + P_12 = ((lightCoord_3.xy / lightCoord_3.w) + (half)(0.5)); tmpvar_11 = _LightTexture0.sample(_mtlsmp__LightTexture0, (float2)(P_12)); - half tmpvar_13; + half tmpvar_13 = 0; tmpvar_13 = dot (lightCoord_3.xyz, lightCoord_3.xyz); - half4 tmpvar_14; + half4 tmpvar_14 = 0; tmpvar_14 = _LightTextureB0.sample(_mtlsmp__LightTextureB0, (float2)(half2(tmpvar_13))); - half tmpvar_15; + half tmpvar_15 = 0; tmpvar_15 = ((half( - (lightCoord_3.z > (half)0.0) + (lightCoord_3.z > (half)(0.0)) ) * tmpvar_11.w) * tmpvar_14.w); atten_2 = tmpvar_15; - half3 lightDir_16; + half3 lightDir_16 = 0; lightDir_16 = half3(tmpvar_4); - half4 c_17; + half4 c_17 = 0; c_17.xyz = ((tmpvar_5 * _mtl_u._LightColor0.xyz) * (( max ((half)0.0, dot (_mtl_i.xlv_TEXCOORD1, lightDir_16)) - * atten_2) * (half)2.0)); + * atten_2) * (half)(2.0))); c_17.w = tmpvar_6; c_1.xyz = c_17.xyz; c_1.w = half(0.0); 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 4743f651c8e..b595775e75d 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 @@ -19,23 +19,23 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _MainTex [[texture(1)]], sampler _mtlsmp__MainTex [[sampler(1)]]) { xlatMtlShaderOutput _mtl_o; - half4 c_1; - half4 tmpvar_2; + half4 c_1 = 0; + half4 tmpvar_2 = 0; tmpvar_2 = _MainTex.sample(_mtlsmp__MainTex, (float2)(_mtl_i.xlv_TEXCOORD0)); - half3 tmpvar_3; - tmpvar_3 = ((_BumpMap.sample(_mtlsmp__BumpMap, (float2)(_mtl_i.xlv_TEXCOORD0)).xyz * (half)2.0) - (half)1.0); - half3 halfDir_4; + half3 tmpvar_3 = 0; + tmpvar_3 = ((_BumpMap.sample(_mtlsmp__BumpMap, (float2)(_mtl_i.xlv_TEXCOORD0)).xyz * (half)(2.0)) - (half)(1.0)); + half3 halfDir_4 = 0; halfDir_4 = _mtl_i.xlv_TEXCOORD1; - half4 c_5; - half spec_6; - half tmpvar_7; + half4 c_5 = 0; + half spec_6 = 0; + half tmpvar_7 = 0; tmpvar_7 = max ((half)0.0, dot (tmpvar_3, halfDir_4)); - half tmpvar_8; - tmpvar_8 = pow (tmpvar_7, (_mtl_u._Shininess * (half)128.0)); + half tmpvar_8 = 0; + tmpvar_8 = pow (tmpvar_7, (_mtl_u._Shininess * (half)(128.0))); spec_6 = (tmpvar_8 * tmpvar_2.w); c_5.xyz = ((( (tmpvar_2.xyz * max ((half)0.0, dot (tmpvar_3, _mtl_i.xlv_TEXCOORD2))) - + spec_6) * _mtl_u._LightColor0.xyz) * (half)2.0); + + spec_6) * _mtl_u._LightColor0.xyz) * (half)(2.0)); c_5.w = half(0.0); c_1.w = c_5.w; c_1.xyz = (c_5.xyz + (tmpvar_2.xyz * _mtl_i.xlv_TEXCOORD3)); 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 3e2c3d4f34f..add23da4e43 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 @@ -18,23 +18,23 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] , texture2d<half> _RandomTexture [[texture(1)]], sampler _mtlsmp__RandomTexture [[sampler(1)]]) { xlatMtlShaderOutput _mtl_o; - half tmpvar_1; - float2 tmpvar_2; + half tmpvar_1 = 0; + float2 tmpvar_2 = 0; tmpvar_2 = _mtl_i.xlv_TEXCOORD0; - float occ_4; - float scale_5; - float depth_6; - float3 viewNorm_7; - half3 randN_8; - half3 tmpvar_9; - tmpvar_9 = ((_RandomTexture.sample(_mtlsmp__RandomTexture, (float2)(_mtl_i.xlv_TEXCOORD1)).xyz * (half)2.0) - (half)1.0); + float occ_4 = 0; + float scale_5 = 0; + float depth_6 = 0; + float3 viewNorm_7 = 0; + half3 randN_8 = 0; + half3 tmpvar_9 = 0; + tmpvar_9 = ((_RandomTexture.sample(_mtlsmp__RandomTexture, (float2)(_mtl_i.xlv_TEXCOORD1)).xyz * (half)(2.0)) - (half)(1.0)); randN_8 = tmpvar_9; - float4 tmpvar_10; + float4 tmpvar_10 = 0; tmpvar_10 = _CameraDepthNormalsTexture.sample(_mtlsmp__CameraDepthNormalsTexture, (float2)(_mtl_i.xlv_TEXCOORD0)); - float3 n_11; - float3 tmpvar_12; + float3 n_11 = 0; + float3 tmpvar_12 = 0; tmpvar_12 = ((tmpvar_10.xyz * float3(3.5554, 3.5554, 0.0)) + float3(-1.7777, -1.7777, 1.0)); - float tmpvar_13; + float tmpvar_13 = 0; tmpvar_13 = (2.0 / dot (tmpvar_12, tmpvar_12)); n_11.xy = (tmpvar_13 * tmpvar_12.xy); n_11.z = (tmpvar_13 - 1.0); @@ -43,29 +43,29 @@ fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]] scale_5 = (_mtl_u._Params.x / depth_6); occ_4 = 0.0; for (int s_3 = 0; s_3 < 8; s_3++) { - half3 randomDir_14; - float3 tmpvar_15; - float3 I_16; + half3 randomDir_14 = 0; + float3 tmpvar_15 = 0; + float3 I_16 = 0; I_16 = _xlat_mtl_const1[s_3]; - tmpvar_15 = (I_16 - (float3)((half)2.0 * ((half3)( + tmpvar_15 = (I_16 - (float3)(((half)(2.0) * ((half3)( dot ((float3)randN_8, I_16) - * (float3)randN_8)))); + * (float3)(randN_8)))))); randomDir_14 = half3(tmpvar_15); - float tmpvar_17; + float tmpvar_17 = 0; tmpvar_17 = dot (viewNorm_7, (float3)randomDir_14); - half tmpvar_18; + half tmpvar_18 = 0; if ((tmpvar_17 < 0.0)) { tmpvar_18 = half(1.0); } else { tmpvar_18 = half(-1.0); }; randomDir_14 = (randomDir_14 * -(tmpvar_18)); - randomDir_14 = half3(((float3)randomDir_14 + (viewNorm_7 * 0.3))); - float tmpvar_19; + randomDir_14 = half3(((float3)(randomDir_14) + (viewNorm_7 * 0.3))); + float tmpvar_19 = 0; tmpvar_19 = clamp (((depth_6 - - ((float)randomDir_14.z * _mtl_u._Params.x) + ((float)(randomDir_14.z) * _mtl_u._Params.x) ) - ( - dot (_CameraDepthNormalsTexture.sample(_mtlsmp__CameraDepthNormalsTexture, (float2)((tmpvar_2 + ((float2)randomDir_14.xy * scale_5)))).zw, float2(1.0, 0.00392157)) + dot (_CameraDepthNormalsTexture.sample(_mtlsmp__CameraDepthNormalsTexture, (float2)((tmpvar_2 + ((float2)(randomDir_14.xy) * scale_5)))).zw, float2(1.0, 0.00392157)) * _mtl_u._ProjectionParams.z)), 0.0, 1.0); if ((tmpvar_19 > _mtl_u._Params.y)) { occ_4 = (occ_4 + pow ((1.0 - tmpvar_19), _mtl_u._Params.z)); 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 c52c31b97ad..369303aa140 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 @@ -35,46 +35,46 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - float3 tmpvar_1; - float4 tmpvar_2; + float3 tmpvar_1 = 0; + float4 tmpvar_2 = 0; tmpvar_1 = float3(_mtl_i._inNormal); tmpvar_2 = float4(_mtl_i._color); - half4 tmpvar_3; - float noiseWave_4; - float noiseTime_5; - float wave_6; - float time_7; - float3 BBLocalPos_8; - float3 localDir_9; - float3 centerLocal_10; - float3 centerOffs_11; - float3 tmpvar_12; + half4 tmpvar_3 = 0; + float noiseWave_4 = 0; + float noiseTime_5 = 0; + float wave_6 = 0; + float time_7 = 0; + float3 BBLocalPos_8 = 0; + float3 localDir_9 = 0; + float3 centerLocal_10 = 0; + float3 centerOffs_11 = 0; + float3 tmpvar_12 = 0; tmpvar_12.z = 0.0; tmpvar_12.xy = (float2(0.5, 0.5) - tmpvar_2.xy); centerOffs_11 = (tmpvar_12 * _mtl_i._uv1.xyy); centerLocal_10 = (_mtl_i._inVertex.xyz + centerOffs_11); - float4 tmpvar_13; + float4 tmpvar_13 = 0; tmpvar_13.w = 1.0; tmpvar_13.xyz = _mtl_u._WorldSpaceCameraPos; localDir_9 = ((_mtl_u._World2Object * tmpvar_13).xyz - centerLocal_10); localDir_9.y = (localDir_9.y * _mtl_u._VerticalBillboarding); - float tmpvar_14; + float tmpvar_14 = 0; tmpvar_14 = sqrt(dot (localDir_9, localDir_9)); - float3 dir_15; + float3 dir_15 = 0; dir_15 = (localDir_9 / tmpvar_14); - float tmpvar_16; + float tmpvar_16 = 0; tmpvar_16 = abs(dir_15.y); - float3 tmpvar_17; + float3 tmpvar_17 = 0; if ((tmpvar_16 > 0.999)) { tmpvar_17 = float3(0.0, 0.0, 1.0); } else { tmpvar_17 = float3(0.0, 1.0, 0.0); }; - float3 tmpvar_18; + float3 tmpvar_18 = 0; tmpvar_18 = normalize(((tmpvar_17.yzx * dir_15.zxy) - (tmpvar_17.zxy * dir_15.yzx))); - float3 tmpvar_19; + float3 tmpvar_19 = 0; tmpvar_19 = ((dir_15.yzx * tmpvar_18.zxy) - (dir_15.zxy * tmpvar_18.yzx)); - float tmpvar_20; + float tmpvar_20 = 0; tmpvar_20 = min ((max ( (tmpvar_14 - _mtl_u._SizeGrowStartDist) , 0.0) / _mtl_u._SizeGrowEndDist), 1.0); @@ -92,23 +92,23 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], (_mtl_u._MaxGrowSize * tmpvar_2.w) ))); time_7 = (_mtl_u._Time.y + (_mtl_u._BlinkingTimeOffsScale * tmpvar_2.z)); - float y_21; + float y_21 = 0; y_21 = (_mtl_u._TimeOnDuration + _mtl_u._TimeOffDuration); - float tmpvar_22; + float tmpvar_22 = 0; tmpvar_22 = (time_7 / y_21); - float tmpvar_23; + float tmpvar_23 = 0; tmpvar_23 = (fract(abs(tmpvar_22)) * y_21); - float tmpvar_24; + float tmpvar_24 = 0; if ((tmpvar_22 >= 0.0)) { tmpvar_24 = tmpvar_23; } else { tmpvar_24 = -(tmpvar_23); }; - float tmpvar_25; + float tmpvar_25 = 0; tmpvar_25 = clamp ((tmpvar_24 / (_mtl_u._TimeOnDuration * 0.25)), 0.0, 1.0); - float edge0_26; + float edge0_26 = 0; edge0_26 = (_mtl_u._TimeOnDuration * 0.75); - float tmpvar_27; + float tmpvar_27 = 0; tmpvar_27 = clamp (((tmpvar_24 - edge0_26) / (_mtl_u._TimeOnDuration - edge0_26)), 0.0, 1.0); wave_6 = ((tmpvar_25 * (tmpvar_25 * (3.0 - (2.0 * tmpvar_25)) @@ -123,19 +123,19 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], (noiseTime_5 * 0.6366) + 56.7272))) + 0.5) )) + (1.0 - _mtl_u._NoiseAmount)); - float tmpvar_28; + float tmpvar_28 = 0; if ((_mtl_u._NoiseAmount < 0.01)) { tmpvar_28 = wave_6; } else { tmpvar_28 = noiseWave_4; }; wave_6 = (tmpvar_28 + _mtl_u._Bias); - float4 tmpvar_29; + float4 tmpvar_29 = 0; tmpvar_29.w = 1.0; tmpvar_29.xyz = BBLocalPos_8; - float ffadeout_30; - float nfadeout_31; - float tmpvar_32; + float ffadeout_30 = 0; + float nfadeout_31 = 0; + float tmpvar_32 = 0; tmpvar_32 = clamp ((tmpvar_14 / _mtl_u._FadeOutDistNear), 0.0, 1.0); ffadeout_30 = (1.0 - clamp (( max ((tmpvar_14 - _mtl_u._FadeOutDistFar), 0.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 1da74693be8..d4dccdc74a8 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 @@ -17,33 +17,33 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - float3 viewDir_1; - float3 tmpvar_2; - float4 tmpvar_3; + float3 viewDir_1 = 0; + float3 tmpvar_2 = 0; + float4 tmpvar_3 = 0; tmpvar_3.w = 1.0; tmpvar_3.xyz = _mtl_u._WorldSpaceCameraPos; viewDir_1 = normalize(((_mtl_u._World2Object * tmpvar_3).xyz - _mtl_i._glesVertex.xyz)); - half tmpvar_4; - float tmpvar_5; + half tmpvar_4 = 0; + float tmpvar_5 = 0; tmpvar_5 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[0])), 0.0, 1.0); tmpvar_4 = half(tmpvar_5); - float3 tmpvar_6; + float3 tmpvar_6 = 0; tmpvar_6.yz = tmpvar_2.yz; - tmpvar_6.x = float((tmpvar_4 * (half)2.0)); - half tmpvar_7; - float tmpvar_8; + tmpvar_6.x = float((tmpvar_4 * (half)(2.0))); + half tmpvar_7 = 0; + float tmpvar_8 = 0; tmpvar_8 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[1])), 0.0, 1.0); tmpvar_7 = half(tmpvar_8); - float3 tmpvar_9; + float3 tmpvar_9 = 0; tmpvar_9.xz = tmpvar_6.xz; - tmpvar_9.y = float((tmpvar_7 * (half)2.0)); - half tmpvar_10; - float tmpvar_11; + tmpvar_9.y = float((tmpvar_7 * (half)(2.0))); + half tmpvar_10 = 0; + float tmpvar_11 = 0; tmpvar_11 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[2])), 0.0, 1.0); tmpvar_10 = half(tmpvar_11); - float3 tmpvar_12; + float3 tmpvar_12 = 0; tmpvar_12.xy = tmpvar_9.xy; - tmpvar_12.z = float((tmpvar_10 * (half)2.0)); + tmpvar_12.z = float((tmpvar_10 * (half)(2.0))); tmpvar_2 = tmpvar_12; _mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * _mtl_i._glesVertex); _mtl_o.xlv_TEXCOORD2 = tmpvar_12; 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 8d3e95e4ab6..ccaa1b02be9 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 @@ -16,12 +16,12 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], , uint gl_VertexID [[vertex_id]]) { xlatMtlShaderOutput _mtl_o; - float3 p_1; + float3 p_1 = 0; p_1.z = _mtl_i._inPos.z; p_1.x = (_mtl_i._inPos.x + float(gl_VertexID)); p_1.y = (_mtl_i._inPos.y + float(gl_InstanceID)); p_1 = (p_1 + _mtl_i._inNor); - float4 tmpvar_2; + float4 tmpvar_2 = 0; tmpvar_2.w = 1.0; tmpvar_2.xyz = p_1; _mtl_o.gl_Position = tmpvar_2; 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 f896ff66cd4..db6277dee41 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/inputs-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/inputs-outES3Metal.txt @@ -17,14 +17,14 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half2 tmpvar_1; + half2 tmpvar_1 = 0; tmpvar_1 = half2(_mtl_i._glesMultiTexCoord0.xy); - float4 tmpvar_2; + float4 tmpvar_2 = 0; tmpvar_2.xyz = normalize(_mtl_i._glesTANGENT.xyz); tmpvar_2.w = _mtl_i._glesTANGENT.w; - half4 tmpvar_3; - tmpvar_3.xy = (tmpvar_1 * (half)0.3); - tmpvar_3.xyz = half3(((float3)tmpvar_3.xyz + ((tmpvar_2.xyz * 0.5) + 0.5))); + half4 tmpvar_3 = 0; + tmpvar_3.xy = (tmpvar_1 * (half)(0.3)); + tmpvar_3.xyz = half3(((float3)(tmpvar_3.xyz) + ((tmpvar_2.xyz * 0.5) + 0.5))); tmpvar_3.w = half(0.0); _mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * _mtl_i._glesVertex); _mtl_o.xlv_TEXCOORD0 = tmpvar_1; 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 fc95a3de659..06bd71bd0f5 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 @@ -48,12 +48,12 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; -float4 phase0_Output0_1; -float4 Temp_0_2; -float4 Temp_1_3; -float4 Temp_2_4; -float4 Temp_3_5; -int4 Temp_int_0_6; +float4 phase0_Output0_1 = 0; +float4 Temp_0_2 = 0; +float4 Temp_1_3 = 0; +float4 Temp_2_4 = 0; +float4 Temp_3_5 = 0; +int4 Temp_int_0_6 = 0; Temp_0_2 = (_mtl_i.dcl_Input0_POSITION0.yyyy * _mtl_u.glstate_matrix_mvp[1]); Temp_0_2 = ((_mtl_u.glstate_matrix_mvp[0] * _mtl_i.dcl_Input0_POSITION0.xxxx) + Temp_0_2); Temp_0_2 = ((_mtl_u.glstate_matrix_mvp[2] * _mtl_i.dcl_Input0_POSITION0.zzzz) + Temp_0_2); 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 00690e14860..b7ebf1806aa 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 @@ -28,11 +28,11 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; -float4 phase0_Output2_1; -float4 Temp_2_2; -float4 Temp_3_3; -int4 Temp_int_0_4; -int4 Temp_int_1_5; +float4 phase0_Output2_1 = 0; +float4 Temp_2_2 = 0; +float4 Temp_3_3 = 0; +int4 Temp_int_0_4 = 0; +int4 Temp_int_1_5 = 0; Temp_int_0_4 = as_type<int4>((_mtl_i.in_POSITION0.yyyy * _mtl_u.glstate_matrix_mvp[1])); Temp_int_0_4 = as_type<int4>(((_mtl_u.glstate_matrix_mvp[0] * _mtl_i.in_POSITION0.xxxx) + as_type<float4>(Temp_int_0_4))); Temp_int_0_4 = as_type<int4>(((_mtl_u.glstate_matrix_mvp[2] * _mtl_i.in_POSITION0.zzzz) + as_type<float4>(Temp_int_0_4))); 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 097f161d566..a46b4aba05b 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 @@ -17,38 +17,38 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - float3 tmpvar_1; + float3 tmpvar_1 = 0; tmpvar_1 = _mtl_i._glesVertex.xyz; - int j_2; - int j_3; - int il_4; - half3 lcolor_5; - half3 eyeNormal_6; - half4 color_7; - half4 tmpvar_8; + int j_2 = 0; + int j_3 = 0; + int il_4 = 0; + half3 lcolor_5 = 0; + half3 eyeNormal_6 = 0; + half4 color_7 = 0; + half4 tmpvar_8 = 0; color_7 = half4(float4(0.0, 0.0, 0.0, 1.1)); eyeNormal_6 = half3(_mtl_i._glesNormal); lcolor_5 = half3(float3(0.0, 0.0, 0.0)); il_4 = 0; while (true) { - float tmpvar_9; + float tmpvar_9 = 0; tmpvar_9 = min (8.0, float(_mtl_u.unity_VertexLightParams.x)); if ((float(il_4) >= tmpvar_9)) { break; }; - float3 tmpvar_10; + float3 tmpvar_10 = 0; tmpvar_10 = _mtl_u.unity_LightPosition[il_4].xyz; - half3 dirToLight_11; + half3 dirToLight_11 = 0; dirToLight_11 = half3(tmpvar_10); lcolor_5 = (lcolor_5 + min (( (max (dot (eyeNormal_6, dirToLight_11), (half)0.0) * _mtl_u.unity_LightColor[il_4].xyz) - * (half)0.5), (half3)float3(1.0, 1.0, 1.0))); + * (half)(0.5)), (half3)float3(1.0, 1.0, 1.0))); il_4++; }; color_7.xyz = lcolor_5; j_3 = 0; while (true) { - float tmpvar_12; + float tmpvar_12 = 0; tmpvar_12 = min (float(_mtl_u.unity_VertexLightParams.y), 4.0); if ((j_3 >= int(tmpvar_12))) { break; @@ -58,7 +58,7 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], }; j_2 = 0; while (true) { - int tmpvar_13; + int tmpvar_13 = 0; tmpvar_13 = min (_mtl_u.unity_VertexLightParams.y, 4); if ((j_2 >= tmpvar_13)) { break; @@ -67,7 +67,7 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], j_2++; }; tmpvar_8 = color_7; - float4 tmpvar_14; + float4 tmpvar_14 = 0; tmpvar_14.w = 1.0; tmpvar_14.xyz = tmpvar_1; _mtl_o.xlv_COLOR0 = tmpvar_8; 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 a87dcb7854b..baecd492cfd 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 @@ -16,31 +16,31 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - float4 l_1_1; - float4 l_2; - half4 tmpvar_3; - half4 tmpvar_4; + float4 l_1_1 = 0; + float4 l_2 = 0; + half4 tmpvar_3 = 0; + half4 tmpvar_4 = 0; tmpvar_3 = half4((_mtl_u.UNITY_MATRIX_MVP * _mtl_i._inVertex)); tmpvar_4 = half4(_mtl_u.unity_LightColor[0]); - tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[1])); - tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[0])); - tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[1])); - tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[2])); - tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[3])); - tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[3])); - tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[2])); - tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[1])); - tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[0])); + tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[1])); + tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[0])); + tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[1])); + tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[2])); + tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[3])); + tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[3])); + tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[2])); + tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[1])); + tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[0])); l_2 = (_mtl_u.unity_LightColor[0] * _mtl_u.unity_LightAtten[0].x); - tmpvar_4 = half4(((float4)tmpvar_4 + l_2)); + tmpvar_4 = half4(((float4)(tmpvar_4) + l_2)); l_2 = (_mtl_u.unity_LightColor[1] * _mtl_u.unity_LightAtten[1].x); - tmpvar_4 = half4(((float4)tmpvar_4 + l_2)); + tmpvar_4 = half4(((float4)(tmpvar_4) + l_2)); l_1_1 = (_mtl_u.unity_LightColor[0] * _mtl_u.unity_LightAtten[0].z); - tmpvar_4 = half4(((float4)tmpvar_4 + l_1_1)); + tmpvar_4 = half4(((float4)(tmpvar_4) + l_1_1)); l_1_1 = (_mtl_u.unity_LightColor[1] * _mtl_u.unity_LightAtten[1].z); - tmpvar_4 = half4(((float4)tmpvar_4 + l_1_1)); - tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[1].x)); - tmpvar_4 = half4(((float4)tmpvar_4 + _mtl_u.unity_LightColor[2].x)); + tmpvar_4 = half4(((float4)(tmpvar_4) + l_1_1)); + tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[1].x)); + tmpvar_4 = half4(((float4)(tmpvar_4) + _mtl_u.unity_LightColor[2].x)); _mtl_o.gl_Position = float4(tmpvar_3); _mtl_o.xlv_TEXCOORD0 = tmpvar_4; return _mtl_o; 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 b888c4c9825..853cf69b6cb 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 @@ -27,13 +27,13 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], float4x4 htof4_3; half2x2 ftoh2_4; half4x4 ftoh4_5; - float4 r_6; + float4 r_6 = 0; r_6.yzw = float3(0.0, 0.0, 0.0); ftoh4_5 = _xlcast_half4x4(_mtl_u.uniMat4F); r_6.x = float(ftoh4_5[0].x); - r_6.x = (r_6.x + (float)ftoh4_5[0].x); + r_6.x = (r_6.x + (float)(ftoh4_5[0].x)); ftoh2_4 = _xlcast_half2x2(_mtl_u.uniMat2F); - r_6.x = (r_6.x + (float)ftoh2_4[0].x); + r_6.x = (r_6.x + (float)(ftoh2_4[0].x)); htof4_3 = _xlcast_float4x4(_mtl_u.uniMat4H); r_6.x = (r_6.x + htof4_3[0].x); htof3_2 = _xlcast_float3x3(_mtl_u.uniMat3H); 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 78a49f1cabf..316a5357934 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 @@ -23,21 +23,21 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half3 lightDir_1; - float3 worldN_2; - half3 tmpvar_3; - half3 tmpvar_4; - half3 tmpvar_5; + half3 lightDir_1 = 0; + float3 worldN_2 = 0; + half3 tmpvar_3 = 0; + half3 tmpvar_4 = 0; + half3 tmpvar_5 = 0; float3x3 tmpvar_6; tmpvar_6[0] = _mtl_u._Object2World[0].xyz; tmpvar_6[1] = _mtl_u._Object2World[1].xyz; tmpvar_6[2] = _mtl_u._Object2World[2].xyz; - half3 tmpvar_7; - tmpvar_7 = ((half3)(tmpvar_6 * (float3)_mtl_i.attrNormal)); + half3 tmpvar_7 = 0; + tmpvar_7 = ((half3)(tmpvar_6 * (float3)(_mtl_i.attrNormal))); worldN_2 = float3(tmpvar_7); tmpvar_5 = half3(worldN_2); - half3 tmpvar_8; - half3 tmpvar_9; + half3 tmpvar_8 = 0; + half3 tmpvar_9 = 0; tmpvar_8 = _mtl_i.attrTangent.xyz; tmpvar_9 = (((_mtl_i.attrNormal.yzx * _mtl_i.attrTangent.zxy) - (_mtl_i.attrNormal.zxy * _mtl_i.attrTangent.yzx)) * _mtl_i.attrTangent.w); half3x3 tmpvar_10; @@ -50,16 +50,16 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], tmpvar_10[2].x = tmpvar_8.z; tmpvar_10[2].y = tmpvar_9.z; tmpvar_10[2].z = _mtl_i.attrNormal.z; - float3 tmpvar_11; - tmpvar_11 = ((float3)(tmpvar_10 * (half3)(_mtl_u._World2Object * (float4)_mtl_u._WorldSpaceLightPos0).xyz)); + float3 tmpvar_11 = 0; + tmpvar_11 = ((float3)(tmpvar_10 * (half3)((_mtl_u._World2Object * (float4)(_mtl_u._WorldSpaceLightPos0)).xyz))); lightDir_1 = half3(tmpvar_11); tmpvar_3 = lightDir_1; - float4 tmpvar_12; + float4 tmpvar_12 = 0; tmpvar_12.w = 1.0; tmpvar_12.xyz = _mtl_u._WorldSpaceCameraPos; - float3 tmpvar_13; - tmpvar_13 = normalize(((float3)lightDir_1 + normalize( - ((float3)(tmpvar_10 * (half3)(((_mtl_u._World2Object * tmpvar_12).xyz * _mtl_u.unity_Scale.w) - _mtl_i.attrVertex.xyz))) + float3 tmpvar_13 = 0; + tmpvar_13 = normalize(((float3)(lightDir_1) + normalize( + ((float3)(tmpvar_10 * (half3)((((_mtl_u._World2Object * tmpvar_12).xyz * _mtl_u.unity_Scale.w) - _mtl_i.attrVertex.xyz)))) ))); tmpvar_4 = half3(tmpvar_13); _mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * _mtl_i.attrVertex); 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 0667465cea4..d1cc5bbd16e 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 @@ -16,9 +16,9 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half4 tmpvar_1; + half4 tmpvar_1 = 0; tmpvar_1 = half4(_mtl_i._glesMultiTexCoord0); - float4 tmpvar_2; + float4 tmpvar_2 = 0; tmpvar_2 = (_mtl_u.glstate_matrix_mvp * _mtl_i._glesVertex); tmpvar_2.z = (tmpvar_2.z + clamp ((_mtl_u.unity_LightShadowBias.x / tmpvar_2.w), 0.0, 1.0)); tmpvar_2.z = mix (tmpvar_2.z, max (tmpvar_2.z, -(tmpvar_2.w)), _mtl_u.unity_LightShadowBias.y); 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 310cef2db24..dc2de38e3e8 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/types-outES3Metal.txt +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/vertex/types-outES3Metal.txt @@ -18,8 +18,8 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - half2 tmpvar_1; - half4 tmpvar_2; + half2 tmpvar_1 = 0; + half4 tmpvar_2 = 0; tmpvar_2.w = _mtl_i._color.w; tmpvar_2.xyz = (_mtl_i._color.xyz + _mtl_i._inNormal); tmpvar_1 = half2(_mtl_i._uv0); 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 c6557d378a7..d37be6c3720 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 @@ -24,18 +24,18 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - float3 tmpvar_1; + float3 tmpvar_1 = 0; tmpvar_1 = _mtl_i._glesVertex.xyz; - float3 n_2; + float3 n_2 = 0; n_2 = float3(_mtl_i._glesNormal); - half4 tmpvar_3; - float4 tmpvar_4; + half4 tmpvar_3 = 0; + float4 tmpvar_4 = 0; tmpvar_4.w = 1.0; tmpvar_4.xyz = tmpvar_1; - float3 lightColor_5; - float3 viewN_6; - float3 viewpos_7; - float4 tmpvar_8; + float3 lightColor_5 = 0; + float3 viewN_6 = 0; + float3 viewpos_7 = 0; + float4 tmpvar_8 = 0; tmpvar_8.w = 1.0; tmpvar_8.xyz = tmpvar_1; viewpos_7 = (_mtl_u.glstate_matrix_modelview0 * tmpvar_8).xyz; @@ -44,37 +44,37 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], tmpvar_9[1] = _mtl_u.glstate_matrix_invtrans_modelview0[1].xyz; tmpvar_9[2] = _mtl_u.glstate_matrix_invtrans_modelview0[2].xyz; viewN_6 = (tmpvar_9 * n_2); - float3 tmpvar_10; + float3 tmpvar_10 = 0; tmpvar_10 = (_mtl_u.unity_LightPosition[0].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[0].w)); - lightColor_5 = (_mtl_u.glstate_lightmodel_ambient.xyz + ((float3)_mtl_u.unity_LightColor[0].xyz * ( + lightColor_5 = (_mtl_u.glstate_lightmodel_ambient.xyz + ((float3)(_mtl_u.unity_LightColor[0].xyz) * ( max (0.0, dot (viewN_6, normalize(tmpvar_10))) * - (1.0/((1.0 + (dot (tmpvar_10, tmpvar_10) * (float)_mtl_u.unity_LightAtten[0].z)))) + (1.0/((1.0 + (dot (tmpvar_10, tmpvar_10) * (float)(_mtl_u.unity_LightAtten[0].z))))) ))); - float3 tmpvar_11; + float3 tmpvar_11 = 0; tmpvar_11 = (_mtl_u.unity_LightPosition[1].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[1].w)); - lightColor_5 = (lightColor_5 + ((float3)_mtl_u.unity_LightColor[1].xyz * ( + lightColor_5 = (lightColor_5 + ((float3)(_mtl_u.unity_LightColor[1].xyz) * ( max (0.0, dot (viewN_6, normalize(tmpvar_11))) * - (1.0/((1.0 + (dot (tmpvar_11, tmpvar_11) * (float)_mtl_u.unity_LightAtten[1].z)))) + (1.0/((1.0 + (dot (tmpvar_11, tmpvar_11) * (float)(_mtl_u.unity_LightAtten[1].z))))) ))); - float3 tmpvar_12; + float3 tmpvar_12 = 0; tmpvar_12 = (_mtl_u.unity_LightPosition[2].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[2].w)); - lightColor_5 = (lightColor_5 + ((float3)_mtl_u.unity_LightColor[2].xyz * ( + lightColor_5 = (lightColor_5 + ((float3)(_mtl_u.unity_LightColor[2].xyz) * ( max (0.0, dot (viewN_6, normalize(tmpvar_12))) * - (1.0/((1.0 + (dot (tmpvar_12, tmpvar_12) * (float)_mtl_u.unity_LightAtten[2].z)))) + (1.0/((1.0 + (dot (tmpvar_12, tmpvar_12) * (float)(_mtl_u.unity_LightAtten[2].z))))) ))); - float3 tmpvar_13; + float3 tmpvar_13 = 0; tmpvar_13 = (_mtl_u.unity_LightPosition[3].xyz - (viewpos_7 * _mtl_u.unity_LightPosition[3].w)); - lightColor_5 = (lightColor_5 + ((float3)_mtl_u.unity_LightColor[3].xyz * ( + lightColor_5 = (lightColor_5 + ((float3)(_mtl_u.unity_LightColor[3].xyz) * ( max (0.0, dot (viewN_6, normalize(tmpvar_13))) * - (1.0/((1.0 + (dot (tmpvar_13, tmpvar_13) * (float)_mtl_u.unity_LightAtten[3].z)))) + (1.0/((1.0 + (dot (tmpvar_13, tmpvar_13) * (float)(_mtl_u.unity_LightAtten[3].z))))) ))); - float4 tmpvar_14; + float4 tmpvar_14 = 0; tmpvar_14.w = 1.0; - tmpvar_14.xyz = ((lightColor_5 * (float3)_mtl_u._Color.xyz) * 2.0); + tmpvar_14.xyz = ((lightColor_5 * (float3)(_mtl_u._Color.xyz)) * 2.0); tmpvar_3 = half4(tmpvar_14); _mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * tmpvar_4); _mtl_o.xlv_COLOR0 = tmpvar_3; 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 680204bd85e..abbb4bb24a7 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 @@ -17,140 +17,140 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], , texture2d<half> _DynLampInfo [[texture(0)]], sampler _mtlsmp__DynLampInfo [[sampler(0)]]) { xlatMtlShaderOutput _mtl_o; - half3 tmpvar_1; - float3 tmpvar_2; + half3 tmpvar_1 = 0; + float3 tmpvar_2 = 0; tmpvar_2 = (_mtl_u._Object2World * _mtl_i._glesVertex).xyz; - float3 tmpvar_3; - half3 hybridCol_4; - int4 tmpvar_5; + float3 tmpvar_3 = 0; + half3 hybridCol_4 = 0; + int4 tmpvar_5 = 0; tmpvar_5.xyz = int3(tmpvar_2); tmpvar_5.w = int(-(tmpvar_2.x)); - float2 tmpvar_6; + float2 tmpvar_6 = 0; tmpvar_6.y = 1.0; tmpvar_6.x = float(tmpvar_5.x); - half2 coord_7; + half2 coord_7 = 0; coord_7 = half2(tmpvar_6); - half4 tmpvar_8; + half4 tmpvar_8 = 0; tmpvar_8.zw = half2(float2(0.0, 0.0)); tmpvar_8.xy = (coord_7 / _mtl_u._DynLampInfo_bufferSize); - half4 tmpvar_9; - half4 tmpvar_10; + half4 tmpvar_9 = 0; + half4 tmpvar_10 = 0; tmpvar_10 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_8.xy), level(0.0)); tmpvar_9 = tmpvar_10; - float2 tmpvar_11; + float2 tmpvar_11 = 0; tmpvar_11.y = 2.0; tmpvar_11.x = float(tmpvar_5.x); - half2 coord_12; + half2 coord_12 = 0; coord_12 = half2(tmpvar_11); - half4 tmpvar_13; + half4 tmpvar_13 = 0; tmpvar_13.zw = half2(float2(0.0, 0.0)); tmpvar_13.xy = (coord_12 / _mtl_u._DynLampInfo_bufferSize); - half4 tmpvar_14; - half4 tmpvar_15; + half4 tmpvar_14 = 0; + half4 tmpvar_15 = 0; tmpvar_15 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_13.xy), level(0.0)); tmpvar_14 = tmpvar_15; - float2 tmpvar_16; + float2 tmpvar_16 = 0; tmpvar_16.y = 1.0; tmpvar_16.x = float(tmpvar_5.y); - half2 coord_17; + half2 coord_17 = 0; coord_17 = half2(tmpvar_16); - half4 tmpvar_18; + half4 tmpvar_18 = 0; tmpvar_18.zw = half2(float2(0.0, 0.0)); tmpvar_18.xy = (coord_17 / _mtl_u._DynLampInfo_bufferSize); - half4 tmpvar_19; - half4 tmpvar_20; + half4 tmpvar_19 = 0; + half4 tmpvar_20 = 0; tmpvar_20 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_18.xy), level(0.0)); tmpvar_19 = tmpvar_20; - float2 tmpvar_21; + float2 tmpvar_21 = 0; tmpvar_21.y = 2.0; tmpvar_21.x = float(tmpvar_5.y); - half2 coord_22; + half2 coord_22 = 0; coord_22 = half2(tmpvar_21); - half4 tmpvar_23; + half4 tmpvar_23 = 0; tmpvar_23.zw = half2(float2(0.0, 0.0)); tmpvar_23.xy = (coord_22 / _mtl_u._DynLampInfo_bufferSize); - half4 tmpvar_24; - half4 tmpvar_25; + half4 tmpvar_24 = 0; + half4 tmpvar_25 = 0; tmpvar_25 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_23.xy), level(0.0)); tmpvar_24 = tmpvar_25; - float2 tmpvar_26; + float2 tmpvar_26 = 0; tmpvar_26.y = 1.0; tmpvar_26.x = float(tmpvar_5.z); - half2 coord_27; + half2 coord_27 = 0; coord_27 = half2(tmpvar_26); - half4 tmpvar_28; + half4 tmpvar_28 = 0; tmpvar_28.zw = half2(float2(0.0, 0.0)); tmpvar_28.xy = (coord_27 / _mtl_u._DynLampInfo_bufferSize); - half4 tmpvar_29; - half4 tmpvar_30; + half4 tmpvar_29 = 0; + half4 tmpvar_30 = 0; tmpvar_30 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_28.xy), level(0.0)); tmpvar_29 = tmpvar_30; - float2 tmpvar_31; + float2 tmpvar_31 = 0; tmpvar_31.y = 2.0; tmpvar_31.x = float(tmpvar_5.z); - half2 coord_32; + half2 coord_32 = 0; coord_32 = half2(tmpvar_31); - half4 tmpvar_33; + half4 tmpvar_33 = 0; tmpvar_33.zw = half2(float2(0.0, 0.0)); tmpvar_33.xy = (coord_32 / _mtl_u._DynLampInfo_bufferSize); - half4 tmpvar_34; - half4 tmpvar_35; + half4 tmpvar_34 = 0; + half4 tmpvar_35 = 0; tmpvar_35 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_33.xy), level(0.0)); tmpvar_34 = tmpvar_35; - float2 tmpvar_36; + float2 tmpvar_36 = 0; tmpvar_36.y = 1.0; tmpvar_36.x = float(tmpvar_5.w); - half2 coord_37; + half2 coord_37 = 0; coord_37 = half2(tmpvar_36); - half4 tmpvar_38; + half4 tmpvar_38 = 0; tmpvar_38.zw = half2(float2(0.0, 0.0)); tmpvar_38.xy = (coord_37 / _mtl_u._DynLampInfo_bufferSize); - half4 tmpvar_39; - half4 tmpvar_40; + half4 tmpvar_39 = 0; + half4 tmpvar_40 = 0; tmpvar_40 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_38.xy), level(0.0)); tmpvar_39 = tmpvar_40; - float2 tmpvar_41; + float2 tmpvar_41 = 0; tmpvar_41.y = 2.0; tmpvar_41.x = float(tmpvar_5.w); - half2 coord_42; + half2 coord_42 = 0; coord_42 = half2(tmpvar_41); - half4 tmpvar_43; + half4 tmpvar_43 = 0; tmpvar_43.zw = half2(float2(0.0, 0.0)); tmpvar_43.xy = (coord_42 / _mtl_u._DynLampInfo_bufferSize); - half4 tmpvar_44; - half4 tmpvar_45; + half4 tmpvar_44 = 0; + half4 tmpvar_45 = 0; tmpvar_45 = _DynLampInfo.sample(_mtlsmp__DynLampInfo, (float2)(tmpvar_43.xy), level(0.0)); tmpvar_44 = tmpvar_45; - half3 hybridCol_46; - half4 atten_47; - float3 tmpvar_48; - tmpvar_48 = ((float3)tmpvar_9.xyz - tmpvar_2); - float tmpvar_49; + half3 hybridCol_46 = 0; + half4 atten_47 = 0; + float3 tmpvar_48 = 0; + tmpvar_48 = ((float3)(tmpvar_9.xyz) - tmpvar_2); + float tmpvar_49 = 0; tmpvar_49 = dot (tmpvar_48, tmpvar_48); - half4 tmpvar_50; + half4 tmpvar_50 = 0; tmpvar_50.yzw = atten_47.yzw; - tmpvar_50.x = half((tmpvar_49 * (float)tmpvar_9.w)); - float3 tmpvar_51; - tmpvar_51 = ((float3)tmpvar_19.xyz - tmpvar_2); - float tmpvar_52; + tmpvar_50.x = half((tmpvar_49 * (float)(tmpvar_9.w))); + float3 tmpvar_51 = 0; + tmpvar_51 = ((float3)(tmpvar_19.xyz) - tmpvar_2); + float tmpvar_52 = 0; tmpvar_52 = dot (tmpvar_51, tmpvar_51); - half4 tmpvar_53; + half4 tmpvar_53 = 0; tmpvar_53.xzw = tmpvar_50.xzw; - tmpvar_53.y = half((tmpvar_52 * (float)tmpvar_19.w)); - float3 tmpvar_54; - tmpvar_54 = ((float3)tmpvar_29.xyz - tmpvar_2); - float tmpvar_55; + tmpvar_53.y = half((tmpvar_52 * (float)(tmpvar_19.w))); + float3 tmpvar_54 = 0; + tmpvar_54 = ((float3)(tmpvar_29.xyz) - tmpvar_2); + float tmpvar_55 = 0; tmpvar_55 = dot (tmpvar_54, tmpvar_54); - half4 tmpvar_56; + half4 tmpvar_56 = 0; tmpvar_56.xyw = tmpvar_53.xyw; - tmpvar_56.z = half((tmpvar_55 * (float)tmpvar_29.w)); - float3 tmpvar_57; - tmpvar_57 = ((float3)tmpvar_39.xyz - tmpvar_2); - float tmpvar_58; + tmpvar_56.z = half((tmpvar_55 * (float)(tmpvar_29.w))); + float3 tmpvar_57 = 0; + tmpvar_57 = ((float3)(tmpvar_39.xyz) - tmpvar_2); + float tmpvar_58 = 0; tmpvar_58 = dot (tmpvar_57, tmpvar_57); - half4 tmpvar_59; + half4 tmpvar_59 = 0; tmpvar_59.xyz = tmpvar_56.xyz; - tmpvar_59.w = half((tmpvar_58 * (float)tmpvar_39.w)); + tmpvar_59.w = half((tmpvar_58 * (float)(tmpvar_39.w))); atten_47 = tmpvar_59; hybridCol_46 = (hybridCol_4 + (tmpvar_14.xyz * tmpvar_50.x)); hybridCol_46 = (hybridCol_46 + (tmpvar_24.xyz * tmpvar_53.y)); 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 36a8c79b23a..6ec726fa790 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 @@ -18,18 +18,18 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - float4 tmpvar_1; - float3 tmpvar_2; + float4 tmpvar_1 = 0; + float3 tmpvar_2 = 0; tmpvar_1 = (_mtl_u.glstate_matrix_mvp * _mtl_i._vertex); - float4 o_3; + float4 o_3 = 0; o_3 = (tmpvar_1 * 0.5); - float2 tmpvar_4; + float2 tmpvar_4 = 0; tmpvar_4.x = o_3.x; tmpvar_4.y = (o_3.y * _mtl_u._ProjectionParams.x); o_3.xy = (tmpvar_4 + o_3.w); o_3.zw = tmpvar_1.zw; tmpvar_2 = ((_mtl_u.glstate_matrix_modelview0 * _mtl_i._vertex).xyz * float3(-1.0, -1.0, 1.0)); - float3 tmpvar_5; + float3 tmpvar_5 = 0; tmpvar_5 = mix (tmpvar_2, _mtl_i._normal, float3(float((_mtl_i._normal.z != 0.0)))); tmpvar_2 = tmpvar_5; _mtl_o.gl_Position = tmpvar_1; 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 3d9bc6f8dff..5991e192410 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 @@ -36,56 +36,56 @@ struct xlatMtlShaderUniform { vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) { xlatMtlShaderOutput _mtl_o; - float4 tmpvar_1; - float3 tmpvar_2; - float4 tmpvar_3; + float4 tmpvar_1 = 0; + float3 tmpvar_2 = 0; + float4 tmpvar_3 = 0; tmpvar_1 = float4(_mtl_i.TANGENT); tmpvar_2 = float3(_mtl_i._inNormal); tmpvar_3 = float4(_mtl_i._color); - float3 binormal_4; - float4 tmpvar_5; - float4 tmpvar_6; - float4 pos_7; - float isBillboard_8; + float3 binormal_4 = 0; + float4 tmpvar_5 = 0; + float4 tmpvar_6 = 0; + float4 pos_7 = 0; + float isBillboard_8 = 0; isBillboard_8 = (1.0 - abs(tmpvar_1.w)); - float4 tmpvar_9; + float4 tmpvar_9 = 0; tmpvar_9.w = 0.0; tmpvar_9.xyz = tmpvar_2; - float4 tmpvar_10; + float4 tmpvar_10 = 0; tmpvar_10.w = 0.0; tmpvar_10.xyz = tmpvar_1.xyz; - float4 tmpvar_11; + float4 tmpvar_11 = 0; tmpvar_11.zw = float2(0.0, 0.0); tmpvar_11.xy = tmpvar_2.xy; pos_7 = (_mtl_i._inVertex + ((tmpvar_11 * _mtl_u.glstate_matrix_invtrans_modelview0) * isBillboard_8)); - float3 tmpvar_12; + float3 tmpvar_12 = 0; tmpvar_12 = mix (tmpvar_2, normalize((tmpvar_9 * _mtl_u.glstate_matrix_invtrans_modelview0)).xyz, float3(isBillboard_8)); - float4 tmpvar_13; + float4 tmpvar_13 = 0; tmpvar_13.w = -1.0; tmpvar_13.xyz = normalize((tmpvar_10 * _mtl_u.glstate_matrix_invtrans_modelview0)).xyz; - float4 tmpvar_14; + float4 tmpvar_14 = 0; tmpvar_14 = mix (tmpvar_1, tmpvar_13, float4(isBillboard_8)); tmpvar_5.w = pos_7.w; tmpvar_6.w = tmpvar_14.w; tmpvar_5.xyz = (pos_7.xyz * _mtl_u._Scale.xyz); - float4 pos_15; + float4 pos_15 = 0; pos_15.w = tmpvar_5.w; - float3 bend_16; - float2 vWavesSum_17; - float4 vWaves_18; - float fBranchPhase_19; + float3 bend_16 = 0; + float2 vWavesSum_17 = 0; + float4 vWaves_18 = 0; + float fBranchPhase_19 = 0; fBranchPhase_19 = (dot (_mtl_u._Object2World[3].xyz, float3(1.0, 1.0, 1.0)) + tmpvar_3.x); - float2 tmpvar_20; + float2 tmpvar_20 = 0; tmpvar_20.x = dot (tmpvar_5.xyz, float3((tmpvar_3.y + fBranchPhase_19))); tmpvar_20.y = fBranchPhase_19; vWaves_18 = ((fract( ((_mtl_u._Time.yy + tmpvar_20).xxyy * float4(1.975, 0.793, 0.375, 0.193)) ) * 2.0) - 1.0); - float4 tmpvar_21; + float4 tmpvar_21 = 0; tmpvar_21 = abs((( fract((vWaves_18 + 0.5)) * 2.0) - 1.0)); - float4 tmpvar_22; + float4 tmpvar_22 = 0; tmpvar_22 = ((tmpvar_21 * tmpvar_21) * (3.0 - (2.0 * tmpvar_21))); vWaves_18 = tmpvar_22; vWavesSum_17 = (tmpvar_22.xz + tmpvar_22.yw); @@ -97,18 +97,18 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], ((_mtl_u._Wind.xyz * vWavesSum_17.y) * _mtl_i._uv1.y) ) * _mtl_u._Wind.w)); pos_15.xyz = (pos_15.xyz + (_mtl_i._uv1.x * _mtl_u._Wind.xyz)); - float3 tmpvar_23; + float3 tmpvar_23 = 0; tmpvar_23 = mix ((pos_15.xyz - ( (dot (_mtl_u._SquashPlaneNormal.xyz, pos_15.xyz) + _mtl_u._SquashPlaneNormal.w) * _mtl_u._SquashPlaneNormal.xyz)), pos_15.xyz, float3(_mtl_u._SquashAmount)); - float4 tmpvar_24; + float4 tmpvar_24 = 0; tmpvar_24.w = 1.0; tmpvar_24.xyz = tmpvar_23; tmpvar_5 = tmpvar_24; - float4 tmpvar_25; + float4 tmpvar_25 = 0; tmpvar_25.xyz = float3(1.0, 1.0, 1.0); tmpvar_25.w = tmpvar_3.w; - float3 tmpvar_26; + float3 tmpvar_26 = 0; tmpvar_26 = normalize(tmpvar_12); tmpvar_6.xyz = normalize(tmpvar_14.xyz); binormal_4 = (((tmpvar_26.yzx * tmpvar_6.zxy) - (tmpvar_26.zxy * tmpvar_6.yzx)) * tmpvar_14.w); @@ -122,21 +122,21 @@ vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], tmpvar_27[2].x = tmpvar_6.z; tmpvar_27[2].y = binormal_4.z; tmpvar_27[2].z = tmpvar_26.z; - float4 tmpvar_28; + float4 tmpvar_28 = 0; tmpvar_28.w = 1.0; tmpvar_28.xyz = _mtl_u._WorldSpaceCameraPos; _mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * tmpvar_24); _mtl_o.xlv_TEXCOORD0 = ((_mtl_i._uv0.xy * _mtl_u._MainTex_ST.xy) + _mtl_u._MainTex_ST.zw); _mtl_o.xlv_COLOR0 = half4(tmpvar_25); - float3 tmpvar_29; + float3 tmpvar_29 = 0; tmpvar_29 = (tmpvar_27 * (_mtl_u._World2Object * _mtl_u._WorldSpaceLightPos0).xyz); _mtl_o.xlv_TEXCOORD1 = half3(tmpvar_29); - float3 tmpvar_30; + float3 tmpvar_30 = 0; tmpvar_30 = (tmpvar_27 * (( (_mtl_u._World2Object * tmpvar_28) .xyz * _mtl_u.unity_Scale.w) - tmpvar_23)); _mtl_o.xlv_TEXCOORD2 = half3(tmpvar_30); - float2 tmpvar_31; + float2 tmpvar_31 = 0; tmpvar_31 = (_mtl_u._LightMatrix0 * (_mtl_u._Object2World * tmpvar_24)).xy; _mtl_o.xlv_TEXCOORD3 = half2(tmpvar_31); return _mtl_o; diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp index 1939cc3578a..7fc8082c613 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp @@ -150,6 +150,8 @@ Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code. Also read releases logs https://github.com/ocornut/imgui/releases for more details. + - 2016/10/15 (1.50) - avoid 'void* user_data' parameter to io.SetClipboardTextFn/io.GetClipboardTextFn pointers. We pass io.ClipboardUserData to it. + - 2016/09/25 (1.50) - style.WindowTitleAlign is now a ImVec2 (ImGuiAlign enum was removed). set to (0.5f,0.5f) for horizontal+vertical centering, (0.0f,0.0f) for upper-left, etc. - 2016/07/30 (1.50) - SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal. - 2016/05/12 (1.49) - title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore. If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you. @@ -293,7 +295,7 @@ Also make sure your orthographic projection matrix and io.DisplaySize matches your actual framebuffer dimension. Q: I integrated ImGui in my engine and some elements are clipping or disappearing when I move windows around.. - A: Most likely you are mishandling the clipping rectangles in your render function. Rectangles provided by ImGui are defined as (x1,y1,x2,y2) and NOT as (x1,y1,width,height). + A: Most likely you are mishandling the clipping rectangles in your render function. Rectangles provided by ImGui are defined as (x1=left,y1=top,x2=right,y2=bottom) and NOT as (x1,y1,width,height). Q: Can I have multiple widgets with the same label? Can I have widget without a label? (Yes) A: Yes. A primer on the use of labels/IDs in ImGui.. @@ -301,7 +303,7 @@ - Elements that are not clickable, such as Text() items don't need an ID. - Interactive widgets require state to be carried over multiple frames (most typically ImGui often needs to remember what is the "active" widget). - to do so they need an unique ID. unique ID are typically derived from a string label, an integer index or a pointer. + to do so they need a unique ID. unique ID are typically derived from a string label, an integer index or a pointer. Button("OK"); // Label = "OK", ID = hash of "OK" Button("Cancel"); // Label = "Cancel", ID = hash of "Cancel" @@ -483,8 +485,9 @@ !- main: make it so that a frame with no window registered won't refocus every window on subsequent frames (~bump LastFrameActive of all windows). - main: IsItemHovered() make it more consistent for various type of widgets, widgets with multiple components, etc. also effectively IsHovered() region sometimes differs from hot region, e.g tree nodes - main: IsItemHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode? - - input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now. + - input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile. - input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541) + - input text: expose CursorPos in char filter event (#816) - input text: flag to disable live update of the user buffer (also applies to float/int text input) - input text: resize behavior - field could stretch when being edited? hover tooltip shows more text? - input text: add ImGuiInputTextFlags_EnterToApply? (off #218) @@ -524,7 +527,7 @@ !- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402) - popups: add variant using global identifier similar to Begin/End (#402) - popups: border options. richer api like BeginChild() perhaps? (#197) - - tooltip: tooltip that doesn't fit in entire screen seems to lose their "last prefered button" and may teleport when moving mouse + - tooltip: tooltip that doesn't fit in entire screen seems to lose their "last preferred button" and may teleport when moving mouse - menus: local shortcuts, global shortcuts (#456, #126) - menus: icons - menus: menubars: some sort of priority / effect of main menu-bar on desktop size? @@ -562,7 +565,6 @@ - style: color-box not always square? - style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc. - style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation). - - style/opt: PopStyleVar could be optimized by having GetStyleVar returns the type, using a table mapping stylevar enum to data type. - style: global scale setting. - style: WindowPadding needs to be EVEN needs the 0.5 multiplier probably have a subtle effect on clip rectangle - text: simple markup language for color change? @@ -707,8 +709,8 @@ static bool DataTypeApplyOpFromText(const char* buf, const char* ini // Platform dependent default implementations //----------------------------------------------------------------------------- -static const char* GetClipboardTextFn_DefaultImpl(); -static void SetClipboardTextFn_DefaultImpl(const char* text); +static const char* GetClipboardTextFn_DefaultImpl(void* user_data); +static void SetClipboardTextFn_DefaultImpl(void* user_data, const char* text); static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y); //----------------------------------------------------------------------------- @@ -734,7 +736,7 @@ ImGuiStyle::ImGuiStyle() WindowPadding = ImVec2(8,8); // Padding within a window WindowMinSize = ImVec2(32,32); // Minimum window size WindowRounding = 9.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows - WindowTitleAlign = ImGuiAlign_Left; // Alignment for title bar text + WindowTitleAlign = ImVec2(0.0f,0.5f);// Alignment for title bar text ChildWindowRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets) FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets). @@ -747,6 +749,7 @@ ImGuiStyle::ImGuiStyle() ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. + ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text. DisplayWindowPadding = ImVec2(22,22); // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows. DisplaySafeAreaPadding = ImVec2(4,4); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. AntiAliasedLines = true; // Enable anti-aliasing on lines/borders. Disable if you are really short on CPU/GPU. @@ -832,6 +835,7 @@ ImGuiIO::ImGuiIO() MemFreeFn = free; GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations SetClipboardTextFn = SetClipboardTextFn_DefaultImpl; + ClipboardUserData = NULL; ImeSetInputScreenPosFn = ImeSetInputScreenPosFn_DefaultImpl; // Set OS X style defaults based on __APPLE__ compile time flag @@ -1198,16 +1202,20 @@ int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_e ImVec4 ImGui::ColorConvertU32ToFloat4(ImU32 in) { float s = 1.0f/255.0f; - return ImVec4((in & 0xFF) * s, ((in >> 8) & 0xFF) * s, ((in >> 16) & 0xFF) * s, (in >> 24) * s); + return ImVec4( + ((in >> IM_COL32_R_SHIFT) & 0xFF) * s, + ((in >> IM_COL32_G_SHIFT) & 0xFF) * s, + ((in >> IM_COL32_B_SHIFT) & 0xFF) * s, + ((in >> IM_COL32_A_SHIFT) & 0xFF) * s); } ImU32 ImGui::ColorConvertFloat4ToU32(const ImVec4& in) { ImU32 out; - out = ((ImU32)IM_F32_TO_INT8_SAT(in.x)); - out |= ((ImU32)IM_F32_TO_INT8_SAT(in.y)) << 8; - out |= ((ImU32)IM_F32_TO_INT8_SAT(in.z)) << 16; - out |= ((ImU32)IM_F32_TO_INT8_SAT(in.w)) << 24; + out = ((ImU32)IM_F32_TO_INT8_SAT(in.x)) << IM_COL32_R_SHIFT; + out |= ((ImU32)IM_F32_TO_INT8_SAT(in.y)) << IM_COL32_G_SHIFT; + out |= ((ImU32)IM_F32_TO_INT8_SAT(in.z)) << IM_COL32_B_SHIFT; + out |= ((ImU32)IM_F32_TO_INT8_SAT(in.w)) << IM_COL32_A_SHIFT; return out; } @@ -1215,14 +1223,14 @@ ImU32 ImGui::GetColorU32(ImGuiCol idx, float alpha_mul) { ImVec4 c = GImGui->Style.Colors[idx]; c.w *= GImGui->Style.Alpha * alpha_mul; - return ImGui::ColorConvertFloat4ToU32(c); + return ColorConvertFloat4ToU32(c); } ImU32 ImGui::GetColorU32(const ImVec4& col) { ImVec4 c = col; c.w *= GImGui->Style.Alpha; - return ImGui::ColorConvertFloat4ToU32(c); + return ColorConvertFloat4ToU32(c); } // Convert rgb floats ([0-1],[0-1],[0-1]) to hsv floats ([0-1],[0-1],[0-1]), from Foley & van Dam p592 @@ -1831,6 +1839,8 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window = NULL) g.ActiveId = id; g.ActiveIdAllowOverlap = false; g.ActiveIdIsJustActivated = true; + if (id) + g.ActiveIdIsAlive = true; g.ActiveIdWindow = window; } @@ -2007,13 +2017,13 @@ void ImGui::MemFree(void* ptr) const char* ImGui::GetClipboardText() { - return GImGui->IO.GetClipboardTextFn ? GImGui->IO.GetClipboardTextFn() : ""; + return GImGui->IO.GetClipboardTextFn ? GImGui->IO.GetClipboardTextFn(GImGui->IO.ClipboardUserData) : ""; } void ImGui::SetClipboardText(const char* text) { if (GImGui->IO.SetClipboardTextFn) - GImGui->IO.SetClipboardTextFn(text); + GImGui->IO.SetClipboardTextFn(GImGui->IO.ClipboardUserData, text); } const char* ImGui::GetVersion() @@ -2339,10 +2349,13 @@ void ImGui::Shutdown() } g.Windows.clear(); g.WindowsSortBuffer.clear(); + g.CurrentWindow = NULL; g.CurrentWindowStack.clear(); g.FocusedWindow = NULL; g.HoveredWindow = NULL; g.HoveredRootWindow = NULL; + g.ActiveIdWindow = NULL; + g.MovedWindow = NULL; for (int i = 0; i < g.Settings.Size; i++) ImGui::MemFree(g.Settings[i].Name); g.Settings.clear(); @@ -2351,6 +2364,8 @@ void ImGui::Shutdown() g.FontStack.clear(); g.OpenPopupStack.clear(); g.CurrentPopupStack.clear(); + g.SetNextWindowSizeConstraintCallback = NULL; + g.SetNextWindowSizeConstraintCallbackUserData = NULL; for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++) g.RenderDrawLists[i].clear(); g.OverlayDrawList.ClearFreeMemory(); @@ -2546,9 +2561,9 @@ static void AddDrawListToRenderList(ImVector<ImDrawList*>& out_render_list, ImDr } // Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. - IM_ASSERT(draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size); - IM_ASSERT(draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size); - IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); + IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size); + IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size); + IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); // 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. @@ -2866,8 +2881,9 @@ void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end } } +// Default clip_rect uses (pos_min,pos_max) // Handle clipping on CPU immediately (vs typically let the GPU clip the triangles that are overlapping the clipping rectangle edges) -void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, ImGuiAlign align, const ImVec2* clip_min, const ImVec2* clip_max) +void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align, const ImRect* clip_rect) { // Hide anything after a '##' string const char* text_display_end = FindRenderedTextEnd(text, text_end); @@ -2882,14 +2898,15 @@ void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, cons ImVec2 pos = pos_min; const ImVec2 text_size = text_size_if_known ? *text_size_if_known : CalcTextSize(text, text_display_end, false, 0.0f); - if (!clip_max) clip_max = &pos_max; + const ImVec2* clip_min = clip_rect ? &clip_rect->Min : &pos_min; + const ImVec2* clip_max = clip_rect ? &clip_rect->Max : &pos_max; bool need_clipping = (pos.x + text_size.x >= clip_max->x) || (pos.y + text_size.y >= clip_max->y); - if (!clip_min) clip_min = &pos_min; else need_clipping |= (pos.x < clip_min->x) || (pos.y < clip_min->y); + if (clip_rect) // If we had no explicit clipping rectangle then pos==clip_min + need_clipping |= (pos.x < clip_min->x) || (pos.y < clip_min->y); - // Align - if (align & ImGuiAlign_Center) pos.x = ImMax(pos.x, (pos.x + pos_max.x - text_size.x) * 0.5f); - else if (align & ImGuiAlign_Right) pos.x = ImMax(pos.x, pos_max.x - text_size.x); - if (align & ImGuiAlign_VCenter) pos.y = ImMax(pos.y, (pos.y + pos_max.y - text_size.y) * 0.5f); + // Align whole block. We should defer that to the better rendering function when we'll have support for individual line alignment. + if (align.x > 0.0f) pos.x = ImMax(pos.x, pos.x + (pos_max.x - pos.x - text_size.x) * align.x); + if (align.y > 0.0f) pos.y = ImMax(pos.y, pos.y + (pos_max.y - pos.y - text_size.y) * align.y); // Render if (need_clipping) @@ -2919,7 +2936,7 @@ void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border, } // Render a triangle to denote expanded/collapsed state -void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale, bool shadow) +void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale) { ImGuiContext& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); @@ -2943,8 +2960,6 @@ void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale, bool c = center + ImVec2(-0.500f,-0.866f)*r; } - if (shadow && (window->Flags & ImGuiWindowFlags_ShowBorders) != 0) - window->DrawList->AddTriangleFilled(a+ImVec2(2,2), b+ImVec2(2,2), c+ImVec2(2,2), GetColorU32(ImGuiCol_BorderShadow)); window->DrawList->AddTriangleFilled(a, b, c, GetColorU32(ImGuiCol_Text)); } @@ -3360,8 +3375,7 @@ void ImGui::EndTooltip() static bool IsPopupOpen(ImGuiID id) { ImGuiContext& g = *GImGui; - const bool is_open = g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id; - return is_open; + return g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id; } // Mark popup as open (toggle toward open state). @@ -3481,11 +3495,11 @@ static bool BeginPopupEx(const char* str_id, ImGuiWindowFlags extra_flags) ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGuiWindowFlags flags = extra_flags|ImGuiWindowFlags_Popup|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize; - char name[32]; + char name[20]; if (flags & ImGuiWindowFlags_ChildMenu) - ImFormatString(name, 20, "##menu_%d", g.CurrentPopupStack.Size); // Recycle windows based on depth + ImFormatString(name, IM_ARRAYSIZE(name), "##menu_%d", g.CurrentPopupStack.Size); // Recycle windows based on depth else - ImFormatString(name, 20, "##popup_%08x", id); // Not recycling, so we can close/open during the same frame + ImFormatString(name, IM_ARRAYSIZE(name), "##popup_%08x", id); // Not recycling, so we can close/open during the same frame bool is_open = ImGui::Begin(name, NULL, flags); if (!(window->Flags & ImGuiWindowFlags_ShowBorders)) @@ -4063,7 +4077,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us if (window_pos_center) { // Center (any sort of window) - SetWindowPos(ImMax(style.DisplaySafeAreaPadding, fullscreen_rect.GetCenter() - window->SizeFull * 0.5f)); + SetWindowPos(window, ImMax(style.DisplaySafeAreaPadding, fullscreen_rect.GetCenter() - window->SizeFull * 0.5f), 0); } else if (flags & ImGuiWindowFlags_ChildMenu) { @@ -4185,8 +4199,7 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f); window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f; - // Window background - // Default alpha + // Window background, Default Alpha ImGuiCol bg_color_idx = ImGuiCol_WindowBg; if ((flags & ImGuiWindowFlags_ComboBox) != 0) bg_color_idx = ImGuiCol_ComboBg; @@ -4199,19 +4212,19 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us bg_color.w = bg_alpha; bg_color.w *= style.Alpha; if (bg_color.w > 0.0f) - window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, ColorConvertFloat4ToU32(bg_color), window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? 15 : 4|8); + window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, ColorConvertFloat4ToU32(bg_color), window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImGuiCorner_All : ImGuiCorner_BottomLeft|ImGuiCorner_BottomRight); // Title bar if (!(flags & ImGuiWindowFlags_NoTitleBar)) - window->DrawList->AddRectFilled(title_bar_rect.GetTL(), title_bar_rect.GetBR(), GetColorU32((g.FocusedWindow && window->RootNonPopupWindow == g.FocusedWindow->RootNonPopupWindow) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, 1|2); + window->DrawList->AddRectFilled(title_bar_rect.GetTL(), title_bar_rect.GetBR(), GetColorU32((g.FocusedWindow && window->RootNonPopupWindow == g.FocusedWindow->RootNonPopupWindow) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, ImGuiCorner_TopLeft|ImGuiCorner_TopRight); // Menu bar if (flags & ImGuiWindowFlags_MenuBar) { ImRect menu_bar_rect = window->MenuBarRect(); - window->DrawList->AddRectFilled(menu_bar_rect.GetTL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, 1|2); if (flags & ImGuiWindowFlags_ShowBorders) - window->DrawList->AddLine(menu_bar_rect.GetBL()-ImVec2(0,0), menu_bar_rect.GetBR()-ImVec2(0,0), GetColorU32(ImGuiCol_Border)); + window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border)); + window->DrawList->AddRectFilled(menu_bar_rect.GetTL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImGuiCorner_TopLeft|ImGuiCorner_TopRight); } // Scrollbars @@ -4303,18 +4316,19 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us const ImVec2 text_size = CalcTextSize(name, NULL, true); if (!(flags & ImGuiWindowFlags_NoCollapse)) - RenderCollapseTriangle(window->Pos + style.FramePadding, !window->Collapsed, 1.0f, true); - - ImVec2 text_min = window->Pos + style.FramePadding; - ImVec2 text_max = window->Pos + ImVec2(window->Size.x - style.FramePadding.x, style.FramePadding.y*2 + text_size.y); - ImVec2 clip_max = ImVec2(window->Pos.x + window->Size.x - (p_open ? title_bar_rect.GetHeight() - 3 : style.FramePadding.x), text_max.y); // Match the size of CloseWindowButton() - bool pad_left = (flags & ImGuiWindowFlags_NoCollapse) == 0; - bool pad_right = (p_open != NULL); - if (style.WindowTitleAlign & ImGuiAlign_Center) pad_right = pad_left; - if (pad_left) text_min.x += g.FontSize + style.ItemInnerSpacing.x; - if (pad_right) text_max.x -= g.FontSize + style.ItemInnerSpacing.x; - ImVec2 clip_min = ImVec2(text_min.x, window->Pos.y); - RenderTextClipped(text_min, text_max, name, NULL, &text_size, style.WindowTitleAlign, &clip_min, &clip_max); + RenderCollapseTriangle(window->Pos + style.FramePadding, !window->Collapsed, 1.0f); + + ImVec2 text_min = window->Pos; + ImVec2 text_max = window->Pos + ImVec2(window->Size.x, style.FramePadding.y*2 + text_size.y); + ImRect clip_rect; + clip_rect.Max = ImVec2(window->Pos.x + window->Size.x - (p_open ? title_bar_rect.GetHeight() - 3 : style.FramePadding.x), text_max.y); // Match the size of CloseWindowButton() + float pad_left = (flags & ImGuiWindowFlags_NoCollapse) == 0 ? (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x) : 0.0f; + float pad_right = (p_open != NULL) ? (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x) : 0.0f; + if (style.WindowTitleAlign.x > 0.0f) pad_right = ImLerp(pad_right, pad_left, style.WindowTitleAlign.x); + text_min.x += pad_left; + text_max.x -= pad_right; + clip_rect.Min = ImVec2(text_min.x, window->Pos.y); + RenderTextClipped(text_min, text_max, name, NULL, &text_size, style.WindowTitleAlign, &clip_rect); } // Save clipped aabb so we can access it in constant-time in FindHoveredWindow() @@ -4418,9 +4432,9 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal) float window_rounding = (window->Flags & ImGuiWindowFlags_ChildWindow) ? style.ChildWindowRounding : style.WindowRounding; int window_rounding_corners; if (horizontal) - window_rounding_corners = 8 | (other_scrollbar ? 0 : 4); + window_rounding_corners = ImGuiCorner_BottomLeft | (other_scrollbar ? 0 : ImGuiCorner_BottomRight); else - window_rounding_corners = (((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? 2 : 0) | (other_scrollbar ? 0 : 4); + window_rounding_corners = (((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImGuiCorner_TopRight : 0) | (other_scrollbar ? 0 : ImGuiCorner_BottomRight); window->DrawList->AddRectFilled(bb.Min, bb.Max, ImGui::GetColorU32(ImGuiCol_ScrollbarBg), window_rounding, window_rounding_corners); bb.Reduce(ImVec2(ImClamp((float)(int)((bb.Max.x - bb.Min.x - 2.0f) * 0.5f), 0.0f, 3.0f), ImClamp((float)(int)((bb.Max.y - bb.Min.y - 2.0f) * 0.5f), 0.0f, 3.0f))); @@ -4646,7 +4660,7 @@ void ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col) ImGuiContext& g = *GImGui; ImGuiColMod backup; backup.Col = idx; - backup.PreviousValue = g.Style.Colors[idx]; + backup.BackupValue = g.Style.Colors[idx]; g.ColorModifiers.push_back(backup); g.Style.Colors[idx] = col; } @@ -4657,65 +4671,66 @@ void ImGui::PopStyleColor(int count) while (count > 0) { ImGuiColMod& backup = g.ColorModifiers.back(); - g.Style.Colors[backup.Col] = backup.PreviousValue; + g.Style.Colors[backup.Col] = backup.BackupValue; g.ColorModifiers.pop_back(); count--; } } -static float* GetStyleVarFloatAddr(ImGuiStyleVar idx) +struct ImGuiStyleVarInfo { - ImGuiContext& g = *GImGui; - switch (idx) - { - case ImGuiStyleVar_Alpha: return &g.Style.Alpha; - case ImGuiStyleVar_WindowRounding: return &g.Style.WindowRounding; - case ImGuiStyleVar_ChildWindowRounding: return &g.Style.ChildWindowRounding; - case ImGuiStyleVar_FrameRounding: return &g.Style.FrameRounding; - case ImGuiStyleVar_IndentSpacing: return &g.Style.IndentSpacing; - case ImGuiStyleVar_GrabMinSize: return &g.Style.GrabMinSize; - case ImGuiStyleVar_ViewId: return &g.Style.ViewId; - } - return NULL; -} + ImGuiDataType Type; + ImU32 Offset; + void* GetVarPtr() const { return (void*)((unsigned char*)&GImGui->Style + Offset); } +}; + +static const ImGuiStyleVarInfo GStyleVarInfo[ImGuiStyleVar_Count_] = +{ + { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, Alpha) }, + { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowPadding) }, + { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowRounding) }, + { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowMinSize) }, + { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, ChildWindowRounding) }, + { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, FramePadding) }, + { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameRounding) }, + { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemSpacing) }, + { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemInnerSpacing) }, + { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, IndentSpacing) }, + { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, GrabMinSize) }, + { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ButtonTextAlign) }, + { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, ViewId) }, +}; -static ImVec2* GetStyleVarVec2Addr(ImGuiStyleVar idx) +static const ImGuiStyleVarInfo* GetStyleVarInfo(ImGuiStyleVar idx) { - ImGuiContext& g = *GImGui; - switch (idx) - { - case ImGuiStyleVar_WindowPadding: return &g.Style.WindowPadding; - case ImGuiStyleVar_WindowMinSize: return &g.Style.WindowMinSize; - case ImGuiStyleVar_FramePadding: return &g.Style.FramePadding; - case ImGuiStyleVar_ItemSpacing: return &g.Style.ItemSpacing; - case ImGuiStyleVar_ItemInnerSpacing: return &g.Style.ItemInnerSpacing; - } - return NULL; + IM_ASSERT(idx >= 0 && idx < ImGuiStyleVar_Count_); + return &GStyleVarInfo[idx]; } void ImGui::PushStyleVar(ImGuiStyleVar idx, float val) { - ImGuiContext& g = *GImGui; - float* pvar = GetStyleVarFloatAddr(idx); - IM_ASSERT(pvar != NULL); // Called function with wrong-type? Variable is not a float. - ImGuiStyleMod backup; - backup.Var = idx; - backup.PreviousValue = ImVec2(*pvar, 0.0f); - g.StyleModifiers.push_back(backup); - *pvar = val; + const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx); + if (var_info->Type == ImGuiDataType_Float) + { + float* pvar = (float*)var_info->GetVarPtr(); + GImGui->StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar)); + *pvar = val; + return; + } + IM_ASSERT(0); // Called function with wrong-type? Variable is not a float. } - void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val) { - ImGuiContext& g = *GImGui; - ImVec2* pvar = GetStyleVarVec2Addr(idx); - IM_ASSERT(pvar != NULL); // Called function with wrong-type? Variable is not a ImVec2. - ImGuiStyleMod backup; - backup.Var = idx; - backup.PreviousValue = *pvar; - g.StyleModifiers.push_back(backup); - *pvar = val; + const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx); + if (var_info->Type == ImGuiDataType_Float2) + { + ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(); + GImGui->StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar)); + *pvar = val; + return; + } + IM_ASSERT(0); // Called function with wrong-type? Variable is not a ImVec2. } void ImGui::PopStyleVar(int count) @@ -4724,10 +4739,10 @@ void ImGui::PopStyleVar(int count) while (count > 0) { ImGuiStyleMod& backup = g.StyleModifiers.back(); - if (float* pvar_f = GetStyleVarFloatAddr(backup.Var)) - *pvar_f = backup.PreviousValue.x; - else if (ImVec2* pvar_v = GetStyleVarVec2Addr(backup.Var)) - *pvar_v = backup.PreviousValue; + const ImGuiStyleVarInfo* info = GetStyleVarInfo(backup.VarIdx); + if (info->Type == ImGuiDataType_Float) (*(float*)info->GetVarPtr()) = backup.BackupFloat[0]; + else if (info->Type == ImGuiDataType_Float2) (*(ImVec2*)info->GetVarPtr()) = ImVec2(backup.BackupFloat[0], backup.BackupFloat[1]); + else if (info->Type == ImGuiDataType_Int) (*(int*)info->GetVarPtr()) = backup.BackupInt[0]; g.StyleModifiers.pop_back(); count--; } @@ -4860,14 +4875,13 @@ static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiSetCond co void ImGui::SetWindowPos(const ImVec2& pos, ImGuiSetCond cond) { - ImGuiWindow* window = GetCurrentWindow(); + ImGuiWindow* window = GetCurrentWindowRead(); SetWindowPos(window, pos, cond); } void ImGui::SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond) { - ImGuiWindow* window = FindWindowByName(name); - if (window) + if (ImGuiWindow* window = FindWindowByName(name)) SetWindowPos(window, pos, cond); } @@ -5448,7 +5462,7 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args) // Render const char* value_text_begin = &g.TempBuffer[0]; const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); - RenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImGuiAlign_VCenter); + RenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImVec2(0.0f,0.5f)); if (label_size.x > 0.0f) RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label); } @@ -5565,7 +5579,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags const ImVec2 label_size = CalcTextSize(label, NULL, true); ImVec2 pos = window->DC.CursorPos; - if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset) + if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset) // Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag) pos.y += window->DC.CurrentLineTextBaseOffset - style.FramePadding.y; ImVec2 size = CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f); @@ -5581,7 +5595,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags // Render const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); - RenderTextClipped(bb.Min, bb.Max, label, NULL, &label_size, ImGuiAlign_Center | ImGuiAlign_VCenter); + RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb); // Automatically close popups //if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup)) @@ -5790,8 +5804,7 @@ void ImGui::LogFinish() } if (g.LogClipboard->size() > 1) { - if (g.IO.SetClipboardTextFn) - g.IO.SetClipboardTextFn(g.LogClipboard->begin()); + SetClipboardText(g.LogClipboard->begin()); g.LogClipboard->clear(); } } @@ -5941,7 +5954,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l { // Framed type RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); - RenderCollapseTriangle(bb.Min + padding + ImVec2(0.0f, text_base_offset_y), is_open, 1.0f, true); + RenderCollapseTriangle(bb.Min + padding + ImVec2(0.0f, text_base_offset_y), is_open, 1.0f); if (g.LogEnabled) { // NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here. @@ -5965,7 +5978,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l if (flags & ImGuiTreeNodeFlags_Bullet) RenderBullet(bb.Min + ImVec2(text_offset_x * 0.5f, g.FontSize*0.50f + text_base_offset_y)); else if (!(flags & ImGuiTreeNodeFlags_Leaf)) - RenderCollapseTriangle(bb.Min + ImVec2(padding.x, g.FontSize*0.15f + text_base_offset_y), is_open, 0.70f, false); + RenderCollapseTriangle(bb.Min + ImVec2(padding.x, g.FontSize*0.15f + text_base_offset_y), is_open, 0.70f); if (g.LogEnabled) LogRenderedText(text_pos, ">"); RenderText(text_pos, label, label_end, false); @@ -6101,7 +6114,7 @@ void ImGui::TreeAdvanceToLabelPos() g.CurrentWindow->DC.CursorPos.x += GetTreeNodeToLabelSpacing(); } -// Horizontal distance preceeding label when using TreeNode() or Bullet() +// Horizontal distance preceding label when using TreeNode() or Bullet() float ImGui::GetTreeNodeToLabelSpacing() { ImGuiContext& g = *GImGui; @@ -6580,7 +6593,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c // Display value using user-provided display format so user can add prefix/suffix/decorations to the value. char value_buf[64]; const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v); - RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImGuiAlign_Center|ImGuiAlign_VCenter); + RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.5f)); if (label_size.x > 0.0f) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); @@ -6627,7 +6640,7 @@ bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float // For the vertical slider we allow centered text to overlap the frame padding char value_buf[64]; char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v); - RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImGuiAlign_Center); + RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.0f)); if (label_size.x > 0.0f) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); @@ -6877,7 +6890,7 @@ bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, f // Display value using user-provided display format so user can add prefix/suffix/decorations to the value. char value_buf[64]; const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v); - RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImGuiAlign_Center|ImGuiAlign_VCenter); + RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.5f)); if (label_size.x > 0.0f) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); @@ -7071,64 +7084,67 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); - int res_w = ImMin((int)graph_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); - int item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); - - // Tooltip on hover - int v_hovered = -1; - if (IsHovered(inner_bb, 0)) + if (values_count > 0) { - const float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f); - const int v_idx = (int)(t * item_count); - IM_ASSERT(v_idx >= 0 && v_idx < values_count); - - const float v0 = values_getter(data, (v_idx + values_offset) % values_count); - const float v1 = values_getter(data, (v_idx + 1 + values_offset) % values_count); - if (plot_type == ImGuiPlotType_Lines) - SetTooltip("%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx+1, v1); - else if (plot_type == ImGuiPlotType_Histogram) - SetTooltip("%d: %8.4g", v_idx, v0); - v_hovered = v_idx; - } + int res_w = ImMin((int)graph_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); + int item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); - const float t_step = 1.0f / (float)res_w; + // Tooltip on hover + int v_hovered = -1; + if (IsHovered(inner_bb, 0)) + { + const float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f); + const int v_idx = (int)(t * item_count); + IM_ASSERT(v_idx >= 0 && v_idx < values_count); + + const float v0 = values_getter(data, (v_idx + values_offset) % values_count); + const float v1 = values_getter(data, (v_idx + 1 + values_offset) % values_count); + if (plot_type == ImGuiPlotType_Lines) + SetTooltip("%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx+1, v1); + else if (plot_type == ImGuiPlotType_Histogram) + SetTooltip("%d: %8.4g", v_idx, v0); + v_hovered = v_idx; + } - float v0 = values_getter(data, (0 + values_offset) % values_count); - float t0 = 0.0f; - ImVec2 tp0 = ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) / (scale_max - scale_min)) ); // Point in the normalized space of our target rectangle + const float t_step = 1.0f / (float)res_w; - const ImU32 col_base = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLines : ImGuiCol_PlotHistogram); - const ImU32 col_hovered = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLinesHovered : ImGuiCol_PlotHistogramHovered); + float v0 = values_getter(data, (0 + values_offset) % values_count); + float t0 = 0.0f; + ImVec2 tp0 = ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) / (scale_max - scale_min)) ); // Point in the normalized space of our target rectangle - for (int n = 0; n < res_w; n++) - { - const float t1 = t0 + t_step; - const int v1_idx = (int)(t0 * item_count + 0.5f); - IM_ASSERT(v1_idx >= 0 && v1_idx < values_count); - const float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count); - const ImVec2 tp1 = ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) / (scale_max - scale_min)) ); + const ImU32 col_base = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLines : ImGuiCol_PlotHistogram); + const ImU32 col_hovered = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLinesHovered : ImGuiCol_PlotHistogramHovered); - // NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU. - ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0); - ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, 1.0f)); - if (plot_type == ImGuiPlotType_Lines) + for (int n = 0; n < res_w; n++) { - window->DrawList->AddLine(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base); - } - else if (plot_type == ImGuiPlotType_Histogram) - { - if (pos1.x >= pos0.x + 2.0f) - pos1.x -= 1.0f; - window->DrawList->AddRectFilled(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base); - } + const float t1 = t0 + t_step; + const int v1_idx = (int)(t0 * item_count + 0.5f); + IM_ASSERT(v1_idx >= 0 && v1_idx < values_count); + const float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count); + const ImVec2 tp1 = ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) / (scale_max - scale_min)) ); + + // NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU. + ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0); + ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, 1.0f)); + if (plot_type == ImGuiPlotType_Lines) + { + window->DrawList->AddLine(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base); + } + else if (plot_type == ImGuiPlotType_Histogram) + { + if (pos1.x >= pos0.x + 2.0f) + pos1.x -= 1.0f; + window->DrawList->AddRectFilled(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base); + } - t0 = t1; - tp0 = tp1; + t0 = t1; + tp0 = tp1; + } } // Text overlay if (overlay_text) - RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImGuiAlign_Center); + RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImVec2(0.5f,0.0f)); if (label_size.x > 0.0f) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); @@ -7204,7 +7220,7 @@ void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* over ImVec2 overlay_size = CalcTextSize(overlay, NULL); if (overlay_size.x > 0.0f) - RenderTextClipped(ImVec2(ImClamp(fill_br.x + style.ItemSpacing.x, bb.Min.x, bb.Max.x - overlay_size.x - style.ItemInnerSpacing.x), bb.Min.y), bb.Max, overlay, NULL, &overlay_size, ImGuiAlign_Left|ImGuiAlign_VCenter, &bb.Min, &bb.Max); + RenderTextClipped(ImVec2(ImClamp(fill_br.x + style.ItemSpacing.x, bb.Min.x, bb.Max.x - overlay_size.x - style.ItemInnerSpacing.x), bb.Min.y), bb.Max, overlay, NULL, &overlay_size, ImVec2(0.0f,0.5f), &bb); } bool ImGui::Checkbox(const char* label, bool* v) @@ -7419,12 +7435,12 @@ static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* ob static bool is_separator(unsigned int c) { return ImCharIsSpace(c) || c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|'; } static int is_word_boundary_from_right(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (is_separator( obj->Text[idx-1] ) && !is_separator( obj->Text[idx] ) ) : 1; } -static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; } +static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; } #ifdef __APPLE__ // FIXME: Move setting to IO structure static int is_word_boundary_from_left(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (!is_separator( obj->Text[idx-1] ) && is_separator( obj->Text[idx] ) ) : 1; } -static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; } +static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; } #else -static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; } +static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; } #endif #define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h #define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL @@ -7605,11 +7621,13 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 const ImGuiIO& io = g.IO; const ImGuiStyle& style = g.Style; - const ImGuiID id = window->GetID(label); const bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0; const bool is_editable = (flags & ImGuiInputTextFlags_ReadOnly) == 0; const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0; + if (is_multiline) // Open group before calling GetID() because groups tracks id created during their spawn + BeginGroup(); + const ImGuiID id = window->GetID(label); const ImVec2 label_size = CalcTextSize(label, NULL, true); ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), (is_multiline ? GetTextLineHeight() * 8.0f : label_size.y) + style.FramePadding.y*2.0f); // Arbitrary default of 8 lines high for multi-line const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size); @@ -7618,7 +7636,6 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 ImGuiWindow* draw_window = window; if (is_multiline) { - BeginGroup(); if (!BeginChildFrame(id, frame_bb.GetSize())) { EndChildFrame(); @@ -7849,7 +7866,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 const int ie = edit_state.HasSelection() ? ImMax(edit_state.StbState.select_start, edit_state.StbState.select_end) : edit_state.CurLenW; edit_state.TempTextBuffer.resize((ie-ib) * 4 + 1); ImTextStrToUtf8(edit_state.TempTextBuffer.Data, edit_state.TempTextBuffer.Size, edit_state.Text.Data+ib, edit_state.Text.Data+ie); - io.SetClipboardTextFn(edit_state.TempTextBuffer.Data); + SetClipboardText(edit_state.TempTextBuffer.Data); } if (cut) @@ -7861,7 +7878,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 else if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_V) && is_editable) { // Paste - if (const char* clipboard = io.GetClipboardTextFn ? io.GetClipboardTextFn() : NULL) + if (const char* clipboard = GetClipboardText()) { // Filter pasted buffer const int clipboard_len = (int)strlen(clipboard); @@ -8145,8 +8162,6 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2 Dummy(text_size + ImVec2(0.0f, g.FontSize)); // Always add room to scroll an extra line EndChildFrame(); EndGroup(); - if (g.ActiveId == id || is_currently_scrolling) // Set LastItemId which was lost by EndChild/EndGroup, so user can use IsItemActive() - window->DC.LastItemId = g.ActiveId; } if (is_password) @@ -8200,7 +8215,7 @@ bool ImGui::InputScalarEx(const char* label, ImGuiDataType data_type, void* data if (!(extra_flags & ImGuiInputTextFlags_CharsHexadecimal)) extra_flags |= ImGuiInputTextFlags_CharsDecimal; extra_flags |= ImGuiInputTextFlags_AutoSelectAll; - if (InputText("", buf, IM_ARRAYSIZE(buf), extra_flags)) + if (InputText("", buf, IM_ARRAYSIZE(buf), extra_flags)) // PushId(label) + "" gives us the expected ID from outside point of view value_changed = DataTypeApplyOpFromText(buf, GImGui->InputTextState.InitialText.begin(), data_type, data_ptr, scalar_format); // Step buttons @@ -8239,7 +8254,7 @@ bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, if (decimal_precision < 0) strcpy(display_format, "%f"); // Ideally we'd have a minimum decimal precision of 1 to visually denote that this is a float, while hiding non-significant digits? %f doesn't have a minimum of 1 else - ImFormatString(display_format, 16, "%%.%df", decimal_precision); + ImFormatString(display_format, IM_ARRAYSIZE(display_format), "%%.%df", decimal_precision); return InputScalarEx(label, ImGuiDataType_Float, (void*)v, (void*)(step>0.0f ? &step : NULL), (void*)(step_fast>0.0f ? &step_fast : NULL), display_format, extra_flags); } @@ -8418,7 +8433,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi { const char* item_text; if (items_getter(data, *current_item, &item_text)) - RenderTextClipped(frame_bb.Min + style.FramePadding, value_bb.Max, item_text, NULL, NULL); + RenderTextClipped(frame_bb.Min + style.FramePadding, value_bb.Max, item_text, NULL, NULL, ImVec2(0.0f,0.0f)); } if (label_size.x > 0) @@ -8564,7 +8579,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl } if (flags & ImGuiSelectableFlags_Disabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]); - RenderTextClipped(bb.Min, bb_with_spacing.Max, label, NULL, &label_size); + RenderTextClipped(bb.Min, bb_with_spacing.Max, label, NULL, &label_size, ImVec2(0.0f,0.0f)); if (flags & ImGuiSelectableFlags_Disabled) PopStyleColor(); // Automatically close popups @@ -8840,7 +8855,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled) tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -100.0f); // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale? tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +100.0f); moving_within_opened_triangle = ImIsPointInTriangle(g.IO.MousePos, ta, tb, tc); - //window->DrawList->PushClipRectFullScreen(); window->DrawList->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? 0x80008000 : 0x80000080); window->DrawList->PopClipRect(); // Debug + //window->DrawList->PushClipRectFullScreen(); window->DrawList->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); window->DrawList->PopClipRect(); // Debug } } @@ -9084,8 +9099,8 @@ void ImGui::Separator() if (!window->DC.GroupStack.empty()) x1 += window->DC.IndentX; - const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y)); - ItemSize(ImVec2(0.0f, 0.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit // FIXME: Height should be 1.0f not 0.0f ? + const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y+1.0f)); + ItemSize(ImVec2(0.0f, 0.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit, we don't provide height to not alter layout. if (!ItemAdd(bb, NULL)) { if (window->DC.ColumnsCount > 1) @@ -9093,7 +9108,7 @@ void ImGui::Separator() return; } - window->DrawList->AddLine(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border)); + window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x,bb.Min.y), GetColorU32(ImGuiCol_Border)); ImGuiContext& g = *GImGui; if (g.LogEnabled) @@ -9147,9 +9162,11 @@ void ImGui::BeginGroup() group_data.BackupCursorPos = window->DC.CursorPos; group_data.BackupCursorMaxPos = window->DC.CursorMaxPos; group_data.BackupIndentX = window->DC.IndentX; + group_data.BackupGroupOffsetX = window->DC.GroupOffsetX; group_data.BackupCurrentLineHeight = window->DC.CurrentLineHeight; group_data.BackupCurrentLineTextBaseOffset = window->DC.CurrentLineTextBaseOffset; group_data.BackupLogLinePosY = window->DC.LogLinePosY; + group_data.BackupActiveIdIsAlive = GImGui->ActiveIdIsAlive; group_data.AdvanceCursor = true; window->DC.GroupOffsetX = window->DC.CursorPos.x - window->Pos.x - window->DC.ColumnsOffsetX; @@ -9161,15 +9178,15 @@ void ImGui::BeginGroup() void ImGui::EndGroup() { + ImGuiContext& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); - ImGuiStyle& style = GetStyle(); IM_ASSERT(!window->DC.GroupStack.empty()); // Mismatched BeginGroup()/EndGroup() calls ImGuiGroupData& group_data = window->DC.GroupStack.back(); ImRect group_bb(group_data.BackupCursorPos, window->DC.CursorMaxPos); - group_bb.Max.y -= style.ItemSpacing.y; // Cancel out last vertical spacing because we are adding one ourselves. + group_bb.Max.y -= g.Style.ItemSpacing.y; // Cancel out last vertical spacing because we are adding one ourselves. group_bb.Max = ImMax(group_bb.Min, group_bb.Max); window->DC.CursorPos = group_data.BackupCursorPos; @@ -9177,7 +9194,7 @@ void ImGui::EndGroup() window->DC.CurrentLineHeight = group_data.BackupCurrentLineHeight; window->DC.CurrentLineTextBaseOffset = group_data.BackupCurrentLineTextBaseOffset; window->DC.IndentX = group_data.BackupIndentX; - window->DC.GroupOffsetX = window->DC.IndentX; + window->DC.GroupOffsetX = group_data.BackupGroupOffsetX; window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f; if (group_data.AdvanceCursor) @@ -9187,9 +9204,17 @@ void ImGui::EndGroup() ItemAdd(group_bb, NULL); } + // If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive() will function on the entire group. + // It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but if you search for LastItemId you'll notice it is only used in that context. + const bool active_id_within_group = (!group_data.BackupActiveIdIsAlive && g.ActiveIdIsAlive && g.ActiveId && g.ActiveIdWindow->RootWindow == window->RootWindow); + if (active_id_within_group) + window->DC.LastItemId = g.ActiveId; + if (active_id_within_group && g.HoveredId == g.ActiveId) + window->DC.LastItemHoveredAndUsable = window->DC.LastItemHoveredRect = true; + window->DC.GroupStack.pop_back(); - //window->DrawList->AddRect(group_bb.Min, group_bb.Max, 0xFFFF00FF); // Debug + //window->DrawList->AddRect(group_bb.Min, group_bb.Max, IM_COL32(255,0,255,255)); // Debug } // Gets back to previous line and continue with horizontal layout @@ -9425,7 +9450,7 @@ void ImGui::Columns(int columns_count, const char* id, bool border) const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(column_index); KeepAliveID(column_id); const float default_t = column_index / (float)window->DC.ColumnsCount; - const float t = window->DC.StateStorage->GetFloat(column_id, default_t); // Cheaply store our floating point value inside the integer (could store an union into the map?) + const float t = window->DC.StateStorage->GetFloat(column_id, default_t); // Cheaply store our floating point value inside the integer (could store a union into the map?) window->DC.ColumnsData[column_index].OffsetNorm = t; } window->DrawList->ChannelsSplit(window->DC.ColumnsCount); @@ -9527,17 +9552,11 @@ void ImGui::ValueColor(const char* prefix, ImU32 v) { Text("%s: %08X", prefix, v); SameLine(); - - ImVec4 col; - col.x = (float)((v >> 0) & 0xFF) / 255.0f; - col.y = (float)((v >> 8) & 0xFF) / 255.0f; - col.z = (float)((v >> 16) & 0xFF) / 255.0f; - col.w = (float)((v >> 24) & 0xFF) / 255.0f; - ColorButton(col, true); + ColorButton(ColorConvertU32ToFloat4(v), true); } //----------------------------------------------------------------------------- -// PLATFORM DEPENDANT HELPERS +// PLATFORM DEPENDENT HELPERS //----------------------------------------------------------------------------- #if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS)) @@ -9553,7 +9572,7 @@ void ImGui::ValueColor(const char* prefix, ImU32 v) #pragma comment(lib, "user32") #endif -static const char* GetClipboardTextFn_DefaultImpl() +static const char* GetClipboardTextFn_DefaultImpl(void*) { static ImVector<char> buf_local; buf_local.clear(); @@ -9573,7 +9592,7 @@ static const char* GetClipboardTextFn_DefaultImpl() return buf_local.Data; } -static void SetClipboardTextFn_DefaultImpl(const char* text) +static void SetClipboardTextFn_DefaultImpl(void*, const char* text) { if (!OpenClipboard(NULL)) return; @@ -9592,13 +9611,13 @@ static void SetClipboardTextFn_DefaultImpl(const char* text) #else // Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers -static const char* GetClipboardTextFn_DefaultImpl() +static const char* GetClipboardTextFn_DefaultImpl(void*) { return GImGui->PrivateClipboard; } // Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers -static void SetClipboardTextFn_DefaultImpl(const char* text) +static void SetClipboardTextFn_DefaultImpl(void*, const char* text) { ImGuiContext& g = *GImGui; if (g.PrivateClipboard) @@ -9732,6 +9751,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window)) return; NodeDrawList(window->DrawList, "DrawList"); + ImGui::BulletText("Pos: (%.1f,%.1f)", window->Pos.x, window->Pos.y); ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y); ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y); if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow"); diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h index 24cb7715449..f6cf88f060a 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h @@ -30,7 +30,7 @@ #endif // Some compilers support applying printf-style warnings to user functions. -#if defined(__clang__) || defined(__GNUC__) +#if 0 //defined(__clang__) || defined(__GNUC__) #define IM_PRINTFARGS(FMT) __attribute__((format(printf, FMT, (FMT+1)))) #else #define IM_PRINTFARGS(FMT) @@ -70,7 +70,6 @@ typedef void* ImTextureID; // user data to identify a texture (this is typedef int ImGuiCol; // a color identifier for styling // enum ImGuiCol_ typedef int ImGuiStyleVar; // a variable identifier for styling // enum ImGuiStyleVar_ typedef int ImGuiKey; // a key identifier (ImGui-side enum) // enum ImGuiKey_ -typedef int ImGuiAlign; // alignment // enum ImGuiAlign_ typedef int ImGuiColorEditMode; // color edit mode for ColorEdit*() // enum ImGuiColorEditMode_ typedef int ImGuiMouseCursor; // a mouse cursor identifier // enum ImGuiMouseCursor_ typedef int ImGuiWindowFlags; // window flags for Begin*() // enum ImGuiWindowFlags_ @@ -332,7 +331,7 @@ namespace ImGui IMGUI_API void TreePush(const void* ptr_id = NULL); // " IMGUI_API void TreePop(); // ~ Unindent()+PopId() IMGUI_API void TreeAdvanceToLabelPos(); // advance cursor x position by GetTreeNodeToLabelSpacing() - IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceeding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode + IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond = 0); // set next TreeNode/CollapsingHeader open state. IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop(). IMGUI_API bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0); // when 'p_open' isn't NULL, display an additional small close button on upper right of the header @@ -647,17 +646,9 @@ enum ImGuiStyleVar_ ImGuiStyleVar_ItemInnerSpacing, // ImVec2 ImGuiStyleVar_IndentSpacing, // float ImGuiStyleVar_GrabMinSize, // float - ImGuiStyleVar_ViewId // uint8_t -}; - -enum ImGuiAlign_ -{ - ImGuiAlign_Left = 1 << 0, - ImGuiAlign_Center = 1 << 1, - ImGuiAlign_Right = 1 << 2, - ImGuiAlign_Top = 1 << 3, - ImGuiAlign_VCenter = 1 << 4, - ImGuiAlign_Default = ImGuiAlign_Left | ImGuiAlign_Top + ImGuiStyleVar_ButtonTextAlign, // flags ImGuiAlign_* + ImGuiStyleVar_ViewId, // uint8_t + ImGuiStyleVar_Count_ }; // Enumeration for ColorEditMode() @@ -674,6 +665,7 @@ enum ImGuiColorEditMode_ // Enumeration for GetMouseCursor() enum ImGuiMouseCursor_ { + ImGuiMouseCursor_None = -1, ImGuiMouseCursor_Arrow = 0, ImGuiMouseCursor_TextInput, // When hovering over InputText, etc. ImGuiMouseCursor_Move, // Unused @@ -700,7 +692,7 @@ struct ImGuiStyle ImVec2 WindowPadding; // Padding within a window ImVec2 WindowMinSize; // Minimum window size float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows - ImGuiAlign WindowTitleAlign; // Alignment for title bar text + ImVec2 WindowTitleAlign; // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. float ChildWindowRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets) float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). @@ -714,6 +706,7 @@ struct ImGuiStyle float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar float ViewId; float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. + ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f,0.5f) for horizontally+vertically centered. ImVec2 DisplayWindowPadding; // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows. ImVec2 DisplaySafeAreaPadding; // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. bool AntiAliasedLines; // Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU. @@ -766,8 +759,9 @@ struct ImGuiIO // Optional: access OS clipboard // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) - const char* (*GetClipboardTextFn)(); - void (*SetClipboardTextFn)(const char* text); + const char* (*GetClipboardTextFn)(void* user_data); + void (*SetClipboardTextFn)(void* user_data, const char* text); + void* ClipboardUserData; // Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer. // (default to posix malloc/free) @@ -813,7 +807,7 @@ struct ImGuiIO int MetricsActiveWindows; // Number of visible windows (exclude child windows) //------------------------------------------------------------------ - // [Internal] ImGui will maintain those fields for you + // [Private] ImGui will maintain those fields. Forward compatibility not guaranteed! //------------------------------------------------------------------ ImVec2 MousePosPrev; // Previous mouse position @@ -960,10 +954,9 @@ struct ImGuiTextBuffer }; // Helper: Simple Key->value storage -// - Store collapse state for a tree (Int 0/1) -// - Store color edit options (Int using values in ImGuiColorEditMode enum). -// - Custom user storage for temporary values. // Typically you don't have to worry about this since a storage is held within each Window. +// We use it to e.g. store collapse state for a tree (Int 0/1), store color edit options. +// You can use it as custom user storage for temporary values. // Declare your own storage if: // - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state). // - You want to store custom debug data easily without adding or editing structures in your code. @@ -995,9 +988,8 @@ struct ImGuiStorage // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set. // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. - // - A typical use case where this is convenient: + // - A typical use case where this is convenient for quick hacking (e.g. add storage during a live Edit&Continue session if you can't modify existing struct) // float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar; - // - You can also use this to quickly create temporary editable values during a session of using Edit&Continue, without restarting your application. IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0); IMGUI_API bool* GetBoolRef(ImGuiID key, bool default_val = false); IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0.0f); @@ -1045,17 +1037,36 @@ struct ImGuiSizeConstraintCallbackData ImVec2 DesiredSize; // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing. }; +// Helpers macros to generate 32-bits encoded colors +#ifdef IMGUI_USE_BGRA_PACKED_COLOR +#define IM_COL32_R_SHIFT 16 +#define IM_COL32_G_SHIFT 8 +#define IM_COL32_B_SHIFT 0 +#define IM_COL32_A_SHIFT 24 +#define IM_COL32_A_MASK 0xFF000000 +#else +#define IM_COL32_R_SHIFT 0 +#define IM_COL32_G_SHIFT 8 +#define IM_COL32_B_SHIFT 16 +#define IM_COL32_A_SHIFT 24 +#define IM_COL32_A_MASK 0xFF000000 +#endif +#define IM_COL32(R,G,B,A) (((ImU32)(A)<<IM_COL32_A_SHIFT) | ((ImU32)(B)<<IM_COL32_B_SHIFT) | ((ImU32)(G)<<IM_COL32_G_SHIFT) | ((ImU32)(R)<<IM_COL32_R_SHIFT)) +#define IM_COL32_WHITE IM_COL32(255,255,255,255) // Opaque white +#define IM_COL32_BLACK IM_COL32(0,0,0,255) // Opaque black +#define IM_COL32_BLACK_TRANS IM_COL32(0,0,0,0) // Transparent black + // ImColor() helper to implicity converts colors to either ImU32 (packed 4x1 byte) or ImVec4 (4x1 float) // Prefer using IM_COL32() macros if you want a guaranteed compile-time ImU32 for usage with ImDrawList API. -// Avoid storing ImColor! Store either u32 of ImVec4. This is not a full-featured color class. -// None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats. +// **Avoid storing ImColor! Store either u32 of ImVec4. This is not a full-featured color class. +// **None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats. struct ImColor { ImVec4 Value; ImColor() { Value.x = Value.y = Value.z = Value.w = 0.0f; } ImColor(int r, int g, int b, int a = 255) { float sc = 1.0f/255.0f; Value.x = (float)r * sc; Value.y = (float)g * sc; Value.z = (float)b * sc; Value.w = (float)a * sc; } - ImColor(ImU32 rgba) { float sc = 1.0f/255.0f; Value.x = (float)(rgba&0xFF) * sc; Value.y = (float)((rgba>>8)&0xFF) * sc; Value.z = (float)((rgba>>16)&0xFF) * sc; Value.w = (float)(rgba >> 24) * sc; } + ImColor(ImU32 rgba) { float sc = 1.0f/255.0f; Value.x = (float)((rgba>>IM_COL32_R_SHIFT)&0xFF) * sc; Value.y = (float)((rgba>>IM_COL32_G_SHIFT)&0xFF) * sc; Value.z = (float)((rgba>>IM_COL32_B_SHIFT)&0xFF) * sc; Value.w = (float)((rgba>>IM_COL32_A_SHIFT)&0xFF) * sc; } ImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; } ImColor(const ImVec4& col) { Value = col; } inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); } @@ -1101,12 +1112,6 @@ struct ImGuiListClipper // Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList. //----------------------------------------------------------------------------- -// Helpers macros to generate 32-bits encoded colors -#define IM_COL32(R,G,B,A) (((ImU32)(A)<<24) | ((ImU32)(B)<<16) | ((ImU32)(G)<<8) | ((ImU32)(R))) -#define IM_COL32_WHITE (0xFFFFFFFF) -#define IM_COL32_BLACK (0xFF000000) -#define IM_COL32_BLACK_TRANS (0x00000000) // Transparent black - // Draw callbacks for advanced uses. // NB- You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering (you can poke into the draw list for that) // Draw callback may be useful for example, A) Change your GPU render state, B) render a complex 3D scene inside a UI element (without an intermediate texture/render target), etc. @@ -1168,7 +1173,7 @@ struct ImDrawList ImVector<ImDrawVert> VtxBuffer; // Vertex buffer. // [Internal, used while building lists] - const char* _OwnerName; // Pointer to owner window's name (if any) for debugging + const char* _OwnerName; // Pointer to owner window's name for debugging unsigned int _VtxCurrentIdx; // [Internal] == VtxBuffer.Size ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) @@ -1179,7 +1184,7 @@ struct ImDrawList int _ChannelsCount; // [Internal] number of active channels (1+) ImVector<ImDrawChannel> _Channels; // [Internal] draw channels for columns API (not resized down so _ChannelsCount may be smaller than _Channels.Size) - ImDrawList() { _OwnerName = NULL; Clear(); } + ImDrawList() { _OwnerName = NULL; Clear(); } ~ImDrawList() { ClearFreeMemory(); } IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) IMGUI_API void PushClipRectFullScreen(); @@ -1189,8 +1194,8 @@ struct ImDrawList // Primitives IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f); - IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F, float thickness = 1.0f); // a: upper-left, b: lower-right - IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F); // a: upper-left, b: lower-right + IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ~0, float thickness = 1.0f); // a: upper-left, b: lower-right, rounding_corners_flags: 4-bits corresponding to which corner to round + IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ~0); // a: upper-left, b: lower-right IMGUI_API void AddRectFilledMultiColor(const ImVec2& a, const ImVec2& b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left); IMGUI_API void AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness = 1.0f); IMGUI_API void AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col); @@ -1212,9 +1217,9 @@ struct ImDrawList inline void PathFill(ImU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col, true); PathClear(); } inline void PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness, true); PathClear(); } IMGUI_API void PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 10); - IMGUI_API void PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle + IMGUI_API void PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle IMGUI_API void PathBezierCurveTo(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, int num_segments = 0); - IMGUI_API void PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, int rounding_corners = 0x0F); + IMGUI_API void PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, int rounding_corners_flags = ~0); // rounding_corners_flags: 4-bits corresponding to which corner to round // Channels // - Use to simulate layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives) @@ -1392,9 +1397,7 @@ struct ImFont #pragma clang diagnostic pop #endif -//---- Include imgui_user.h at the end of imgui.h -//---- So you can include code that extends ImGui using any of the types declared above. -//---- (also convenient for user to only explicitly include vanilla imgui.h) +// Include imgui_user.h at the end of imgui.h (convenient for user to only explicitly include vanilla imgui.h) #ifdef IMGUI_INCLUDE_IMGUI_USER_H #include "imgui_user.h" #endif diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp index 814ee8998ac..b4829d155ba 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp @@ -30,7 +30,9 @@ #pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' #pragma clang diagnostic ignored "-Wformat-security" // warning : warning: format string is not a string literal #pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals. -#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier // +#if __has_warning("-Wreserved-id-macro") +#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier // +#endif #elif defined(__GNUC__) #pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size #pragma GCC diagnostic ignored "-Wformat-security" // warning : format string is not a string literal (potentially insecure) @@ -71,7 +73,13 @@ static void ShowHelpMarker(const char* desc) { ImGui::TextDisabled("(?)"); if (ImGui::IsItemHovered()) - ImGui::SetTooltip(desc); + { + ImGui::BeginTooltip(); + ImGui::PushTextWrapPos(450.0f); + ImGui::TextUnformatted(desc); + ImGui::PopTextWrapPos(); + ImGui::EndTooltip(); + } } void ImGui::ShowUserGuide() @@ -349,18 +357,18 @@ void ImGui::ShowTestWindow(bool* p_open) ImGui::Text("Test paragraph 1:"); ImVec2 pos = ImGui::GetCursorScreenPos(); - ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), 0xFFFF00FF); + ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), IM_COL32(255,0,255,255)); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width); ImGui::Text("lazy dog. This paragraph is made to fit within %.0f pixels. The quick brown fox jumps over the lazy dog.", wrap_width); - ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), 0xFF00FFFF); + ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), IM_COL32(255,255,0,255)); ImGui::PopTextWrapPos(); ImGui::Text("Test paragraph 2:"); pos = ImGui::GetCursorScreenPos(); - ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), 0xFFFF00FF); + ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), IM_COL32(255,0,255,255)); ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width); ImGui::Text("aaaaaaaa bbbbbbbb, cccccccc,dddddddd. eeeeeeee ffffffff. gggggggg!hhhhhhhh"); - ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), 0xFF00FFFF); + ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), IM_COL32(255,255,0,255)); ImGui::PopTextWrapPos(); ImGui::TreePop(); @@ -790,7 +798,7 @@ void ImGui::ShowTestWindow(bool* p_open) ImGui::Separator(); ImGui::PushItemWidth(100); ImGui::Combo("func", &func_type, "Sin\0Saw\0"); ImGui::PopItemWidth(); ImGui::SameLine(); - ImGui::SliderInt("Sample count", &display_count, 1, 500); + ImGui::SliderInt("Sample count", &display_count, 1, 400); float (*func)(void*, int) = (func_type == 0) ? Funcs::Sin : Funcs::Saw; ImGui::PlotLines("Lines", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80)); ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80)); @@ -896,7 +904,7 @@ void ImGui::ShowTestWindow(bool* p_open) if (ImGui::TreeNode("Basic Horizontal Layout")) { - ImGui::TextWrapped("(Use ImGui::SameLine() to keep adding items to the right of the preceeding item)"); + ImGui::TextWrapped("(Use ImGui::SameLine() to keep adding items to the right of the preceding item)"); // Text ImGui::Text("Two items: Hello"); ImGui::SameLine(); @@ -1415,9 +1423,9 @@ void ImGui::ShowTestWindow(bool* p_open) ImGui::InputFloat("blue", &bar, 0.05f, 0, 3); ImGui::NextColumn(); - if (ImGui::CollapsingHeader("Category A")) ImGui::Text("Blah blah blah"); ImGui::NextColumn(); - if (ImGui::CollapsingHeader("Category B")) ImGui::Text("Blah blah blah"); ImGui::NextColumn(); - if (ImGui::CollapsingHeader("Category C")) ImGui::Text("Blah blah blah"); ImGui::NextColumn(); + if (ImGui::CollapsingHeader("Category A")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn(); + if (ImGui::CollapsingHeader("Category B")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn(); + if (ImGui::CollapsingHeader("Category C")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn(); ImGui::Columns(1); ImGui::Separator(); ImGui::TreePop(); @@ -1534,7 +1542,7 @@ void ImGui::ShowTestWindow(bool* p_open) if (ImGui::TreeNode("Dragging")) { - ImGui::TextWrapped("You can use ImGui::GetItemActiveDragDelta() to query for the dragged amount on any widget."); + ImGui::TextWrapped("You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget."); ImGui::Button("Drag Me"); if (ImGui::IsItemActive()) { @@ -1632,7 +1640,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) ImGui::TreePop(); } - if (ImGui::TreeNode("Sizes")) + if (ImGui::TreeNode("Settings")) { ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f"); ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 16.0f, "%.0f"); @@ -1647,6 +1655,9 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 16.0f, "%.0f"); ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f"); ImGui::SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 16.0f, "%.0f"); + ImGui::Text("Alignment"); + ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f"); + ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); ShowHelpMarker("Alignment applies when a button is larger than its text content."); ImGui::TreePop(); } @@ -1728,7 +1739,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) ImGui::PopFont(); if (ImGui::TreeNode("Details")) { - ImGui::DragFloat("font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // scale only this font + ImGui::DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // Scale only this font + ImGui::SameLine(); ShowHelpMarker("Note than the default embedded font is NOT meant to be scaled.\n\nFont are currently rendered into bitmaps at a given size at the time of building the atlas. You may oversample them to get some flexibility with scaling. You can also render at multiple sizes and select which one to use at runtime.\n\n(Glimmer of hope: the atlas system should hopefully be rewritten in the future to make scaling more natural and automatic.)"); ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent); ImGui::Text("Fallback character: '%c' (%d)", font->FallbackChar, font->FallbackChar); for (int config_i = 0; config_i < font->ConfigDataCount; config_i++) @@ -1736,6 +1748,47 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) ImFontConfig* cfg = &font->ConfigData[config_i]; ImGui::BulletText("Input %d: \'%s\'\nOversample: (%d,%d), PixelSnapH: %d", config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH); } + if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size)) + { + // Display all glyphs of the fonts in separate pages of 256 characters + const ImFont::Glyph* glyph_fallback = font->FallbackGlyph; // Forcefully/dodgily make FindGlyph() return NULL on fallback, which isn't the default behavior. + font->FallbackGlyph = NULL; + for (int base = 0; base < 0x10000; base += 256) + { + int count = 0; + for (int n = 0; n < 256; n++) + count += font->FindGlyph((ImWchar)(base + n)) ? 1 : 0; + if (count > 0 && ImGui::TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base+255, count, count > 1 ? "glyphs" : "glyph")) + { + float cell_spacing = style.ItemSpacing.y; + ImVec2 cell_size(font->FontSize * 1, font->FontSize * 1); + ImVec2 base_pos = ImGui::GetCursorScreenPos(); + ImDrawList* draw_list = ImGui::GetWindowDrawList(); + for (int n = 0; n < 256; n++) + { + ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size.x + cell_spacing), base_pos.y + (n / 16) * (cell_size.y + cell_spacing)); + ImVec2 cell_p2(cell_p1.x + cell_size.x, cell_p1.y + cell_size.y); + const ImFont::Glyph* glyph = font->FindGlyph((ImWchar)(base+n));; + draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255,255,255,100) : IM_COL32(255,255,255,50)); + font->RenderChar(draw_list, cell_size.x, cell_p1, ImGui::GetColorU32(ImGuiCol_Text), (ImWchar)(base+n)); // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string. + if (glyph && ImGui::IsMouseHoveringRect(cell_p1, cell_p2)) + { + ImGui::BeginTooltip(); + ImGui::Text("Codepoint: U+%04X", base+n); + ImGui::Separator(); + ImGui::Text("XAdvance+1: %.1f", glyph->XAdvance); + ImGui::Text("Pos: (%.2f,%.2f)->(%.2f,%.2f)", glyph->X0, glyph->Y0, glyph->X1, glyph->Y1); + ImGui::Text("UV: (%.3f,%.3f)->(%.3f,%.3f)", glyph->U0, glyph->V0, glyph->U1, glyph->V1); + ImGui::EndTooltip(); + } + } + ImGui::Dummy(ImVec2((cell_size.x + cell_spacing) * 16, (cell_size.y + cell_spacing) * 16)); + ImGui::TreePop(); + } + } + font->FallbackGlyph = glyph_fallback; + ImGui::TreePop(); + } ImGui::TreePop(); } ImGui::TreePop(); @@ -1873,8 +1926,8 @@ static void ShowExampleAppConstrainedResize(bool* p_open) "Custom: Fixed Steps (100)", }; ImGui::Combo("Constraint", &type, desc, IM_ARRAYSIZE(desc)); - if (ImGui::Button("200x200")) ImGui::SetWindowSize(ImVec2(200,200)); ImGui::SameLine(); - if (ImGui::Button("500x500")) ImGui::SetWindowSize(ImVec2(500,500)); ImGui::SameLine(); + if (ImGui::Button("200x200")) { ImGui::SetWindowSize(ImVec2(200,200)); } ImGui::SameLine(); + if (ImGui::Button("500x500")) { ImGui::SetWindowSize(ImVec2(500,500)); } ImGui::SameLine(); if (ImGui::Button("800x200")) ImGui::SetWindowSize(ImVec2(800,200)); for (int i = 0; i < 10; i++) ImGui::Text("Hello, sailor! Making this line long enough for the example."); @@ -2012,7 +2065,7 @@ static void ShowExampleAppCustomRendering(bool* p_open) } draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y)); // clip lines within the canvas (if we resize it, etc.) for (int i = 0; i < points.Size - 1; i += 2) - draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), 0xFF00FFFF, 2.0f); + draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), IM_COL32(255,255,0,255), 2.0f); draw_list->PopClipRect(); if (adding_preview) points.pop_back(); @@ -2088,8 +2141,8 @@ struct ExampleAppConsole // TODO: display items starting from the bottom if (ImGui::SmallButton("Add Dummy Text")) { AddLog("%d some text", Items.Size); AddLog("some more text"); AddLog("display very important message here!"); } ImGui::SameLine(); - if (ImGui::SmallButton("Add Dummy Error")) AddLog("[error] something went wrong"); ImGui::SameLine(); - if (ImGui::SmallButton("Clear")) ClearLog(); ImGui::SameLine(); + if (ImGui::SmallButton("Add Dummy Error")) { AddLog("[error] something went wrong"); } ImGui::SameLine(); + if (ImGui::SmallButton("Clear")) { ClearLog(); } ImGui::SameLine(); if (ImGui::SmallButton("Scroll to bottom")) ScrollToBottom = true; //static float t = 0.0f; if (ImGui::GetTime() - t > 0.02f) { t = ImGui::GetTime(); AddLog("Spam %f", t); } @@ -2143,7 +2196,7 @@ struct ExampleAppConsole if (ImGui::InputText("Input", InputBuf, IM_ARRAYSIZE(InputBuf), ImGuiInputTextFlags_EnterReturnsTrue|ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_CallbackHistory, &TextEditCallbackStub, (void*)this)) { char* input_end = InputBuf+strlen(InputBuf); - while (input_end > InputBuf && input_end[-1] == ' ') input_end--; *input_end = 0; + while (input_end > InputBuf && input_end[-1] == ' ') { input_end--; } *input_end = 0; if (InputBuf[0]) ExecCommand(InputBuf); strcpy(InputBuf, ""); diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp index 5721873aed3..e5bd11a1cdd 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp @@ -39,7 +39,9 @@ #pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok. #pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it. #pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness // +#if __has_warning("-Wreserved-id-macro") #pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier // +#endif #elif defined(__GNUC__) #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used #pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function @@ -431,7 +433,7 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 { // Anti-aliased stroke const float AA_SIZE = 1.0f; - const ImU32 col_trans = col & 0x00ffffff; + const ImU32 col_trans = col & IM_COL32(255,255,255,0); const int idx_count = thick_line ? count*18 : count*12; const int vtx_count = thick_line ? points_count*4 : points_count*3; @@ -604,7 +606,7 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun { // Anti-aliased Fill const float AA_SIZE = 1.0f; - const ImU32 col_trans = col & 0x00ffffff; + const ImU32 col_trans = col & IM_COL32(255,255,255,0); const int idx_count = (points_count-2)*3 + points_count*6; const int vtx_count = (points_count*2); PrimReserve(idx_count, vtx_count); @@ -799,7 +801,7 @@ void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, int void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; PathLineTo(a + ImVec2(0.5f,0.5f)); PathLineTo(b + ImVec2(0.5f,0.5f)); @@ -807,21 +809,21 @@ void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thic } // a: upper-left, b: lower-right. we don't render 1 px sized rectangles properly. -void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners, float thickness) +void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners_flags, float thickness) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; - PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.5f,0.5f), rounding, rounding_corners); + PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.5f,0.5f), rounding, rounding_corners_flags); PathStroke(col, true, thickness); } -void ImDrawList::AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners) +void ImDrawList::AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners_flags) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; if (rounding > 0.0f) { - PathRect(a, b, rounding, rounding_corners); + PathRect(a, b, rounding, rounding_corners_flags); PathFill(col); } else @@ -833,7 +835,7 @@ void ImDrawList::AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, floa void ImDrawList::AddRectFilledMultiColor(const ImVec2& a, const ImVec2& c, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left) { - if (((col_upr_left | col_upr_right | col_bot_right | col_bot_left) >> 24) == 0) + if (((col_upr_left | col_upr_right | col_bot_right | col_bot_left) & IM_COL32_A_MASK) == 0) return; const ImVec2 uv = GImGui->FontTexUvWhitePixel; @@ -848,7 +850,7 @@ void ImDrawList::AddRectFilledMultiColor(const ImVec2& a, const ImVec2& c, ImU32 void ImDrawList::AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; PathLineTo(a); @@ -860,7 +862,7 @@ void ImDrawList::AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, cons void ImDrawList::AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; PathLineTo(a); @@ -872,7 +874,7 @@ void ImDrawList::AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c void ImDrawList::AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col, float thickness) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; PathLineTo(a); @@ -883,7 +885,7 @@ void ImDrawList::AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, void ImDrawList::AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; PathLineTo(a); @@ -894,7 +896,7 @@ void ImDrawList::AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments, float thickness) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; const float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments; @@ -904,7 +906,7 @@ void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int nu void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; const float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments; @@ -914,7 +916,7 @@ void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, void ImDrawList::AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; PathLineTo(pos0); @@ -924,7 +926,7 @@ void ImDrawList::AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImV void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width, const ImVec4* cpu_fine_clip_rect) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; if (text_end == NULL) @@ -959,7 +961,7 @@ void ImDrawList::AddText(const ImVec2& pos, ImU32 col, const char* text_begin, c void ImDrawList::AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col) { - if ((col >> 24) == 0) + if ((col & IM_COL32_A_MASK) == 0) return; // FIXME-OPT: This is wasting draw calls. @@ -1121,7 +1123,7 @@ void ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_wid const unsigned char* src = pixels; unsigned int* dst = TexPixelsRGBA32; for (int n = TexWidth * TexHeight; n > 0; n--) - *dst++ = ((unsigned int)(*src++) << 24) | 0x00FFFFFF; + *dst++ = IM_COL32(255, 255, 255, (unsigned int)(*src++)); } *out_pixels = (unsigned char*)TexPixelsRGBA32; @@ -1169,7 +1171,7 @@ static void Decode85(const unsigned char* src, unsigned char* dst) while (*src) { unsigned int tmp = Decode85Byte(src[0]) + 85*(Decode85Byte(src[1]) + 85*(Decode85Byte(src[2]) + 85*(Decode85Byte(src[3]) + 85*Decode85Byte(src[4])))); - dst[0] = ((tmp >> 0) & 0xFF); dst[1] = ((tmp >> 8) & 0xFF); dst[2] = ((tmp >> 16) & 0xFF); dst[3] = ((tmp >> 24) & 0xFF); // We can't assume little-endianess. + dst[0] = ((tmp >> 0) & 0xFF); dst[1] = ((tmp >> 8) & 0xFF); dst[2] = ((tmp >> 16) & 0xFF); dst[3] = ((tmp >> 24) & 0xFF); // We can't assume little-endianness. src += 5; dst += 4; } @@ -1843,7 +1845,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c } } - const float char_width = ((int)c < IndexXAdvance.Size) ? IndexXAdvance[(int)c] * scale : FallbackXAdvance; + const float char_width = ((int)c < IndexXAdvance.Size ? IndexXAdvance[(int)c] : FallbackXAdvance) * scale; if (ImCharIsSpace(c)) { if (inside_word) @@ -2326,7 +2328,7 @@ static const char proggy_clean_ttf_compressed_data_base85[11980+1] = "%(?A%R$f<->Zts'^kn=-^@c4%-pY6qI%J%1IGxfLU9CP8cbPlXv);C=b),<2mOvP8up,UVf3839acAWAW-W?#ao/^#%KYo8fRULNd2.>%m]UK:n%r$'sw]J;5pAoO_#2mO3n,'=H5(et" "Hg*`+RLgv>=4U8guD$I%D:W>-r5V*%j*W:Kvej.Lp$<M-SGZ':+Q_k+uvOSLiEo(<aD/K<CCc`'Lx>'?;++O'>()jLR-^u68PHm8ZFWe+ej8h:9r6L*0//c&iH&R8pRbA#Kjm%upV1g:" "a_#Ur7FuA#(tRh#.Y5K+@?3<-8m0$PEn;J:rh6?I6uG<-`wMU'ircp0LaE_OtlMb&1#6T.#FDKu#1Lw%u%+GM+X'e?YLfjM[VO0MbuFp7;>Q&#WIo)0@F%q7c#4XAXN-U&VB<HFF*qL(" - "$/V,;(kXZejWO`<[5??ewY(*9=%wDc;,u<'9t3W-(H1th3+G]ucQ]kLs7df($/*JL]@*t7Bu_G3_7mp7<iaQjO@.kLg;x3B0lqp7Hf,^Ze7-##@/c58Mo(3;knp0%)A7?-W+eI'o8)b<" + "$/V,;(kXZejWO`<[5?\?ewY(*9=%wDc;,u<'9t3W-(H1th3+G]ucQ]kLs7df($/*JL]@*t7Bu_G3_7mp7<iaQjO@.kLg;x3B0lqp7Hf,^Ze7-##@/c58Mo(3;knp0%)A7?-W+eI'o8)b<" "nKnw'Ho8C=Y>pqB>0ie&jhZ[?iLR@@_AvA-iQC(=ksRZRVp7`.=+NpBC%rh&3]R:8XDmE5^V8O(x<<aG/1N$#FX$0V5Y6x'aErI3I$7x%E`v<-BY,)%-?Psf*l?%C3.mM(=/M0:JxG'?" "7WhH%o'a<-80g0NBxoO(GH<dM]n.+%q@jH?f.UsJ2Ggs&4<-e47&Kl+f//9@`b+?.TeN_&B8Ss?v;^Trk;f#YvJkl&w$]>-+k?'(<S:68tq*WoDfZu';mM?8X[ma8W%*`-=;D.(nc7/;" ")g:T1=^J$&BRV(-lTmNB6xqB[@0*o.erM*<SWF]u2=st-*(6v>^](H.aREZSi,#1:[IXaZFOm<-ui#qUq2$##Ri;u75OK#(RtaW-K-F`S+cF]uN`-KMQ%rP/Xri.LRcB##=YL3BgM/3M" diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h index dc02f719a63..08f206adc54 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h @@ -75,6 +75,7 @@ extern IMGUI_API ImGuiContext* GImGui; // current implicit ImGui context po #define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR))) #define IM_PI 3.14159265358979323846f +#define IM_OFFSETOF(_TYPE,_ELM) ((size_t)&(((_TYPE*)0)->_ELM)) // Helpers: UTF-8 <> wchar IMGUI_API int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end); // return output UTF-8 bytes count @@ -192,7 +193,17 @@ enum ImGuiPlotType enum ImGuiDataType { ImGuiDataType_Int, - ImGuiDataType_Float + ImGuiDataType_Float, + ImGuiDataType_Float2, +}; + +enum ImGuiCorner +{ + ImGuiCorner_TopLeft = 1 << 0, // 1 + ImGuiCorner_TopRight = 1 << 1, // 2 + ImGuiCorner_BottomRight = 1 << 2, // 4 + ImGuiCorner_BottomLeft = 1 << 3, // 8 + ImGuiCorner_All = 0x0F }; // 2D axis aligned bounding-box @@ -241,14 +252,17 @@ struct IMGUI_API ImRect struct ImGuiColMod { ImGuiCol Col; - ImVec4 PreviousValue; + ImVec4 BackupValue; }; -// Stacked style modifier, backup of modified data so we can restore it +// Stacked style modifier, backup of modified data so we can restore it. Data type inferred from the variable. struct ImGuiStyleMod { - ImGuiStyleVar Var; - ImVec2 PreviousValue; + ImGuiStyleVar VarIdx; + union { int BackupInt[2]; float BackupFloat[2]; }; + ImGuiStyleMod(ImGuiStyleVar idx, int v) { VarIdx = idx; BackupInt[0] = v; } + ImGuiStyleMod(ImGuiStyleVar idx, float v) { VarIdx = idx; BackupFloat[0] = v; } + ImGuiStyleMod(ImGuiStyleVar idx, ImVec2 v) { VarIdx = idx; BackupFloat[0] = v.x; BackupFloat[1] = v.y; } }; // Stacked data for BeginGroup()/EndGroup() @@ -257,9 +271,11 @@ struct ImGuiGroupData ImVec2 BackupCursorPos; ImVec2 BackupCursorMaxPos; float BackupIndentX; + float BackupGroupOffsetX; float BackupCurrentLineHeight; float BackupCurrentLineTextBaseOffset; float BackupLogLinePosY; + bool BackupActiveIdIsAlive; bool AdvanceCursor; }; @@ -704,13 +720,13 @@ namespace ImGui IMGUI_API void OpenPopupEx(const char* str_id, bool reopen_existing); // NB: All position are in absolute pixels coordinates (not window coordinates) - // FIXME: All those functions are a mess and needs to be refactored into something decent. Avoid use outside of imgui.cpp! + // FIXME: All those functions are a mess and needs to be refactored into something decent. AVOID USING OUTSIDE OF IMGUI.CPP! NOT FOR PUBLIC CONSUMPTION. // We need: a sort of symbol library, preferably baked into font atlas when possible + decent text rendering helpers. IMGUI_API void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true); IMGUI_API void RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width); - IMGUI_API void RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, ImGuiAlign align = ImGuiAlign_Default, const ImVec2* clip_min = NULL, const ImVec2* clip_max = NULL); + IMGUI_API void RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0,0), const ImRect* clip_rect = NULL); IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f); - IMGUI_API void RenderCollapseTriangle(ImVec2 pos, bool is_open, float scale = 1.0f, bool shadow = false); + IMGUI_API void RenderCollapseTriangle(ImVec2 pos, bool is_open, float scale = 1.0f); IMGUI_API void RenderBullet(ImVec2 pos); IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col); IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text. diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.h index 60b8df40c9f..45ae2c013aa 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.h +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.h @@ -45,3 +45,4 @@ namespace ImGui #include "widgets/file_list.h" #include "widgets/memory_editor.h" #include "widgets/gizmo.h" +#include "widgets/dock.h"
\ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.inl b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.inl index c03955f1887..b88fdd0dcfe 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.inl +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.inl @@ -75,3 +75,4 @@ namespace ImGui #include "widgets/file_list.inl" #include "widgets/memory_editor.inl" #include "widgets/gizmo.inl" +#include "widgets/dock.inl"
\ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_wm.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_wm.cpp deleted file mode 100644 index 83a7e40d376..00000000000 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_wm.cpp +++ /dev/null @@ -1,1681 +0,0 @@ -/* - * Copyright 2011-2016 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -/* - * Based on ImWindow code from: - * https://github.com/thennequin/ImWindow - * - * MIT license: - * https://github.com/thennequin/ImWindow/blob/master/LICENSE - */ - -#include "imgui_wm.h" -#include "imgui_internal.h" -#include <algorithm> - -#define IMGUI_NEW(type) new (ImGui::MemAlloc(sizeof(type) ) ) type -#define IMGUI_DELETE(type, obj) static_cast<type*>(obj)->~type(), ImGui::MemFree(obj) -#define IMGUI_DELETE_NULL(type, obj) for (;;) { if (NULL != obj) { IMGUI_DELETE(type, obj); obj = NULL; } break; } - -namespace ImGuiWM -{ - enum EPlatformWindowAction - { - E_PLATFORM_WINDOW_ACTION_DESTOY = 1, - E_PLATFORM_WINDOW_ACTION_SHOW = 2, - E_PLATFORM_WINDOW_ACTION_HIDE = 4, - E_PLATFORM_WINDOW_ACTION_SET_POSITION = 8, - E_PLATFORM_WINDOW_ACTION_SET_SIZE = 16, - }; - - static const ImVec2 IM_VEC2_0 = ImVec2(0, 0); - static const ImVec2 IM_VEC2_N1 = ImVec2(-1, -1); - - int Id::s_iNextId = 0; - - Id::Id() - { - m_iId = s_iNextId++; - ImFormatString(m_pId, 11, "0x%8X", m_iId); - } - - ImU32 Id::GetId() const - { - return m_iId; - } - - const char* Id::GetStr() const - { - return m_pId; - } - - Window::Window() - { - m_pTitle = NULL; - WindowManager::GetInstance()->AddWindow(this); - } - - Window::~Window() - { - WindowManager::GetInstance()->RemoveWindow(this); - ImGui::MemFree(m_pTitle); - } - - void Window::Destroy() - { - WindowManager::GetInstance()->DestroyWindow(this); - } - - void Window::SetTitle(const char* pTitle) - { - ImGui::MemFree(m_pTitle); - m_pTitle = ImStrdup(pTitle); - } - - const char* Window::GetTitle() const - { - return m_pTitle; - } - - const ImVec2& Window::GetLastPosition() const - { - return m_oLastPosition; - } - - const ImVec2& Window::GetLastSize() const - { - return m_oLastSize; - } - - Container::Container(Container* pParent) - { - IM_ASSERT(NULL != pParent); - m_pSplits[0] = NULL; - m_pSplits[1] = NULL; - m_bVerticalSplit = false; - m_iActiveWindow = 0; - m_fSplitRatio = 0.5f; - m_bIsDrag = false; - m_pParent = pParent; - m_pParentWindow = (NULL != pParent) ? pParent->m_pParentWindow : NULL; - } - - Container::Container(PlatformWindow* pParent) - { - IM_ASSERT(NULL != pParent); - m_pSplits[0] = NULL; - m_pSplits[1] = NULL; - m_bVerticalSplit = false; - m_iActiveWindow = 0; - m_fSplitRatio = 0.5f; - m_bIsDrag = false; - m_pParent = NULL; - m_pParentWindow = pParent; - } - - Container::~Container() - { - while (m_lWindows.begin() != m_lWindows.end()) - { - Window* window = *m_lWindows.begin(); - WindowManager::GetInstance()->RemoveWindow(window); - IMGUI_DELETE(Window, window); - m_lWindows.erase(m_lWindows.begin()); - } - - IMGUI_DELETE_NULL(Container, m_pSplits[0]); - IMGUI_DELETE_NULL(Container, m_pSplits[1]); - } - - void Container::CreateSplits() - { - m_pSplits[0] = IMGUI_NEW(Container)(this); - m_pSplits[1] = IMGUI_NEW(Container)(this); - } - - void Container::Dock(Window* pWindow, EDockOrientation eOrientation) - { - IM_ASSERT(NULL != pWindow); - - if (NULL != pWindow) - { - IM_ASSERT(eOrientation != E_DOCK_ORIENTATION_CENTER || !IsSplit()); - - if (!IsSplit()) - { - if (m_lWindows.size() == 0) - { - eOrientation = E_DOCK_ORIENTATION_CENTER; - } - - switch (eOrientation) - { - case E_DOCK_ORIENTATION_CENTER: - { - m_lWindows.push_back(pWindow); - m_iActiveWindow = int(m_lWindows.size() - 1); - } - break; - case E_DOCK_ORIENTATION_TOP: - { - m_bVerticalSplit = true; - CreateSplits(); - m_pSplits[0]->Dock(pWindow); - m_pSplits[1]->m_lWindows.insert(m_pSplits[1]->m_lWindows.begin(), m_lWindows.begin(), m_lWindows.end()); - m_lWindows.clear(); - m_iActiveWindow = 0; - } - break; - case E_DOCK_ORIENTATION_LEFT: - { - m_bVerticalSplit = false; - CreateSplits(); - m_pSplits[0]->Dock(pWindow); - m_pSplits[1]->m_lWindows.insert(m_pSplits[1]->m_lWindows.begin(), m_lWindows.begin(), m_lWindows.end()); - m_lWindows.clear(); - m_iActiveWindow = 0; - } - break; - case E_DOCK_ORIENTATION_RIGHT: - { - m_bVerticalSplit = false; - CreateSplits(); - m_pSplits[0]->m_lWindows.insert(m_pSplits[0]->m_lWindows.begin(), m_lWindows.begin(), m_lWindows.end()); - m_pSplits[1]->Dock(pWindow); - m_lWindows.clear(); - m_iActiveWindow = 0; - } - break; - case E_DOCK_ORIENTATION_BOTTOM: - { - m_bVerticalSplit = true; - CreateSplits(); - m_pSplits[0]->m_lWindows.insert(m_pSplits[0]->m_lWindows.begin(), m_lWindows.begin(), m_lWindows.end()); - m_pSplits[1]->Dock(pWindow); - m_lWindows.clear(); - m_iActiveWindow = 0; - } - break; - } - } - else - { - switch (eOrientation) - { - case E_DOCK_ORIENTATION_CENTER: - IM_ASSERT(false); - break; - case E_DOCK_ORIENTATION_TOP: - { - Container* pSplit0 = m_pSplits[0]; - Container* pSplit1 = m_pSplits[1]; - CreateSplits(); - m_pSplits[0]->m_lWindows.push_back(pWindow); - m_pSplits[1]->m_bVerticalSplit = m_bVerticalSplit; - m_pSplits[1]->m_fSplitRatio = m_fSplitRatio; - m_pSplits[1]->m_pSplits[0] = pSplit0; - m_pSplits[1]->m_pSplits[1] = pSplit1; - m_pSplits[1]->m_pSplits[0]->m_pParent = m_pSplits[1]; - m_pSplits[1]->m_pSplits[1]->m_pParent = m_pSplits[1]; - m_fSplitRatio = WindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; - m_bVerticalSplit = true; - } - break; - case E_DOCK_ORIENTATION_LEFT: - { - Container* pSplit0 = m_pSplits[0]; - Container* pSplit1 = m_pSplits[1]; - CreateSplits(); - m_pSplits[0]->m_lWindows.push_back(pWindow); - m_pSplits[1]->m_bVerticalSplit = m_bVerticalSplit; - m_pSplits[1]->m_fSplitRatio = m_fSplitRatio; - m_pSplits[1]->m_pSplits[0] = pSplit0; - m_pSplits[1]->m_pSplits[1] = pSplit1; - m_pSplits[1]->m_pSplits[0]->m_pParent = m_pSplits[1]; - m_pSplits[1]->m_pSplits[1]->m_pParent = m_pSplits[1]; - m_fSplitRatio = WindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; - m_bVerticalSplit = false; - } - break; - case E_DOCK_ORIENTATION_RIGHT: - { - Container* pSplit0 = m_pSplits[0]; - Container* pSplit1 = m_pSplits[1]; - CreateSplits(); - m_pSplits[1]->m_lWindows.push_back(pWindow); - m_pSplits[0]->m_bVerticalSplit = m_bVerticalSplit; - m_pSplits[0]->m_fSplitRatio = m_fSplitRatio; - m_pSplits[0]->m_pSplits[0] = pSplit0; - m_pSplits[0]->m_pSplits[1] = pSplit1; - m_pSplits[0]->m_pSplits[0]->m_pParent = m_pSplits[0]; - m_pSplits[0]->m_pSplits[1]->m_pParent = m_pSplits[0]; - m_fSplitRatio = 1.f - WindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; - m_bVerticalSplit = false; - } - break; - case E_DOCK_ORIENTATION_BOTTOM: - { - Container* pSplit0 = m_pSplits[0]; - Container* pSplit1 = m_pSplits[1]; - CreateSplits(); - m_pSplits[1]->m_lWindows.push_back(pWindow); - m_pSplits[0]->m_bVerticalSplit = m_bVerticalSplit; - m_pSplits[0]->m_fSplitRatio = m_fSplitRatio; - m_pSplits[0]->m_pSplits[0] = pSplit0; - m_pSplits[0]->m_pSplits[1] = pSplit1; - m_pSplits[0]->m_pSplits[0]->m_pParent = m_pSplits[0]; - m_pSplits[0]->m_pSplits[1]->m_pParent = m_pSplits[0]; - m_fSplitRatio = 1.f - WindowManager::GetInstance()->GetConfig().m_fDragMarginSizeRatio; - m_bVerticalSplit = true; - } - break; - } - } - } - } - - bool Container::UnDock(Window* pWindow) - { - if (std::find(m_lWindows.begin(), m_lWindows.end(), pWindow) != m_lWindows.end()) - { - m_lWindows.remove(pWindow); - if (m_iActiveWindow >= int(m_lWindows.size())) - { - m_iActiveWindow = int(m_lWindows.size() - 1); - } - return true; - } - - if (NULL != m_pSplits[0] && NULL != m_pSplits[1]) - { - if (m_pSplits[0]->UnDock(pWindow)) - { - if (m_pSplits[0]->IsEmpty()) - { - if (m_pSplits[1]->IsSplit()) - { - Container* pSplit = m_pSplits[1]; - m_bVerticalSplit = pSplit->m_bVerticalSplit; - IMGUI_DELETE_NULL(Container, m_pSplits[0]); - m_pSplits[0] = pSplit->m_pSplits[0]; - m_pSplits[1] = pSplit->m_pSplits[1]; - pSplit->m_pSplits[0] = NULL; - pSplit->m_pSplits[1] = NULL; - m_pSplits[0]->m_pParent = this; - m_pSplits[1]->m_pParent = this; - IMGUI_DELETE_NULL(Container, pSplit); - } - else - { - m_lWindows.insert(m_lWindows.end(), m_pSplits[1]->m_lWindows.begin(), m_pSplits[1]->m_lWindows.end()); - m_pSplits[1]->m_lWindows.clear(); - m_pSplits[1]->m_iActiveWindow = 0; - IMGUI_DELETE_NULL(Container, m_pSplits[0]); - IMGUI_DELETE_NULL(Container, m_pSplits[1]); - } - } - return true; - } - - if (m_pSplits[1]->UnDock(pWindow)) - { - if (m_pSplits[1]->IsEmpty()) - { - if (m_pSplits[0]->IsSplit()) - { - Container* pSplit = m_pSplits[0]; - m_bVerticalSplit = pSplit->m_bVerticalSplit; - IMGUI_DELETE_NULL(Container, m_pSplits[1]); - m_pSplits[0] = pSplit->m_pSplits[0]; - m_pSplits[1] = pSplit->m_pSplits[1]; - pSplit->m_pSplits[0] = NULL; - pSplit->m_pSplits[1] = NULL; - m_pSplits[0]->m_pParent = this; - m_pSplits[1]->m_pParent = this; - IMGUI_DELETE_NULL(Container, pSplit); - } - else - { - m_lWindows.insert(m_lWindows.end(), m_pSplits[0]->m_lWindows.begin(), m_pSplits[0]->m_lWindows.end()); - m_pSplits[0]->m_lWindows.clear(); - m_pSplits[0]->m_iActiveWindow = 0; - IMGUI_DELETE_NULL(Container, m_pSplits[0]); - IMGUI_DELETE_NULL(Container, m_pSplits[1]); - } - } - return true; - } - } - - return false; - } - - bool Container::IsEmpty() - { - //IM_ASSERT(IsSplit() != HasWindowTabbed()); - return !(IsSplit() || HasWindowTabbed()); - } - - bool Container::IsSplit() - { - IM_ASSERT((NULL == m_pSplits[0]) == (NULL == m_pSplits[1])); - return (NULL != m_pSplits[0] && NULL != m_pSplits[1]); - } - - bool Container::HasWindowTabbed() - { - return m_lWindows.size() > 0; - } - - Container* Container::HasWindow(const Window* pWindow) - { - if (std::find(m_lWindows.begin(), m_lWindows.end(), pWindow) != m_lWindows.end()) - { - return this; - } - else - { - if (NULL != m_pSplits[0]) - { - Container* pContainer = m_pSplits[0]->HasWindow(pWindow); - if (NULL != pContainer) - { - return pContainer; - } - } - if (NULL != m_pSplits[1]) - { - Container* pContainer = m_pSplits[1]->HasWindow(pWindow); - if (NULL != pContainer) - { - return pContainer; - } - } - } - return NULL; - } - - PlatformWindow* Container::GetPlatformWindowParent() const - { - return m_pParentWindow; - } - - void Container::Paint() - { - WindowManager* pWindowManager = WindowManager::GetInstance(); - ImGuiWindow* pWindow = ImGui::GetCurrentWindow(); - const ImGuiStyle& oStyle = ImGui::GetStyle(); - ImDrawList* pDrawList = ImGui::GetWindowDrawList(); - - const ImVec2 oPos = ImGui::GetWindowPos(); - const ImVec2 oSize = ImGui::GetWindowSize(); - const ImVec2 oMin = ImVec2(oPos.x + 1, oPos.y + 1); - const ImVec2 oMax = ImVec2(oPos.x + oSize.x - 2, oPos.y + oSize.y - 2); - - m_oLastPosition = oPos; - m_oLastSize = oSize; - - const int iSeparatorHalfSize = 2; - const int iSeparatorSize = iSeparatorHalfSize * 2; - - if (IsSplit()) - { - if (m_bVerticalSplit) - { - float iFirstHeight = oSize.y * m_fSplitRatio - iSeparatorHalfSize - pWindow->WindowPadding.x; - - ImGui::BeginChild("Split1", ImVec2(0, iFirstHeight), false, ImGuiWindowFlags_NoScrollbar); - m_pSplits[0]->Paint(); - ImGui::EndChild(); - - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 0.0f)); - ImRect oSeparatorRect(0, iFirstHeight, oSize.x, iFirstHeight + iSeparatorSize); - ImGui::Button("", oSeparatorRect.GetSize()); - if (ImGui::IsItemHovered() || m_bIsDrag) - { - ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeNS); - } - ImGui::PopStyleVar(1); - - if (ImGui::IsItemActive()) - { - if (!m_bIsDrag) - { - m_bIsDrag = true; - } - m_fSplitRatio += ImGui::GetIO().MouseDelta.y / oSize.y; - m_fSplitRatio = ImClamp(m_fSplitRatio, 0.05f, 0.95f); - - } - else - { - m_bIsDrag = false; - } - - ImGui::BeginChild("Split2", ImVec2(0, 0), false, ImGuiWindowFlags_NoScrollbar); - m_pSplits[1]->Paint(/*iX, iY + iFirstHeight, iWidth, iSecondHeight*/); - ImGui::EndChild(); - } - else - { - float iFirstWidth = oSize.x * m_fSplitRatio - iSeparatorHalfSize - pWindow->WindowPadding.y; - ImGui::BeginChild("Split1", ImVec2(iFirstWidth, 0), false, ImGuiWindowFlags_NoScrollbar); - m_pSplits[0]->Paint(); - ImGui::EndChild(); - - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 0.0f)); - ImGui::SameLine(); - - ImRect oSeparatorRect(iFirstWidth, 0, iFirstWidth + iSeparatorSize, oSize.y); - ImGui::Button("", oSeparatorRect.GetSize()); - - if (ImGui::IsItemHovered() || m_bIsDrag) - { - ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW); - } - ImGui::PopStyleVar(1); - - if (ImGui::IsItemActive()) - { - if (!m_bIsDrag) - { - m_bIsDrag = true; - } - - m_fSplitRatio += ImGui::GetIO().MouseDelta.x / oSize.x; - m_fSplitRatio = ImClamp(m_fSplitRatio, 0.05f, 0.95f); - } - else - { - m_bIsDrag = false; - } - - ImGui::SameLine(); - - ImGui::BeginChild("Split2", ImVec2(0, 0), false, ImGuiWindowFlags_NoScrollbar); - m_pSplits[1]->Paint(); - ImGui::EndChild(); - } - } - else if (HasWindowTabbed()) - { - ImGui::InvisibleButton("TabListButton", ImVec2(16, 16)); - ImGui::SameLine(); - - if (ImGui::BeginPopupContextItem("TabListMenu", 0)) - { - int iIndex = 0; - for (WindowList::const_iterator itWindow = m_lWindows.begin(); itWindow != m_lWindows.end(); ++itWindow, ++iIndex) - { - if (ImGui::Selectable((*itWindow)->GetTitle())) - { - m_iActiveWindow = iIndex; - } - } - ImGui::EndPopup(); - } - - ImColor oLinesColor = ImColor(160, 160, 160, 255); - if (ImGui::IsItemHovered()) - { - oLinesColor = ImColor(255, 255, 255, 255); - } - ImVec2 oButtonMin = ImGui::GetItemRectMin(); - ImVec2 oButtonMax = ImGui::GetItemRectMax(); - ImVec2 oButtonSize = ImVec2(oButtonMax.x - oButtonMin.x, oButtonMax.y - oButtonMin.y); - pDrawList->AddLine( - ImVec2(oButtonMin.x + 1, oButtonMin.y + oButtonSize.y / 2), - ImVec2(oButtonMax.x - 1, oButtonMin.y + oButtonSize.y / 2), - oLinesColor); - - pDrawList->AddLine( - ImVec2(oButtonMin.x + 1, oButtonMin.y + oButtonSize.y / 2 - 4), - ImVec2(oButtonMax.x - 1, oButtonMin.y + oButtonSize.y / 2 - 4), - oLinesColor); - - pDrawList->AddLine( - ImVec2(oButtonMin.x + 1, oButtonMin.y + oButtonSize.y / 2 + 4), - ImVec2(oButtonMax.x - 1, oButtonMin.y + oButtonSize.y / 2 + 4), - oLinesColor); - - pDrawList->ChannelsSplit(2); - - //Tabs - int iIndex = 0; - int iNewActive = m_iActiveWindow; - int iSize = int(m_lWindows.size()); - for (WindowList::iterator it = m_lWindows.begin(); it != m_lWindows.end(); ++it) - { - const ImVec2 oTextSize = ImGui::CalcTextSize((*it)->GetTitle()); - ImVec2 oRectSize(oTextSize.x + 15, 25); - - ImGui::PushID(iIndex); - - bool bSelected = iIndex == m_iActiveWindow; - if (ImGui::InvisibleButton((*it)->GetId(), oRectSize)) - { - iNewActive = iIndex; - } - if (iIndex < (iSize - 1)) - { - ImGui::SameLine(); - } - - if (ImGui::IsItemActive()) - { - if (ImGui::IsMouseDragging()) - { - pWindowManager->StartDragWindow(*it); - } - } - - ImColor oNormalTab(50, 50, 50, 255); // normal - ImColor oSelectedTab(37, 37, 37, 255); // selected - ImColor oBorderColor(72, 72, 72, 255); // border - - ImVec2 oRectMin = ImGui::GetItemRectMin(); - ImVec2 oRectMax = ImGui::GetItemRectMax(); - - const float fOverlap = 10.f; - const float fSlopWidth = 30.f; - const float sSlopP1Ratio = 0.6f; - const float fSlopP2Ratio = 0.4f; - const float fSlopHRatio = 0.f; - const float fShadowDropSize = 15.f; - const float fShadowSlopRatio = 0.6f; - const float fShadowAlpha = 0.75f; - - pDrawList->PathClear(); - if (bSelected) - { - pDrawList->ChannelsSetCurrent(1); - } - else - { - pDrawList->ChannelsSetCurrent(0); - } - - //Drop shadows - const ImVec2 uv = GImGui->FontTexUvWhitePixel; - pDrawList->PrimReserve(3, 3); - pDrawList->PrimWriteIdx((ImDrawIdx)(pDrawList->_VtxCurrentIdx)); pDrawList->PrimWriteIdx((ImDrawIdx)(pDrawList->_VtxCurrentIdx + 1)); pDrawList->PrimWriteIdx((ImDrawIdx)(pDrawList->_VtxCurrentIdx + 2)); - pDrawList->PrimWriteVtx(ImVec2(oRectMin.x - fOverlap - fShadowDropSize, oRectMax.y), uv, ImColor(0.f, 0.f, 0.f, 0.f)); - pDrawList->PrimWriteVtx(ImVec2(oRectMin.x - fOverlap + fSlopWidth * fShadowSlopRatio, oRectMin.y), uv, ImColor(0.f, 0.f, 0.f, 0.f)); - pDrawList->PrimWriteVtx(ImVec2(oRectMin.x - fOverlap + fSlopWidth * fShadowSlopRatio, oRectMax.y), uv, ImColor(0.f, 0.f, 0.f, fShadowAlpha)); - if (bSelected) - { - pDrawList->PrimReserve(3, 3); - pDrawList->PrimWriteIdx((ImDrawIdx)(pDrawList->_VtxCurrentIdx)); pDrawList->PrimWriteIdx((ImDrawIdx)(pDrawList->_VtxCurrentIdx + 1)); pDrawList->PrimWriteIdx((ImDrawIdx)(pDrawList->_VtxCurrentIdx + 2)); - pDrawList->PrimWriteVtx(ImVec2(oRectMax.x + fOverlap + fShadowDropSize, oRectMax.y), uv, ImColor(0.f, 0.f, 0.f, 0.f)); - pDrawList->PrimWriteVtx(ImVec2(oRectMax.x + fOverlap - fSlopWidth * fShadowSlopRatio, oRectMin.y), uv, ImColor(0.f, 0.f, 0.f, 0.f)); - pDrawList->PrimWriteVtx(ImVec2(oRectMax.x + fOverlap - fSlopWidth * fShadowSlopRatio, oRectMax.y), uv, ImColor(0.f, 0.f, 0.f, fShadowAlpha)); - } - - // Draw tab and border - if (bSelected) - { - pDrawList->PathLineTo(ImVec2(oMin.x, oRectMax.y)); - } - pDrawList->PathLineTo(ImVec2(oRectMin.x - fOverlap, oRectMax.y)); - pDrawList->PathBezierCurveTo( - ImVec2(oRectMin.x + fSlopWidth * sSlopP1Ratio - fOverlap, oRectMin.y + (oRectMax.y - oRectMin.y) * fSlopHRatio), - ImVec2(oRectMin.x + fSlopWidth * fSlopP2Ratio - fOverlap, oRectMin.y), - ImVec2(oRectMin.x + fSlopWidth - fOverlap, oRectMin.y) - ); - pDrawList->PathLineTo(ImVec2(oRectMax.x - fSlopWidth + fOverlap, oRectMin.y)); - pDrawList->PathBezierCurveTo( - ImVec2(oRectMax.x - fSlopWidth * fSlopP2Ratio + fOverlap, oRectMin.y), - ImVec2(oRectMax.x - fSlopWidth * sSlopP1Ratio + fOverlap, oRectMin.y + (oRectMax.y - oRectMin.y) * fSlopHRatio), - ImVec2(oRectMax.x + fOverlap, oRectMax.y) - ); - - if (bSelected) - { - pDrawList->AddConvexPolyFilled(pDrawList->_Path.Data + 1, pDrawList->_Path.Size - 1, bSelected ? oSelectedTab : oNormalTab, true); - if (oMax.x > (oRectMax.x + fOverlap)) - { - pDrawList->PathLineTo(ImVec2(oMax.x, oRectMax.y)); - } - pDrawList->AddPolyline(pDrawList->_Path.Data, pDrawList->_Path.Size, oBorderColor, false, 1.5f, true); - } - else - { - pDrawList->AddConvexPolyFilled(pDrawList->_Path.Data, pDrawList->_Path.Size, bSelected ? oSelectedTab : oNormalTab, true); - } - - pDrawList->PathClear(); - - ImGui::RenderTextClipped(oRectMin, ImVec2(oRectMax.x, oRectMax.y), (*it)->GetTitle(), NULL, &oTextSize, ImGuiAlign_Center | ImGuiAlign_VCenter); - - if (ImGui::BeginPopupContextItem("TabMenu")) - { - if (ImGui::Selectable("Close")) - { - (*it)->Destroy(); - } - if (ImGui::BeginMenu("Dock to")) - { - int iIndex1 = 0; - - if (pWindowManager->GetMainPlatformWindow()->GetContainer()->IsEmpty()) - { - ImGui::PushID(0); - if (ImGui::Selectable("Main")) pWindowManager->Dock((*it)); - ImGui::PopID(); - ++iIndex1; - } - const WindowList& lWindows = pWindowManager->GetWindowList(); - for (WindowList::const_iterator itWindow = lWindows.begin(); itWindow != lWindows.end(); ++itWindow) - { - if ((*it) != (*itWindow)) - { - ImGui::PushID(iIndex1); - if (ImGui::BeginMenu((*itWindow)->GetTitle())) - { - bool bHovered = false; - PlatformWindow* pPlatformWindow = pWindowManager->GetWindowParent((*itWindow)); - - ImVec2 oLastWinPos = (*itWindow)->GetLastPosition(); - ImVec2 oLastWinSize = (*itWindow)->GetLastSize(); - - ImGui::PushID(0); - if (ImGui::Selectable("Tab")) pWindowManager->DockWith((*it), (*itWindow), E_DOCK_ORIENTATION_CENTER); - if (ImGui::IsItemHovered() && NULL != pPlatformWindow) - { - bHovered = true; - pWindowManager->DrawWindowArea(pPlatformWindow, oLastWinPos, oLastWinSize, ImColor(0.f, 0.5f, 1.f, 0.5f)); - } - ImGui::PopID(); - - ImGui::PushID(1); - if (ImGui::Selectable("Top")) pWindowManager->DockWith((*it), (*itWindow), E_DOCK_ORIENTATION_TOP); - if (ImGui::IsItemHovered() && NULL != pPlatformWindow) - { - bHovered = true; - pWindowManager->DrawWindowArea(pPlatformWindow, oLastWinPos, ImVec2(oLastWinSize.x, oLastWinSize.y / 2.f), ImColor(0.f, 0.5f, 1.f, 0.5f)); - } - ImGui::PopID(); - - ImGui::PushID(2); - if (ImGui::Selectable("Left")) pWindowManager->DockWith((*it), (*itWindow), E_DOCK_ORIENTATION_LEFT); - if (ImGui::IsItemHovered() && NULL != pPlatformWindow) - { - bHovered = true; - pWindowManager->DrawWindowArea(pPlatformWindow, oLastWinPos, ImVec2(oLastWinSize.x / 2.f, oLastWinSize.y), ImColor(0.f, 0.5f, 1.f, 0.5f)); - } - ImGui::PopID(); - - ImGui::PushID(3); - if (ImGui::Selectable("Right")) pWindowManager->DockWith((*it), (*itWindow), E_DOCK_ORIENTATION_RIGHT); - if (ImGui::IsItemHovered() && NULL != pPlatformWindow) - { - bHovered = true; - pWindowManager->DrawWindowArea(pPlatformWindow, ImVec2(oLastWinPos.x + oLastWinSize.x / 2.f, oLastWinPos.y), ImVec2(oLastWinSize.x / 2.f, oLastWinSize.y), ImColor(0.f, 0.5f, 1.f, 0.5f)); - } - ImGui::PopID(); - - ImGui::PushID(4); - if (ImGui::Selectable("Bottom")) pWindowManager->DockWith((*it), (*itWindow), E_DOCK_ORIENTATION_BOTTOM); - if (ImGui::IsItemHovered() && NULL != pPlatformWindow) - { - bHovered = true; - pWindowManager->DrawWindowArea(pPlatformWindow, ImVec2(oLastWinPos.x, oLastWinPos.y + oLastWinSize.y / 2.f), ImVec2(oLastWinSize.x, oLastWinSize.y / 2.f), ImColor(0.f, 0.5f, 1.f, 0.5f)); - } - ImGui::PopID(); - - if (!bHovered) - { - if (NULL != pPlatformWindow) - { - pWindowManager->DrawWindowArea(pPlatformWindow, oLastWinPos, oLastWinSize, ImColor(0.f, 0.5f, 1.f, 0.5f)); - } - } - - ImGui::EndMenu(); - } - ImGui::PopID(); - } - ++iIndex1; - } - - ImGui::EndMenu(); - } - if (ImGui::Selectable("Float")) - { - pWindowManager->Float((*it)); - } - - ImGui::EndPopup(); - } - - ImGui::PopID(); - - ++iIndex; - } - m_iActiveWindow = iNewActive; - pDrawList->ChannelsMerge(); - - WindowList::iterator itActiveWindow = m_lWindows.begin(); - std::advance(itActiveWindow, m_iActiveWindow); - - //Draw active - IM_ASSERT(itActiveWindow != m_lWindows.end()); - if (itActiveWindow != m_lWindows.end()) - { - ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, oStyle.WindowPadding); - //ImGui::PushStyleColor(ImGuiCol_ChildWindowBg, ImColor(59, 59, 59, 255)); - ImGui::BeginChild((*itActiveWindow)->GetId(), ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar); - - ImVec2 oWinPos = ImGui::GetWindowPos(); - ImVec2 oWinSize = ImGui::GetWindowSize(); - - for (WindowList::iterator it = m_lWindows.begin(); it != m_lWindows.end(); ++it) - { - (*it)->m_oLastPosition = oWinPos; - (*it)->m_oLastSize = oWinSize; - } - (*itActiveWindow)->OnGui(); - - ImGui::EndChild(); - //ImGui::PopStyleColor(1); - ImGui::PopStyleVar(1); - } - } - else - { - // This case can happened only where it's main container - IM_ASSERT(m_pParent == NULL); - } - } - - Container* Container::GetBestDocking(const ImVec2 oCursorPos, EDockOrientation& oOutOrientation, ImVec2& oOutAreaPos, ImVec2& oOutAreaSize) - { - if (m_pParent == NULL || - (oCursorPos.x >= m_oLastPosition.x && oCursorPos.x <= (m_oLastPosition.x + m_oLastSize.x) && - oCursorPos.y >= m_oLastPosition.y && oCursorPos.y <= (m_oLastPosition.y + m_oLastSize.y))) - { - if (IsSplit()) - { - Container* pBestContainer = NULL; - pBestContainer = m_pSplits[0]->GetBestDocking(oCursorPos, oOutOrientation, oOutAreaPos, oOutAreaSize); - if (NULL != pBestContainer) - { - return pBestContainer; - } - pBestContainer = m_pSplits[1]->GetBestDocking(oCursorPos, oOutOrientation, oOutAreaPos, oOutAreaSize); - if (NULL != pBestContainer) - { - return pBestContainer; - } - } - else - { - const float c_fBoxHalfSize = 20.f; - const float c_fBoxSize = c_fBoxHalfSize * 2.f; - const float c_fMinSize = c_fBoxSize * 4.f; - const float c_fSplitRatio = 0.5f; - //const float c_fSplitRatio = oConfig.m_fDragMarginSizeRatio; - const ImColor oBoxColor(200, 200, 255, 255); - const ImColor oBoxHightlightColor(100, 100, 255, 255); - - if (m_oLastSize.x < c_fMinSize && m_oLastSize.y < c_fMinSize) - { - oOutOrientation = E_DOCK_ORIENTATION_CENTER; - oOutAreaPos = m_oLastPosition; - oOutAreaSize = m_oLastSize; - return this; - } - else - { - ImVec2 oCenter = ImVec2(m_oLastPosition.x + m_oLastSize.x / 2.f, m_oLastPosition.y + m_oLastSize.y / 2.f); - - bool bIsInCenter = false; - bool bIsInTop = false; - bool bIsInLeft = false; - bool bIsInRight = false; - bool bIsInBottom = false; - - //Center - ImRect oRectCenter(ImVec2(oCenter.x - c_fBoxHalfSize, oCenter.y - c_fBoxHalfSize), ImVec2(oCenter.x + c_fBoxHalfSize, oCenter.y + c_fBoxHalfSize)); - bIsInCenter = oRectCenter.Contains(oCursorPos); - WindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectCenter.Min, oRectCenter.GetSize(), bIsInCenter ? oBoxHightlightColor : oBoxColor); - - if (m_oLastSize.y >= c_fMinSize) - { - //Top - ImRect oRectTop(ImVec2(oCenter.x - c_fBoxHalfSize, oCenter.y - c_fBoxHalfSize * 4.f), ImVec2(oCenter.x + c_fBoxHalfSize, oCenter.y - c_fBoxHalfSize * 2.f)); - bIsInTop = oRectTop.Contains(oCursorPos); - WindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectTop.Min, oRectTop.GetSize(), bIsInTop ? oBoxHightlightColor : oBoxColor); - - //Bottom - ImRect oRectBottom(ImVec2(oCenter.x - c_fBoxHalfSize, oCenter.y + c_fBoxHalfSize * 2.f), ImVec2(oCenter.x + c_fBoxHalfSize, oCenter.y + c_fBoxHalfSize * 4.f)); - bIsInBottom = oRectBottom.Contains(oCursorPos); - WindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectBottom.Min, oRectBottom.GetSize(), bIsInBottom ? oBoxHightlightColor : oBoxColor); - } - - if (m_oLastSize.x >= c_fMinSize) - { - //Left - ImRect oRectLeft(ImVec2(oCenter.x - c_fBoxHalfSize * 4.f, oCenter.y - c_fBoxHalfSize), ImVec2(oCenter.x - c_fBoxHalfSize * 2.f, oCenter.y + c_fBoxHalfSize)); - bIsInLeft = oRectLeft.Contains(oCursorPos); - WindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectLeft.Min, oRectLeft.GetSize(), bIsInLeft ? oBoxHightlightColor : oBoxColor); - - //Right - ImRect oRectRight(ImVec2(oCenter.x + c_fBoxHalfSize * 2.f, oCenter.y - c_fBoxHalfSize), ImVec2(oCenter.x + c_fBoxHalfSize * 4.f, oCenter.y + c_fBoxHalfSize)); - bIsInRight = oRectRight.Contains(oCursorPos); - WindowManager::GetInstance()->DrawWindowArea(m_pParentWindow, oRectRight.Min, oRectRight.GetSize(), bIsInRight ? oBoxHightlightColor : oBoxColor); - } - - if (bIsInCenter) - { - oOutOrientation = E_DOCK_ORIENTATION_CENTER; - oOutAreaPos = m_oLastPosition; - oOutAreaSize = m_oLastSize; - return this; - } - else if (bIsInTop) - { - oOutOrientation = E_DOCK_ORIENTATION_TOP; - oOutAreaPos = m_oLastPosition; - oOutAreaSize = ImVec2(m_oLastSize.x, m_oLastSize.y * c_fSplitRatio); - return this; - } - else if (bIsInLeft) - { - oOutOrientation = E_DOCK_ORIENTATION_LEFT; - oOutAreaPos = m_oLastPosition; - oOutAreaSize = ImVec2(m_oLastSize.x * c_fSplitRatio, m_oLastSize.y); - return this; - } - else if (bIsInRight) - { - oOutOrientation = E_DOCK_ORIENTATION_RIGHT; - oOutAreaPos = ImVec2(m_oLastPosition.x + m_oLastSize.x * (1.f - c_fSplitRatio), m_oLastPosition.y); - oOutAreaSize = ImVec2(m_oLastSize.x * c_fSplitRatio, m_oLastSize.y); - return this; - } - else if (bIsInBottom) - { - oOutOrientation = E_DOCK_ORIENTATION_BOTTOM; - oOutAreaPos = ImVec2(m_oLastPosition.x, m_oLastPosition.y + m_oLastSize.y * (1.f - c_fSplitRatio)); - oOutAreaSize = ImVec2(m_oLastSize.x, m_oLastSize.y * c_fSplitRatio); - return this; - } - } - } - } - - return NULL; - } - - PlatformWindow::PlatformWindow(bool bMain, bool bIsDragWindow) - { - m_bMain = bMain; - m_bIsDragWindow = bIsDragWindow; - m_pContainer = IMGUI_NEW(Container)(this); - m_pPreviousState = NULL; - - ImGui::GetIO().IniFilename = NULL; - - m_pState = ImGui::CreateContext(); - } - - PlatformWindow::~PlatformWindow() - { - IMGUI_DELETE_NULL(Container, m_pContainer); - - SetState(); - if (!IsMain()) - { - ImGui::GetIO().Fonts = NULL; - } - - RestoreState(); - ImGui::DestroyContext(m_pState); - m_pState = NULL; - } - - void PlatformWindow::OnClose() - { - WindowManager::GetInstance()->OnClosePlatformWindow(this); - } - - static bool s_bStatePush = false; - - bool PlatformWindow::IsStateSet() - { - return s_bStatePush; - } - - void PlatformWindow::SetState() - { - IM_ASSERT(s_bStatePush == false); - s_bStatePush = true; - m_pPreviousState = ImGui::GetCurrentContext(); - ImGui::SetCurrentContext(m_pState); - memcpy(&m_pState->Style, &m_pPreviousState->Style, sizeof(ImGuiStyle) ); - } - - void PlatformWindow::RestoreState() - { - IM_ASSERT(s_bStatePush == true); - s_bStatePush = false; - memcpy(&m_pPreviousState->Style, &m_pState->Style, sizeof(ImGuiStyle) ); - ImGui::SetCurrentContext(m_pPreviousState); - } - - void PlatformWindow::OnLoseFocus() - { - ImGuiContext& g = *m_pState; - g.SetNextWindowPosCond = g.SetNextWindowSizeCond = g.SetNextWindowContentSizeCond = g.SetNextWindowCollapsedCond = g.SetNextWindowFocus = 0; - } - - void PlatformWindow::Paint() - { - PaintBegin(); - WindowManager::GetInstance()->Paint(this); - PaintEnd(); - } - - bool PlatformWindow::IsMain() - { - return m_bMain; - } - - void PlatformWindow::Dock(Window* pWindow) - { - m_pContainer->Dock(pWindow); - } - - bool PlatformWindow::UnDock(Window* pWindow) - { - return m_pContainer->UnDock(pWindow); - } - - Container* PlatformWindow::GetContainer() - { - return m_pContainer; - } - - Container* PlatformWindow::HasWindow(Window* pWindow) - { - return m_pContainer->HasWindow(pWindow); - } - - void PlatformWindow::PaintContainer() - { - m_pContainer->Paint(); - } - - WindowManager::DrawWindowAreaAction::DrawWindowAreaAction(PlatformWindow* pWindow, const ImVec2& oRectPos, const ImVec2& oRectSize, const ImColor& oColor) - : m_oColor(oColor) - { - m_pWindow = pWindow; - m_oRectPos = oRectPos; - m_oRectSize = oRectSize; - } - - WindowManager* WindowManager::s_pInstance = 0; - - ////////////////////////////////////////////////////////////////////////// - - WindowManager::Config::Config() - : m_fDragMarginRatio(0.1f) - , m_fDragMarginSizeRatio(0.25f) - , m_oHightlightAreaColor(0.f, 0.5f, 1.f, 0.5f) - { - } - - ////////////////////////////////////////////////////////////////////////// - - WindowManager::WindowManager() - { - s_pInstance = this; - m_pMainPlatformWindow = NULL; - m_pDragPlatformWindow = NULL; - m_pCurrentPlatformWindow = NULL; - m_pDraggedWindow = NULL; - m_oDragPreviewOffset = ImVec2(-20, -10); - } - - WindowManager::~WindowManager() - { - IMGUI_DELETE_NULL(PlatformWindow, m_pMainPlatformWindow); - IMGUI_DELETE_NULL(PlatformWindow, m_pDragPlatformWindow); - s_pInstance = 0; - ImGui::Shutdown(); - } - - bool WindowManager::Init() - { - m_pMainPlatformWindow = CreatePlatformWindow(true, NULL, false); - if (NULL != m_pMainPlatformWindow) - { - m_pMainPlatformWindow->Show(); - - m_pDragPlatformWindow = CreatePlatformWindow(false, m_pMainPlatformWindow, true); - return true; - } - return false; - } - - bool WindowManager::Run() - { - if (m_pMainPlatformWindow != NULL) - { - ImGuiIO& io = ImGui::GetIO(); - m_pMainPlatformWindow->SetSize(io.DisplaySize); - } - InternalRun(); - return m_pMainPlatformWindow != NULL; - } - - void WindowManager::Exit() - { - //TODO : Manual exit - } - - PlatformWindow* WindowManager::GetMainPlatformWindow() - { - return m_pMainPlatformWindow; - } - - WindowManager::Config& WindowManager::GetConfig() - { - return m_oConfig; - } - - void WindowManager::SetMainTitle(const char* pTitle) - { - if (NULL != m_pMainPlatformWindow) - { - m_pMainPlatformWindow->SetTitle(pTitle); - } - } - - void WindowManager::Dock(Window* pWindow, EDockOrientation eOrientation, PlatformWindow* pToPlatformWindow) - { - DockAction* pAction = IMGUI_NEW(DockAction); - pAction->m_bFloat = false; - pAction->m_pWindow = pWindow; - pAction->m_pWith = NULL; - pAction->m_eOrientation = eOrientation; - pAction->m_pToPlatformWindow = (pToPlatformWindow != NULL) ? pToPlatformWindow : m_pMainPlatformWindow; - pAction->m_pToContainer = NULL; - m_lDockActions.push_back(pAction); - } - - void WindowManager::DockTo(Window* pWindow, EDockOrientation eOrientation, Container* pContainer) - { - IM_ASSERT(NULL != pContainer); - if (NULL != pContainer) - { - DockAction* pAction = IMGUI_NEW(DockAction); - pAction->m_bFloat = false; - pAction->m_pWindow = pWindow; - pAction->m_pWith = NULL; - pAction->m_eOrientation = eOrientation; - pAction->m_pToPlatformWindow = NULL; - pAction->m_pToContainer = pContainer; - m_lDockActions.push_back(pAction); - } - } - - void WindowManager::DockWith(Window* pWindow, Window* pWithWindow, EDockOrientation eOrientation) - { - DockAction* pAction = IMGUI_NEW(DockAction); - pAction->m_bFloat = false; - pAction->m_pWindow = pWindow; - pAction->m_pWith = pWithWindow; - pAction->m_eOrientation = eOrientation; - m_lDockActions.push_back(pAction); - } - - void WindowManager::Float(Window* pWindow, const ImVec2& oPosition, const ImVec2& oSize) - { - DockAction* pAction = IMGUI_NEW(DockAction); - pAction->m_bFloat = true; - pAction->m_pWindow = pWindow; - pAction->m_oPosition = oPosition; - pAction->m_oSize = oSize; - m_lDockActions.push_back(pAction); - } - - const WindowList& WindowManager::GetWindowList() const - { - return m_lWindows; - } - - PlatformWindow* WindowManager::GetCurrentPlatformWindow() - { - return m_pCurrentPlatformWindow; - } - - PlatformWindow* WindowManager::GetWindowParent(Window* pWindow) - { - Container* pContainer = m_pMainPlatformWindow->HasWindow(pWindow); - if (NULL != pContainer) - { - return m_pMainPlatformWindow; - } - - for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) - { - pContainer = (*it)->HasWindow(pWindow); - if (NULL != pContainer) - { - return *it; - } - } - IM_ASSERT(false); - return NULL; - } - - void WindowManager::Log(const char* pFormat, ...) - { - char pBuffer[32768]; - va_list argptr; - va_start(argptr, pFormat); - ImFormatStringV(pBuffer, sizeof(char) * 32767, pFormat, argptr); - va_end(argptr); - LogFormatted(pBuffer); - } - - void WindowManager::PreUpdate() - { - if (NULL != m_pMainPlatformWindow) - { - m_pMainPlatformWindow->PreUpdate(); - } - - for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) - { - (*it)->PreUpdate(); - } - } - - void WindowManager::Update() - { - UpdatePlatformwWindowActions(); - UpdateDockActions(); - UpdateOrphans(); - - while (m_lToDestroyWindows.begin() != m_lToDestroyWindows.end()) - { - Window* pWindow = *m_lToDestroyWindows.begin(); - - m_lToDestroyWindows.remove(pWindow); - m_lOrphanWindows.remove(pWindow); - m_lWindows.remove(pWindow); - - InternalUnDock(pWindow); - - IMGUI_DELETE(Window, pWindow); - } - - while (m_lToDestroyPlatformWindows.begin() != m_lToDestroyPlatformWindows.end()) - { - PlatformWindow* pPlatformWindow = *m_lToDestroyPlatformWindows.begin(); - m_lToDestroyPlatformWindows.remove(pPlatformWindow); - m_lPlatformWindows.remove(pPlatformWindow); - IMGUI_DELETE(PlatformWindow, pPlatformWindow); - } - - UpdateDragWindow(); - - m_pCurrentPlatformWindow = m_pMainPlatformWindow; - if (NULL != m_pMainPlatformWindow) - { - m_pMainPlatformWindow->Paint(); - } - - for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) - { - m_pCurrentPlatformWindow = (*it); - (*it)->Paint(); - } - - m_pCurrentPlatformWindow = NULL; - } - - void WindowManager::UpdatePlatformwWindowActions() - { - while (m_lPlatformWindowActions.begin() != m_lPlatformWindowActions.end()) - { - PlatformWindowAction* pAction = *m_lPlatformWindowActions.begin(); - - IM_ASSERT((pAction->m_iFlags & E_PLATFORM_WINDOW_ACTION_SHOW & E_PLATFORM_WINDOW_ACTION_HIDE) == 0); // Can't show and hide - - if (pAction->m_iFlags & E_PLATFORM_WINDOW_ACTION_DESTOY) - { - //pAction->m_pPlatformWindow->Show(); - //todo destroy - bool bFound = false; - if (m_pMainPlatformWindow == pAction->m_pPlatformWindow) - { - while (m_lPlatformWindows.begin() != m_lPlatformWindows.end()) - { - IMGUI_DELETE(PlatformWindow, *m_lPlatformWindows.begin()); - m_lPlatformWindows.erase(m_lPlatformWindows.begin()); - } - IMGUI_DELETE(PlatformWindow, m_pMainPlatformWindow); - m_pMainPlatformWindow = NULL; - bFound = true; - } - else - { - for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) - { - if (*it == pAction->m_pPlatformWindow) - { - IMGUI_DELETE(PlatformWindow, *it); - m_lPlatformWindows.erase(it); - bFound = true; - break; - } - } - } - - if (!bFound) - { - IM_ASSERT(false, "ImwPlatformWindow not found, maybe already closed"); - } - } - - if (pAction->m_iFlags & E_PLATFORM_WINDOW_ACTION_SHOW) - { - pAction->m_pPlatformWindow->Show(); - } - - if (pAction->m_iFlags & E_PLATFORM_WINDOW_ACTION_HIDE) - { - pAction->m_pPlatformWindow->Hide(); - } - - if (pAction->m_iFlags & E_PLATFORM_WINDOW_ACTION_SET_POSITION) - { - pAction->m_pPlatformWindow->SetPosition(pAction->m_oPosition); - } - - if (pAction->m_iFlags & E_PLATFORM_WINDOW_ACTION_SET_SIZE) - { - pAction->m_pPlatformWindow->SetSize(pAction->m_oSize); - } - - IMGUI_DELETE(PlatformWindowAction, *m_lPlatformWindowActions.begin()); - m_lPlatformWindowActions.erase(m_lPlatformWindowActions.begin()); - } - } - - void WindowManager::UpdateDockActions() - { - while (m_lDockActions.begin() != m_lDockActions.end()) - { - DockAction* pAction = *m_lDockActions.begin(); - - InternalUnDock(pAction->m_pWindow); - - if (pAction->m_bFloat) - { - if (!InternalFloat(pAction->m_pWindow, pAction->m_oPosition, pAction->m_oSize) ) - { - InternalDock(pAction->m_pWindow, E_DOCK_ORIENTATION_LEFT, m_pMainPlatformWindow); - } - } - else - { - if (NULL != pAction->m_pWith) - { - InternalDockWith(pAction->m_pWindow, pAction->m_pWith, pAction->m_eOrientation); - } - else if (NULL != pAction->m_pToContainer) - { - InternalDockTo(pAction->m_pWindow, pAction->m_eOrientation, pAction->m_pToContainer); - } - else - { - InternalDock(pAction->m_pWindow, pAction->m_eOrientation, pAction->m_pToPlatformWindow); - } - } - - m_lOrphanWindows.remove(pAction->m_pWindow); - - IMGUI_DELETE(DockAction, pAction); - m_lDockActions.erase(m_lDockActions.begin()); - } - } - - void WindowManager::UpdateOrphans() - { - while (m_lOrphanWindows.begin() != m_lOrphanWindows.end()) - { - if (m_pMainPlatformWindow->m_pContainer->IsEmpty()) - { - InternalDock(*m_lOrphanWindows.begin(), E_DOCK_ORIENTATION_CENTER, m_pMainPlatformWindow); - } - else - { - ImVec2 oSize = ImVec2(300, 300); - ImVec2 oPos = m_pMainPlatformWindow->GetPosition(); - ImVec2 oMainSize = m_pMainPlatformWindow->GetSize(); - oPos.x += (oMainSize.x - oSize.x) / 2; - oPos.y += (oMainSize.y - oSize.y) / 2; - InternalFloat(*m_lOrphanWindows.begin(), oPos, oSize); - } - m_lOrphanWindows.erase(m_lOrphanWindows.begin()); - } - } - - void WindowManager::Paint(PlatformWindow* pWindow) - { - if (!pWindow->GetContainer()->IsEmpty() ) - { - float fY = 0.f; - - ImGui::SetNextWindowPos(ImVec2(0, fY), ImGuiSetCond_Always); - ImGui::SetNextWindowSize(ImVec2(pWindow->GetSize().x, pWindow->GetSize().y - fY), ImGuiSetCond_Always); - int iFlags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse; - - if (NULL != m_pDraggedWindow) - { - iFlags += ImGuiWindowFlags_NoInputs; - } - - ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(5.0f, 5.0f)); - char name[64]; - ImFormatString(name, sizeof(name), "Window %p", pWindow); - ImGui::Begin(name, NULL, iFlags); - pWindow->PaintContainer(); - ImGui::End(); - ImGui::PopStyleVar(1); - - ImGui::Begin("##Overlay", NULL, ImVec2(0, 0), 0.f, ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize); - ImDrawList* pDrawList = ImGui::GetWindowDrawList(); - for (ImwList<DrawWindowAreaAction>::iterator it = m_lDrawWindowAreas.begin(); it != m_lDrawWindowAreas.end();) - { - const DrawWindowAreaAction& oAction = *it; - - if (pWindow == oAction.m_pWindow) - { - ImVec2 oPosA = oAction.m_oRectPos; - ImVec2 oPosB = oAction.m_oRectSize; - oPosB.x += oPosA.x; - oPosB.y += oPosA.y; - - pDrawList->PushClipRectFullScreen(); - pDrawList->AddRectFilled(oPosA, oPosB, oAction.m_oColor); - pDrawList->PopClipRect(); - ImwList<DrawWindowAreaAction>::iterator toRemove = it; - ++it; - m_lDrawWindowAreas.erase(toRemove); - } - else - { - ++it; - } - } - - ImGui::End(); - } - } - - static ImVec2 GetCursorPos() - { - ImGuiIO& io = ImGui::GetIO(); - return io.MousePos; - } - - void WindowManager::StartDragWindow(Window* pWindow) - { - if (NULL == m_pDraggedWindow) - { - m_pDraggedWindow = pWindow; - - PlatformWindowAction* pAction = IMGUI_NEW(PlatformWindowAction); - pAction->m_pPlatformWindow = m_pDragPlatformWindow; - pAction->m_iFlags = E_PLATFORM_WINDOW_ACTION_SHOW | E_PLATFORM_WINDOW_ACTION_SET_POSITION | E_PLATFORM_WINDOW_ACTION_SET_SIZE; - ImVec2 oCursorPos = GetCursorPos(); - pAction->m_oPosition = ImVec2(oCursorPos.x + m_oDragPreviewOffset.x, oCursorPos.y + m_oDragPreviewOffset.y); - pAction->m_oSize = ImVec2(pWindow->GetLastSize().x, pWindow->GetLastSize().y); - m_lPlatformWindowActions.push_back(pAction); - - Dock(pWindow, E_DOCK_ORIENTATION_CENTER, m_pDragPlatformWindow); - m_pDragPlatformWindow->m_pState->IO.MouseDown[0] = true; - } - } - - void WindowManager::StopDragWindow() - { - PlatformWindowAction* pAction = IMGUI_NEW(PlatformWindowAction); - pAction->m_pPlatformWindow = m_pDragPlatformWindow; - pAction->m_iFlags = E_PLATFORM_WINDOW_ACTION_HIDE; - m_pDragPlatformWindow->Hide(); - m_lPlatformWindowActions.push_back(pAction); - m_pDraggedWindow = NULL; - } - - void WindowManager::UpdateDragWindow() - { - if (NULL != m_pDraggedWindow) - { - m_pCurrentPlatformWindow = m_pDragPlatformWindow; - m_pDragPlatformWindow->Paint(); - m_pCurrentPlatformWindow = NULL; - - ImVec2 oCursorPos = GetCursorPos(); - m_pDragPlatformWindow->SetPosition(ImVec2(oCursorPos.x + m_oDragPreviewOffset.x, oCursorPos.y + m_oDragPreviewOffset.y)); - - //Search best dock area - EDockOrientation eBestDockOrientation; - ImVec2 oHightlightPos; - ImVec2 oHightlightSize; - Container* pBestContainer = GetBestDocking(m_pMainPlatformWindow, oCursorPos, eBestDockOrientation, oHightlightPos, oHightlightSize); - if (NULL == pBestContainer) - { - for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end() && NULL == pBestContainer; ++it) - { - pBestContainer = GetBestDocking(*it, oCursorPos, eBestDockOrientation, oHightlightPos, oHightlightSize); - } - } - if (pBestContainer) - { - DrawWindowArea(pBestContainer->GetPlatformWindowParent(), oHightlightPos, oHightlightSize, m_oConfig.m_oHightlightAreaColor); - } - - ImGuiIO& io = ImGui::GetIO(); - if (!io.MouseDown[0]) - { - if (NULL != pBestContainer) - { - DockTo(m_pDraggedWindow, eBestDockOrientation, pBestContainer); - } - else - { - Float(m_pDraggedWindow, m_pDragPlatformWindow->GetPosition(), m_pDragPlatformWindow->GetSize()); - } - - StopDragWindow(); - } - } - } - - Container* WindowManager::GetBestDocking(PlatformWindow* pPlatformWindow, const ImVec2 oCursorPos, EDockOrientation& oOutOrientation, ImVec2& oOutAreaPos, ImVec2& oOutAreaSize) - { - ImVec2 oPos = pPlatformWindow->GetPosition(); - ImVec2 oSize = pPlatformWindow->GetSize(); - if (oCursorPos.x >= oPos.x && oCursorPos.x <= (oPos.x + oSize.x) && - oCursorPos.y >= oPos.y && oCursorPos.y <= (oPos.y + oSize.y)) - { - ImVec2 oRectPos(oCursorPos.x - oPos.x, oCursorPos.y - oPos.y); - - Container* pBestContainer = pPlatformWindow->GetContainer()->GetBestDocking(oRectPos, oOutOrientation, oOutAreaPos, oOutAreaSize); - if (NULL != pBestContainer) - { - return pBestContainer; - } - - //Left - if (oRectPos.x <= oSize.x * m_oConfig.m_fDragMarginRatio) - { - oOutOrientation = E_DOCK_ORIENTATION_LEFT; - oOutAreaPos = IM_VEC2_0; - oOutAreaSize = ImVec2(oSize.x * m_oConfig.m_fDragMarginSizeRatio, oSize.y); - } - //Right - else if (oRectPos.x >= oSize.x * (1.f - m_oConfig.m_fDragMarginRatio)) - { - oOutOrientation = E_DOCK_ORIENTATION_RIGHT; - oOutAreaPos = ImVec2(oSize.x * (1.f - m_oConfig.m_fDragMarginSizeRatio), 0.f); - oOutAreaSize = ImVec2(oSize.x * m_oConfig.m_fDragMarginSizeRatio, oSize.y); - } - //Top - else if (oRectPos.y <= oSize.y * m_oConfig.m_fDragMarginRatio) - { - oOutOrientation = E_DOCK_ORIENTATION_TOP; - oOutAreaPos = IM_VEC2_0; - oOutAreaSize = ImVec2(oSize.x, oSize.y * m_oConfig.m_fDragMarginSizeRatio); - } - //Bottom - else if (oRectPos.y >= oSize.y * (1.f - m_oConfig.m_fDragMarginRatio)) - { - oOutOrientation = E_DOCK_ORIENTATION_BOTTOM; - oOutAreaPos = ImVec2(0.f, oSize.y * (1.f - m_oConfig.m_fDragMarginSizeRatio)); - oOutAreaSize = ImVec2(oSize.x, oSize.y * m_oConfig.m_fDragMarginSizeRatio); - } - else - { - oOutOrientation = E_DOCK_ORIENTATION_CENTER; - oOutAreaPos = IM_VEC2_0; - oOutAreaSize = ImVec2(oSize.x, oSize.y); - //IM_ASSERT(false); //Best dock orientation not found - return NULL; - } - return pPlatformWindow->GetContainer(); - } - return NULL; - } - - void WindowManager::AddWindow(Window* pWindow) - { - m_lWindows.push_back(pWindow); - - m_lOrphanWindows.push_back(pWindow); - } - - void WindowManager::RemoveWindow(Window* pWindow) - { - m_lWindows.remove(pWindow); - m_lOrphanWindows.remove(pWindow); - } - - void WindowManager::DestroyWindow(Window* pWindow) - { - if (NULL != pWindow && std::find(m_lToDestroyWindows.begin(), m_lToDestroyWindows.end(), pWindow) == m_lToDestroyWindows.end()) - { - m_lToDestroyWindows.push_back(pWindow); - } - } - - void WindowManager::InternalDock(Window* pWindow, EDockOrientation eOrientation, PlatformWindow* pToPlatformWindow) - { - pToPlatformWindow->m_pContainer->Dock(pWindow, eOrientation); - } - - void WindowManager::InternalDockTo(Window* pWindow, EDockOrientation eOrientation, Container* pToContainer) - { - pToContainer->Dock(pWindow, eOrientation); - } - - void WindowManager::InternalDockWith(Window* pWindow, Window* pWithWindow, EDockOrientation eOrientation) - { - Container* pContainer = m_pMainPlatformWindow->HasWindow(pWithWindow); - if (NULL != pContainer) - { - pContainer->Dock(pWindow, eOrientation); - } - - for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) - { - pContainer = (*it)->HasWindow(pWithWindow); - if (NULL != pContainer) - { - pContainer->Dock(pWindow, eOrientation); - break; - } - } - } - - bool WindowManager::InternalFloat(Window* pWindow, ImVec2 oPosition, ImVec2 oSize) - { - PlatformWindow* pPlatformWindow = CreatePlatformWindow(false, m_pMainPlatformWindow, false); - if (NULL == pPlatformWindow) - { - return false; - } - - m_lPlatformWindows.push_back(pPlatformWindow); - - if (oSize.x == IM_VEC2_N1.x && oSize.y == IM_VEC2_N1.y) - { - oSize = pWindow->GetLastSize(); - } - - if (oPosition.x == IM_VEC2_N1.x && oPosition.y == IM_VEC2_N1.y) - { - oPosition = GetCursorPos(); - oPosition.x -= 20; - oPosition.x -= 10; - } - pPlatformWindow->Dock(pWindow); - pPlatformWindow->SetSize(oSize); - pPlatformWindow->SetPosition(oPosition); - pPlatformWindow->Show(); - - return true; - } - - void WindowManager::InternalUnDock(Window* pWindow) - { - if (m_pMainPlatformWindow->UnDock(pWindow)) - { - return; - } - - for (PlatformWindowList::iterator it = m_lPlatformWindows.begin(); it != m_lPlatformWindows.end(); ++it) - { - if ((*it)->UnDock(pWindow)) - { - //Destroy empty platform window if not main window - if (!(*it)->IsMain() && (*it)->GetContainer()->IsEmpty()) - { - m_lToDestroyPlatformWindows.push_back(*it); - } - return; - } - } - - m_pDragPlatformWindow->UnDock(pWindow); - } - - void WindowManager::OnClosePlatformWindow(PlatformWindow* pWindow) - { - PlatformWindowAction* pAction = IMGUI_NEW(PlatformWindowAction); - pAction->m_iFlags = E_PLATFORM_WINDOW_ACTION_DESTOY; - pAction->m_pPlatformWindow = pWindow; - m_lPlatformWindowActions.push_back(pAction); - } - - void WindowManager::DrawWindowArea(PlatformWindow* pWindow, const ImVec2& oPos, const ImVec2& oSize, const ImColor& oColor) - { - m_lDrawWindowAreas.push_back(DrawWindowAreaAction(pWindow, oPos, oSize, oColor)); - } - - // Static - WindowManager* WindowManager::GetInstance() - { - return s_pInstance; - } - -} // namespace ImWindow diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_wm.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_wm.h deleted file mode 100644 index e191339e1d7..00000000000 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_wm.h +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright 2011-2016 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -/* - * Based on ImWindow code from: - * https://github.com/thennequin/ImWindow - * - * MIT license: - * https://github.com/thennequin/ImWindow/blob/master/LICENSE - */ - -#ifndef IMGUI_WM_H_HEADER_GUARD -#define IMGUI_WM_H_HEADER_GUARD - -#include "imgui.h" - -typedef unsigned int ImU32; - -#ifndef ImwList -# include <list> -# define ImwList std::list -#endif // ImList - -#ifndef ImwMap -# include <unordered_map> -# define ImwMap std::unordered_map -#endif // ImMap - -namespace ImGuiWM -{ - enum EDockOrientation - { - E_DOCK_ORIENTATION_CENTER, - E_DOCK_ORIENTATION_TOP, - E_DOCK_ORIENTATION_LEFT, - E_DOCK_ORIENTATION_RIGHT, - E_DOCK_ORIENTATION_BOTTOM, - }; - - class Id - { - public: - Id(); - ImU32 GetId() const; - const char* GetStr() const; - - private: - ImU32 m_iId; - char m_pId[11]; - static int s_iNextId; - }; - - class Window - { - friend class WindowManager; - friend class Container; - - public: - virtual void OnGui() = 0; - virtual void OnMenu() {}; - - const char* GetId() const { return m_oId.GetStr(); } - - void Destroy(); - - void SetTitle(const char* pTitle); - const char* GetTitle() const; - - const ImVec2& GetLastPosition() const; - const ImVec2& GetLastSize() const; - - protected: - Window(); - virtual ~Window(); - - char* m_pTitle; - Id m_oId; - - ImVec2 m_oLastPosition; - ImVec2 m_oLastSize; - }; - - typedef ImwList<Window*> WindowList; - - class PlatformWindow; - - class Container - { - friend class PlatformWindow; - - public: - void Dock(Window* pWindow,EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER); - bool UnDock(Window* pWindow); - - bool IsEmpty(); - bool IsSplit(); - bool HasWindowTabbed(); - Container* HasWindow(const Window* pWindow); - PlatformWindow* GetPlatformWindowParent() const; - Container* GetBestDocking(const ImVec2 oCursorPosInContainer,EDockOrientation& oOutOrientation,ImVec2& oOutAreaPos,ImVec2& oOutAreaSize); - - protected: - Container(Container* pParent); - Container(PlatformWindow* pParent); - ~Container(); - - void CreateSplits(); - void Paint(); - - Container* m_pParent; - PlatformWindow* m_pParentWindow; - WindowList m_lWindows; - Container* m_pSplits[2]; - - float m_fSplitRatio; - bool m_bVerticalSplit; - int m_iActiveWindow; - - bool m_bIsDrag; - - ImVec2 m_oLastPosition; - ImVec2 m_oLastSize; - }; - - class PlatformWindow - { - friend class WindowManager; - - public: - PlatformWindow(bool bMainWindow,bool bIsDragWindow); - virtual ~PlatformWindow(); - - virtual bool Init(PlatformWindow* pParent) = 0; - - virtual const ImVec2& GetPosition() const = 0; - virtual const ImVec2& GetSize() const = 0; - - virtual void Show() = 0; - virtual void Hide() = 0; - virtual void SetSize(const ImVec2& size) = 0; - virtual void SetPosition(const ImVec2& pos) = 0; - virtual void SetTitle(const char* pTitle) = 0; - - bool IsMain(); - - void Dock(Window* pWindow); - bool UnDock(Window* pWindow); - - Container* GetContainer(); - Container* HasWindow(Window* pWindow); - bool IsStateSet(); - - protected: - void SetState(); - void RestoreState(); - void OnLoseFocus(); - virtual void PreUpdate() = 0; - virtual void PaintBegin() = 0; - virtual void Paint(); - virtual void PaintEnd() = 0; - virtual void Destroy() = 0; - virtual void StartDrag() = 0; - virtual void StopDrag() = 0; - virtual bool IsDraging() = 0; - - void PaintContainer(); - void OnClose(); - - Id m_oId; - bool m_bMain; - bool m_bIsDragWindow; - Container* m_pContainer; - ImGuiContext* m_pState; - ImGuiContext* m_pPreviousState; - }; - - typedef ImwList<PlatformWindow*> PlatformWindowList; - - class WindowManager - { - friend class Window; - friend class PlatformWindow; - friend class Container; - - struct PlatformWindowAction - { - PlatformWindow* m_pPlatformWindow; - unsigned int m_iFlags; - ImVec2 m_oPosition; - ImVec2 m_oSize; - }; - - struct DockAction - { - Window* m_pWindow; - - // Is Dock or Float - bool m_bFloat; - - //For Docking - Window* m_pWith; - EDockOrientation m_eOrientation; - PlatformWindow* m_pToPlatformWindow; - Container* m_pToContainer; - - //For Floating - ImVec2 m_oPosition; - ImVec2 m_oSize; - }; - - struct DrawWindowAreaAction - { - DrawWindowAreaAction(PlatformWindow* pWindow,const ImVec2& oRectPos,const ImVec2& oRectSize,const ImColor& oColor); - PlatformWindow* m_pWindow; - ImVec2 m_oRectPos; - ImVec2 m_oRectSize; - ImColor m_oColor; - }; - - public: - struct Config - { - Config(); - float m_fDragMarginRatio; - float m_fDragMarginSizeRatio; - ImColor m_oHightlightAreaColor; - }; - - WindowManager(); - virtual ~WindowManager(); - - bool Init(); - bool Run(); - void Exit(); - - PlatformWindow* GetMainPlatformWindow(); - Config& GetConfig(); - - void SetMainTitle(const char* pTitle); - - void Dock(Window* pWindow, EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER, PlatformWindow* pToPlatformWindow = NULL); - void DockTo(Window* pWindow, EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER, Container* pContainer = NULL); - void DockWith(Window* pWindow, Window* pWithWindow,EDockOrientation eOrientation = E_DOCK_ORIENTATION_CENTER); - void Float(Window* pWindow, const ImVec2& oPosition = ImVec2(-1,-1), const ImVec2& oSize = ImVec2(-1,-1)); - - const WindowList& GetWindowList() const; - PlatformWindow* GetCurrentPlatformWindow(); - PlatformWindow* GetWindowParent(Window* pWindow); - - void Log(const char* pFormat, ...); - virtual void LogFormatted(const char* pStr) = 0;; - - static WindowManager* GetInstance(); - - protected: - virtual PlatformWindow* CreatePlatformWindow(bool bMain,PlatformWindow* pParent,bool bDragWindow) = 0; - virtual void InternalRun() = 0; - - void AddWindow(Window* pWindow); - void RemoveWindow(Window* pWindow); - void DestroyWindow(Window* pWindow); - - void InternalDock(Window* pWindow,EDockOrientation eOrientation,PlatformWindow* pToPlatformWindow); - void InternalDockTo(Window* pWindow,EDockOrientation eOrientation,Container* pToContainer); - void InternalDockWith(Window* pWindow,Window* pWithWindow,EDockOrientation eOrientation); - bool InternalFloat(Window* pWindow,ImVec2 oPosition,ImVec2 oSize); - void InternalUnDock(Window* pWindow); - void InternalDrag(Window* pWindow); - - void OnClosePlatformWindow(PlatformWindow* pWindow); - - void DrawWindowArea(PlatformWindow* pWindow,const ImVec2& oPos,const ImVec2& oSize,const ImColor& oColor); - - void PreUpdate(); - void Update(); - void UpdatePlatformwWindowActions(); - void UpdateDockActions(); - void UpdateOrphans(); - - void Paint(PlatformWindow* pWindow); - - void StartDragWindow(Window* pWindow); - void StopDragWindow(); - void UpdateDragWindow(); - Container* GetBestDocking(PlatformWindow* pPlatformWindow,const ImVec2 oCursorPos,EDockOrientation& oOutOrientation,ImVec2& oOutAreaPos,ImVec2& oOutAreaSize); - - Config m_oConfig; - PlatformWindow* m_pMainPlatformWindow; - PlatformWindowList m_lPlatformWindows; - PlatformWindow* m_pDragPlatformWindow; - WindowList m_lWindows; - WindowList m_lOrphanWindows; - WindowList m_lToDestroyWindows; - PlatformWindowList m_lToDestroyPlatformWindows; - ImwList<PlatformWindowAction*> m_lPlatformWindowActions; - ImwList<DockAction*> m_lDockActions; - ImwList<DrawWindowAreaAction> m_lDrawWindowAreas; - - PlatformWindow* m_pCurrentPlatformWindow; - Window* m_pDraggedWindow; - - ImVec2 m_oDragPreviewOffset; - - static WindowManager* s_pInstance; - }; -} - -#endif // IMGUI_WM_H_HEADER_GUARD diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/dock.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/dock.h new file mode 100644 index 00000000000..7b12328178f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/dock.h @@ -0,0 +1,21 @@ +namespace ImGui +{ + /// + IMGUI_API void InitDockContext(); + + /// + IMGUI_API void ShutdownDockContext(); + + /// + IMGUI_API void RootDock(const ImVec2& pos, const ImVec2& size); + + /// + IMGUI_API bool BeginDock(const char* label, bool* opened = NULL, ImGuiWindowFlags extra_flags = 0); + + /// + IMGUI_API void EndDock(); + + /// + IMGUI_API void SetDockActive(); + +} // namespace ImGui diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/dock.inl b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/dock.inl new file mode 100644 index 00000000000..206a4bee023 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/dock.inl @@ -0,0 +1,1084 @@ +// https://github.com/vassvik/imgui_docking_minimal/ +// +// This is free and unencumbered software released into the public domain. +// +// Anyone is free to copy, modify, publish, use, compile, sell, or +// distribute this software, either in source code form or as a compiled +// binary, for any purpose, commercial or non-commercial, and by any +// means. +// +// In jurisdictions that recognize copyright laws, the author or authors +// of this software dedicate any and all copyright interest in the +// software to the public domain. We make this dedication for the benefit +// of the public at large and to the detriment of our heirs and +// successors. We intend this dedication to be an overt act of +// relinquishment in perpetuity of all present and future rights to this +// software under copyright law. +// +// THE SOFTWARE IS 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 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 SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// For more information, please refer to <http://unlicense.org> + +#include <new> // placement new + +namespace ImGui +{ + struct DockContext + { + enum Slot_ + { + Slot_Left, + Slot_Right, + Slot_Top, + Slot_Bottom, + Slot_Tab, + + Slot_Float, + Slot_None + }; + + enum EndAction_ + { + EndAction_None, + EndAction_Panel, + EndAction_End, + EndAction_EndChild + }; + + enum Status_ + { + Status_Docked, + Status_Float, + Status_Dragged + }; + + struct Dock + { + Dock() + : id(0) + , label(NULL) + , next_tab(NULL) + , prev_tab(NULL) + , parent(NULL) + , pos(0, 0) + , size(-1, -1) + , active(true) + , status(Status_Float) + , opened(false) + { + location[0] = 0; + children[0] = children[1] = NULL; + } + + ~Dock() + { + MemFree(label); + } + + ImVec2 getMinSize() const + { + if (!children[0]) return ImVec2(16, 16 + GetTextLineHeightWithSpacing()); + + ImVec2 s0 = children[0]->getMinSize(); + ImVec2 s1 = children[1]->getMinSize(); + return isHorizontal() ? ImVec2(s0.x + s1.x, ImMax(s0.y, s1.y)) + : ImVec2(ImMax(s0.x, s1.x), s0.y + s1.y); + } + + bool isHorizontal() const + { + return children[0]->pos.x < children[1]->pos.x; + } + + void setParent(Dock* dock) + { + parent = dock; + for (Dock* tmp = prev_tab; tmp; tmp = tmp->prev_tab) tmp->parent = dock; + for (Dock* tmp = next_tab; tmp; tmp = tmp->next_tab) tmp->parent = dock; + } + + Dock& getSibling() + { + IM_ASSERT(parent); + if (parent->children[0] == &getFirstTab()) return *parent->children[1]; + return *parent->children[0]; + } + + Dock& getFirstTab() + { + Dock* tmp = this; + while (tmp->prev_tab) tmp = tmp->prev_tab; + return *tmp; + } + + void setActive() + { + active = true; + for (Dock* tmp = prev_tab; tmp; tmp = tmp->prev_tab) tmp->active = false; + for (Dock* tmp = next_tab; tmp; tmp = tmp->next_tab) tmp->active = false; + } + + bool isContainer() const + { + return children[0] != NULL; + } + + void setChildrenPosSize(const ImVec2& _pos, const ImVec2& _size) + { + ImVec2 s = children[0]->size; + if (isHorizontal()) + { + s.y = _size.y; + s.x = (float)int( + _size.x * children[0]->size.x / (children[0]->size.x + children[1]->size.x)); + if (s.x < children[0]->getMinSize().x) + { + s.x = children[0]->getMinSize().x; + } + else if (_size.x - s.x < children[1]->getMinSize().x) + { + s.x = _size.x - children[1]->getMinSize().x; + } + children[0]->setPosSize(_pos, s); + + s.x = _size.x - children[0]->size.x; + ImVec2 p = _pos; + p.x += children[0]->size.x; + children[1]->setPosSize(p, s); + } + else + { + s.x = _size.x; + s.y = (float)int( + _size.y * children[0]->size.y / (children[0]->size.y + children[1]->size.y)); + if (s.y < children[0]->getMinSize().y) + { + s.y = children[0]->getMinSize().y; + } + else if (_size.y - s.y < children[1]->getMinSize().y) + { + s.y = _size.y - children[1]->getMinSize().y; + } + children[0]->setPosSize(_pos, s); + + s.y = _size.y - children[0]->size.y; + ImVec2 p = _pos; + p.y += children[0]->size.y; + children[1]->setPosSize(p, s); + } + } + + void setPosSize(const ImVec2& _pos, const ImVec2& _size) + { + size = _size; + pos = _pos; + for (Dock* tmp = prev_tab; tmp; tmp = tmp->prev_tab) + { + tmp->size = _size; + tmp->pos = _pos; + } + for (Dock* tmp = next_tab; tmp; tmp = tmp->next_tab) + { + tmp->size = _size; + tmp->pos = _pos; + } + + if (!isContainer()) return; + setChildrenPosSize(_pos, _size); + } + + ImU32 id; + char* label; + Dock* next_tab; + Dock* prev_tab; + Dock* parent; + ImVec2 pos; + ImVec2 size; + bool active; + Status_ status; + bool opened; + + Dock* children[2]; + char location[16]; + int last_frame; + int invalid_frames; + bool first; + }; + + typedef ImVector<Dock*> DockVector; + DockVector m_docks; + ImVec2 m_drag_offset; + Dock* m_current; + int m_last_frame; + EndAction_ m_end_action; + + DockContext() + : m_current(NULL) + , m_last_frame(0) + { + } + + ~DockContext() + { + } + + Dock& getDock(const char* label, bool opened) + { + ImU32 id = ImHash(label, 0); + for (int i = 0; i < m_docks.size(); ++i) + { + if (m_docks[i]->id == id) return *m_docks[i]; + } + + Dock* new_dock = (Dock*)MemAlloc(sizeof(Dock)); + IM_PLACEMENT_NEW(new_dock) Dock(); + m_docks.push_back(new_dock); + new_dock->label = ImStrdup(label); + IM_ASSERT(new_dock->label); + new_dock->id = id; + new_dock->setActive(); + new_dock->status = Status_Float; + new_dock->pos = ImVec2(0, 0); + new_dock->size = GetIO().DisplaySize; + new_dock->opened = opened; + new_dock->first = true; + new_dock->last_frame = 0; + new_dock->invalid_frames = 0; + new_dock->location[0] = 0; + return *new_dock; + } + + void putInBackground() + { + ImGuiWindow* win = GetCurrentWindow(); + ImGuiContext& g = *GImGui; + if (g.Windows[0] == win) return; + + for (int i = 0; i < g.Windows.Size; i++) + { + if (g.Windows[i] == win) + { + for (int j = i - 1; j >= 0; --j) + { + g.Windows[j + 1] = g.Windows[j]; + } + g.Windows[0] = win; + break; + } + } + } + + void splits() + { + if (GetFrameCount() == m_last_frame) + { + return; + } + + m_last_frame = GetFrameCount(); + + putInBackground(); + + ImU32 color = GetColorU32(ImGuiCol_Button); + ImU32 color_hovered = GetColorU32(ImGuiCol_ButtonHovered); + ImDrawList* draw_list = GetWindowDrawList(); + ImGuiIO& io = GetIO(); + for (int i = 0; i < m_docks.size(); ++i) + { + Dock& dock = *m_docks[i]; + if (!dock.isContainer()) + { + continue; + } + + PushID(i); + if (!IsMouseDown(0)) + { + dock.status = Status_Docked; + } + + ImVec2 dsize(0, 0); + SetCursorScreenPos(dock.children[1]->pos); + ImVec2 min_size0 = dock.children[0]->getMinSize(); + ImVec2 min_size1 = dock.children[1]->getMinSize(); + if (dock.isHorizontal()) + { + InvisibleButton("split", ImVec2(3, dock.size.y)); + if (dock.status == Status_Dragged) dsize.x = io.MouseDelta.x; + dsize.x = -ImMin(-dsize.x, dock.children[0]->size.x - min_size0.x); + dsize.x = ImMin(dsize.x, dock.children[1]->size.x - min_size1.x); + } + else + { + InvisibleButton("split", ImVec2(dock.size.x, 3)); + if (dock.status == Status_Dragged) dsize.y = io.MouseDelta.y; + dsize.y = -ImMin(-dsize.y, dock.children[0]->size.y - min_size0.y); + dsize.y = ImMin(dsize.y, dock.children[1]->size.y - min_size1.y); + } + ImVec2 new_size0 = dock.children[0]->size + dsize; + ImVec2 new_size1 = dock.children[1]->size - dsize; + ImVec2 new_pos1 = dock.children[1]->pos + dsize; + dock.children[0]->setPosSize(dock.children[0]->pos, new_size0); + dock.children[1]->setPosSize(new_pos1, new_size1); + + if (IsItemHovered() && IsMouseClicked(0)) + { + dock.status = Status_Dragged; + } + + draw_list->AddRectFilled( + GetItemRectMin(), GetItemRectMax(), IsItemHovered() ? color_hovered : color); + PopID(); + } + } + + void checkNonexistent() + { + int frame_limit = ImMax(0, ImGui::GetFrameCount() - 2); + for (DockVector::iterator it = m_docks.begin(), itEnd = m_docks.end(); it != itEnd; ++it) + { + Dock* dock = *it; + if (dock->isContainer()) continue; + if (dock->status == Status_Float) continue; + if (dock->last_frame < frame_limit) + { + ++dock->invalid_frames; + if (dock->invalid_frames > 2) + { + doUndock(*dock); + dock->status = Status_Float; + } + return; + } + dock->invalid_frames = 0; + } + } + + void beginPanel() + { + ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | + ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | + ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar | + ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_ShowBorders | + ImGuiWindowFlags_NoBringToFrontOnFocus; + Dock* root = getRootDock(); + if (root) + { + SetNextWindowPos(root->pos); + SetNextWindowSize(root->size); + } + else + { + SetNextWindowPos(ImVec2(0, 0)); + SetNextWindowSize(GetIO().DisplaySize); + } + ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0); + Begin("###DockPanel", NULL, flags); + splits(); + + checkNonexistent(); + } + + void endPanel() + { + End(); + ImGui::PopStyleVar(); + } + + // Doesn't use input?? + Dock* getDockAt(const ImVec2& /*pos*/) const + { + for (int i = 0; i < m_docks.size(); ++i) + { + Dock& dock = *m_docks[i]; + if (dock.isContainer()) continue; + if (dock.status != Status_Docked) continue; + if (IsMouseHoveringRect(dock.pos, dock.pos + dock.size, false)) + { + return &dock; + } + } + + return NULL; + } + + static ImRect getDockedRect(const ImRect& rect, Slot_ dock_slot) + { + ImVec2 half_size = rect.GetSize() * 0.5f; + switch (dock_slot) + { + default: return rect; + case Slot_Top: return ImRect(rect.Min, rect.Min + ImVec2(rect.Max.x, half_size.y)); + case Slot_Right: return ImRect(rect.Min + ImVec2(half_size.x, 0), rect.Max); + case Slot_Bottom: return ImRect(rect.Min + ImVec2(0, half_size.y), rect.Max); + case Slot_Left: return ImRect(rect.Min, rect.Min + ImVec2(half_size.x, rect.Max.y)); + } + } + + static ImRect getSlotRect(ImRect parent_rect, Slot_ dock_slot) + { + ImVec2 size = parent_rect.Max - parent_rect.Min; + ImVec2 center = parent_rect.Min + size * 0.5f; + switch (dock_slot) + { + default: return ImRect(center - ImVec2(20, 20), center + ImVec2(20, 20)); + case Slot_Top: return ImRect(center + ImVec2(-20, -50), center + ImVec2(20, -30)); + case Slot_Right: return ImRect(center + ImVec2(30, -20), center + ImVec2(50, 20)); + case Slot_Bottom: return ImRect(center + ImVec2(-20, +30), center + ImVec2(20, 50)); + case Slot_Left: return ImRect(center + ImVec2(-50, -20), center + ImVec2(-30, 20)); + } + } + + static ImRect getSlotRectOnBorder(ImRect parent_rect, Slot_ dock_slot) + { + ImVec2 size = parent_rect.Max - parent_rect.Min; + ImVec2 center = parent_rect.Min + size * 0.5f; + switch (dock_slot) + { + case Slot_Top: + return ImRect(ImVec2(center.x - 20, parent_rect.Min.y + 10), + ImVec2(center.x + 20, parent_rect.Min.y + 30)); + case Slot_Left: + return ImRect(ImVec2(parent_rect.Min.x + 10, center.y - 20), + ImVec2(parent_rect.Min.x + 30, center.y + 20)); + case Slot_Bottom: + return ImRect(ImVec2(center.x - 20, parent_rect.Max.y - 30), + ImVec2(center.x + 20, parent_rect.Max.y - 10)); + case Slot_Right: + return ImRect(ImVec2(parent_rect.Max.x - 30, center.y - 20), + ImVec2(parent_rect.Max.x - 10, center.y + 20)); + default: IM_ASSERT(false); + } + IM_ASSERT(false); + return ImRect(); + } + + Dock* getRootDock() + { + for (int i = 0; i < m_docks.size(); ++i) + { + if (!m_docks[i]->parent && + (m_docks[i]->status == Status_Docked || m_docks[i]->children[0])) + { + return m_docks[i]; + } + } + return NULL; + } + + bool dockSlots(Dock& dock, Dock* dest_dock, const ImRect& rect, bool on_border) + { + ImDrawList* canvas = GetWindowDrawList(); + ImU32 color = GetColorU32(ImGuiCol_Button); + ImU32 color_hovered = GetColorU32(ImGuiCol_ButtonHovered); + ImVec2 mouse_pos = GetIO().MousePos; + for (int i = 0; i < (on_border ? 4 : 5); ++i) + { + ImRect r = + on_border ? getSlotRectOnBorder(rect, (Slot_)i) : getSlotRect(rect, (Slot_)i); + bool hovered = r.Contains(mouse_pos); + + canvas->AddRectFilled(r.Min, r.Max, hovered ? color_hovered : color); + if (!hovered) continue; + + if (!IsMouseDown(0)) + { + doDock(dock, dest_dock ? dest_dock : getRootDock(), (Slot_)i); + return true; + } + ImRect docked_rect = getDockedRect(rect, (Slot_)i); + canvas->AddRectFilled(docked_rect.Min, docked_rect.Max, GetColorU32(ImGuiCol_Button)); + } + return false; + } + + void handleDrag(Dock& dock) + { + Dock* dest_dock = getDockAt(GetIO().MousePos); + + Begin("##Overlay", + NULL, + ImVec2(0, 0), + 0.f, + ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | + ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | + ImGuiWindowFlags_AlwaysAutoResize); + ImDrawList* canvas = GetWindowDrawList(); + + canvas->PushClipRectFullScreen(); + + ImU32 docked_color = GetColorU32(ImGuiCol_FrameBg); + docked_color = (docked_color & 0x00ffFFFF) | 0x80000000; + dock.pos = GetIO().MousePos - m_drag_offset; + if (dest_dock) + { + if (dockSlots(dock, + dest_dock, + ImRect(dest_dock->pos, dest_dock->pos + dest_dock->size), + false)) + { + canvas->PopClipRect(); + End(); + return; + } + } + if (dockSlots(dock, NULL, ImRect(ImVec2(0, 0), GetIO().DisplaySize), true)) + { + canvas->PopClipRect(); + End(); + return; + } + canvas->AddRectFilled(dock.pos, dock.pos + dock.size, docked_color); + canvas->PopClipRect(); + + if (!IsMouseDown(0)) + { + dock.status = Status_Float; + dock.location[0] = 0; + dock.setActive(); + } + + End(); + } + + void fillLocation(Dock& dock) + { + if (dock.status == Status_Float) return; + char* c = dock.location; + Dock* tmp = &dock; + while (tmp->parent) + { + *c = getLocationCode(tmp); + tmp = tmp->parent; + ++c; + } + *c = 0; + } + + void doUndock(Dock& dock) + { + if (dock.prev_tab) + dock.prev_tab->setActive(); + else if (dock.next_tab) + dock.next_tab->setActive(); + else + dock.active = false; + Dock* container = dock.parent; + + if (container) + { + Dock& sibling = dock.getSibling(); + if (container->children[0] == &dock) + { + container->children[0] = dock.next_tab; + } + else if (container->children[1] == &dock) + { + container->children[1] = dock.next_tab; + } + + bool remove_container = !container->children[0] || !container->children[1]; + if (remove_container) + { + if (container->parent) + { + Dock*& child = container->parent->children[0] == container + ? container->parent->children[0] + : container->parent->children[1]; + child = &sibling; + child->setPosSize(container->pos, container->size); + child->setParent(container->parent); + } + else + { + if (container->children[0]) + { + container->children[0]->setParent(NULL); + container->children[0]->setPosSize(container->pos, container->size); + } + if (container->children[1]) + { + container->children[1]->setParent(NULL); + container->children[1]->setPosSize(container->pos, container->size); + } + } + for (int i = 0; i < m_docks.size(); ++i) + { + if (m_docks[i] == container) + { + m_docks.erase(m_docks.begin() + i); + break; + } + } + container->~Dock(); + MemFree(container); + } + } + if (dock.prev_tab) dock.prev_tab->next_tab = dock.next_tab; + if (dock.next_tab) dock.next_tab->prev_tab = dock.prev_tab; + dock.parent = NULL; + dock.prev_tab = dock.next_tab = NULL; + } + + void drawTabbarListButton(Dock& dock) + { + if (!dock.next_tab) return; + + ImDrawList* draw_list = GetWindowDrawList(); + if (InvisibleButton("list", ImVec2(16, 16))) + { + OpenPopup("tab_list_popup"); + } + if (BeginPopup("tab_list_popup")) + { + Dock* tmp = &dock; + while (tmp) + { + bool dummy = false; + if (Selectable(tmp->label, &dummy)) + { + tmp->setActive(); + } + tmp = tmp->next_tab; + } + EndPopup(); + } + + bool hovered = IsItemHovered(); + ImVec2 min = GetItemRectMin(); + ImVec2 max = GetItemRectMax(); + ImVec2 center = (min + max) * 0.5f; + ImU32 text_color = GetColorU32(ImGuiCol_Text); + ImU32 color_active = GetColorU32(ImGuiCol_FrameBgActive); + draw_list->AddRectFilled(ImVec2(center.x - 4, min.y + 3), + ImVec2(center.x + 4, min.y + 5), + hovered ? color_active : text_color); + draw_list->AddTriangleFilled(ImVec2(center.x - 4, min.y + 7), + ImVec2(center.x + 4, min.y + 7), + ImVec2(center.x, min.y + 12), + hovered ? color_active : text_color); + } + + bool tabbar(Dock& dock, bool close_button) + { + float tabbar_height = 2 * GetTextLineHeightWithSpacing(); + ImVec2 size0(dock.size.x, tabbar_height); + bool tab_closed = false; + + SetCursorScreenPos(dock.pos); + char tmp[20]; + ImFormatString(tmp, IM_ARRAYSIZE(tmp), "tabs%d", (int)dock.id); + if (BeginChild(tmp, size0, true)) + { + Dock* dock_tab = &dock; + + ImDrawList* draw_list = GetWindowDrawList(); + ImU32 color = GetColorU32(ImGuiCol_FrameBg); + ImU32 color_active = GetColorU32(ImGuiCol_FrameBgActive); + ImU32 color_hovered = GetColorU32(ImGuiCol_FrameBgHovered); + ImU32 text_color = GetColorU32(ImGuiCol_Text); + ImU32 text_color_disabled = GetColorU32(ImGuiCol_TextDisabled); + float line_height = GetTextLineHeightWithSpacing(); + float tab_base; + + drawTabbarListButton(dock); + + while (dock_tab) + { + SameLine(0, 15); + + const char* text_end = FindRenderedTextEnd(dock_tab->label); + ImVec2 size1(CalcTextSize(dock_tab->label, text_end).x, line_height); + if (InvisibleButton(dock_tab->label, size1)) + { + dock_tab->setActive(); + } + + if (IsItemActive() && IsMouseDragging()) + { + m_drag_offset = GetMousePos() - dock_tab->pos; + doUndock(*dock_tab); + dock_tab->status = Status_Dragged; + } + + bool hovered = IsItemHovered(); + ImVec2 pos = GetItemRectMin(); + size1.x += 20 + GetStyle().ItemSpacing.x; + + tab_base = pos.y; + + draw_list->AddRectFilled(pos+ImVec2(-8.0f, 0.0), + pos+size1, + hovered ? color_hovered : (dock_tab->active ? color_active : color)); + draw_list->AddText(pos, text_color, dock_tab->label, text_end); + + if (dock_tab->active && close_button) + { + SameLine(); + tab_closed = InvisibleButton("close", ImVec2(16, 16)); + + ImVec2 center = ((GetItemRectMin() + GetItemRectMax()) * 0.5f); + draw_list->AddLine( center + ImVec2(-3.5f, -3.5f), center + ImVec2(3.5f, 3.5f), text_color); + draw_list->AddLine( center + ImVec2(3.5f, -3.5f), center + ImVec2(-3.5f, 3.5f), text_color); + } else { + if(!dock_tab->active && close_button) { + SameLine(); + InvisibleButton("close", ImVec2(16, 16)); + + ImVec2 center = ((GetItemRectMin() + GetItemRectMax()) * 0.5f); + draw_list->AddLine( center + ImVec2(-3.5f, -3.5f), center + ImVec2(3.5f, 3.5f), text_color_disabled); + draw_list->AddLine( center + ImVec2(3.5f, -3.5f), center + ImVec2(-3.5f, 3.5f), text_color_disabled); + } + } + + dock_tab = dock_tab->next_tab; + } + ImVec2 cp(dock.pos.x, tab_base + line_height); + draw_list->AddLine(cp, cp + ImVec2(dock.size.x, 0), color); + } + EndChild(); + return tab_closed; + } + + static void setDockPosSize(Dock& dest, Dock& dock, Slot_ dock_slot, Dock& container) + { + IM_ASSERT(!dock.prev_tab && !dock.next_tab && !dock.children[0] && !dock.children[1]); + + dest.pos = container.pos; + dest.size = container.size; + dock.pos = container.pos; + dock.size = container.size; + + switch (dock_slot) + { + case Slot_Bottom: + dest.size.y *= 0.5f; + dock.size.y *= 0.5f; + dock.pos.y += dest.size.y; + break; + case Slot_Right: + dest.size.x *= 0.5f; + dock.size.x *= 0.5f; + dock.pos.x += dest.size.x; + break; + case Slot_Left: + dest.size.x *= 0.5f; + dock.size.x *= 0.5f; + dest.pos.x += dock.size.x; + break; + case Slot_Top: + dest.size.y *= 0.5f; + dock.size.y *= 0.5f; + dest.pos.y += dock.size.y; + break; + default: IM_ASSERT(false); break; + } + dest.setPosSize(dest.pos, dest.size); + + if (container.children[1]->pos.x < container.children[0]->pos.x || + container.children[1]->pos.y < container.children[0]->pos.y) + { + Dock* tmp = container.children[0]; + container.children[0] = container.children[1]; + container.children[1] = tmp; + } + } + + void doDock(Dock& dock, Dock* dest, Slot_ dock_slot) + { + IM_ASSERT(!dock.parent); + if (!dest) + { + dock.status = Status_Docked; + dock.setPosSize(ImVec2(0, 0), GetIO().DisplaySize); + } + else if (dock_slot == Slot_Tab) + { + Dock* tmp = dest; + while (tmp->next_tab) + { + tmp = tmp->next_tab; + } + + tmp->next_tab = &dock; + dock.prev_tab = tmp; + dock.size = tmp->size; + dock.pos = tmp->pos; + dock.parent = dest->parent; + dock.status = Status_Docked; + } + else if (dock_slot == Slot_None) + { + dock.status = Status_Float; + } + else + { + Dock* container = (Dock*)MemAlloc(sizeof(Dock)); + IM_PLACEMENT_NEW(container) Dock(); + m_docks.push_back(container); + container->children[0] = &dest->getFirstTab(); + container->children[1] = &dock; + container->next_tab = NULL; + container->prev_tab = NULL; + container->parent = dest->parent; + container->size = dest->size; + container->pos = dest->pos; + container->status = Status_Docked; + container->label = ImStrdup(""); + + if (!dest->parent) + { + } + else if (&dest->getFirstTab() == dest->parent->children[0]) + { + dest->parent->children[0] = container; + } + else + { + dest->parent->children[1] = container; + } + + dest->setParent(container); + dock.parent = container; + dock.status = Status_Docked; + + setDockPosSize(*dest, dock, dock_slot, *container); + } + dock.setActive(); + } + + void rootDock(const ImVec2& pos, const ImVec2& size) + { + Dock* root = getRootDock(); + if (!root) return; + + ImVec2 min_size = root->getMinSize(); + ImVec2 requested_size = size; + root->setPosSize(pos, ImMax(min_size, requested_size)); + } + + void setDockActive() + { + IM_ASSERT(m_current); + if (m_current) m_current->setActive(); + } + + static Slot_ getSlotFromLocationCode(char code) + { + switch (code) + { + case '1': return Slot_Left; + case '2': return Slot_Top; + case '3': return Slot_Bottom; + default: return Slot_Right; + } + } + + static char getLocationCode(Dock* dock) + { + if (!dock) return '0'; + + if (dock->parent->isHorizontal()) + { + if (dock->pos.x < dock->parent->children[0]->pos.x) return '1'; + if (dock->pos.x < dock->parent->children[1]->pos.x) return '1'; + return '0'; + } + else + { + if (dock->pos.y < dock->parent->children[0]->pos.y) return '2'; + if (dock->pos.y < dock->parent->children[1]->pos.y) return '2'; + return '3'; + } + } + + void tryDockToStoredLocation(Dock& dock) + { + if (dock.status == Status_Docked) return; + if (dock.location[0] == 0) return; + + Dock* tmp = getRootDock(); + if (!tmp) return; + + Dock* prev = NULL; + char* c = dock.location + strlen(dock.location) - 1; + while (c >= dock.location && tmp) + { + prev = tmp; + tmp = *c == getLocationCode(tmp->children[0]) ? tmp->children[0] : tmp->children[1]; + if(tmp) --c; + } + if (tmp && tmp->children[0]) tmp = tmp->parent; + doDock(dock, tmp ? tmp : prev, tmp && !tmp->children[0] ? Slot_Tab : getSlotFromLocationCode(*c)); + } + + bool begin(const char* label, bool* opened, ImGuiWindowFlags extra_flags) + { + Dock& dock = getDock(label, !opened || *opened); + if (!dock.opened && (!opened || *opened)) tryDockToStoredLocation(dock); + dock.last_frame = ImGui::GetFrameCount(); + if (strcmp(dock.label, label) != 0) + { + MemFree(dock.label); + dock.label = ImStrdup(label); + } + + m_end_action = EndAction_None; + + if (dock.first && opened) *opened = dock.opened; + dock.first = false; + if (opened && !*opened) + { + if (dock.status != Status_Float) + { + fillLocation(dock); + doUndock(dock); + dock.status = Status_Float; + } + dock.opened = false; + return false; + } + dock.opened = true; + + m_end_action = EndAction_Panel; + beginPanel(); + + m_current = &dock; + if (dock.status == Status_Dragged) handleDrag(dock); + + bool is_float = dock.status == Status_Float; + + if (is_float) + { + SetNextWindowPos(dock.pos); + SetNextWindowSize(dock.size); + bool ret = Begin(label, + opened, + dock.size, + -1.0f, + ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_ShowBorders | extra_flags); + m_end_action = EndAction_End; + dock.pos = GetWindowPos(); + dock.size = GetWindowSize(); + + ImGuiContext& g = *GImGui; + + if (g.ActiveId == GetCurrentWindow()->MoveId && g.IO.MouseDown[0]) + { + m_drag_offset = GetMousePos() - dock.pos; + doUndock(dock); + dock.status = Status_Dragged; + } + return ret; + } + + if (!dock.active && dock.status != Status_Dragged) return false; + + m_end_action = EndAction_EndChild; + + PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); + PushStyleColor(ImGuiCol_BorderShadow, ImVec4(0, 0, 0, 0)); + float tabbar_height = GetTextLineHeightWithSpacing(); + if (tabbar(dock.getFirstTab(), opened != NULL)) + { + fillLocation(dock); + *opened = false; + } + ImVec2 pos = dock.pos; + ImVec2 size = dock.size; + pos.y += tabbar_height + GetStyle().WindowPadding.y; + size.y -= tabbar_height + GetStyle().WindowPadding.y; + + SetCursorScreenPos(pos); + ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | + ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | + ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoBringToFrontOnFocus | + extra_flags; + char tmp[256]; + strcpy(tmp, label); + strcat(tmp, "_docked"); // to avoid https://github.com/ocornut/imgui/issues/713 + bool ret = BeginChild(tmp, size, true, flags); + PopStyleColor(); + PopStyleColor(); + return ret; + } + + void end() + { + if (m_end_action == EndAction_End) + { + End(); + } + else if (m_end_action == EndAction_EndChild) + { + PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); + PushStyleColor(ImGuiCol_BorderShadow, ImVec4(0, 0, 0, 0)); + EndChild(); + PopStyleColor(); + PopStyleColor(); + } + m_current = NULL; + if (m_end_action > EndAction_None) endPanel(); + } + + int getDockIndex(Dock* dock) + { + if (!dock) return -1; + + for (int i = 0; i < m_docks.size(); ++i) + { + if (dock == m_docks[i]) return i; + } + + IM_ASSERT(false); + return -1; + } + + Dock* getDockByIndex(int idx) + { + return idx < 0 ? NULL : m_docks[(int)idx]; + } + }; + + static DockContext* s_dock = NULL; + + IMGUI_API void InitDockContext() + { + void* ptr = ImGui::MemAlloc(sizeof(DockContext) ); + s_dock = new(ptr) DockContext; + } + + IMGUI_API void ShutdownDockContext() + { + s_dock->~DockContext(); + ImGui::MemFree(s_dock); + s_dock = NULL; + } + + IMGUI_API void RootDock(const ImVec2& pos, const ImVec2& size) + { + s_dock->rootDock(pos, size); + } + + IMGUI_API bool BeginDock(const char* label, bool* opened, ImGuiWindowFlags extra_flags) + { + return s_dock->begin(label, opened, extra_flags); + } + + IMGUI_API void EndDock() + { + s_dock->end(); + } + + IMGUI_API void SetDockActive() + { + s_dock->setDockActive(); + } + +} // namespace ImGui diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.inl b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.inl index d7b89103c1f..41b07edbf76 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.inl +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.inl @@ -16,7 +16,7 @@ namespace ImGui void ImFileList::ChDir(const char* path) { -#if BX_PLATFORM_NACL +#if BX_PLATFORM_NACL || BX_PLATFORM_PS4 BX_UNUSED(path); #else DIR* dir = opendir(path); @@ -47,7 +47,7 @@ namespace ImGui closedir(dir); } -#endif // BX_PLATFORM_NACL +#endif // BX_PLATFORM_NACL || BX_PLATFORM_PS4 } void ImFileList::Draw() diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.h index 2263dd5a071..7b398fefe51 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.h +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.h @@ -1,5 +1,5 @@ // https://github.com/CedricGuillemet/ImGuizmo -// v 1.0 WIP +// v 1.04 WIP // // The MIT License(MIT) // @@ -25,48 +25,81 @@ // // ------------------------------------------------------------------------------------------- // History : +// 2016/09/11 Behind camera culling. Scaling Delta matrix not multiplied by source matrix scales. local/world rotation and translation fixed. Display message is incorrect (X: ... Y:...) in local mode. +// 2016/09/09 Hatched negative axis. Snapping. Documentation update. +// 2016/09/04 Axis switch and translation plan autohiding. Scale transform stability improved // 2016/09/01 Mogwai changed to Manipulate. Draw debug cube. Fixed inverted scale. Mixing scale and translation/rotation gives bad results. // 2016/08/31 First version // // ------------------------------------------------------------------------------------------- -// Example -// -// static ImGuizmo::OPERATION mCurrentGizmoOperation(ImGuizmo::TRANSLATE); -// static ImGuizmo::MODE mCurrentGizmoMode(ImGuizmo::LOCAL); -// -// // Maya shortcut keys -// if (ImGui::IsKeyPressed(90)) // w Key -// mCurrentGizmoOperation = ImGuizmo::TRANSLATE; -// if (ImGui::IsKeyPressed(69)) // e Key -// mCurrentGizmoOperation = ImGuizmo::ROTATE; -// if (ImGui::IsKeyPressed(82)) // r Key -// mCurrentGizmoOperation = ImGuizmo::SCALE; +// Future (no order): // -// if (ImGui::RadioButton("Translate", mCurrentGizmoOperation == ImGuizmo::TRANSLATE)) -// mCurrentGizmoOperation = ImGuizmo::TRANSLATE; -// ImGui::SameLine(); -// if (ImGui::RadioButton("Rotate", mCurrentGizmoOperation == ImGuizmo::ROTATE)) -// mCurrentGizmoOperation = ImGuizmo::ROTATE; -// ImGui::SameLine(); -// if (ImGui::RadioButton("Scale", mCurrentGizmoOperation == ImGuizmo::SCALE)) -// mCurrentGizmoOperation = ImGuizmo::SCALE; -// -// float matrixTranslation[3], matrixRotation[3], matrixScale[3]; -// ImGuizmo::DecomposeMatrixToComponents(gizmoMatrix.m16, matrixTranslation, matrixRotation, matrixScale); -// ImGui::InputFloat3("Tr", matrixTranslation, 3); -// ImGui::InputFloat3("Rt", matrixRotation, 3); -// ImGui::InputFloat3("Sc", matrixScale, 3); -// ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16); -// -// if (ImGui::RadioButton("Local", mCurrentGizmoMode == ImGuizmo::LOCAL)) -// mCurrentGizmoMode = ImGuizmo::LOCAL; -// ImGui::SameLine(); -// if (ImGui::RadioButton("World", mCurrentGizmoMode == ImGuizmo::WORLD)) -// mCurrentGizmoMode = ImGuizmo::WORLD; +// - Multi view +// - display rotation/translation/scale infos in local/world space and not only local +// - finish local/world matrix application +// - OPERATION as bitmask // -// ImGuizmo::Mogwai(gCurrentCamera->mView.m16, gCurrentCamera->mProjection.m16, mCurrentGizmoOperation, mCurrentGizmoMode, gizmoMatrix.m16); -// +// ------------------------------------------------------------------------------------------- +// Example +#if 0 +void EditTransform(const Camera& camera, matrix_t& matrix) +{ + static ImGuizmo::OPERATION mCurrentGizmoOperation(ImGuizmo::ROTATE); + static ImGuizmo::MODE mCurrentGizmoMode(ImGuizmo::WORLD); + if (ImGui::IsKeyPressed(90)) + mCurrentGizmoOperation = ImGuizmo::TRANSLATE; + if (ImGui::IsKeyPressed(69)) + mCurrentGizmoOperation = ImGuizmo::ROTATE; + if (ImGui::IsKeyPressed(82)) // r Key + mCurrentGizmoOperation = ImGuizmo::SCALE; + if (ImGui::RadioButton("Translate", mCurrentGizmoOperation == ImGuizmo::TRANSLATE)) + mCurrentGizmoOperation = ImGuizmo::TRANSLATE; + ImGui::SameLine(); + if (ImGui::RadioButton("Rotate", mCurrentGizmoOperation == ImGuizmo::ROTATE)) + mCurrentGizmoOperation = ImGuizmo::ROTATE; + ImGui::SameLine(); + if (ImGui::RadioButton("Scale", mCurrentGizmoOperation == ImGuizmo::SCALE)) + mCurrentGizmoOperation = ImGuizmo::SCALE; + float matrixTranslation[3], matrixRotation[3], matrixScale[3]; + ImGuizmo::DecomposeMatrixToComponents(matrix.m16, matrixTranslation, matrixRotation, matrixScale); + ImGui::InputFloat3("Tr", matrixTranslation, 3); + ImGui::InputFloat3("Rt", matrixRotation, 3); + ImGui::InputFloat3("Sc", matrixScale, 3); + ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, matrix.m16); + + if (mCurrentGizmoOperation != ImGuizmo::SCALE) + { + if (ImGui::RadioButton("Local", mCurrentGizmoMode == ImGuizmo::LOCAL)) + mCurrentGizmoMode = ImGuizmo::LOCAL; + ImGui::SameLine(); + if (ImGui::RadioButton("World", mCurrentGizmoMode == ImGuizmo::WORLD)) + mCurrentGizmoMode = ImGuizmo::WORLD; + } + static bool useSnap(false); + if (ImGui::IsKeyPressed(83)) + useSnap = !useSnap; + ImGui::Checkbox("", &useSnap); + ImGui::SameLine(); + vec_t snap; + switch (mCurrentGizmoOperation) + { + case ImGuizmo::TRANSLATE: + snap = config.mSnapTranslation; + ImGui::InputFloat3("Snap", &snap.x); + break; + case ImGuizmo::ROTATE: + snap = config.mSnapRotation; + ImGui::InputFloat("Angle Snap", &snap.x); + break; + case ImGuizmo::SCALE: + snap = config.mSnapScale; + ImGui::InputFloat("Scale Snap", &snap.x); + break; + } + ImGuizmo::Manipulate(camera.mView.m16, camera.mProjection.m16, mCurrentGizmoOperation, mCurrentGizmoMode, matrix.m16, NULL, useSnap ? &snap.x : NULL); +} +#endif #pragma once namespace ImGuizmo @@ -119,5 +152,5 @@ namespace ImGuizmo WORLD }; - void Manipulate(const float *view, const float *projection, OPERATION operation, MODE mode, float *matrix, float *deltaMatrix = 0); + void Manipulate(const float *view, const float *projection, OPERATION operation, MODE mode, float *matrix, float *deltaMatrix = 0, float *snap = 0); }; diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.inl b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.inl index dc416fdeb8a..e578691f9c9 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.inl +++ b/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.inl @@ -22,1272 +22,1474 @@ namespace ImGuizmo { - static const float ZPI = 3.14159265358979323846f; - static const float RAD2DEG = (180.f / ZPI); - static const float DEG2RAD = (ZPI / 180.f); - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // utility and math - - void FPU_MatrixF_x_MatrixF(const float *a, const float *b, float *r) - { - r[0] = a[0] * b[0] + a[1] * b[4] + a[2] * b[8] + a[3] * b[12]; - r[1] = a[0] * b[1] + a[1] * b[5] + a[2] * b[9] + a[3] * b[13]; - r[2] = a[0] * b[2] + a[1] * b[6] + a[2] * b[10] + a[3] * b[14]; - r[3] = a[0] * b[3] + a[1] * b[7] + a[2] * b[11] + a[3] * b[15]; - - r[4] = a[4] * b[0] + a[5] * b[4] + a[6] * b[8] + a[7] * b[12]; - r[5] = a[4] * b[1] + a[5] * b[5] + a[6] * b[9] + a[7] * b[13]; - r[6] = a[4] * b[2] + a[5] * b[6] + a[6] * b[10] + a[7] * b[14]; - r[7] = a[4] * b[3] + a[5] * b[7] + a[6] * b[11] + a[7] * b[15]; - - r[8] = a[8] * b[0] + a[9] * b[4] + a[10] * b[8] + a[11] * b[12]; - r[9] = a[8] * b[1] + a[9] * b[5] + a[10] * b[9] + a[11] * b[13]; - r[10] = a[8] * b[2] + a[9] * b[6] + a[10] * b[10] + a[11] * b[14]; - r[11] = a[8] * b[3] + a[9] * b[7] + a[10] * b[11] + a[11] * b[15]; - - r[12] = a[12] * b[0] + a[13] * b[4] + a[14] * b[8] + a[15] * b[12]; - r[13] = a[12] * b[1] + a[13] * b[5] + a[14] * b[9] + a[15] * b[13]; - r[14] = a[12] * b[2] + a[13] * b[6] + a[14] * b[10] + a[15] * b[14]; - r[15] = a[12] * b[3] + a[13] * b[7] + a[14] * b[11] + a[15] * b[15]; - } - - template <typename T> T LERP(T x, T y, float z) { return (x + (y - x)*z); } - template <typename T> T Clamp(T x, T y, T z) { return ((x<y) ? y : ((x>z) ? z : x)); } - - struct matrix_t; - struct vec_t - { - public: - float x, y, z, w; - - void Lerp(const vec_t& v, float t) - { - x += (v.x - x) * t; - y += (v.y - y) * t; - z += (v.z - z) * t; - w += (v.w - w) * t; - } - - void Set(float v) { x = y = z = w = v; } - void Set(float _x, float _y, float _z = 0.f, float _w = 0.f) { x = _x; y = _y; z = _z; w = _w; } - - vec_t& operator -= (const vec_t& v) { x -= v.x; y -= v.y; z -= v.z; w -= v.w; return *this; } - vec_t& operator += (const vec_t& v) { x += v.x; y += v.y; z += v.z; w += v.w; return *this; } - vec_t& operator *= (const vec_t& v) { x *= v.x; y *= v.y; z *= v.z; w *= v.w; return *this; } - vec_t& operator *= (float v) { x *= v; y *= v; z *= v; w *= v; return *this; } - - vec_t operator * (float f) const; - vec_t operator - () const; - vec_t operator - (const vec_t& v) const; - vec_t operator + (const vec_t& v) const; - vec_t operator * (const vec_t& v) const; - - const vec_t& operator + () const { return (*this); } - float Length() const { return sqrtf(x*x + y*y + z*z); }; - float LengthSq() const { return (x*x + y*y + z*z); }; - vec_t Normalize() { (*this) *= (1.f / Length()); return (*this); } - vec_t Normalize(const vec_t& v) { this->Set(v.x, v.y, v.z, v.w); this->Normalize(); return (*this); } - - void Cross(const vec_t& v) - { - vec_t res; - res.x = y * v.z - z * v.y; - res.y = z * v.x - x * v.z; - res.z = x * v.y - y * v.x; - - x = res.x; - y = res.y; - z = res.z; - w = 0.f; - } - void Cross(const vec_t& v1, const vec_t& v2) - { - x = v1.y * v2.z - v1.z * v2.y; - y = v1.z * v2.x - v1.x * v2.z; - z = v1.x * v2.y - v1.y * v2.x; - w = 0.f; - } - float Dot(const vec_t &v) const - { - return (x * v.x) + (y * v.y) + (z * v.z) + (w * v.w); - } - float Dot3(const vec_t &v) const - { - return (x * v.x) + (y * v.y) + (z * v.z); - } - - void Transform(const matrix_t& matrix); - void Transform(const vec_t & s, const matrix_t& matrix); - - void TransformVector(const matrix_t& matrix); - void TransformPoint(const matrix_t& matrix); - void TransformVector(const vec_t& v, const matrix_t& matrix) { (*this) = v; this->TransformVector(matrix); } - void TransformPoint(const vec_t& v, const matrix_t& matrix) { (*this) = v; this->TransformPoint(matrix); } - - float& operator [] (size_t index) { return ((float*)&x)[index]; } - const float& operator [] (size_t index) const { return ((float*)&x)[index]; } - }; - - vec_t makeVect(float _x, float _y, float _z = 0.f, float _w = 0.f) { vec_t res; res.x = _x; res.y = _y; res.z = _z; res.w = _w; return res; } - vec_t vec_t::operator * (float f) const { return makeVect(x * f, y * f, z * f, w *f); } - vec_t vec_t::operator - () const { return makeVect(-x, -y, -z, -w); } - vec_t vec_t::operator - (const vec_t& v) const { return makeVect(x - v.x, y - v.y, z - v.z, w - v.w); } - vec_t vec_t::operator + (const vec_t& v) const { return makeVect(x + v.x, y + v.y, z + v.z, w + v.w); } - vec_t vec_t::operator * (const vec_t& v) const { return makeVect(x * v.x, y * v.y, z * v.z, w * v.w); } - - ImVec2 operator+ (const ImVec2& a, const ImVec2& b) { return ImVec2(a.x + b.x, a.y + b.y); } - - vec_t Normalized(const vec_t& v) { vec_t res; res = v; res.Normalize(); return res; } - vec_t Cross(const vec_t& v1, const vec_t& v2) - { - vec_t res; - res.x = v1.y * v2.z - v1.z * v2.y; - res.y = v1.z * v2.x - v1.x * v2.z; - res.z = v1.x * v2.y - v1.y * v2.x; - res.w = 0.f; - return res; - } - - float Dot(const vec_t &v1, const vec_t &v2) - { - return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z); - } - - vec_t BuildPlan(const vec_t & p_point1, const vec_t & p_normal) - { - vec_t normal, res; - normal.Normalize(p_normal); - res.w = normal.Dot(p_point1); - res.x = normal.x; - res.y = normal.y; - res.z = normal.z; - return res; - } - - struct matrix_t - { - public: - - union - { - float m[4][4]; - float m16[16]; - struct - { - vec_t right, up, dir, position; - } v; - }; - - matrix_t(const matrix_t& other) { memcpy(&m16[0], &other.m16[0], sizeof(float) * 16); } - matrix_t() {} - - operator float * () { return m16; } - operator const float* () const { return m16; } - void Translation(float _x, float _y, float _z) { this->Translation(makeVect(_x, _y, _z)); } - - void Translation(const vec_t& vt) - { - v.right.Set(1.f, 0.f, 0.f, 0.f); - v.up.Set(0.f, 1.f, 0.f, 0.f); - v.dir.Set(0.f, 0.f, 1.f, 0.f); - v.position.Set(vt.x, vt.y, vt.z, 1.f); - } - - void Scale(float _x, float _y, float _z) - { - v.right.Set(_x, 0.f, 0.f, 0.f); - v.up.Set(0.f, _y, 0.f, 0.f); - v.dir.Set(0.f, 0.f, _z, 0.f); - v.position.Set(0.f, 0.f, 0.f, 1.f); - } - void Scale(const vec_t& s) { Scale(s.x, s.y, s.z); } - - matrix_t& operator *= (const matrix_t& mat) - { - matrix_t tmpMat; - tmpMat = *this; - tmpMat.Multiply(mat); - *this = tmpMat; - return *this; - } - matrix_t operator * (const matrix_t& mat) const - { - matrix_t matT; - matT.Multiply(*this, mat); - return matT; - } - - void Multiply(const matrix_t &matrix) - { - matrix_t tmp; - tmp = *this; - - FPU_MatrixF_x_MatrixF((float*)&tmp, (float*)&matrix, (float*)this); - } - - void Multiply(const matrix_t &m1, const matrix_t &m2) - { - FPU_MatrixF_x_MatrixF((float*)&m1, (float*)&m2, (float*)this); - } - - float GetDeterminant() const - { - return m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0] + m[0][2] * m[1][0] * m[2][1] - - m[0][2] * m[1][1] * m[2][0] - m[0][1] * m[1][0] * m[2][2] - m[0][0] * m[1][2] * m[2][1]; - } - - float Inverse(const matrix_t &srcMatrix, bool affine = false); - float Inverse(bool affine = false); - void SetToIdentity() - { - v.right.Set(1.f, 0.f, 0.f, 0.f); - v.up.Set(0.f, 1.f, 0.f, 0.f); - v.dir.Set(0.f, 0.f, 1.f, 0.f); - v.position.Set(0.f, 0.f, 0.f, 1.f); - } - void Transpose() - { - matrix_t tmpm; - for (int l = 0; l < 4; l++) - { - for (int c = 0; c < 4; c++) - { - tmpm.m[l][c] = m[c][l]; - } - } - (*this) = tmpm; - } - - void RotationAxis(const vec_t & axis, float angle); - - void OrthoNormalize() - { - v.right.Normalize(); - v.up.Normalize(); - v.dir.Normalize(); - } - }; - - void vec_t::Transform(const matrix_t& matrix) - { - vec_t out; - - out.x = x * matrix.m[0][0] + y * matrix.m[1][0] + z * matrix.m[2][0] + w * matrix.m[3][0]; - out.y = x * matrix.m[0][1] + y * matrix.m[1][1] + z * matrix.m[2][1] + w * matrix.m[3][1]; - out.z = x * matrix.m[0][2] + y * matrix.m[1][2] + z * matrix.m[2][2] + w * matrix.m[3][2]; - out.w = x * matrix.m[0][3] + y * matrix.m[1][3] + z * matrix.m[2][3] + w * matrix.m[3][3]; - - x = out.x; - y = out.y; - z = out.z; - w = out.w; - } - - void vec_t::Transform(const vec_t & s, const matrix_t& matrix) - { - *this = s; - Transform(matrix); - } - - void vec_t::TransformPoint(const matrix_t& matrix) - { - vec_t out; - - out.x = x * matrix.m[0][0] + y * matrix.m[1][0] + z * matrix.m[2][0] + matrix.m[3][0]; - out.y = x * matrix.m[0][1] + y * matrix.m[1][1] + z * matrix.m[2][1] + matrix.m[3][1]; - out.z = x * matrix.m[0][2] + y * matrix.m[1][2] + z * matrix.m[2][2] + matrix.m[3][2]; - out.w = x * matrix.m[0][3] + y * matrix.m[1][3] + z * matrix.m[2][3] + matrix.m[3][3]; - - x = out.x; - y = out.y; - z = out.z; - w = out.w; - } - - - void vec_t::TransformVector(const matrix_t& matrix) - { - vec_t out; - - out.x = x * matrix.m[0][0] + y * matrix.m[1][0] + z * matrix.m[2][0]; - out.y = x * matrix.m[0][1] + y * matrix.m[1][1] + z * matrix.m[2][1]; - out.z = x * matrix.m[0][2] + y * matrix.m[1][2] + z * matrix.m[2][2]; - out.w = x * matrix.m[0][3] + y * matrix.m[1][3] + z * matrix.m[2][3]; - - x = out.x; - y = out.y; - z = out.z; - w = out.w; - } - - float matrix_t::Inverse(const matrix_t &srcMatrix, bool affine) - { - float det = 0; - - if (affine) - { - det = GetDeterminant(); - float s = 1 / det; - m[0][0] = (srcMatrix.m[1][1] * srcMatrix.m[2][2] - srcMatrix.m[1][2] * srcMatrix.m[2][1]) * s; - m[0][1] = (srcMatrix.m[2][1] * srcMatrix.m[0][2] - srcMatrix.m[2][2] * srcMatrix.m[0][1]) * s; - m[0][2] = (srcMatrix.m[0][1] * srcMatrix.m[1][2] - srcMatrix.m[0][2] * srcMatrix.m[1][1]) * s; - m[1][0] = (srcMatrix.m[1][2] * srcMatrix.m[2][0] - srcMatrix.m[1][0] * srcMatrix.m[2][2]) * s; - m[1][1] = (srcMatrix.m[2][2] * srcMatrix.m[0][0] - srcMatrix.m[2][0] * srcMatrix.m[0][2]) * s; - m[1][2] = (srcMatrix.m[0][2] * srcMatrix.m[1][0] - srcMatrix.m[0][0] * srcMatrix.m[1][2]) * s; - m[2][0] = (srcMatrix.m[1][0] * srcMatrix.m[2][1] - srcMatrix.m[1][1] * srcMatrix.m[2][0]) * s; - m[2][1] = (srcMatrix.m[2][0] * srcMatrix.m[0][1] - srcMatrix.m[2][1] * srcMatrix.m[0][0]) * s; - m[2][2] = (srcMatrix.m[0][0] * srcMatrix.m[1][1] - srcMatrix.m[0][1] * srcMatrix.m[1][0]) * s; - m[3][0] = -(m[0][0] * srcMatrix.m[3][0] + m[1][0] * srcMatrix.m[3][1] + m[2][0] * srcMatrix.m[3][2]); - m[3][1] = -(m[0][1] * srcMatrix.m[3][0] + m[1][1] * srcMatrix.m[3][1] + m[2][1] * srcMatrix.m[3][2]); - m[3][2] = -(m[0][2] * srcMatrix.m[3][0] + m[1][2] * srcMatrix.m[3][1] + m[2][2] * srcMatrix.m[3][2]); - } - else - { - // transpose matrix - float src[16]; - for (int i = 0; i < 4; ++i) - { - src[i] = srcMatrix.m16[i * 4]; - src[i + 4] = srcMatrix.m16[i * 4 + 1]; - src[i + 8] = srcMatrix.m16[i * 4 + 2]; - src[i + 12] = srcMatrix.m16[i * 4 + 3]; - } - - // calculate pairs for first 8 elements (cofactors) - float tmp[12]; // temp array for pairs - tmp[0] = src[10] * src[15]; - tmp[1] = src[11] * src[14]; - tmp[2] = src[9] * src[15]; - tmp[3] = src[11] * src[13]; - tmp[4] = src[9] * src[14]; - tmp[5] = src[10] * src[13]; - tmp[6] = src[8] * src[15]; - tmp[7] = src[11] * src[12]; - tmp[8] = src[8] * src[14]; - tmp[9] = src[10] * src[12]; - tmp[10] = src[8] * src[13]; - tmp[11] = src[9] * src[12]; - - // calculate first 8 elements (cofactors) - m16[0] = (tmp[0] * src[5] + tmp[3] * src[6] + tmp[4] * src[7]) - (tmp[1] * src[5] + tmp[2] * src[6] + tmp[5] * src[7]); - m16[1] = (tmp[1] * src[4] + tmp[6] * src[6] + tmp[9] * src[7]) - (tmp[0] * src[4] + tmp[7] * src[6] + tmp[8] * src[7]); - m16[2] = (tmp[2] * src[4] + tmp[7] * src[5] + tmp[10] * src[7]) - (tmp[3] * src[4] + tmp[6] * src[5] + tmp[11] * src[7]); - m16[3] = (tmp[5] * src[4] + tmp[8] * src[5] + tmp[11] * src[6]) - (tmp[4] * src[4] + tmp[9] * src[5] + tmp[10] * src[6]); - m16[4] = (tmp[1] * src[1] + tmp[2] * src[2] + tmp[5] * src[3]) - (tmp[0] * src[1] + tmp[3] * src[2] + tmp[4] * src[3]); - m16[5] = (tmp[0] * src[0] + tmp[7] * src[2] + tmp[8] * src[3]) - (tmp[1] * src[0] + tmp[6] * src[2] + tmp[9] * src[3]); - m16[6] = (tmp[3] * src[0] + tmp[6] * src[1] + tmp[11] * src[3]) - (tmp[2] * src[0] + tmp[7] * src[1] + tmp[10] * src[3]); - m16[7] = (tmp[4] * src[0] + tmp[9] * src[1] + tmp[10] * src[2]) - (tmp[5] * src[0] + tmp[8] * src[1] + tmp[11] * src[2]); - - // calculate pairs for second 8 elements (cofactors) - tmp[0] = src[2] * src[7]; - tmp[1] = src[3] * src[6]; - tmp[2] = src[1] * src[7]; - tmp[3] = src[3] * src[5]; - tmp[4] = src[1] * src[6]; - tmp[5] = src[2] * src[5]; - tmp[6] = src[0] * src[7]; - tmp[7] = src[3] * src[4]; - tmp[8] = src[0] * src[6]; - tmp[9] = src[2] * src[4]; - tmp[10] = src[0] * src[5]; - tmp[11] = src[1] * src[4]; - - // calculate second 8 elements (cofactors) - m16[8] = (tmp[0] * src[13] + tmp[3] * src[14] + tmp[4] * src[15]) - (tmp[1] * src[13] + tmp[2] * src[14] + tmp[5] * src[15]); - m16[9] = (tmp[1] * src[12] + tmp[6] * src[14] + tmp[9] * src[15]) - (tmp[0] * src[12] + tmp[7] * src[14] + tmp[8] * src[15]); - m16[10] = (tmp[2] * src[12] + tmp[7] * src[13] + tmp[10] * src[15]) - (tmp[3] * src[12] + tmp[6] * src[13] + tmp[11] * src[15]); - m16[11] = (tmp[5] * src[12] + tmp[8] * src[13] + tmp[11] * src[14]) - (tmp[4] * src[12] + tmp[9] * src[13] + tmp[10] * src[14]); - m16[12] = (tmp[2] * src[10] + tmp[5] * src[11] + tmp[1] * src[9]) - (tmp[4] * src[11] + tmp[0] * src[9] + tmp[3] * src[10]); - m16[13] = (tmp[8] * src[11] + tmp[0] * src[8] + tmp[7] * src[10]) - (tmp[6] * src[10] + tmp[9] * src[11] + tmp[1] * src[8]); - m16[14] = (tmp[6] * src[9] + tmp[11] * src[11] + tmp[3] * src[8]) - (tmp[10] * src[11] + tmp[2] * src[8] + tmp[7] * src[9]); - m16[15] = (tmp[10] * src[10] + tmp[4] * src[8] + tmp[9] * src[9]) - (tmp[8] * src[9] + tmp[11] * src[10] + tmp[5] * src[8]); - - // calculate determinant - det = src[0] * m16[0] + src[1] * m16[1] + src[2] * m16[2] + src[3] * m16[3]; - - // calculate matrix inverse - float invdet = 1 / det; - for (int j = 0; j < 16; ++j) - { - m16[j] *= invdet; - } - } - - return det; - } - - void matrix_t::RotationAxis(const vec_t & axis, float angle) - { - float length2 = axis.LengthSq(); - if (length2 < FLT_EPSILON) - { - SetToIdentity(); - return; - } - - vec_t n = axis * (1.f / sqrtf(length2)); - float s = sinf(angle); - float c = cosf(angle); - float k = 1.f - c; - - float xx = n.x * n.x * k + c; - float yy = n.y * n.y * k + c; - float zz = n.z * n.z * k + c; - float xy = n.x * n.y * k; - float yz = n.y * n.z * k; - float zx = n.z * n.x * k; - float xs = n.x * s; - float ys = n.y * s; - float zs = n.z * s; - - m[0][0] = xx; - m[0][1] = xy + zs; - m[0][2] = zx - ys; - m[0][3] = 0.f; - m[1][0] = xy - zs; - m[1][1] = yy; - m[1][2] = yz + xs; - m[1][3] = 0.f; - m[2][0] = zx + ys; - m[2][1] = yz - xs; - m[2][2] = zz; - m[2][3] = 0.f; - m[3][0] = 0.f; - m[3][1] = 0.f; - m[3][2] = 0.f; - m[3][3] = 1.f; - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - - enum MOVETYPE - { - NONE, - MOVE_X, - MOVE_Y, - MOVE_Z, - MOVE_XY, - MOVE_XZ, - MOVE_YZ, - MOVE_SCREEN, - ROTATE_X, - ROTATE_Y, - ROTATE_Z, - ROTATE_SCREEN, - SCALE_X, - SCALE_Y, - SCALE_Z, - SCALE_XYZ, - }; - - struct Context - { - Context() : mbUsing(false), mbEnable(true) - { - } - - ImDrawList* mDrawList; - - matrix_t mViewMat; - matrix_t mProjectionMat; - matrix_t mModel; - matrix_t mModelInverse; - matrix_t mModelSource; - matrix_t mMVP; - matrix_t mViewProjection; - - vec_t mCameraEye; - vec_t mCameraRight; - vec_t mCameraDir; - vec_t mCameraUp; - vec_t mRayOrigin; - vec_t mRayVector; - - vec_t mCameraToModel; - - ImVec2 mScreenSquareCenter; - ImVec2 mScreenSquareMin; - ImVec2 mScreenSquareMax; - - float mScreenFactor; - vec_t mRelativeOrigin; - - bool mbUsing; - bool mbEnable; - - // translation - vec_t mTranslationPlan; - vec_t mTranslationPlanOrigin; - vec_t mMatrixOrigin; - - // rotation - vec_t mRotationVectorSource; - float mRotationAngle; - float mRotationAngleOrigin; - - // scale - vec_t mScale; - ImVec2 mScaleMousePos; - - int mCurrentOperation; - }; - - static Context gContext; - - static const float angleLimit = 0.96f; - static const float planeLimit = 0.2f; - - static const vec_t directionUnary[3] = { makeVect(1.f, 0.f, 0.f), makeVect(0.f, 1.f, 0.f), makeVect(0.f, 0.f, 1.f) }; - static const ImU32 directionColor[3] = { 0xFF0000AA, 0xFF00AA00, 0xFFAA0000 }; - static const ImU32 selectionColor = 0xFF1080FF; - static const ImU32 inactiveColor = 0x99999999; - static const ImU32 translationLineColor = 0xAAAAAAAA; - static const char *translationInfoMask[] = { "X : %5.2f", "Y : %5.2f", "Z : %5.2f", "X : %5.2f Y : %5.2f", "Y : %5.2f Z : %5.2f", "X : %5.2f Z : %5.2f", "X : %5.2f Y : %5.2f Z : %5.2f" }; - static const char *scaleInfoMask[] = { "X : %5.2f", "Y : %5.2f", "Z : %5.2f", "XYZ : %5.2f" }; - static const char *rotationInfoMask[] = { "X : %5.2f deg %5.2f rad", "Y : %5.2f deg %5.2f rad", "Z : %5.2f deg %5.2f rad", "Screen : %5.2f deg %5.2f rad" }; - static const int translationInfoIndex[] = { 0,0,0, 1,0,0, 2,0,0, 0,1,0, 0,2,0, 1,2,0, 0,1,2 }; - static const float quadMin = 0.5f; - static const float quadMax = 0.8f; - static const float quadUV[8] = { quadMin, quadMin, quadMin, quadMax, quadMax, quadMax, quadMax, quadMin }; - static const int halfCircleSegmentCount = 64; - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - static int GetMoveType(vec_t *gizmoHitProportion); - static int GetRotateType(); - static int GetScaleType(); - - static ImVec2 worldToPos(const vec_t& worldPos, const matrix_t& mat) - { - ImGuiIO& io = ImGui::GetIO(); - - vec_t trans; - trans.TransformPoint(worldPos, mat); - trans *= 0.5f / trans.w; - trans += makeVect(0.5f, 0.5f); - trans.y = 1.f - trans.y; - trans.x *= io.DisplaySize.x; - trans.y *= io.DisplaySize.y; - return ImVec2(trans.x, trans.y); - } - - static void ComputeCameraRay(vec_t &rayOrigin, vec_t &rayDir) - { - ImGuiIO& io = ImGui::GetIO(); - - matrix_t mViewProjInverse; - mViewProjInverse.Inverse(gContext.mViewMat * gContext.mProjectionMat); - - float mox = (io.MousePos.x / io.DisplaySize.x) * 2.f - 1.f; - float moy = (1.f - (io.MousePos.y / io.DisplaySize.y)) * 2.f - 1.f; - - rayOrigin.Transform(makeVect(mox, moy, 0.f, 1.f), mViewProjInverse); - rayOrigin *= 1.f / rayOrigin.w; - vec_t rayEnd; - rayEnd.Transform(makeVect(mox, moy, 1.f, 1.f), mViewProjInverse); - rayEnd *= 1.f / rayEnd.w; - rayDir = Normalized(rayEnd - rayOrigin); - } - - static float IntersectRayPlane(const vec_t & rOrigin, const vec_t& rVector, const vec_t& plan) - { - float numer = plan.Dot3(rOrigin) - plan.w; - float denom = plan.Dot3(rVector); - - if (fabsf(denom) < FLT_EPSILON) // normal is orthogonal to vector, cant intersect - return -1.0f; - - return -(numer / denom); - } - - void BeginFrame() - { - ImGuiIO& io = ImGui::GetIO(); - - ImGui::Begin("gizmo", NULL, io.DisplaySize, 0, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus); - gContext.mDrawList = ImGui::GetWindowDrawList(); - - ImGui::End(); - } - - bool IsUsing() - { - return gContext.mbUsing; - } - - bool IsOver() - { - return (GetMoveType(NULL) != NONE) || GetRotateType() != NONE || GetScaleType() != NONE || IsUsing(); - } - - void Enable(bool enable) - { - gContext.mbEnable = enable; - if (!enable) - gContext.mbUsing = false; - } - - static float GetUniform(const vec_t& position, const matrix_t& mat) - { - vec_t trf = makeVect(position.x, position.y, position.z, 1.f); - trf.Transform(mat); - return trf.w; - } - - static void ComputeContext(const float *view, const float *projection, float *matrix, MODE mode) - { - gContext.mViewMat = *(matrix_t*)view; - gContext.mProjectionMat = *(matrix_t*)projection; - if (mode == LOCAL) - { - gContext.mModel = *(matrix_t*)matrix; - gContext.mModel.OrthoNormalize(); - } - else - { - gContext.mModel.Translation(((matrix_t*)matrix)->v.position); - } - gContext.mModelSource = *(matrix_t*)matrix; - gContext.mModelInverse.Inverse(gContext.mModel); - gContext.mViewProjection = gContext.mViewMat * gContext.mProjectionMat; - gContext.mMVP = gContext.mModel * gContext.mViewProjection; - - matrix_t viewInverse; - viewInverse.Inverse(gContext.mViewMat); - gContext.mCameraDir = viewInverse.v.dir; - gContext.mCameraEye = viewInverse.v.position; - gContext.mCameraRight = viewInverse.v.right; - gContext.mCameraUp = viewInverse.v.up; - gContext.mCameraToModel = gContext.mModel.v.position - gContext.mCameraEye; - gContext.mScreenFactor = 0.1f * GetUniform(gContext.mModel.v.position, gContext.mViewProjection); - - ImVec2 centerSSpace = worldToPos(makeVect(0.f, 0.f), gContext.mMVP); - gContext.mScreenSquareCenter = centerSSpace; - gContext.mScreenSquareMin = ImVec2(centerSSpace.x - 10.f, centerSSpace.y - 10.f); - gContext.mScreenSquareMax = ImVec2(centerSSpace.x + 10.f, centerSSpace.y + 10.f); - - ComputeCameraRay(gContext.mRayOrigin, gContext.mRayVector); - } - - static void ComputeColors(ImU32 *colors, int type, OPERATION operation) - { - if (gContext.mbEnable) - { - switch (operation) - { - case TRANSLATE: - colors[0] = (type == MOVE_SCREEN) ? selectionColor : 0xFFFFFFFF; - for (int i = 0; i < 3; i++) - { - int colorPlaneIndex = (i + 2) % 3; - colors[i + 1] = (type == (int)(MOVE_X + i)) ? selectionColor : directionColor[i]; - colors[i + 4] = (type == (int)(MOVE_XY + i)) ? selectionColor : directionColor[colorPlaneIndex]; - } - break; - case ROTATE: - colors[0] = (type == ROTATE_SCREEN) ? selectionColor : 0xFFFFFFFF; - for (int i = 0; i < 3; i++) - colors[i + 1] = (type == (int)(ROTATE_X + i)) ? selectionColor : directionColor[i]; - break; - case SCALE: - colors[0] = (type == SCALE_XYZ) ? selectionColor : 0xFFFFFFFF; - for (int i = 0; i < 3; i++) - colors[i + 1] = (type == (int)(SCALE_X + i)) ? selectionColor : directionColor[i]; - break; - } - } - else - { - for (int i = 0; i < 7; i++) - colors[i] = inactiveColor; - } - } - - static void DrawRotationGizmo(int type) - { - ImDrawList* drawList = gContext.mDrawList; - ImGuiIO& io = ImGui::GetIO(); - - // colors - ImU32 colors[7]; - ComputeColors(colors, type, ROTATE); - - vec_t cameraToModelNormalized = Normalized(gContext.mCameraToModel); - cameraToModelNormalized.TransformVector(gContext.mModelInverse); - - for (int axis = 0; axis < 3; axis++) - { - ImVec2 circlePos[halfCircleSegmentCount]; - - float angleStart = atan2f(cameraToModelNormalized[(4-axis)%3], cameraToModelNormalized[(3 - axis) % 3]) + ZPI * 0.5f; - - for (unsigned int i = 0; i < halfCircleSegmentCount; i++) - { - float ng = angleStart + ZPI * ((float)i / (float)halfCircleSegmentCount); - vec_t axisPos = makeVect(cosf(ng), sinf(ng), 0.f); - vec_t pos = makeVect(axisPos[axis], axisPos[(axis+1)%3], axisPos[(axis+2)%3]) * gContext.mScreenFactor; - circlePos[i] = worldToPos(pos, gContext.mMVP); - } - drawList->AddPolyline(circlePos, halfCircleSegmentCount, colors[3 - axis], false, 2, true); - } - drawList->AddCircle(worldToPos(gContext.mModel.v.position, gContext.mViewProjection), 0.06f * io.DisplaySize.x, colors[0], 64); - - if (gContext.mbUsing) - { - ImVec2 circlePos[halfCircleSegmentCount +1]; - - circlePos[0] = worldToPos(gContext.mModel.v.position, gContext.mViewProjection); - for (unsigned int i = 1; i < halfCircleSegmentCount; i++) - { - float ng = gContext.mRotationAngle * ((float)(i-1) / (float)(halfCircleSegmentCount -1)); - matrix_t rotateVectorMatrix; - rotateVectorMatrix.RotationAxis(gContext.mTranslationPlan, ng); - vec_t pos; - pos.TransformPoint(gContext.mRotationVectorSource, rotateVectorMatrix); - pos *= gContext.mScreenFactor; - circlePos[i] = worldToPos(pos + gContext.mModel.v.position, gContext.mViewProjection); - } - drawList->AddConvexPolyFilled(circlePos, halfCircleSegmentCount, 0x801080FF, true); - drawList->AddPolyline(circlePos, halfCircleSegmentCount, 0xFF1080FF, true, 2, true); - - ImVec2 destinationPosOnScreen = circlePos[1]; - char tmps[512]; - ImFormatString(tmps, sizeof(tmps), rotationInfoMask[type - ROTATE_X], (gContext.mRotationAngle/ZPI)*180.f, gContext.mRotationAngle); - drawList->AddText(ImVec2(destinationPosOnScreen.x + 15, destinationPosOnScreen.y + 15), 0xFF000000, tmps); - drawList->AddText(ImVec2(destinationPosOnScreen.x + 14, destinationPosOnScreen.y + 14), 0xFFFFFFFF, tmps); - } - } - - static void DrawScaleGizmo(int type) - { - ImDrawList* drawList = gContext.mDrawList; - - // colors - ImU32 colors[7]; - ComputeColors(colors, type, SCALE); - - // draw screen cirle - drawList->AddCircleFilled(gContext.mScreenSquareCenter, 12.f, colors[0], 32); - - // draw - vec_t scale = { 1.f, 1.f, 1.f, 1.f }; - - if (gContext.mbUsing) - scale = gContext.mScale; - - for (unsigned int i = 0; i < 3; i++) - { - //const int planNormal = (i + 2) % 3; - const vec_t& dirPlaneX = directionUnary[i]; - //const vec_t& dirPlaneY = directionUnary[(i + 1) % 3]; - //const vec_t& dirPlaneNormal = directionUnary[planNormal]; - - //vec_t cameraEyeToGizmo = Normalized(gContext.mModel.v.position - gContext.mCameraEye); - //const bool belowAxisLimit = (fabsf(cameraEyeToGizmo.Dot3(dirPlaneX)) < angleLimit); - //const bool belowPlaneLimit = (fabsf(cameraEyeToGizmo.Dot3(dirPlaneNormal)) > planeLimit); - - // draw axis - //if (belowAxisLimit) - { - ImVec2 baseSSpace = worldToPos(dirPlaneX * 0.1f * gContext.mScreenFactor, gContext.mMVP); - ImVec2 worldDirSSpaceNoScale = worldToPos(dirPlaneX * gContext.mScreenFactor, gContext.mMVP); - ImVec2 worldDirSSpace = worldToPos(dirPlaneX * (1.f / scale[i]) * gContext.mScreenFactor, gContext.mMVP); - - if (gContext.mbUsing) - { - drawList->AddLine(baseSSpace, worldDirSSpaceNoScale, 0xFF404040, 6.f); - drawList->AddCircleFilled(worldDirSSpaceNoScale, 10.f, 0xFF404040); - } - - drawList->AddLine(baseSSpace, worldDirSSpace, colors[i + 1], 6.f); - drawList->AddCircleFilled(worldDirSSpace, 10.f, colors[i + 1]); - } - } - - if (gContext.mbUsing) - { -// ImVec2 sourcePosOnScreen = worldToPos(gContext.mMatrixOrigin, gContext.mViewProjection); - ImVec2 destinationPosOnScreen = worldToPos(gContext.mModel.v.position, gContext.mViewProjection); - /*vec_t dif(destinationPosOnScreen.x - sourcePosOnScreen.x, destinationPosOnScreen.y - sourcePosOnScreen.y); - dif.Normalize(); - dif *= 5.f; - drawList->AddCircle(sourcePosOnScreen, 6.f, translationLineColor); - drawList->AddCircle(destinationPosOnScreen, 6.f, translationLineColor); - drawList->AddLine(ImVec2(sourcePosOnScreen.x + dif.x, sourcePosOnScreen.y + dif.y), ImVec2(destinationPosOnScreen.x - dif.x, destinationPosOnScreen.y - dif.y), translationLineColor, 2.f); - */ - char tmps[512]; - //vec_t deltaInfo = gContext.mModel.v.position - gContext.mMatrixOrigin; - int componentInfoIndex = (type - SCALE_X) * 3; - ImFormatString(tmps, sizeof(tmps), scaleInfoMask[type - SCALE_X], 1.f/gContext.mScale[translationInfoIndex[componentInfoIndex]]); - drawList->AddText(ImVec2(destinationPosOnScreen.x + 15, destinationPosOnScreen.y + 15), 0xFF000000, tmps); - drawList->AddText(ImVec2(destinationPosOnScreen.x + 14, destinationPosOnScreen.y + 14), 0xFFFFFFFF, tmps); - } - - } - - static void DrawTranslationGizmo(int type) - { - ImDrawList* drawList = gContext.mDrawList; - - // colors - ImU32 colors[7]; - ComputeColors(colors, type, TRANSLATE); - - // draw screen quad - drawList->AddRectFilled(gContext.mScreenSquareMin, gContext.mScreenSquareMax, colors[0], 2.f); - - // draw - for (unsigned int i = 0; i < 3; i++) - { - //const int planNormal = (i + 2) % 3; - const vec_t& dirPlaneX = directionUnary[i]; - const vec_t& dirPlaneY = directionUnary[(i + 1) % 3]; - //const vec_t& dirPlaneNormal = directionUnary[planNormal]; - - //vec_t cameraEyeToGizmo = Normalized(gContext.mModel.v.position - gContext.mCameraEye); - //const bool belowAxisLimit = (fabsf(cameraEyeToGizmo.Dot3(dirPlaneX)) < angleLimit); - //const bool belowPlaneLimit = (fabsf(cameraEyeToGizmo.Dot3(dirPlaneNormal)) > planeLimit); - - // draw axis - //if (belowAxisLimit) - { - ImVec2 baseSSpace = worldToPos(dirPlaneX * 0.1f * gContext.mScreenFactor, gContext.mMVP); - ImVec2 worldDirSSpace = worldToPos(dirPlaneX * gContext.mScreenFactor, gContext.mMVP); - - drawList->AddLine(baseSSpace, worldDirSSpace, colors[i + 1], 6.f); - } - - // draw plane - //if (belowPlaneLimit) - { - ImVec2 screenQuadPts[4]; - for (int j = 0; j < 4; j++) - { - vec_t cornerWorldPos = (dirPlaneX * quadUV[j * 2] + dirPlaneY * quadUV[j * 2 + 1]) * gContext.mScreenFactor; - screenQuadPts[j] = worldToPos(cornerWorldPos, gContext.mMVP); - } - drawList->AddConvexPolyFilled(screenQuadPts, 4, colors[i + 4], true); - } - } - - if (gContext.mbUsing) - { - ImVec2 sourcePosOnScreen = worldToPos(gContext.mMatrixOrigin, gContext.mViewProjection); - ImVec2 destinationPosOnScreen = worldToPos(gContext.mModel.v.position, gContext.mViewProjection); - vec_t dif = { destinationPosOnScreen.x - sourcePosOnScreen.x, destinationPosOnScreen.y - sourcePosOnScreen.y, 0.0f, 0.0f }; - dif.Normalize(); - dif *= 5.f; - drawList->AddCircle(sourcePosOnScreen, 6.f, translationLineColor); - drawList->AddCircle(destinationPosOnScreen, 6.f, translationLineColor); - drawList->AddLine(ImVec2(sourcePosOnScreen.x + dif.x, sourcePosOnScreen.y + dif.y), ImVec2(destinationPosOnScreen.x - dif.x, destinationPosOnScreen.y - dif.y), translationLineColor, 2.f); - - char tmps[512]; - vec_t deltaInfo = gContext.mModel.v.position - gContext.mMatrixOrigin; - int componentInfoIndex = (type - MOVE_X) * 3; - ImFormatString(tmps, sizeof(tmps), translationInfoMask[type - MOVE_X], deltaInfo[translationInfoIndex[componentInfoIndex]], deltaInfo[translationInfoIndex[componentInfoIndex + 1]], deltaInfo[translationInfoIndex[componentInfoIndex + 2]]); - drawList->AddText(ImVec2(destinationPosOnScreen.x + 15, destinationPosOnScreen.y + 15), 0xFF000000, tmps); - drawList->AddText(ImVec2(destinationPosOnScreen.x + 14, destinationPosOnScreen.y + 14), 0xFFFFFFFF, tmps); - } - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - - static int GetScaleType() - { - ImGuiIO& io = ImGui::GetIO(); - int type = NONE; - - // screen - if (io.MousePos.x >= gContext.mScreenSquareMin.x && io.MousePos.x <= gContext.mScreenSquareMax.x && - io.MousePos.y >= gContext.mScreenSquareMin.y && io.MousePos.y <= gContext.mScreenSquareMax.y) - type = SCALE_XYZ; - - const vec_t direction[3] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir }; - // compute - for (unsigned int i = 0; i < 3 && type == NONE; i++) - { - const int planNormal = (i + 2) % 3; - const int nextPlan = (i + 1) % 3; - - vec_t cameraEyeToGizmo = Normalized(gContext.mModel.v.position - gContext.mCameraEye); - const bool belowAxisLimit = (fabsf(cameraEyeToGizmo.Dot3(direction[i])) < angleLimit); - - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, BuildPlan(gContext.mModel.v.position, direction[planNormal])); - vec_t posOnPlan = gContext.mRayOrigin + gContext.mRayVector * len; - - const float dx = direction[i].Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); - const float dy = direction[nextPlan].Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); - if (belowAxisLimit && dy > -0.1f && dy < 0.1f && dx > 0.1f && dx < 1.f) - type = SCALE_X + i; - } - return type; - } - - static int GetRotateType() - { - ImGuiIO& io = ImGui::GetIO(); - int type = NONE; - - vec_t deltaScreen = { io.MousePos.x - gContext.mScreenSquareCenter.x, io.MousePos.y - gContext.mScreenSquareCenter.y, 0.0f, 0.0f }; - float dist = deltaScreen.Length(); - if (dist >= 0.058f * io.DisplaySize.x && dist < 0.062f * io.DisplaySize.x) - type = ROTATE_SCREEN; - - const vec_t planNormals[] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir}; - - for (unsigned int i = 0; i < 3 && type == NONE; i++) - { - // pickup plan - vec_t pickupPlan = BuildPlan(gContext.mModel.v.position, planNormals[i]); - - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, pickupPlan); - vec_t localPos = gContext.mRayOrigin + gContext.mRayVector * len - gContext.mModel.v.position; - - if (Dot(Normalized(localPos), gContext.mRayVector) > FLT_EPSILON) - continue; - - float distance = localPos.Length() / gContext.mScreenFactor; - if (distance > 0.9f && distance < 1.1f) - type = ROTATE_X + i; - } - - return type; - } - - static int GetMoveType(vec_t *gizmoHitProportion) - { - ImGuiIO& io = ImGui::GetIO(); - int type = NONE; - - // screen - if (io.MousePos.x >= gContext.mScreenSquareMin.x && io.MousePos.x <= gContext.mScreenSquareMax.x && - io.MousePos.y >= gContext.mScreenSquareMin.y && io.MousePos.y <= gContext.mScreenSquareMax.y) - type = MOVE_SCREEN; - - const vec_t direction[3] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir }; - - // compute - for (unsigned int i = 0; i < 3 && type == NONE; i++) - { - const int planNormal = (i + 2) % 3; - const int nextPlan = (i + 1) % 3; - - vec_t cameraEyeToGizmo = Normalized(gContext.mModel.v.position - gContext.mCameraEye); - const bool belowAxisLimit = (fabsf(cameraEyeToGizmo.Dot3(direction[i])) < angleLimit); - const bool belowPlaneLimit = (fabsf(cameraEyeToGizmo.Dot3(direction[planNormal])) > planeLimit); - - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, BuildPlan(gContext.mModel.v.position, direction[planNormal])); - vec_t posOnPlan = gContext.mRayOrigin + gContext.mRayVector * len; - - const float dx = direction[i].Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); - const float dy = direction[nextPlan].Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); - if (belowAxisLimit && dy > -0.1f && dy < 0.1f && dx > 0.1f && dx < 1.f) - type = MOVE_X + i; - - if (belowPlaneLimit && dx >= quadUV[0] && dx <= quadUV[4] && dy >= quadUV[1] && dy <= quadUV[3]) - type = MOVE_XY + i; - - if (gizmoHitProportion) - *gizmoHitProportion = makeVect(dx, dy, 0.f); - } - return type; - } - - static void HandleTranslation(float *matrix, float *deltaMatrix, int& type) - { - ImGuiIO& io = ImGui::GetIO(); - - // move - if (gContext.mbUsing) - { - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); - vec_t newPos = gContext.mRayOrigin + gContext.mRayVector * len; - vec_t newOrigin = newPos - gContext.mRelativeOrigin * gContext.mScreenFactor; - vec_t delta = newOrigin - gContext.mModel.v.position; - - // 1 axis constraint - if (gContext.mCurrentOperation >= MOVE_X && gContext.mCurrentOperation <= MOVE_Z) - { - int axisIndex = gContext.mCurrentOperation - MOVE_X; - const vec_t& axisValue = *(vec_t*)&gContext.mModel.m[axisIndex]; - float lengthOnAxis = Dot(axisValue, delta); - delta = axisValue * lengthOnAxis; - } - - // compute matrix & delta - gContext.mTranslationPlanOrigin += delta; - matrix_t deltaMatrixTranslation; - deltaMatrixTranslation.Translation(delta); - if (deltaMatrix) - memcpy(deltaMatrix, deltaMatrixTranslation.m16, sizeof(float) * 16); - matrix_t res = gContext.mModelSource * deltaMatrixTranslation; - *(matrix_t*)matrix = res; - - if (!io.MouseDown[0]) - gContext.mbUsing = false; - - type = gContext.mCurrentOperation; - } - else - { - // find new possible way to move - vec_t gizmoHitProportion; - type = GetMoveType(&gizmoHitProportion); - if (io.MouseDown[0] && type != NONE) - { - gContext.mbUsing = true; - gContext.mCurrentOperation = type; - const vec_t movePlanNormal[] = { gContext.mModel.v.up, gContext.mModel.v.dir, gContext.mModel.v.right, gContext.mModel.v.dir, gContext.mModel.v.right, gContext.mModel.v.up, -gContext.mCameraDir }; - // pickup plan - gContext.mTranslationPlan = BuildPlan(gContext.mModel.v.position, movePlanNormal[type - MOVE_X]); - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); - gContext.mTranslationPlanOrigin = gContext.mRayOrigin + gContext.mRayVector * len; - gContext.mMatrixOrigin = gContext.mModel.v.position; - - gContext.mRelativeOrigin = (gContext.mTranslationPlanOrigin - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor); - } - } - } - - static void HandleScale(float *matrix, float *deltaMatrix, int& type) - { - ImGuiIO& io = ImGui::GetIO(); - - if (!gContext.mbUsing) - { - // find new possible way to scale - //vec_t gizmoHitProportion; - type = GetScaleType(); - if (io.MouseDown[0] && type != NONE) - { - gContext.mbUsing = true; - gContext.mCurrentOperation = type; - const vec_t movePlanNormal[] = { gContext.mModel.v.up, gContext.mModel.v.dir, gContext.mModel.v.right, gContext.mModel.v.dir, gContext.mModel.v.up, gContext.mModel.v.right, -gContext.mCameraDir }; - // pickup plan - - gContext.mTranslationPlan = BuildPlan(gContext.mModel.v.position, movePlanNormal[type - SCALE_X]); - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); - gContext.mTranslationPlanOrigin = gContext.mRayOrigin + gContext.mRayVector * len; - gContext.mMatrixOrigin = gContext.mModel.v.position; - gContext.mScale.Set(1.f, 1.f, 1.f); - gContext.mRelativeOrigin = (gContext.mTranslationPlanOrigin - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor); - gContext.mScaleMousePos = io.MousePos; - } - } - // scale - if (gContext.mbUsing) - { - vec_t newScale = { 1.f, 1.f, 1.f, 0.0f }; - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); - vec_t newPos = gContext.mRayOrigin + gContext.mRayVector * len; - vec_t newOrigin = newPos - gContext.mRelativeOrigin * gContext.mScreenFactor; - vec_t delta = newOrigin - gContext.mModel.v.position; - - // 1 axis constraint - if (gContext.mCurrentOperation >= SCALE_X && gContext.mCurrentOperation <= SCALE_Z) - { - int axisIndex = gContext.mCurrentOperation - SCALE_X; - const vec_t& axisValue = directionUnary[axisIndex]; - float lengthOnAxis = 1.f - Dot(axisValue, delta) / gContext.mScreenFactor; - - if (lengthOnAxis >= 0.f) - newScale[axisIndex] = lengthOnAxis; - else - newScale[axisIndex] = Clamp(lengthOnAxis, 0.001f, 1.f); - } - else - { - float newScaleUniform = 1.f + (io.MousePos.x - gContext.mScaleMousePos.x) * 0.01f; - newScale.Set(newScaleUniform, newScaleUniform, newScaleUniform, 0.f); - } - - // compute matrix & delta - matrix_t deltaMatrixScale; - deltaMatrixScale.Scale(makeVect(1.f, 1.f, 1.f) - (newScale - gContext.mScale)); - gContext.mScale = newScale; - if (deltaMatrix) - memcpy(deltaMatrix, deltaMatrixScale.m16, sizeof(float) * 16); - matrix_t res = deltaMatrixScale * gContext.mModelSource; - *(matrix_t*)matrix = res; - - if (!io.MouseDown[0]) - gContext.mbUsing = false; - - type = gContext.mCurrentOperation; - } - } - - static float ComputeAngleOnPlan() - { - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); - vec_t localPos = Normalized(gContext.mRayOrigin + gContext.mRayVector * len - gContext.mModel.v.position); - - vec_t perpendicularVector; - perpendicularVector.Cross(gContext.mRotationVectorSource, gContext.mTranslationPlan); - perpendicularVector.Normalize(); - float acosAngle = Clamp(Dot(localPos, gContext.mRotationVectorSource), -0.9999f, 0.9999f); - float angle = acosf(acosAngle); - angle *= (Dot(localPos, perpendicularVector) < 0.f) ? 1.f : -1.f; - return angle; - } - - static void HandleRotation(float *matrix, float *deltaMatrix, int& type) - { - ImGuiIO& io = ImGui::GetIO(); - - if (!gContext.mbUsing) - { - type = GetRotateType(); - if (io.MouseDown[0] && type != NONE) - { - gContext.mbUsing = true; - gContext.mCurrentOperation = type; - const vec_t rotatePlanNormal[] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir, -gContext.mCameraDir }; - // pickup plan - gContext.mTranslationPlan = BuildPlan(gContext.mModel.v.position, rotatePlanNormal[type - ROTATE_X]); - - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); - vec_t localPos = gContext.mRayOrigin + gContext.mRayVector * len - gContext.mModel.v.position; - gContext.mRotationVectorSource = Normalized(localPos); - gContext.mRotationAngleOrigin = ComputeAngleOnPlan(); - } - } - - // rotation - if (gContext.mbUsing) - { - gContext.mRotationAngle = ComputeAngleOnPlan(); - - vec_t rotationAxisLocalSpace; - rotationAxisLocalSpace.TransformVector(makeVect(gContext.mTranslationPlan.x, gContext.mTranslationPlan.y, gContext.mTranslationPlan.z, 0.f), gContext.mModelInverse); - - matrix_t deltaRotation; - deltaRotation.RotationAxis(rotationAxisLocalSpace, gContext.mRotationAngle - gContext.mRotationAngleOrigin); - gContext.mRotationAngleOrigin = gContext.mRotationAngle; - - *(matrix_t*)matrix = deltaRotation * gContext.mModelSource; - - if (deltaMatrix) - { - *(matrix_t*)deltaMatrix = gContext.mModelInverse * deltaRotation * gContext.mModel; - } - - if (!io.MouseDown[0]) - gContext.mbUsing = false; - - type = gContext.mCurrentOperation; - } - } - - void DecomposeMatrixToComponents(const float *matrix, float *translation, float *rotation, float *scale) - { - matrix_t& mat = *(matrix_t*)matrix; - - rotation[0] = RAD2DEG * atan2f(mat.m[1][2], mat.m[2][2]); - rotation[1] = RAD2DEG * atan2f(-mat.m[0][2], sqrtf(mat.m[1][2] * mat.m[1][2] + mat.m[2][2]* mat.m[2][2])); - rotation[2] = RAD2DEG * atan2f(mat.m[0][1], mat.m[0][0]); - - scale[0] = mat.v.right.Length(); - scale[1] = mat.v.up.Length(); - scale[2] = mat.v.dir.Length(); - - translation[0] = mat.v.position.x; - translation[1] = mat.v.position.y; - translation[2] = mat.v.position.z; - } - - void RecomposeMatrixFromComponents(const float *translation, const float *rotation, const float *scale, float *matrix) - { - matrix_t& mat = *(matrix_t*)matrix; - - matrix_t rot[3]; - for (int i = 0; i < 3;i++) - rot[i].RotationAxis(directionUnary[i], rotation[i] * DEG2RAD); - - mat = rot[0] * rot[1] * rot[2]; - - mat.v.right *= scale[0]; - mat.v.up *= scale[1]; - mat.v.dir *= scale[2]; - mat.v.position.Set(translation[0], translation[1], translation[2], 1.f); - } - - void Manipulate(const float *view, const float *projection, OPERATION operation, MODE mode, float *matrix, float *deltaMatrix) - { - ComputeContext(view, projection, matrix, mode); - - // set delta to identity - if (deltaMatrix) - ((matrix_t*)deltaMatrix)->SetToIdentity(); - // -- - int type = NONE; - if (gContext.mbEnable) - { - switch (operation) - { - case ROTATE: - HandleRotation(matrix, deltaMatrix, type); - break; - case TRANSLATE: - HandleTranslation(matrix, deltaMatrix, type); - break; - case SCALE: - HandleScale(matrix, deltaMatrix, type); - break; - } - } - - switch (operation) - { - case ROTATE: - DrawRotationGizmo(type); - break; - case TRANSLATE: - DrawTranslationGizmo(type); - break; - case SCALE: - DrawScaleGizmo(type); - break; - } - } - - void DrawCube(const float *view, const float *projection, float *matrix) - { - matrix_t viewInverse; - viewInverse.Inverse(*(matrix_t*)view); - const matrix_t& model = *(matrix_t*)matrix; - matrix_t res = *(matrix_t*)matrix * *(matrix_t*)view * *(matrix_t*)projection; - - for (int iFace = 0; iFace < 6; iFace++) - { - const int normalIndex = (iFace % 3); - const int perpXIndex = (normalIndex + 1) % 3; - const int perpYIndex = (normalIndex + 2) % 3; - const float invert = (iFace > 2) ? -1.f : 1.f; - - const vec_t faceCoords[4] = { directionUnary[normalIndex] + directionUnary[perpXIndex] + directionUnary[perpYIndex], - directionUnary[normalIndex] + directionUnary[perpXIndex] - directionUnary[perpYIndex], - directionUnary[normalIndex] - directionUnary[perpXIndex] - directionUnary[perpYIndex], - directionUnary[normalIndex] - directionUnary[perpXIndex] + directionUnary[perpYIndex], - }; - ImVec2 faceCoordsScreen[4]; - for (unsigned int iCoord = 0; iCoord < 4; iCoord++) - faceCoordsScreen[iCoord] = worldToPos(faceCoords[iCoord] * 0.5f * invert, res); - - // back face culling - vec_t cullPos, cullNormal; - cullPos.TransformPoint(faceCoords[0] * 0.5f * invert, model); - cullNormal.TransformVector(directionUnary[normalIndex] * invert, model); - float dt = Dot(Normalized(cullPos - viewInverse.v.position), Normalized(cullNormal)); - if (dt>0.f) - continue; - - // draw face with lighter color - gContext.mDrawList->AddConvexPolyFilled(faceCoordsScreen, 4, directionColor[normalIndex] | 0x808080, true); - } - } + static const float ZPI = 3.14159265358979323846f; + static const float RAD2DEG = (180.f / ZPI); + static const float DEG2RAD = (ZPI / 180.f); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // utility and math + + void FPU_MatrixF_x_MatrixF(const float *a, const float *b, float *r) + { + r[0] = a[0] * b[0] + a[1] * b[4] + a[2] * b[8] + a[3] * b[12]; + r[1] = a[0] * b[1] + a[1] * b[5] + a[2] * b[9] + a[3] * b[13]; + r[2] = a[0] * b[2] + a[1] * b[6] + a[2] * b[10] + a[3] * b[14]; + r[3] = a[0] * b[3] + a[1] * b[7] + a[2] * b[11] + a[3] * b[15]; + + r[4] = a[4] * b[0] + a[5] * b[4] + a[6] * b[8] + a[7] * b[12]; + r[5] = a[4] * b[1] + a[5] * b[5] + a[6] * b[9] + a[7] * b[13]; + r[6] = a[4] * b[2] + a[5] * b[6] + a[6] * b[10] + a[7] * b[14]; + r[7] = a[4] * b[3] + a[5] * b[7] + a[6] * b[11] + a[7] * b[15]; + + r[8] = a[8] * b[0] + a[9] * b[4] + a[10] * b[8] + a[11] * b[12]; + r[9] = a[8] * b[1] + a[9] * b[5] + a[10] * b[9] + a[11] * b[13]; + r[10] = a[8] * b[2] + a[9] * b[6] + a[10] * b[10] + a[11] * b[14]; + r[11] = a[8] * b[3] + a[9] * b[7] + a[10] * b[11] + a[11] * b[15]; + + r[12] = a[12] * b[0] + a[13] * b[4] + a[14] * b[8] + a[15] * b[12]; + r[13] = a[12] * b[1] + a[13] * b[5] + a[14] * b[9] + a[15] * b[13]; + r[14] = a[12] * b[2] + a[13] * b[6] + a[14] * b[10] + a[15] * b[14]; + r[15] = a[12] * b[3] + a[13] * b[7] + a[14] * b[11] + a[15] * b[15]; + } + + //template <typename T> T LERP(T x, T y, float z) { return (x + (y - x)*z); } + template <typename T> T Clamp(T x, T y, T z) { return ((x<y) ? y : ((x>z) ? z : x)); } + template <typename T> T max(T x, T y) { return (x > y) ? x : y; } + + struct matrix_t; + struct vec_t + { + public: + float x, y, z, w; + + void Lerp(const vec_t& v, float t) + { + x += (v.x - x) * t; + y += (v.y - y) * t; + z += (v.z - z) * t; + w += (v.w - w) * t; + } + + void Set(float v) { x = y = z = w = v; } + void Set(float _x, float _y, float _z = 0.f, float _w = 0.f) { x = _x; y = _y; z = _z; w = _w; } + + vec_t& operator -= (const vec_t& v) { x -= v.x; y -= v.y; z -= v.z; w -= v.w; return *this; } + vec_t& operator += (const vec_t& v) { x += v.x; y += v.y; z += v.z; w += v.w; return *this; } + vec_t& operator *= (const vec_t& v) { x *= v.x; y *= v.y; z *= v.z; w *= v.w; return *this; } + vec_t& operator *= (float v) { x *= v; y *= v; z *= v; w *= v; return *this; } + + vec_t operator * (float f) const; + vec_t operator - () const; + vec_t operator - (const vec_t& v) const; + vec_t operator + (const vec_t& v) const; + vec_t operator * (const vec_t& v) const; + + const vec_t& operator + () const { return (*this); } + float Length() const { return sqrtf(x*x + y*y + z*z); }; + float LengthSq() const { return (x*x + y*y + z*z); }; + vec_t Normalize() { (*this) *= (1.f / Length()); return (*this); } + vec_t Normalize(const vec_t& v) { this->Set(v.x, v.y, v.z, v.w); this->Normalize(); return (*this); } + + void Cross(const vec_t& v) + { + vec_t res; + res.x = y * v.z - z * v.y; + res.y = z * v.x - x * v.z; + res.z = x * v.y - y * v.x; + + x = res.x; + y = res.y; + z = res.z; + w = 0.f; + } + void Cross(const vec_t& v1, const vec_t& v2) + { + x = v1.y * v2.z - v1.z * v2.y; + y = v1.z * v2.x - v1.x * v2.z; + z = v1.x * v2.y - v1.y * v2.x; + w = 0.f; + } + float Dot(const vec_t &v) const + { + return (x * v.x) + (y * v.y) + (z * v.z) + (w * v.w); + } + float Dot3(const vec_t &v) const + { + return (x * v.x) + (y * v.y) + (z * v.z); + } + + void Transform(const matrix_t& matrix); + void Transform(const vec_t & s, const matrix_t& matrix); + + void TransformVector(const matrix_t& matrix); + void TransformPoint(const matrix_t& matrix); + void TransformVector(const vec_t& v, const matrix_t& matrix) { (*this) = v; this->TransformVector(matrix); } + void TransformPoint(const vec_t& v, const matrix_t& matrix) { (*this) = v; this->TransformPoint(matrix); } + + float& operator [] (size_t index) { return ((float*)&x)[index]; } + const float& operator [] (size_t index) const { return ((float*)&x)[index]; } + }; + + vec_t makeVect(float _x, float _y, float _z = 0.f, float _w = 0.f) { vec_t res; res.x = _x; res.y = _y; res.z = _z; res.w = _w; return res; } + vec_t vec_t::operator * (float f) const { return makeVect(x * f, y * f, z * f, w *f); } + vec_t vec_t::operator - () const { return makeVect(-x, -y, -z, -w); } + vec_t vec_t::operator - (const vec_t& v) const { return makeVect(x - v.x, y - v.y, z - v.z, w - v.w); } + vec_t vec_t::operator + (const vec_t& v) const { return makeVect(x + v.x, y + v.y, z + v.z, w + v.w); } + vec_t vec_t::operator * (const vec_t& v) const { return makeVect(x * v.x, y * v.y, z * v.z, w * v.w); } + + ImVec2 operator+ (const ImVec2& a, const ImVec2& b) { return ImVec2(a.x + b.x, a.y + b.y); } + + vec_t Normalized(const vec_t& v) { vec_t res; res = v; res.Normalize(); return res; } + vec_t Cross(const vec_t& v1, const vec_t& v2) + { + vec_t res; + res.x = v1.y * v2.z - v1.z * v2.y; + res.y = v1.z * v2.x - v1.x * v2.z; + res.z = v1.x * v2.y - v1.y * v2.x; + res.w = 0.f; + return res; + } + + float Dot(const vec_t &v1, const vec_t &v2) + { + return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z); + } + + vec_t BuildPlan(const vec_t & p_point1, const vec_t & p_normal) + { + vec_t normal, res; + normal.Normalize(p_normal); + res.w = normal.Dot(p_point1); + res.x = normal.x; + res.y = normal.y; + res.z = normal.z; + return res; + } + + struct matrix_t + { + public: + + union + { + float m[4][4]; + float m16[16]; + struct + { + vec_t right, up, dir, position; + } v; + }; + + matrix_t(const matrix_t& other) { memcpy(&m16[0], &other.m16[0], sizeof(float) * 16); } + matrix_t() {} + + operator float * () { return m16; } + operator const float* () const { return m16; } + void Translation(float _x, float _y, float _z) { this->Translation(makeVect(_x, _y, _z)); } + + void Translation(const vec_t& vt) + { + v.right.Set(1.f, 0.f, 0.f, 0.f); + v.up.Set(0.f, 1.f, 0.f, 0.f); + v.dir.Set(0.f, 0.f, 1.f, 0.f); + v.position.Set(vt.x, vt.y, vt.z, 1.f); + } + + void Scale(float _x, float _y, float _z) + { + v.right.Set(_x, 0.f, 0.f, 0.f); + v.up.Set(0.f, _y, 0.f, 0.f); + v.dir.Set(0.f, 0.f, _z, 0.f); + v.position.Set(0.f, 0.f, 0.f, 1.f); + } + void Scale(const vec_t& s) { Scale(s.x, s.y, s.z); } + + matrix_t& operator *= (const matrix_t& mat) + { + matrix_t tmpMat; + tmpMat = *this; + tmpMat.Multiply(mat); + *this = tmpMat; + return *this; + } + matrix_t operator * (const matrix_t& mat) const + { + matrix_t matT; + matT.Multiply(*this, mat); + return matT; + } + + void Multiply(const matrix_t &matrix) + { + matrix_t tmp; + tmp = *this; + + FPU_MatrixF_x_MatrixF((float*)&tmp, (float*)&matrix, (float*)this); + } + + void Multiply(const matrix_t &m1, const matrix_t &m2) + { + FPU_MatrixF_x_MatrixF((float*)&m1, (float*)&m2, (float*)this); + } + + float GetDeterminant() const + { + return m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0] + m[0][2] * m[1][0] * m[2][1] - + m[0][2] * m[1][1] * m[2][0] - m[0][1] * m[1][0] * m[2][2] - m[0][0] * m[1][2] * m[2][1]; + } + + float Inverse(const matrix_t &srcMatrix, bool affine = false); + float Inverse(bool affine = false); + void SetToIdentity() + { + v.right.Set(1.f, 0.f, 0.f, 0.f); + v.up.Set(0.f, 1.f, 0.f, 0.f); + v.dir.Set(0.f, 0.f, 1.f, 0.f); + v.position.Set(0.f, 0.f, 0.f, 1.f); + } + void Transpose() + { + matrix_t tmpm; + for (int l = 0; l < 4; l++) + { + for (int c = 0; c < 4; c++) + { + tmpm.m[l][c] = m[c][l]; + } + } + (*this) = tmpm; + } + + void RotationAxis(const vec_t & axis, float angle); + + void OrthoNormalize() + { + v.right.Normalize(); + v.up.Normalize(); + v.dir.Normalize(); + } + }; + + void vec_t::Transform(const matrix_t& matrix) + { + vec_t out; + + out.x = x * matrix.m[0][0] + y * matrix.m[1][0] + z * matrix.m[2][0] + w * matrix.m[3][0]; + out.y = x * matrix.m[0][1] + y * matrix.m[1][1] + z * matrix.m[2][1] + w * matrix.m[3][1]; + out.z = x * matrix.m[0][2] + y * matrix.m[1][2] + z * matrix.m[2][2] + w * matrix.m[3][2]; + out.w = x * matrix.m[0][3] + y * matrix.m[1][3] + z * matrix.m[2][3] + w * matrix.m[3][3]; + + x = out.x; + y = out.y; + z = out.z; + w = out.w; + } + + void vec_t::Transform(const vec_t & s, const matrix_t& matrix) + { + *this = s; + Transform(matrix); + } + + void vec_t::TransformPoint(const matrix_t& matrix) + { + vec_t out; + + out.x = x * matrix.m[0][0] + y * matrix.m[1][0] + z * matrix.m[2][0] + matrix.m[3][0]; + out.y = x * matrix.m[0][1] + y * matrix.m[1][1] + z * matrix.m[2][1] + matrix.m[3][1]; + out.z = x * matrix.m[0][2] + y * matrix.m[1][2] + z * matrix.m[2][2] + matrix.m[3][2]; + out.w = x * matrix.m[0][3] + y * matrix.m[1][3] + z * matrix.m[2][3] + matrix.m[3][3]; + + x = out.x; + y = out.y; + z = out.z; + w = out.w; + } + + + void vec_t::TransformVector(const matrix_t& matrix) + { + vec_t out; + + out.x = x * matrix.m[0][0] + y * matrix.m[1][0] + z * matrix.m[2][0]; + out.y = x * matrix.m[0][1] + y * matrix.m[1][1] + z * matrix.m[2][1]; + out.z = x * matrix.m[0][2] + y * matrix.m[1][2] + z * matrix.m[2][2]; + out.w = x * matrix.m[0][3] + y * matrix.m[1][3] + z * matrix.m[2][3]; + + x = out.x; + y = out.y; + z = out.z; + w = out.w; + } + + float matrix_t::Inverse(const matrix_t &srcMatrix, bool affine) + { + float det = 0; + + if (affine) + { + det = GetDeterminant(); + float s = 1 / det; + m[0][0] = (srcMatrix.m[1][1] * srcMatrix.m[2][2] - srcMatrix.m[1][2] * srcMatrix.m[2][1]) * s; + m[0][1] = (srcMatrix.m[2][1] * srcMatrix.m[0][2] - srcMatrix.m[2][2] * srcMatrix.m[0][1]) * s; + m[0][2] = (srcMatrix.m[0][1] * srcMatrix.m[1][2] - srcMatrix.m[0][2] * srcMatrix.m[1][1]) * s; + m[1][0] = (srcMatrix.m[1][2] * srcMatrix.m[2][0] - srcMatrix.m[1][0] * srcMatrix.m[2][2]) * s; + m[1][1] = (srcMatrix.m[2][2] * srcMatrix.m[0][0] - srcMatrix.m[2][0] * srcMatrix.m[0][2]) * s; + m[1][2] = (srcMatrix.m[0][2] * srcMatrix.m[1][0] - srcMatrix.m[0][0] * srcMatrix.m[1][2]) * s; + m[2][0] = (srcMatrix.m[1][0] * srcMatrix.m[2][1] - srcMatrix.m[1][1] * srcMatrix.m[2][0]) * s; + m[2][1] = (srcMatrix.m[2][0] * srcMatrix.m[0][1] - srcMatrix.m[2][1] * srcMatrix.m[0][0]) * s; + m[2][2] = (srcMatrix.m[0][0] * srcMatrix.m[1][1] - srcMatrix.m[0][1] * srcMatrix.m[1][0]) * s; + m[3][0] = -(m[0][0] * srcMatrix.m[3][0] + m[1][0] * srcMatrix.m[3][1] + m[2][0] * srcMatrix.m[3][2]); + m[3][1] = -(m[0][1] * srcMatrix.m[3][0] + m[1][1] * srcMatrix.m[3][1] + m[2][1] * srcMatrix.m[3][2]); + m[3][2] = -(m[0][2] * srcMatrix.m[3][0] + m[1][2] * srcMatrix.m[3][1] + m[2][2] * srcMatrix.m[3][2]); + } + else + { + // transpose matrix + float src[16]; + for (int i = 0; i < 4; ++i) + { + src[i] = srcMatrix.m16[i * 4]; + src[i + 4] = srcMatrix.m16[i * 4 + 1]; + src[i + 8] = srcMatrix.m16[i * 4 + 2]; + src[i + 12] = srcMatrix.m16[i * 4 + 3]; + } + + // calculate pairs for first 8 elements (cofactors) + float tmp[12]; // temp array for pairs + tmp[0] = src[10] * src[15]; + tmp[1] = src[11] * src[14]; + tmp[2] = src[9] * src[15]; + tmp[3] = src[11] * src[13]; + tmp[4] = src[9] * src[14]; + tmp[5] = src[10] * src[13]; + tmp[6] = src[8] * src[15]; + tmp[7] = src[11] * src[12]; + tmp[8] = src[8] * src[14]; + tmp[9] = src[10] * src[12]; + tmp[10] = src[8] * src[13]; + tmp[11] = src[9] * src[12]; + + // calculate first 8 elements (cofactors) + m16[0] = (tmp[0] * src[5] + tmp[3] * src[6] + tmp[4] * src[7]) - (tmp[1] * src[5] + tmp[2] * src[6] + tmp[5] * src[7]); + m16[1] = (tmp[1] * src[4] + tmp[6] * src[6] + tmp[9] * src[7]) - (tmp[0] * src[4] + tmp[7] * src[6] + tmp[8] * src[7]); + m16[2] = (tmp[2] * src[4] + tmp[7] * src[5] + tmp[10] * src[7]) - (tmp[3] * src[4] + tmp[6] * src[5] + tmp[11] * src[7]); + m16[3] = (tmp[5] * src[4] + tmp[8] * src[5] + tmp[11] * src[6]) - (tmp[4] * src[4] + tmp[9] * src[5] + tmp[10] * src[6]); + m16[4] = (tmp[1] * src[1] + tmp[2] * src[2] + tmp[5] * src[3]) - (tmp[0] * src[1] + tmp[3] * src[2] + tmp[4] * src[3]); + m16[5] = (tmp[0] * src[0] + tmp[7] * src[2] + tmp[8] * src[3]) - (tmp[1] * src[0] + tmp[6] * src[2] + tmp[9] * src[3]); + m16[6] = (tmp[3] * src[0] + tmp[6] * src[1] + tmp[11] * src[3]) - (tmp[2] * src[0] + tmp[7] * src[1] + tmp[10] * src[3]); + m16[7] = (tmp[4] * src[0] + tmp[9] * src[1] + tmp[10] * src[2]) - (tmp[5] * src[0] + tmp[8] * src[1] + tmp[11] * src[2]); + + // calculate pairs for second 8 elements (cofactors) + tmp[0] = src[2] * src[7]; + tmp[1] = src[3] * src[6]; + tmp[2] = src[1] * src[7]; + tmp[3] = src[3] * src[5]; + tmp[4] = src[1] * src[6]; + tmp[5] = src[2] * src[5]; + tmp[6] = src[0] * src[7]; + tmp[7] = src[3] * src[4]; + tmp[8] = src[0] * src[6]; + tmp[9] = src[2] * src[4]; + tmp[10] = src[0] * src[5]; + tmp[11] = src[1] * src[4]; + + // calculate second 8 elements (cofactors) + m16[8] = (tmp[0] * src[13] + tmp[3] * src[14] + tmp[4] * src[15]) - (tmp[1] * src[13] + tmp[2] * src[14] + tmp[5] * src[15]); + m16[9] = (tmp[1] * src[12] + tmp[6] * src[14] + tmp[9] * src[15]) - (tmp[0] * src[12] + tmp[7] * src[14] + tmp[8] * src[15]); + m16[10] = (tmp[2] * src[12] + tmp[7] * src[13] + tmp[10] * src[15]) - (tmp[3] * src[12] + tmp[6] * src[13] + tmp[11] * src[15]); + m16[11] = (tmp[5] * src[12] + tmp[8] * src[13] + tmp[11] * src[14]) - (tmp[4] * src[12] + tmp[9] * src[13] + tmp[10] * src[14]); + m16[12] = (tmp[2] * src[10] + tmp[5] * src[11] + tmp[1] * src[9]) - (tmp[4] * src[11] + tmp[0] * src[9] + tmp[3] * src[10]); + m16[13] = (tmp[8] * src[11] + tmp[0] * src[8] + tmp[7] * src[10]) - (tmp[6] * src[10] + tmp[9] * src[11] + tmp[1] * src[8]); + m16[14] = (tmp[6] * src[9] + tmp[11] * src[11] + tmp[3] * src[8]) - (tmp[10] * src[11] + tmp[2] * src[8] + tmp[7] * src[9]); + m16[15] = (tmp[10] * src[10] + tmp[4] * src[8] + tmp[9] * src[9]) - (tmp[8] * src[9] + tmp[11] * src[10] + tmp[5] * src[8]); + + // calculate determinant + det = src[0] * m16[0] + src[1] * m16[1] + src[2] * m16[2] + src[3] * m16[3]; + + // calculate matrix inverse + float invdet = 1 / det; + for (int j = 0; j < 16; ++j) + { + m16[j] *= invdet; + } + } + + return det; + } + + void matrix_t::RotationAxis(const vec_t & axis, float angle) + { + float length2 = axis.LengthSq(); + if (length2 < FLT_EPSILON) + { + SetToIdentity(); + return; + } + + vec_t n = axis * (1.f / sqrtf(length2)); + float s = sinf(angle); + float c = cosf(angle); + float k = 1.f - c; + + float xx = n.x * n.x * k + c; + float yy = n.y * n.y * k + c; + float zz = n.z * n.z * k + c; + float xy = n.x * n.y * k; + float yz = n.y * n.z * k; + float zx = n.z * n.x * k; + float xs = n.x * s; + float ys = n.y * s; + float zs = n.z * s; + + m[0][0] = xx; + m[0][1] = xy + zs; + m[0][2] = zx - ys; + m[0][3] = 0.f; + m[1][0] = xy - zs; + m[1][1] = yy; + m[1][2] = yz + xs; + m[1][3] = 0.f; + m[2][0] = zx + ys; + m[2][1] = yz - xs; + m[2][2] = zz; + m[2][3] = 0.f; + m[3][0] = 0.f; + m[3][1] = 0.f; + m[3][2] = 0.f; + m[3][3] = 1.f; + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + + enum MOVETYPE + { + NONE, + MOVE_X, + MOVE_Y, + MOVE_Z, + MOVE_XY, + MOVE_XZ, + MOVE_YZ, + MOVE_SCREEN, + ROTATE_X, + ROTATE_Y, + ROTATE_Z, + ROTATE_SCREEN, + SCALE_X, + SCALE_Y, + SCALE_Z, + SCALE_XYZ, + }; + + struct Context + { + Context() : mbUsing(false), mbEnable(true) + { + } + + ImDrawList* mDrawList; + + MODE mMode; + matrix_t mViewMat; + matrix_t mProjectionMat; + matrix_t mModel; + matrix_t mModelInverse; + matrix_t mModelSource; + matrix_t mModelSourceInverse; + matrix_t mMVP; + matrix_t mViewProjection; + + vec_t mModelScaleOrigin; + vec_t mCameraEye; + vec_t mCameraRight; + vec_t mCameraDir; + vec_t mCameraUp; + vec_t mRayOrigin; + vec_t mRayVector; + + ImVec2 mScreenSquareCenter; + ImVec2 mScreenSquareMin; + ImVec2 mScreenSquareMax; + + float mScreenFactor; + vec_t mRelativeOrigin; + + bool mbUsing; + bool mbEnable; + + // translation + vec_t mTranslationPlan; + vec_t mTranslationPlanOrigin; + vec_t mMatrixOrigin; + + // rotation + vec_t mRotationVectorSource; + float mRotationAngle; + float mRotationAngleOrigin; + //vec_t mWorldToLocalAxis; + + // scale + vec_t mScale; + vec_t mScaleValueOrigin; + float mSaveMousePosx; + + // save axis factor when using gizmo + bool mBelowAxisLimit[3]; + bool mBelowPlaneLimit[3]; + float mAxisFactor[3]; + + // + int mCurrentOperation; + }; + + static Context gContext; + + static const float angleLimit = 0.96f; + static const float planeLimit = 0.2f; + + static const vec_t directionUnary[3] = { makeVect(1.f, 0.f, 0.f), makeVect(0.f, 1.f, 0.f), makeVect(0.f, 0.f, 1.f) }; + static const ImU32 directionColor[3] = { 0xFF0000AA, 0xFF00AA00, 0xFFAA0000 }; + static const ImU32 selectionColor = 0xFF1080FF; + static const ImU32 inactiveColor = 0x99999999; + static const ImU32 translationLineColor = 0xAAAAAAAA; + static const char *translationInfoMask[] = { "X : %5.3f", "Y : %5.3f", "Z : %5.3f", "X : %5.3f Y : %5.3f", "Y : %5.3f Z : %5.3f", "X : %5.3f Z : %5.3f", "X : %5.3f Y : %5.3f Z : %5.3f" }; + static const char *scaleInfoMask[] = { "X : %5.2f", "Y : %5.2f", "Z : %5.2f", "XYZ : %5.2f" }; + static const char *rotationInfoMask[] = { "X : %5.2f deg %5.2f rad", "Y : %5.2f deg %5.2f rad", "Z : %5.2f deg %5.2f rad", "Screen : %5.2f deg %5.2f rad" }; + static const int translationInfoIndex[] = { 0,0,0, 1,0,0, 2,0,0, 0,1,0, 1,2,0, 0,2,1, 0,1,2 }; + static const float quadMin = 0.5f; + static const float quadMax = 0.8f; + static const float quadUV[8] = { quadMin, quadMin, quadMin, quadMax, quadMax, quadMax, quadMax, quadMin }; + static const int halfCircleSegmentCount = 64; + static const float snapTension = 0.5f; + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + static int GetMoveType(vec_t *gizmoHitProportion); + static int GetRotateType(); + static int GetScaleType(); + + static ImVec2 worldToPos(const vec_t& worldPos, const matrix_t& mat) + { + ImGuiIO& io = ImGui::GetIO(); + + vec_t trans; + trans.TransformPoint(worldPos, mat); + trans *= 0.5f / trans.w; + trans += makeVect(0.5f, 0.5f); + trans.y = 1.f - trans.y; + trans.x *= io.DisplaySize.x; + trans.y *= io.DisplaySize.y; + return ImVec2(trans.x, trans.y); + } + + static void ComputeCameraRay(vec_t &rayOrigin, vec_t &rayDir) + { + ImGuiIO& io = ImGui::GetIO(); + + matrix_t mViewProjInverse; + mViewProjInverse.Inverse(gContext.mViewMat * gContext.mProjectionMat); + + float mox = (io.MousePos.x / io.DisplaySize.x) * 2.f - 1.f; + float moy = (1.f - (io.MousePos.y / io.DisplaySize.y)) * 2.f - 1.f; + + rayOrigin.Transform(makeVect(mox, moy, 0.f, 1.f), mViewProjInverse); + rayOrigin *= 1.f / rayOrigin.w; + vec_t rayEnd; + rayEnd.Transform(makeVect(mox, moy, 1.f, 1.f), mViewProjInverse); + rayEnd *= 1.f / rayEnd.w; + rayDir = Normalized(rayEnd - rayOrigin); + } + + static float IntersectRayPlane(const vec_t & rOrigin, const vec_t& rVector, const vec_t& plan) + { + float numer = plan.Dot3(rOrigin) - plan.w; + float denom = plan.Dot3(rVector); + + if (fabsf(denom) < FLT_EPSILON) // normal is orthogonal to vector, cant intersect + return -1.0f; + + return -(numer / denom); + } + + void BeginFrame() + { + ImGuiIO& io = ImGui::GetIO(); + + ImGui::Begin("gizmo", NULL, io.DisplaySize, 0, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus); + gContext.mDrawList = ImGui::GetWindowDrawList(); + + ImGui::End(); + } + + bool IsUsing() + { + return gContext.mbUsing; + } + + bool IsOver() + { + return (GetMoveType(NULL) != NONE) || GetRotateType() != NONE || GetScaleType() != NONE || IsUsing(); + } + + void Enable(bool enable) + { + gContext.mbEnable = enable; + if (!enable) + gContext.mbUsing = false; + } + + static float GetUniform(const vec_t& position, const matrix_t& mat) + { + vec_t trf = makeVect(position.x, position.y, position.z, 1.f); + trf.Transform(mat); + return trf.w; + } + + static void ComputeContext(const float *view, const float *projection, float *matrix, MODE mode) + { + gContext.mMode = mode; + gContext.mViewMat = *(matrix_t*)view; + gContext.mProjectionMat = *(matrix_t*)projection; + + if (mode == LOCAL) + { + gContext.mModel = *(matrix_t*)matrix; + gContext.mModel.OrthoNormalize(); + } + else + { + gContext.mModel.Translation(((matrix_t*)matrix)->v.position); + } + gContext.mModelSource = *(matrix_t*)matrix; + gContext.mModelScaleOrigin.Set(gContext.mModelSource.v.right.Length(), gContext.mModelSource.v.up.Length(), gContext.mModelSource.v.dir.Length()); + + gContext.mModelInverse.Inverse(gContext.mModel); + gContext.mModelSourceInverse.Inverse(gContext.mModelSource); + gContext.mViewProjection = gContext.mViewMat * gContext.mProjectionMat; + gContext.mMVP = gContext.mModel * gContext.mViewProjection; + + matrix_t viewInverse; + viewInverse.Inverse(gContext.mViewMat); + gContext.mCameraDir = viewInverse.v.dir; + gContext.mCameraEye = viewInverse.v.position; + gContext.mCameraRight = viewInverse.v.right; + gContext.mCameraUp = viewInverse.v.up; + gContext.mScreenFactor = 0.1f * GetUniform(gContext.mModel.v.position, gContext.mViewProjection); + + ImVec2 centerSSpace = worldToPos(makeVect(0.f, 0.f), gContext.mMVP); + gContext.mScreenSquareCenter = centerSSpace; + gContext.mScreenSquareMin = ImVec2(centerSSpace.x - 10.f, centerSSpace.y - 10.f); + gContext.mScreenSquareMax = ImVec2(centerSSpace.x + 10.f, centerSSpace.y + 10.f); + + ComputeCameraRay(gContext.mRayOrigin, gContext.mRayVector); + } + + static void ComputeColors(ImU32 *colors, int type, OPERATION operation) + { + if (gContext.mbEnable) + { + switch (operation) + { + case TRANSLATE: + colors[0] = (type == MOVE_SCREEN) ? selectionColor : 0xFFFFFFFF; + for (int i = 0; i < 3; i++) + { + int colorPlaneIndex = (i + 2) % 3; + colors[i + 1] = (type == (int)(MOVE_X + i)) ? selectionColor : directionColor[i]; + colors[i + 4] = (type == (int)(MOVE_XY + i)) ? selectionColor : directionColor[colorPlaneIndex]; + } + break; + case ROTATE: + colors[0] = (type == ROTATE_SCREEN) ? selectionColor : 0xFFFFFFFF; + for (int i = 0; i < 3; i++) + colors[i + 1] = (type == (int)(ROTATE_X + i)) ? selectionColor : directionColor[i]; + break; + case SCALE: + colors[0] = (type == SCALE_XYZ) ? selectionColor : 0xFFFFFFFF; + for (int i = 0; i < 3; i++) + colors[i + 1] = (type == (int)(SCALE_X + i)) ? selectionColor : directionColor[i]; + break; + } + } + else + { + for (int i = 0; i < 7; i++) + colors[i] = inactiveColor; + } + } + + static void ComputeTripodAxisAndVisibility(int axisIndex, vec_t& dirPlaneX, vec_t& dirPlaneY, bool& belowAxisLimit, bool& belowPlaneLimit) + { + const int planNormal = (axisIndex + 2) % 3; + dirPlaneX = directionUnary[axisIndex]; + dirPlaneY = directionUnary[(axisIndex + 1) % 3]; + + if (gContext.mbUsing) + { + // when using, use stored factors so the gizmo doesn't flip when we translate + belowAxisLimit = gContext.mBelowAxisLimit[axisIndex]; + belowPlaneLimit = gContext.mBelowPlaneLimit[axisIndex]; + + dirPlaneX *= gContext.mAxisFactor[axisIndex]; + dirPlaneY *= gContext.mAxisFactor[(axisIndex + 1) % 3]; + } + else + { + vec_t dirPlaneNormalWorld; + dirPlaneNormalWorld.TransformVector(directionUnary[planNormal], gContext.mModel); + dirPlaneNormalWorld.Normalize(); + + vec_t dirPlaneXWorld(dirPlaneX); + dirPlaneXWorld.TransformVector(gContext.mModel); + dirPlaneXWorld.Normalize(); + + vec_t dirPlaneYWorld(dirPlaneY); + dirPlaneYWorld.TransformVector(gContext.mModel); + dirPlaneYWorld.Normalize(); + + vec_t cameraEyeToGizmo = Normalized(gContext.mModel.v.position - gContext.mCameraEye); + float dotCameraDirX = cameraEyeToGizmo.Dot3(dirPlaneXWorld); + float dotCameraDirY = cameraEyeToGizmo.Dot3(dirPlaneYWorld); + + // compute factor values + float mulAxisX = (dotCameraDirX > 0.f) ? -1.f : 1.f; + float mulAxisY = (dotCameraDirY > 0.f) ? -1.f : 1.f; + dirPlaneX *= mulAxisX; + dirPlaneY *= mulAxisY; + + belowAxisLimit = fabsf(dotCameraDirX) < angleLimit; + belowPlaneLimit = (fabsf(cameraEyeToGizmo.Dot3(dirPlaneNormalWorld)) > planeLimit); + + // and store values + gContext.mAxisFactor[axisIndex] = mulAxisX; + gContext.mAxisFactor[(axisIndex+1)%3] = mulAxisY; + gContext.mBelowAxisLimit[axisIndex] = belowAxisLimit; + gContext.mBelowPlaneLimit[axisIndex] = belowPlaneLimit; + } + } + + static void ComputeSnap(float*value, float *snap) + { + if (*snap <= FLT_EPSILON) + return; + float modulo = fmodf(*value, *snap); + float moduloRatio = fabsf(modulo) / *snap; + if (moduloRatio < snapTension) + *value -= modulo; + else if (moduloRatio >(1.f - snapTension)) + *value = *value - modulo + *snap * ((*value<0.f) ? -1.f : 1.f); + } + static void ComputeSnap(vec_t& value, float *snap) + { + for (int i = 0; i < 3; i++) + { + ComputeSnap(&value[i], &snap[i]); + } + } + + static float ComputeAngleOnPlan() + { + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); + vec_t localPos = Normalized(gContext.mRayOrigin + gContext.mRayVector * len - gContext.mModel.v.position); + + vec_t perpendicularVector; + perpendicularVector.Cross(gContext.mRotationVectorSource, gContext.mTranslationPlan); + perpendicularVector.Normalize(); + float acosAngle = Clamp(Dot(localPos, gContext.mRotationVectorSource), -0.9999f, 0.9999f); + float angle = acosf(acosAngle); + angle *= (Dot(localPos, perpendicularVector) < 0.f) ? 1.f : -1.f; + return angle; + } + + static void DrawRotationGizmo(int type) + { + ImDrawList* drawList = gContext.mDrawList; + ImGuiIO& io = ImGui::GetIO(); + + // colors + ImU32 colors[7]; + ComputeColors(colors, type, ROTATE); + + vec_t cameraToModelNormalized = Normalized(gContext.mModel.v.position - gContext.mCameraEye); + cameraToModelNormalized.TransformVector(gContext.mModelInverse); + + for (int axis = 0; axis < 3; axis++) + { + ImVec2 circlePos[halfCircleSegmentCount]; + + float angleStart = atan2f(cameraToModelNormalized[(4-axis)%3], cameraToModelNormalized[(3 - axis) % 3]) + ZPI * 0.5f; + + for (unsigned int i = 0; i < halfCircleSegmentCount; i++) + { + float ng = angleStart + ZPI * ((float)i / (float)halfCircleSegmentCount); + vec_t axisPos = makeVect(cosf(ng), sinf(ng), 0.f); + vec_t pos = makeVect(axisPos[axis], axisPos[(axis+1)%3], axisPos[(axis+2)%3]) * gContext.mScreenFactor; + circlePos[i] = worldToPos(pos, gContext.mMVP); + } + drawList->AddPolyline(circlePos, halfCircleSegmentCount, colors[3 - axis], false, 2, true); + } + drawList->AddCircle(worldToPos(gContext.mModel.v.position, gContext.mViewProjection), 0.06f * io.DisplaySize.x, colors[0], 64); + + if (gContext.mbUsing) + { + ImVec2 circlePos[halfCircleSegmentCount +1]; + + circlePos[0] = worldToPos(gContext.mModel.v.position, gContext.mViewProjection); + for (unsigned int i = 1; i < halfCircleSegmentCount; i++) + { + float ng = gContext.mRotationAngle * ((float)(i-1) / (float)(halfCircleSegmentCount -1)); + matrix_t rotateVectorMatrix; + rotateVectorMatrix.RotationAxis(gContext.mTranslationPlan, ng); + vec_t pos; + pos.TransformPoint(gContext.mRotationVectorSource, rotateVectorMatrix); + pos *= gContext.mScreenFactor; + circlePos[i] = worldToPos(pos + gContext.mModel.v.position, gContext.mViewProjection); + } + drawList->AddConvexPolyFilled(circlePos, halfCircleSegmentCount, 0x801080FF, true); + drawList->AddPolyline(circlePos, halfCircleSegmentCount, 0xFF1080FF, true, 2, true); + + ImVec2 destinationPosOnScreen = circlePos[1]; + char tmps[512]; + ImFormatString(tmps, sizeof(tmps), rotationInfoMask[type - ROTATE_X], (gContext.mRotationAngle/ZPI)*180.f, gContext.mRotationAngle); + drawList->AddText(ImVec2(destinationPosOnScreen.x + 15, destinationPosOnScreen.y + 15), 0xFF000000, tmps); + drawList->AddText(ImVec2(destinationPosOnScreen.x + 14, destinationPosOnScreen.y + 14), 0xFFFFFFFF, tmps); + } + } + + static void DrawHatchedAxis(const vec_t& axis) + { + for (int j = 1; j < 10; j++) + { + ImVec2 baseSSpace2 = worldToPos(axis * 0.05f * (float)(j * 2) * gContext.mScreenFactor, gContext.mMVP); + ImVec2 worldDirSSpace2 = worldToPos(axis * 0.05f * (float)(j * 2 + 1) * gContext.mScreenFactor, gContext.mMVP); + gContext.mDrawList->AddLine(baseSSpace2, worldDirSSpace2, 0x80000000, 6.f); + } + } + + static void DrawScaleGizmo(int type) + { + ImDrawList* drawList = gContext.mDrawList; + + // colors + ImU32 colors[7]; + ComputeColors(colors, type, SCALE); + + // draw screen cirle + drawList->AddCircleFilled(gContext.mScreenSquareCenter, 12.f, colors[0], 32); + + // draw + vec_t scaleDisplay = { 1.f, 1.f, 1.f, 1.f }; + + if (gContext.mbUsing) + scaleDisplay = gContext.mScale; + + for (unsigned int i = 0; i < 3; i++) + { + vec_t dirPlaneX, dirPlaneY; + bool belowAxisLimit, belowPlaneLimit; + ComputeTripodAxisAndVisibility(i, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); + + // draw axis + if (belowAxisLimit) + { + ImVec2 baseSSpace = worldToPos(dirPlaneX * 0.1f * gContext.mScreenFactor, gContext.mMVP); + ImVec2 worldDirSSpaceNoScale = worldToPos(dirPlaneX * gContext.mScreenFactor, gContext.mMVP); + ImVec2 worldDirSSpace = worldToPos((dirPlaneX * scaleDisplay[i]) * gContext.mScreenFactor, gContext.mMVP); + + if (gContext.mbUsing) + { + drawList->AddLine(baseSSpace, worldDirSSpaceNoScale, 0xFF404040, 6.f); + drawList->AddCircleFilled(worldDirSSpaceNoScale, 10.f, 0xFF404040); + } + + drawList->AddLine(baseSSpace, worldDirSSpace, colors[i + 1], 6.f); + drawList->AddCircleFilled(worldDirSSpace, 10.f, colors[i + 1]); + + if (gContext.mAxisFactor[i] < 0.f) + DrawHatchedAxis(dirPlaneX * scaleDisplay[i]); + } + } + + if (gContext.mbUsing) + { + //ImVec2 sourcePosOnScreen = worldToPos(gContext.mMatrixOrigin, gContext.mViewProjection); + ImVec2 destinationPosOnScreen = worldToPos(gContext.mModel.v.position, gContext.mViewProjection); + /*vec_t dif(destinationPosOnScreen.x - sourcePosOnScreen.x, destinationPosOnScreen.y - sourcePosOnScreen.y); + dif.Normalize(); + dif *= 5.f; + drawList->AddCircle(sourcePosOnScreen, 6.f, translationLineColor); + drawList->AddCircle(destinationPosOnScreen, 6.f, translationLineColor); + drawList->AddLine(ImVec2(sourcePosOnScreen.x + dif.x, sourcePosOnScreen.y + dif.y), ImVec2(destinationPosOnScreen.x - dif.x, destinationPosOnScreen.y - dif.y), translationLineColor, 2.f); + */ + char tmps[512]; + //vec_t deltaInfo = gContext.mModel.v.position - gContext.mMatrixOrigin; + int componentInfoIndex = (type - SCALE_X) * 3; + ImFormatString(tmps, sizeof(tmps), scaleInfoMask[type - SCALE_X], scaleDisplay[translationInfoIndex[componentInfoIndex]]); + drawList->AddText(ImVec2(destinationPosOnScreen.x + 15, destinationPosOnScreen.y + 15), 0xFF000000, tmps); + drawList->AddText(ImVec2(destinationPosOnScreen.x + 14, destinationPosOnScreen.y + 14), 0xFFFFFFFF, tmps); + } + } + + + static void DrawTranslationGizmo(int type) + { + ImDrawList* drawList = gContext.mDrawList; + + // colors + ImU32 colors[7]; + ComputeColors(colors, type, TRANSLATE); + + // draw screen quad + drawList->AddRectFilled(gContext.mScreenSquareMin, gContext.mScreenSquareMax, colors[0], 2.f); + + // draw + for (unsigned int i = 0; i < 3; i++) + { + vec_t dirPlaneX, dirPlaneY; + bool belowAxisLimit, belowPlaneLimit; + ComputeTripodAxisAndVisibility(i, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); + + // draw axis + if (belowAxisLimit) + { + ImVec2 baseSSpace = worldToPos(dirPlaneX * 0.1f * gContext.mScreenFactor, gContext.mMVP); + ImVec2 worldDirSSpace = worldToPos(dirPlaneX * gContext.mScreenFactor, gContext.mMVP); + + drawList->AddLine(baseSSpace, worldDirSSpace, colors[i + 1], 6.f); + + if (gContext.mAxisFactor[i] < 0.f) + DrawHatchedAxis(dirPlaneX); + } + + // draw plane + if (belowPlaneLimit) + { + ImVec2 screenQuadPts[4]; + for (int j = 0; j < 4; j++) + { + vec_t cornerWorldPos = (dirPlaneX * quadUV[j * 2] + dirPlaneY * quadUV[j * 2 + 1]) * gContext.mScreenFactor; + screenQuadPts[j] = worldToPos(cornerWorldPos, gContext.mMVP); + } + drawList->AddConvexPolyFilled(screenQuadPts, 4, colors[i + 4], true); + } + } + + if (gContext.mbUsing) + { + ImVec2 sourcePosOnScreen = worldToPos(gContext.mMatrixOrigin, gContext.mViewProjection); + ImVec2 destinationPosOnScreen = worldToPos(gContext.mModel.v.position, gContext.mViewProjection); + vec_t dif = { destinationPosOnScreen.x - sourcePosOnScreen.x, destinationPosOnScreen.y - sourcePosOnScreen.y, 0.f, 0.f }; + dif.Normalize(); + dif *= 5.f; + drawList->AddCircle(sourcePosOnScreen, 6.f, translationLineColor); + drawList->AddCircle(destinationPosOnScreen, 6.f, translationLineColor); + drawList->AddLine(ImVec2(sourcePosOnScreen.x + dif.x, sourcePosOnScreen.y + dif.y), ImVec2(destinationPosOnScreen.x - dif.x, destinationPosOnScreen.y - dif.y), translationLineColor, 2.f); + + char tmps[512]; + vec_t deltaInfo = gContext.mModel.v.position - gContext.mMatrixOrigin; + int componentInfoIndex = (type - MOVE_X) * 3; + ImFormatString(tmps, sizeof(tmps), translationInfoMask[type - MOVE_X], deltaInfo[translationInfoIndex[componentInfoIndex]], deltaInfo[translationInfoIndex[componentInfoIndex + 1]], deltaInfo[translationInfoIndex[componentInfoIndex + 2]]); + drawList->AddText(ImVec2(destinationPosOnScreen.x + 15, destinationPosOnScreen.y + 15), 0xFF000000, tmps); + drawList->AddText(ImVec2(destinationPosOnScreen.x + 14, destinationPosOnScreen.y + 14), 0xFFFFFFFF, tmps); + } + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + + static int GetScaleType() + { + ImGuiIO& io = ImGui::GetIO(); + int type = NONE; + + // screen + if (io.MousePos.x >= gContext.mScreenSquareMin.x && io.MousePos.x <= gContext.mScreenSquareMax.x && + io.MousePos.y >= gContext.mScreenSquareMin.y && io.MousePos.y <= gContext.mScreenSquareMax.y) + type = SCALE_XYZ; + + const vec_t direction[3] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir }; + // compute + for (unsigned int i = 0; i < 3 && type == NONE; i++) + { + vec_t dirPlaneX, dirPlaneY; + bool belowAxisLimit, belowPlaneLimit; + ComputeTripodAxisAndVisibility(i, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); + dirPlaneX.TransformVector(gContext.mModel); + dirPlaneY.TransformVector(gContext.mModel); + + const int planNormal = (i + 2) % 3; + + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, BuildPlan(gContext.mModel.v.position, direction[planNormal])); + vec_t posOnPlan = gContext.mRayOrigin + gContext.mRayVector * len; + + const float dx = dirPlaneX.Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); + const float dy = dirPlaneY.Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); + if (belowAxisLimit && dy > -0.1f && dy < 0.1f && dx > 0.1f && dx < 1.f) + type = SCALE_X + i; + } + return type; + } + + static int GetRotateType() + { + ImGuiIO& io = ImGui::GetIO(); + int type = NONE; + + vec_t deltaScreen = { io.MousePos.x - gContext.mScreenSquareCenter.x, io.MousePos.y - gContext.mScreenSquareCenter.y, 0.f, 0.f }; + float dist = deltaScreen.Length(); + if (dist >= 0.058f * io.DisplaySize.x && dist < 0.062f * io.DisplaySize.x) + type = ROTATE_SCREEN; + + const vec_t planNormals[] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir}; + + for (unsigned int i = 0; i < 3 && type == NONE; i++) + { + // pickup plan + vec_t pickupPlan = BuildPlan(gContext.mModel.v.position, planNormals[i]); + + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, pickupPlan); + vec_t localPos = gContext.mRayOrigin + gContext.mRayVector * len - gContext.mModel.v.position; + + if (Dot(Normalized(localPos), gContext.mRayVector) > FLT_EPSILON) + continue; + + float distance = localPos.Length() / gContext.mScreenFactor; + if (distance > 0.9f && distance < 1.1f) + type = ROTATE_X + i; + } + + return type; + } + + static int GetMoveType(vec_t *gizmoHitProportion) + { + ImGuiIO& io = ImGui::GetIO(); + int type = NONE; + + // screen + if (io.MousePos.x >= gContext.mScreenSquareMin.x && io.MousePos.x <= gContext.mScreenSquareMax.x && + io.MousePos.y >= gContext.mScreenSquareMin.y && io.MousePos.y <= gContext.mScreenSquareMax.y) + type = MOVE_SCREEN; + + const vec_t direction[3] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir }; + + // compute + for (unsigned int i = 0; i < 3 && type == NONE; i++) + { + vec_t dirPlaneX, dirPlaneY; + bool belowAxisLimit, belowPlaneLimit; + ComputeTripodAxisAndVisibility(i, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); + dirPlaneX.TransformVector(gContext.mModel); + dirPlaneY.TransformVector(gContext.mModel); + + const int planNormal = (i + 2) % 3; + + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, BuildPlan(gContext.mModel.v.position, direction[planNormal])); + vec_t posOnPlan = gContext.mRayOrigin + gContext.mRayVector * len; + + const float dx = dirPlaneX.Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); + const float dy = dirPlaneY.Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); + if (belowAxisLimit && dy > -0.1f && dy < 0.1f && dx > 0.1f && dx < 1.f) + type = MOVE_X + i; + + if (belowPlaneLimit && dx >= quadUV[0] && dx <= quadUV[4] && dy >= quadUV[1] && dy <= quadUV[3]) + type = MOVE_XY + i; + + if (gizmoHitProportion) + *gizmoHitProportion = makeVect(dx, dy, 0.f); + } + return type; + } + + static void HandleTranslation(float *matrix, float *deltaMatrix, int& type, float *snap) + { + ImGuiIO& io = ImGui::GetIO(); + bool applyRotationLocaly = gContext.mMode == LOCAL || type == MOVE_SCREEN; + + // move + if (gContext.mbUsing) + { + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); + vec_t newPos = gContext.mRayOrigin + gContext.mRayVector * len; + + // compute delta + vec_t newOrigin = newPos - gContext.mRelativeOrigin * gContext.mScreenFactor; + vec_t delta = newOrigin - gContext.mModel.v.position; + + // 1 axis constraint + if (gContext.mCurrentOperation >= MOVE_X && gContext.mCurrentOperation <= MOVE_Z) + { + int axisIndex = gContext.mCurrentOperation - MOVE_X; + const vec_t& axisValue = *(vec_t*)&gContext.mModel.m[axisIndex]; + float lengthOnAxis = Dot(axisValue, delta); + delta = axisValue * lengthOnAxis; + } + + // snap + if (snap) + { + vec_t cumulativeDelta = gContext.mModel.v.position + delta - gContext.mMatrixOrigin; + if (applyRotationLocaly) + { + matrix_t modelSourceNormalized = gContext.mModelSource; + modelSourceNormalized.OrthoNormalize(); + matrix_t modelSourceNormalizedInverse; + modelSourceNormalizedInverse.Inverse(modelSourceNormalized); + cumulativeDelta.TransformVector(modelSourceNormalizedInverse); + ComputeSnap(cumulativeDelta, snap); + cumulativeDelta.TransformVector(modelSourceNormalized); + } + else + { + ComputeSnap(cumulativeDelta, snap); + } + delta = gContext.mMatrixOrigin + cumulativeDelta - gContext.mModel.v.position; + + } + + // compute matrix & delta + matrix_t deltaMatrixTranslation; + deltaMatrixTranslation.Translation(delta); + if (deltaMatrix) + memcpy(deltaMatrix, deltaMatrixTranslation.m16, sizeof(float) * 16); + + + matrix_t res = gContext.mModelSource * deltaMatrixTranslation; + *(matrix_t*)matrix = res; + + if (!io.MouseDown[0]) + gContext.mbUsing = false; + + type = gContext.mCurrentOperation; + } + else + { + // find new possible way to move + vec_t gizmoHitProportion; + type = GetMoveType(&gizmoHitProportion); + if (io.MouseDown[0] && type != NONE) + { + gContext.mbUsing = true; + gContext.mCurrentOperation = type; + const vec_t movePlanNormal[] = { gContext.mModel.v.up, gContext.mModel.v.dir, gContext.mModel.v.right, gContext.mModel.v.dir, gContext.mModel.v.right, gContext.mModel.v.up, -gContext.mCameraDir }; + // pickup plan + gContext.mTranslationPlan = BuildPlan(gContext.mModel.v.position, movePlanNormal[type - MOVE_X]); + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); + gContext.mTranslationPlanOrigin = gContext.mRayOrigin + gContext.mRayVector * len; + gContext.mMatrixOrigin = gContext.mModel.v.position; + + gContext.mRelativeOrigin = (gContext.mTranslationPlanOrigin - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor); + } + } + } + + static void HandleScale(float *matrix, float *deltaMatrix, int& type, float *snap) + { + ImGuiIO& io = ImGui::GetIO(); + + if (!gContext.mbUsing) + { + // find new possible way to scale + type = GetScaleType(); + if (io.MouseDown[0] && type != NONE) + { + gContext.mbUsing = true; + gContext.mCurrentOperation = type; + const vec_t movePlanNormal[] = { gContext.mModel.v.up, gContext.mModel.v.dir, gContext.mModel.v.right, gContext.mModel.v.dir, gContext.mModel.v.up, gContext.mModel.v.right, -gContext.mCameraDir }; + // pickup plan + + gContext.mTranslationPlan = BuildPlan(gContext.mModel.v.position, movePlanNormal[type - SCALE_X]); + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); + gContext.mTranslationPlanOrigin = gContext.mRayOrigin + gContext.mRayVector * len; + gContext.mMatrixOrigin = gContext.mModel.v.position; + gContext.mScale.Set(1.f, 1.f, 1.f); + gContext.mRelativeOrigin = (gContext.mTranslationPlanOrigin - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor); + gContext.mScaleValueOrigin = makeVect(gContext.mModelSource.v.right.Length(), gContext.mModelSource.v.up.Length(), gContext.mModelSource.v.dir.Length()); + gContext.mSaveMousePosx = io.MousePos.x; + } + } + // scale + if (gContext.mbUsing) + { + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); + vec_t newPos = gContext.mRayOrigin + gContext.mRayVector * len; + vec_t newOrigin = newPos - gContext.mRelativeOrigin * gContext.mScreenFactor; + vec_t delta = newOrigin - gContext.mModel.v.position; + + // 1 axis constraint + if (gContext.mCurrentOperation >= SCALE_X && gContext.mCurrentOperation <= SCALE_Z) + { + int axisIndex = gContext.mCurrentOperation - SCALE_X; + const vec_t& axisValue = *(vec_t*)&gContext.mModel.m[axisIndex]; + float lengthOnAxis = Dot(axisValue, delta); + delta = axisValue * lengthOnAxis; + + vec_t baseVector = gContext.mTranslationPlanOrigin - gContext.mModel.v.position; + float ratio = Dot(axisValue, baseVector + delta) / Dot(axisValue, baseVector); + + gContext.mScale[axisIndex] = max(ratio, 0.001f); + } + else + { + float scaleDelta = (io.MousePos.x - gContext.mSaveMousePosx) * 0.01f; + gContext.mScale.Set(max(1.f + scaleDelta, 0.001f)); + } + + // snap + if (snap) + { + float scaleSnap[] = { snap[0], snap[0], snap[0] }; + ComputeSnap(gContext.mScale, scaleSnap); + } + + // no 0 allowed + for (int i = 0; i < 3;i++) + gContext.mScale[i] = max(gContext.mScale[i], 0.001f); + + // compute matrix & delta + matrix_t deltaMatrixScale; + deltaMatrixScale.Scale(gContext.mScale * gContext.mScaleValueOrigin); + + matrix_t res = deltaMatrixScale * gContext.mModel; + *(matrix_t*)matrix = res; + + if (deltaMatrix) + { + deltaMatrixScale.Scale(gContext.mScale); + memcpy(deltaMatrix, deltaMatrixScale.m16, sizeof(float) * 16); + } + + if (!io.MouseDown[0]) + gContext.mbUsing = false; + + type = gContext.mCurrentOperation; + } + } + + static void HandleRotation(float *matrix, float *deltaMatrix, int& type, float *snap) + { + ImGuiIO& io = ImGui::GetIO(); + bool applyRotationLocaly = gContext.mMode == LOCAL; + + if (!gContext.mbUsing) + { + type = GetRotateType(); + + if (type == ROTATE_SCREEN) + { + applyRotationLocaly = true; + } + + if (io.MouseDown[0] && type != NONE) + { + gContext.mbUsing = true; + gContext.mCurrentOperation = type; + const vec_t rotatePlanNormal[] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir, -gContext.mCameraDir }; + // pickup plan + if (applyRotationLocaly) + { + gContext.mTranslationPlan = BuildPlan(gContext.mModel.v.position, rotatePlanNormal[type - ROTATE_X]); + } + else + { + gContext.mTranslationPlan = BuildPlan(gContext.mModelSource.v.position, directionUnary[type - ROTATE_X]); + } + + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); + vec_t localPos = gContext.mRayOrigin + gContext.mRayVector * len - gContext.mModel.v.position; + gContext.mRotationVectorSource = Normalized(localPos); + gContext.mRotationAngleOrigin = ComputeAngleOnPlan(); + } + } + + // rotation + if (gContext.mbUsing) + { + gContext.mRotationAngle = ComputeAngleOnPlan(); + if (snap) + { + float snapInRadian = snap[0] * DEG2RAD; + ComputeSnap(&gContext.mRotationAngle, &snapInRadian); + } + vec_t rotationAxisLocalSpace; + + rotationAxisLocalSpace.TransformVector(makeVect(gContext.mTranslationPlan.x, gContext.mTranslationPlan.y, gContext.mTranslationPlan.z, 0.f), gContext.mModelInverse); + rotationAxisLocalSpace.Normalize(); + + matrix_t deltaRotation; + deltaRotation.RotationAxis(rotationAxisLocalSpace, gContext.mRotationAngle - gContext.mRotationAngleOrigin); + gContext.mRotationAngleOrigin = gContext.mRotationAngle; + + matrix_t scaleOrigin; + scaleOrigin.Scale(gContext.mModelScaleOrigin); + + if (applyRotationLocaly) + { + *(matrix_t*)matrix = scaleOrigin * deltaRotation * gContext.mModel; + } + else + { + matrix_t res = gContext.mModelSource; + res.v.position.Set(0.f); + + *(matrix_t*)matrix = res * deltaRotation; + ((matrix_t*)matrix)->v.position = gContext.mModelSource.v.position; + } + + if (deltaMatrix) + { + *(matrix_t*)deltaMatrix = gContext.mModelInverse * deltaRotation * gContext.mModel; + } + + if (!io.MouseDown[0]) + gContext.mbUsing = false; + + type = gContext.mCurrentOperation; + } + } + + void DecomposeMatrixToComponents(const float *matrix, float *translation, float *rotation, float *scale) + { + matrix_t mat = *(matrix_t*)matrix; + + scale[0] = mat.v.right.Length(); + scale[1] = mat.v.up.Length(); + scale[2] = mat.v.dir.Length(); + + mat.OrthoNormalize(); + + rotation[0] = RAD2DEG * atan2f(mat.m[1][2], mat.m[2][2]); + rotation[1] = RAD2DEG * atan2f(-mat.m[0][2], sqrtf(mat.m[1][2] * mat.m[1][2] + mat.m[2][2]* mat.m[2][2])); + rotation[2] = RAD2DEG * atan2f(mat.m[0][1], mat.m[0][0]); + + translation[0] = mat.v.position.x; + translation[1] = mat.v.position.y; + translation[2] = mat.v.position.z; + } + + void RecomposeMatrixFromComponents(const float *translation, const float *rotation, const float *scale, float *matrix) + { + matrix_t& mat = *(matrix_t*)matrix; + + matrix_t rot[3]; + for (int i = 0; i < 3;i++) + rot[i].RotationAxis(directionUnary[i], rotation[i] * DEG2RAD); + + mat = rot[0] * rot[1] * rot[2]; + + float validScale[3]; + for (int i = 0; i < 3; i++) + { + if (fabsf(scale[i]) < FLT_EPSILON) + validScale[i] = 0.001f; + else + validScale[i] = scale[i]; + } + mat.v.right *= validScale[0]; + mat.v.up *= validScale[1]; + mat.v.dir *= validScale[2]; + mat.v.position.Set(translation[0], translation[1], translation[2], 1.f); + } + + void Manipulate(const float *view, const float *projection, OPERATION operation, MODE mode, float *matrix, float *deltaMatrix, float *snap) + { + ComputeContext(view, projection, matrix, mode); + + // set delta to identity + if (deltaMatrix) + ((matrix_t*)deltaMatrix)->SetToIdentity(); + + // behind camera + vec_t camSpacePosition; + camSpacePosition.TransformPoint(makeVect(0.f, 0.f, 0.f), gContext.mMVP); + if (camSpacePosition.z < 0.001f) + return; + + // -- + int type = NONE; + if (gContext.mbEnable) + { + switch (operation) + { + case ROTATE: + HandleRotation(matrix, deltaMatrix, type, snap); + break; + case TRANSLATE: + HandleTranslation(matrix, deltaMatrix, type, snap); + break; + case SCALE: + HandleScale(matrix, deltaMatrix, type, snap); + break; + } + } + + switch (operation) + { + case ROTATE: + DrawRotationGizmo(type); + break; + case TRANSLATE: + DrawTranslationGizmo(type); + break; + case SCALE: + DrawScaleGizmo(type); + break; + } + } + + void DrawCube(const float *view, const float *projection, float *matrix) + { + matrix_t viewInverse; + viewInverse.Inverse(*(matrix_t*)view); + const matrix_t& model = *(matrix_t*)matrix; + matrix_t res = *(matrix_t*)matrix * *(matrix_t*)view * *(matrix_t*)projection; + + for (int iFace = 0; iFace < 6; iFace++) + { + const int normalIndex = (iFace % 3); + const int perpXIndex = (normalIndex + 1) % 3; + const int perpYIndex = (normalIndex + 2) % 3; + const float invert = (iFace > 2) ? -1.f : 1.f; + + const vec_t faceCoords[4] = { directionUnary[normalIndex] + directionUnary[perpXIndex] + directionUnary[perpYIndex], + directionUnary[normalIndex] + directionUnary[perpXIndex] - directionUnary[perpYIndex], + directionUnary[normalIndex] - directionUnary[perpXIndex] - directionUnary[perpYIndex], + directionUnary[normalIndex] - directionUnary[perpXIndex] + directionUnary[perpYIndex], + }; + + // clipping + bool skipFace = false; + for (unsigned int iCoord = 0; iCoord < 4; iCoord++) + { + vec_t camSpacePosition; + camSpacePosition.TransformPoint(faceCoords[iCoord] * 0.5f * invert, gContext.mMVP); + if (camSpacePosition.z < 0.001f) + { + skipFace = true; + break; + } + } + if (skipFace) + continue; + + // 3D->2D + ImVec2 faceCoordsScreen[4]; + for (unsigned int iCoord = 0; iCoord < 4; iCoord++) + faceCoordsScreen[iCoord] = worldToPos(faceCoords[iCoord] * 0.5f * invert, res); + + // back face culling + vec_t cullPos, cullNormal; + cullPos.TransformPoint(faceCoords[0] * 0.5f * invert, model); + cullNormal.TransformVector(directionUnary[normalIndex] * invert, model); + float dt = Dot(Normalized(cullPos - viewInverse.v.position), Normalized(cullNormal)); + if (dt>0.f) + continue; + + // draw face with lighter color + gContext.mDrawList->AddConvexPolyFilled(faceCoordsScreen, 4, directionColor[normalIndex] | 0x808080, true); + } + } }; diff --git a/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c b/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c index 3acc72fa336..4dc2bf4753a 100644 --- a/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c +++ b/3rdparty/bgfx/3rdparty/remotery/lib/Remotery.c @@ -5682,7 +5682,8 @@ static void* rmtglGetProcAddress(OpenGL* opengl, const char* symbol) #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) - return NSGLGetProcAddress((const GLubyte*)symbol); + extern void* nsglGetProcAddress(const GLubyte* _name); + return nsglGetProcAddress((const GLubyte*)symbol); #elif defined(RMT_PLATFORM_LINUX) diff --git a/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h b/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h index a392cecbbd7..b9f3341da79 100644 --- a/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h +++ b/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h @@ -24,6 +24,11 @@ #pragma once +////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Documentation for the API is available at https://renderdoc.org/docs/in_application_api.html +// + #if !defined(RENDERDOC_NO_STDINT) #include <stdint.h> #endif @@ -380,18 +385,22 @@ typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, char *logfil uint32_t *pathlength, uint64_t *timestamp); // returns 1 if the RenderDoc UI is connected to this application, 0 otherwise +// This was renamed to IsTargetControlConnected in API 1.1.1, the old typedef is kept here for +// backwards compatibility with old code, it is castable either way since it's ABI compatible +// as the same function pointer type. typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsRemoteAccessConnected)(); +typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsTargetControlConnected)(); // This function will launch the Replay UI associated with the RenderDoc library injected // into the running application. // -// if connectRemoteAccess is 1, the Replay UI will be launched with a command line parameter +// if connectTargetControl is 1, the Replay UI will be launched with a command line parameter // to connect to this application // cmdline is the rest of the command line, as a UTF-8 string. E.g. a captures to open // if cmdline is NULL, the command line will be empty. // // returns the PID of the replay UI if successful, 0 if not successful. -typedef uint32_t(RENDERDOC_CC *pRENDERDOC_LaunchReplayUI)(uint32_t connectRemoteAccess, +typedef uint32_t(RENDERDOC_CC *pRENDERDOC_LaunchReplayUI)(uint32_t connectTargetControl, const char *cmdline); // RenderDoc can return a higher version than requested if it's backwards compatible, @@ -474,6 +483,7 @@ typedef enum { eRENDERDOC_API_Version_1_0_1 = 10001, // RENDERDOC_API_1_0_1 = 1 00 01 eRENDERDOC_API_Version_1_0_2 = 10002, // RENDERDOC_API_1_0_2 = 1 00 02 eRENDERDOC_API_Version_1_1_0 = 10100, // RENDERDOC_API_1_1_0 = 1 01 00 + eRENDERDOC_API_Version_1_1_1 = 10101, // RENDERDOC_API_1_1_1 = 1 01 01 } RENDERDOC_Version; // API version changelog: @@ -484,6 +494,8 @@ typedef enum { // 1.0.2 - Refactor: Renamed eRENDERDOC_Option_DebugDeviceMode to eRENDERDOC_Option_APIValidation // 1.1.0 - Add feature: TriggerMultiFrameCapture(). Backwards compatible with 1.0.x since the new // function pointer is added to the end of the struct, the original layout is identical +// 1.1.1 - Refactor: Renamed remote access to target control (to better disambiguate from remote +// replay/remote server concept in replay UI) // eRENDERDOC_API_Version_1_1_0 typedef struct @@ -529,6 +541,53 @@ typedef RENDERDOC_API_1_1_0 RENDERDOC_API_1_0_0; typedef RENDERDOC_API_1_1_0 RENDERDOC_API_1_0_1; typedef RENDERDOC_API_1_1_0 RENDERDOC_API_1_0_2; +// although this structure is identical to RENDERDOC_API_1_1_0, the member +// IsRemoteAccessConnected was renamed to IsTargetControlConnected. So that +// old code can still compile with a new header, we must declare a new struct +// type. It can be casted back and forth though, so we will still return a +// pointer to this type for all previous API versions - the above struct is +// purely legacy for compilation compatibility + +// eRENDERDOC_API_Version_1_1_1 +typedef struct +{ + pRENDERDOC_GetAPIVersion GetAPIVersion; + + pRENDERDOC_SetCaptureOptionU32 SetCaptureOptionU32; + pRENDERDOC_SetCaptureOptionF32 SetCaptureOptionF32; + + pRENDERDOC_GetCaptureOptionU32 GetCaptureOptionU32; + pRENDERDOC_GetCaptureOptionF32 GetCaptureOptionF32; + + pRENDERDOC_SetFocusToggleKeys SetFocusToggleKeys; + pRENDERDOC_SetCaptureKeys SetCaptureKeys; + + pRENDERDOC_GetOverlayBits GetOverlayBits; + pRENDERDOC_MaskOverlayBits MaskOverlayBits; + + pRENDERDOC_Shutdown Shutdown; + pRENDERDOC_UnloadCrashHandler UnloadCrashHandler; + + pRENDERDOC_SetLogFilePathTemplate SetLogFilePathTemplate; + pRENDERDOC_GetLogFilePathTemplate GetLogFilePathTemplate; + + pRENDERDOC_GetNumCaptures GetNumCaptures; + pRENDERDOC_GetCapture GetCapture; + + pRENDERDOC_TriggerCapture TriggerCapture; + + pRENDERDOC_IsTargetControlConnected IsTargetControlConnected; + pRENDERDOC_LaunchReplayUI LaunchReplayUI; + + pRENDERDOC_SetActiveWindow SetActiveWindow; + + pRENDERDOC_StartFrameCapture StartFrameCapture; + pRENDERDOC_IsFrameCapturing IsFrameCapturing; + pRENDERDOC_EndFrameCapture EndFrameCapture; + + pRENDERDOC_TriggerMultiFrameCapture TriggerMultiFrameCapture; +} RENDERDOC_API_1_1_1; + ////////////////////////////////////////////////////////////////////////////////////////////////// // RenderDoc API entry point // diff --git a/3rdparty/bgfx/3rdparty/stb/stb_textedit.h b/3rdparty/bgfx/3rdparty/stb/stb_textedit.h index 23f0f24ee8f..4b731a0c229 100644 --- a/3rdparty/bgfx/3rdparty/stb/stb_textedit.h +++ b/3rdparty/bgfx/3rdparty/stb/stb_textedit.h @@ -1,9 +1,10 @@ -// [ImGui] this is a slightly modified version of stb_truetype.h 1.8 +// [ImGui] this is a slightly modified version of stb_truetype.h 1.9. Those changes would need to be pushed into nothings/sb +// [ImGui] - fixed linestart handler when over last character of multi-line buffer + simplified existing code (#588, #815) +// [ImGui] - fixed a state corruption/crash bug in stb_text_redo and stb_textedit_discard_redo (#715) // [ImGui] - fixed a crash bug in stb_textedit_discard_redo (#681) // [ImGui] - fixed some minor warnings -// [ImGui] - added STB_TEXTEDIT_MOVEWORDLEFT/STB_TEXTEDIT_MOVEWORDRIGHT custom handler (#473) -// stb_textedit.h - v1.8 - public domain - Sean Barrett +// stb_textedit.h - v1.9 - public domain - Sean Barrett // Development of this library was sponsored by RAD Game Tools // // This C header file implements the guts of a multi-line text-editing @@ -36,6 +37,7 @@ // // VERSION HISTORY // +// 1.9 (2016-08-27) customizable move-by-word // 1.8 (2016-04-02) better keyboard handling when mouse button is down // 1.7 (2015-09-13) change y range handling in case baseline is non-0 // 1.6 (2015-04-15) allow STB_TEXTEDIT_memmove @@ -424,10 +426,9 @@ static int stb_text_locate_coord(STB_TEXTEDIT_STRING *str, float x, float y) // check if it's before the end of the line if (x < r.x1) { // search characters in row for one that straddles 'x' - k = i; prev_x = r.x0; - for (i=0; i < r.num_chars; ++i) { - float w = STB_TEXTEDIT_GETWIDTH(str, k, i); + for (k=0; k < r.num_chars; ++k) { + float w = STB_TEXTEDIT_GETWIDTH(str, i, k); if (x < prev_x+w) { if (x < prev_x+w/2) return k+i; @@ -617,15 +618,16 @@ static void stb_textedit_move_to_last(STB_TEXTEDIT_STRING *str, STB_TexteditStat } #ifdef STB_TEXTEDIT_IS_SPACE -static int is_word_boundary( STB_TEXTEDIT_STRING *_str, int _idx ) +static int is_word_boundary( STB_TEXTEDIT_STRING *str, int idx ) { - return _idx > 0 ? (STB_TEXTEDIT_IS_SPACE( STB_TEXTEDIT_GETCHAR(_str,_idx-1) ) && !STB_TEXTEDIT_IS_SPACE( STB_TEXTEDIT_GETCHAR(_str, _idx) ) ) : 1; + return idx > 0 ? (STB_TEXTEDIT_IS_SPACE( STB_TEXTEDIT_GETCHAR(str,idx-1) ) && !STB_TEXTEDIT_IS_SPACE( STB_TEXTEDIT_GETCHAR(str, idx) ) ) : 1; } #ifndef STB_TEXTEDIT_MOVEWORDLEFT -static int stb_textedit_move_to_word_previous( STB_TEXTEDIT_STRING *_str, int c ) +static int stb_textedit_move_to_word_previous( STB_TEXTEDIT_STRING *str, int c ) { - while( c >= 0 && !is_word_boundary( _str, c ) ) + --c; // always move at least one character + while( c >= 0 && !is_word_boundary( str, c ) ) --c; if( c < 0 ) @@ -637,10 +639,11 @@ static int stb_textedit_move_to_word_previous( STB_TEXTEDIT_STRING *_str, int c #endif #ifndef STB_TEXTEDIT_MOVEWORDRIGHT -static int stb_textedit_move_to_word_next( STB_TEXTEDIT_STRING *_str, int c ) +static int stb_textedit_move_to_word_next( STB_TEXTEDIT_STRING *str, int c ) { - const int len = STB_TEXTEDIT_STRINGLEN(_str); - while( c < len && !is_word_boundary( _str, c ) ) + const int len = STB_TEXTEDIT_STRINGLEN(str); + ++c; // always move at least one character + while( c < len && !is_word_boundary( str, c ) ) ++c; if( c > len ) @@ -777,7 +780,7 @@ retry: if (STB_TEXT_HAS_SELECTION(state)) stb_textedit_move_to_first(state); else { - state->cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state->cursor-1); + state->cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state->cursor); stb_textedit_clamp( str, state ); } break; @@ -786,7 +789,7 @@ retry: if( !STB_TEXT_HAS_SELECTION( state ) ) stb_textedit_prep_selection_at_cursor(state); - state->cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state->cursor-1); + state->cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state->cursor); state->select_end = state->cursor; stb_textedit_clamp( str, state ); @@ -798,7 +801,7 @@ retry: if (STB_TEXT_HAS_SELECTION(state)) stb_textedit_move_to_last(str, state); else { - state->cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state->cursor+1); + state->cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state->cursor); stb_textedit_clamp( str, state ); } break; @@ -807,7 +810,7 @@ retry: if( !STB_TEXT_HAS_SELECTION( state ) ) stb_textedit_prep_selection_at_cursor(state); - state->cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state->cursor+1); + state->cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state->cursor); state->select_end = state->cursor; stb_textedit_clamp( str, state ); @@ -990,58 +993,58 @@ retry: #ifdef STB_TEXTEDIT_K_LINESTART2 case STB_TEXTEDIT_K_LINESTART2: #endif - case STB_TEXTEDIT_K_LINESTART: { - StbFindState find; + case STB_TEXTEDIT_K_LINESTART: stb_textedit_clamp(str, state); stb_textedit_move_to_first(state); - stb_textedit_find_charpos(&find, str, state->cursor, state->single_line); - state->cursor = find.first_char; + if (state->single_line) + state->cursor = 0; + else while (state->cursor > 0 && STB_TEXTEDIT_GETCHAR(str, state->cursor-1) != STB_TEXTEDIT_NEWLINE) + --state->cursor; state->has_preferred_x = 0; break; - } #ifdef STB_TEXTEDIT_K_LINEEND2 case STB_TEXTEDIT_K_LINEEND2: #endif case STB_TEXTEDIT_K_LINEEND: { - StbFindState find; + int n = STB_TEXTEDIT_STRINGLEN(str); stb_textedit_clamp(str, state); stb_textedit_move_to_first(state); - stb_textedit_find_charpos(&find, str, state->cursor, state->single_line); - + if (state->single_line) + state->cursor = n; + else while (state->cursor < n && STB_TEXTEDIT_GETCHAR(str, state->cursor) != STB_TEXTEDIT_NEWLINE) + ++state->cursor; state->has_preferred_x = 0; - state->cursor = find.first_char + find.length; - if (find.length > 0 && STB_TEXTEDIT_GETCHAR(str, state->cursor-1) == STB_TEXTEDIT_NEWLINE) - --state->cursor; break; } #ifdef STB_TEXTEDIT_K_LINESTART2 case STB_TEXTEDIT_K_LINESTART2 | STB_TEXTEDIT_K_SHIFT: #endif - case STB_TEXTEDIT_K_LINESTART | STB_TEXTEDIT_K_SHIFT: { - StbFindState find; + case STB_TEXTEDIT_K_LINESTART | STB_TEXTEDIT_K_SHIFT: stb_textedit_clamp(str, state); stb_textedit_prep_selection_at_cursor(state); - stb_textedit_find_charpos(&find, str, state->cursor, state->single_line); - state->cursor = state->select_end = find.first_char; + if (state->single_line) + state->cursor = 0; + else while (state->cursor > 0 && STB_TEXTEDIT_GETCHAR(str, state->cursor-1) != STB_TEXTEDIT_NEWLINE) + --state->cursor; + state->select_end = state->cursor; state->has_preferred_x = 0; break; - } #ifdef STB_TEXTEDIT_K_LINEEND2 case STB_TEXTEDIT_K_LINEEND2 | STB_TEXTEDIT_K_SHIFT: #endif case STB_TEXTEDIT_K_LINEEND | STB_TEXTEDIT_K_SHIFT: { - StbFindState find; + int n = STB_TEXTEDIT_STRINGLEN(str); stb_textedit_clamp(str, state); stb_textedit_prep_selection_at_cursor(state); - stb_textedit_find_charpos(&find, str, state->cursor, state->single_line); - state->has_preferred_x = 0; - state->cursor = find.first_char + find.length; - if (find.length > 0 && STB_TEXTEDIT_GETCHAR(str, state->cursor-1) == STB_TEXTEDIT_NEWLINE) - --state->cursor; + if (state->single_line) + state->cursor = n; + else while (state->cursor < n && STB_TEXTEDIT_GETCHAR(str, state->cursor) != STB_TEXTEDIT_NEWLINE) + ++state->cursor; state->select_end = state->cursor; + state->has_preferred_x = 0; break; } @@ -1101,8 +1104,8 @@ static void stb_textedit_discard_redo(StbUndoState *state) if (state->undo_rec[i].char_storage >= 0) state->undo_rec[i].char_storage = state->undo_rec[i].char_storage + (short) n; // vsnet05 } + STB_TEXTEDIT_memmove(state->undo_rec + state->redo_point, state->undo_rec + state->redo_point-1, (size_t) ((size_t)(STB_TEXTEDIT_UNDOSTATECOUNT - state->redo_point)*sizeof(state->undo_rec[0]))); ++state->redo_point; - STB_TEXTEDIT_memmove(state->undo_rec + state->redo_point-1, state->undo_rec + state->redo_point, (size_t) ((size_t)(STB_TEXTEDIT_UNDOSTATECOUNT - state->redo_point)*sizeof(state->undo_rec[0]))); } } @@ -1260,6 +1263,7 @@ static void stb_text_redo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state) if (r.insert_length) { // easy case: need to insert n characters STB_TEXTEDIT_INSERTCHARS(str, r.where, &s->undo_char[r.char_storage], r.insert_length); + s->redo_char_point += r.insert_length; } state->cursor = r.where + r.insert_length; diff --git a/3rdparty/bgfx/README.md b/3rdparty/bgfx/README.md index 722430f1bb6..2c528ac792a 100644 --- a/3rdparty/bgfx/README.md +++ b/3rdparty/bgfx/README.md @@ -58,6 +58,7 @@ Languages: * [Go language API bindings](https://github.com/james4k/go-bgfx) * [Haskell language API bindings](https://github.com/haskell-game/bgfx) * [Java language API bindings](https://github.com/enleeten/twilight-bgfx) + * [Lightweight Java Game Library 3 bindings](https://github.com/LWJGL/lwjgl3) * [Lua language API bindings](https://github.com/excessive/lua-bgfx) * [Nim language API bindings](https://github.com/Halsys/nim-bgfx) * [Python language API bindings](https://github.com/jnadro/pybgfx#pybgf) diff --git a/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h b/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h index 694e76a6b0d..53ce3f3f42b 100644 --- a/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h +++ b/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h @@ -102,9 +102,9 @@ static const uint8_t fs_metaballs_dx11[660] = 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x3e, 0x00, 0x00, 0x01, // .....@.....?>... 0x00, 0x00, 0x00, 0x00, // .... }; -static const uint8_t fs_metaballs_mtl[704] = +static const uint8_t fs_metaballs_mtl[712] = { - 0x46, 0x53, 0x48, 0x04, 0x03, 0x2c, 0xf5, 0x3f, 0x00, 0x00, 0xb1, 0x02, 0x00, 0x00, 0x75, 0x73, // FSH..,.?......us + 0x46, 0x53, 0x48, 0x04, 0x03, 0x2c, 0xf5, 0x3f, 0x00, 0x00, 0xb9, 0x02, 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 { @@ -127,25 +127,26 @@ static const uint8_t fs_metaballs_mtl[704] = 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, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x6e, 0x6f, 0x72, // var_1 = dot (nor - 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, // malize(_mtl_i.v_ - 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x29, 0x2c, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, // normal), float3( - 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x2d, 0x31, 0x2e, 0x30, 0x29, 0x29, // 0.0, 0.0, -1.0)) - 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ;. float4 tmpva - 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, // r_2;. tmpvar_2. - 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // w = 1.0;. tmpva - 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x28, // r_2.xyz = pow (( - 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // (. pow (_mtl_ - 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, // i.v_color0.xyz, - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x2c, // float3(2.2, 2.2, - 0x20, 0x32, 0x2e, 0x32, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, // 2.2)). * tmpv - 0x61, 0x72, 0x5f, 0x31, 0x29, 0x20, 0x2b, 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x74, 0x6d, 0x70, // ar_1) + pow (tmp - 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2c, 0x20, 0x33, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x2c, 0x20, 0x66, // var_1, 30.0)), f - 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, // loat3(0.4545454, - 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, // 0.4545454, 0.45 - 0x34, 0x35, 0x34, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // 45454));. _mtl_ - 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, // o.gl_FragColor = - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, // tmpvar_2;. ret - 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // urn _mtl_o;.}... + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // tmpvar_1 = 0;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x64, 0x6f, 0x74, 0x20, // tmpvar_1 = dot + 0x28, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // (normalize(_mtl_ + 0x69, 0x2e, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x29, 0x2c, 0x20, 0x66, 0x6c, 0x6f, // i.v_normal), flo + 0x61, 0x74, 0x33, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x2d, 0x31, // at3(0.0, 0.0, -1 + 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, // .0));. float4 t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, // mpvar_2 = 0;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, // mpvar_2.w = 1.0; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, // . tmpvar_2.xyz + 0x3d, 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x70, 0x6f, // = pow (((. po + 0x77, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // w (_mtl_i.v_colo + 0x72, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x32, // r0.xyz, float3(2 + 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x29, 0x29, 0x0a, 0x20, // .2, 2.2, 2.2)). + 0x20, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x20, 0x2b, 0x20, // * tmpvar_1) + + 0x70, 0x6f, 0x77, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2c, 0x20, 0x33, // pow (tmpvar_1, 3 + 0x30, 0x2e, 0x30, 0x29, 0x29, 0x2c, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x30, 0x2e, // 0.0)), float3(0. + 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, // 4545454, 0.45454 + 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x29, 0x29, 0x3b, // 54, 0.4545454)); + 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . _mtl_o.gl_Fra + 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // gColor = tmpvar_ + 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // 2;. return _mtl + 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _o;.}... }; diff --git a/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h b/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h index 1e35cc2394e..11bb8a1ba3b 100644 --- a/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h +++ b/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h @@ -116,9 +116,9 @@ static const uint8_t vs_metaballs_dx11[726] = 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x03, 0x05, 0x00, // F.......>....... 0x02, 0x00, 0x01, 0x00, 0x40, 0x08, // ....@. }; -static const uint8_t vs_metaballs_mtl[855] = +static const uint8_t vs_metaballs_mtl[863] = { - 0x56, 0x53, 0x48, 0x04, 0x03, 0x2c, 0xf5, 0x3f, 0x00, 0x00, 0x48, 0x03, 0x00, 0x00, 0x75, 0x73, // VSH..,.?..H...us + 0x56, 0x53, 0x48, 0x04, 0x03, 0x2c, 0xf5, 0x3f, 0x00, 0x00, 0x50, 0x03, 0x00, 0x00, 0x75, 0x73, // VSH..,.?..P...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 { @@ -152,24 +152,24 @@ static const uint8_t vs_metaballs_mtl[855] = 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // )]]).{. xlatMtl 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, // ShaderOutput _mt 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, // l_o;. float4 tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_1;. tmpvar - 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // _1.w = 1.0;. tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, // pvar_1.xyz = _mt - 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, // l_i.a_position;. - 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, // _mtl_o.gl_Posi - 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // tion = (_mtl_u.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, 0x66, 0x6c, // tmpvar_1);. fl - 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, // oat4 tmpvar_2;. - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x30, 0x2e, // tmpvar_2.w = 0. - 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, // 0;. tmpvar_2.xy - 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x6e, 0x6f, 0x72, // z = _mtl_i.a_nor - 0x6d, 0x61, 0x6c, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, // mal;. _mtl_o.v_ - 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // normal = (_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, 0x32, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // pvar_2).xyz;. _ - 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;.}... + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // pvar_1 = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, // pvar_1.w = 1.0;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, // tmpvar_1.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, 0x67, 0x6c, 0x5f, // on;. _mtl_o.gl_ + 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // Position = (_mtl + 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, // _u.u_modelViewPr + 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, // oj * tmpvar_1);. + 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // float4 tmpvar_ + 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 2 = 0;. tmpvar_ + 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // 2.w = 0.0;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // var_2.xyz = _mtl + 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // _i.a_normal;. _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x3d, // mtl_o.v_normal = + 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // (_mtl_u.u_model + 0x5b, 0x30, 0x5d, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x2e, // [0] * tmpvar_2). + 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, // xyz;. _mtl_o.v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, // color0 = _mtl_i. + 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, // a_color0;. retu + 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // rn _mtl_o;.}... }; diff --git a/3rdparty/bgfx/examples/07-callback/callback.cpp b/3rdparty/bgfx/examples/07-callback/callback.cpp index cdc1b6b5b5a..c5d7d430707 100644 --- a/3rdparty/bgfx/examples/07-callback/callback.cpp +++ b/3rdparty/bgfx/examples/07-callback/callback.cpp @@ -377,7 +377,7 @@ int _main_(int _argc, char** _argv) // Enumerate supported backend renderers. bgfx::RendererType::Enum renderers[bgfx::RendererType::Count]; - uint8_t numRenderers = bgfx::getSupportedRenderers(renderers); + uint8_t numRenderers = bgfx::getSupportedRenderers(BX_COUNTOF(renderers), renderers); bgfx::init(bgfx::RendererType::Count == args.m_type ? renderers[bx::getHPCounter() % numRenderers] /* randomize renderer */ diff --git a/3rdparty/bgfx/examples/08-update/cs_update.sc b/3rdparty/bgfx/examples/08-update/cs_update.sc new file mode 100644 index 00000000000..2599a92c509 --- /dev/null +++ b/3rdparty/bgfx/examples/08-update/cs_update.sc @@ -0,0 +1,32 @@ +/* + * Copyright 2014 Stanlo Slasinski. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "bgfx_compute.sh" + +IMAGE2D_ARRAY_WR(s_texColor,rgba32f,0); +uniform vec4 u_time; + +NUM_THREADS(16, 16, 1) +void main() +{ + vec3 colors[] = { + vec3(1,0,0), + vec3(1,1,0), + vec3(1,0,1), + vec3(0,1,0), + vec3(0,1,1), + vec3(0,0,1), + }; + + for (int face=0;face<6;face++) + { + vec3 color = colors[face]*0.75 + sin( u_time.x*4.0 )*0.25; + ivec3 dest = ivec3( gl_GlobalInvocationID.xy, face ); + imageStore( s_texColor, dest, vec4(color,1) ); + } +} + + + diff --git a/3rdparty/bgfx/examples/08-update/update.cpp b/3rdparty/bgfx/examples/08-update/update.cpp index e919fc6eafe..13f9d5bc180 100644 --- a/3rdparty/bgfx/examples/08-update/update.cpp +++ b/3rdparty/bgfx/examples/08-update/update.cpp @@ -162,7 +162,8 @@ public: const bgfx::Caps* caps = bgfx::getCaps(); m_texture3DSupported = !!(caps->supported & BGFX_CAPS_TEXTURE_3D); m_blitSupported = !!(caps->supported & BGFX_CAPS_TEXTURE_BLIT); - m_numm_textures3d = 0; + m_computeSupported = !!(caps->supported & BGFX_CAPS_COMPUTE); + m_numTextures3d = 0; if (m_texture3DSupported) { @@ -186,17 +187,17 @@ public: if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R8]) ) { - m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem8); + m_textures3d[m_numTextures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem8); } if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R16F]) ) { - m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R16F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem16f); + m_textures3d[m_numTextures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R16F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem16f); } if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R32F]) ) { - m_textures3d[m_numm_textures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R32F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem32f); + m_textures3d[m_numTextures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R32F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem32f); } } @@ -215,6 +216,12 @@ public: m_program3d = loadProgram("vs_update", "fs_update_3d"); } + m_programCompute.idx = bgfx::invalidHandle; + if (m_computeSupported) + { + m_programCompute = bgfx::createProgram( loadShader( "cs_update" ), true ); + } + // Create texture sampler uniforms. s_texCube = bgfx::createUniform("s_texCube", bgfx::UniformType::Int1); s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1); @@ -222,6 +229,11 @@ public: // Create time uniform. u_time = bgfx::createUniform("u_time", bgfx::UniformType::Vec4); + for(uint32_t ii = 0; ii<BX_COUNTOF( m_textureCube ); ++ii) + { + m_textureCube[ii].idx = bgfx::invalidHandle; + } + m_textureCube[0] = bgfx::createTextureCube( textureside , false @@ -241,6 +253,17 @@ public: ); } + if (m_computeSupported) + { + m_textureCube[2] = bgfx::createTextureCube( + textureside + , false + , 1 + , bgfx::TextureFormat::RGBA8 + , BGFX_TEXTURE_COMPUTE_WRITE + ); + } + m_texture2d = bgfx::createTexture2D( texture2dSize , texture2dSize @@ -278,17 +301,21 @@ public: bgfx::destroyTexture(m_textures[ii]); } - for (uint32_t ii = 0; ii < m_numm_textures3d; ++ii) + for (uint32_t ii = 0; ii < m_numTextures3d; ++ii) { bgfx::destroyTexture(m_textures3d[ii]); } bgfx::destroyTexture(m_texture2d); - bgfx::destroyTexture(m_textureCube[0]); - if (m_blitSupported) + + for (uint32_t ii = 0; ii<BX_COUNTOF(m_textureCube); ++ii) { - bgfx::destroyTexture(m_textureCube[1]); + if (bgfx::isValid(m_textureCube[ii])) + { + bgfx::destroyTexture(m_textureCube[ii]); + } } + bgfx::destroyIndexBuffer(m_ibh); bgfx::destroyVertexBuffer(m_vbh); if (bgfx::isValid(m_program3d) ) @@ -296,6 +323,10 @@ public: bgfx::destroyProgram(m_program3d); } bgfx::destroyProgram(m_programCmp); + if (bgfx::isValid(m_programCompute) ) + { + bgfx::destroyProgram(m_programCompute); + } bgfx::destroyProgram(m_program); bgfx::destroyUniform(u_time); bgfx::destroyUniform(s_texColor); @@ -426,26 +457,36 @@ public: // Set view and projection matrix for view 0. bgfx::setViewTransform(0, view, proj); - for (uint32_t ii = 0; ii < 1 + uint32_t(m_blitSupported); ++ii) + // Update texturecube using compute shader + if (bgfx::isValid(m_programCompute) ) { - float mtx[16]; - bx::mtxSRT(mtx, 1.0f, 1.0f, 1.0f, time, time*0.37f, 0.0f, -1.5f*m_blitSupported + ii*3.0f, 0.0f, 0.0f); + bgfx::setImage(0, s_texCube, m_textureCube[2], 0, bgfx::Access::Write); + bgfx::dispatch(0, m_programCompute, textureside/16, textureside/16); + } - // Set model matrix for rendering. - bgfx::setTransform(mtx); + for (uint32_t ii = 0; ii < BX_COUNTOF(m_textureCube); ++ii) + { + if (bgfx::isValid(m_textureCube[ii])) + { + float mtx[16]; + bx::mtxSRT( mtx, 0.7f, 0.7f, 0.7f, time, time*0.37f, 0.0f, -2.0f +ii*2.0f, 0.0f, 0.0f ); - // Set vertex and index buffer. - bgfx::setVertexBuffer(m_vbh); - bgfx::setIndexBuffer(m_ibh); + // Set model matrix for rendering. + bgfx::setTransform( mtx ); - // Bind texture. - bgfx::setTexture(0, s_texCube, m_textureCube[ii]); + // Set vertex and index buffer. + bgfx::setVertexBuffer( m_vbh ); + bgfx::setIndexBuffer( m_ibh ); - // Set render states. - bgfx::setState(BGFX_STATE_DEFAULT); + // Bind texture. + bgfx::setTexture( 0, s_texCube, m_textureCube[ii] ); + + // Set render states. + bgfx::setState( BGFX_STATE_DEFAULT ); - // Submit primitive for rendering to view 0. - bgfx::submit(0, m_program); + // Submit primitive for rendering to view 0. + bgfx::submit( 0, m_program ); + } } // Set view and projection matrix for view 1. @@ -496,7 +537,7 @@ public: bgfx::submit(1, m_programCmp); } - for (uint32_t ii = 0; ii < m_numm_textures3d; ++ii) + for (uint32_t ii = 0; ii < m_numTextures3d; ++ii) { bx::mtxTranslate(mtx, xpos + ii*2.1f, -size+6.5f, 0.0f); @@ -554,9 +595,10 @@ public: uint32_t m_debug; uint32_t m_reset; - uint32_t m_numm_textures3d; + uint32_t m_numTextures3d; bool m_texture3DSupported; bool m_blitSupported; + bool m_computeSupported; std::list<PackCube> m_quads; RectPackCubeT<256> m_cube; @@ -573,11 +615,12 @@ public: bgfx::TextureHandle m_textures[9]; bgfx::TextureHandle m_textures3d[3]; bgfx::TextureHandle m_texture2d; - bgfx::TextureHandle m_textureCube[2]; + bgfx::TextureHandle m_textureCube[3]; bgfx::IndexBufferHandle m_ibh; bgfx::VertexBufferHandle m_vbh; bgfx::ProgramHandle m_program3d; bgfx::ProgramHandle m_programCmp; + bgfx::ProgramHandle m_programCompute; bgfx::ProgramHandle m_program; bgfx::UniformHandle u_time; bgfx::UniformHandle s_texColor; diff --git a/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp b/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp index 10201030edb..274e5f40469 100644 --- a/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp +++ b/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp @@ -385,6 +385,7 @@ int _main_(int _argc, char** _argv) bgfx::destroyUniform(u_shadowMap); bgfx::destroyUniform(u_lightPos); bgfx::destroyUniform(u_lightMtx); + bgfx::destroyUniform(u_depthScaleOffset); // Shutdown bgfx. bgfx::shutdown(); diff --git a/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp b/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp index 5cc97337946..69dd2fef099 100644 --- a/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp +++ b/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp @@ -97,7 +97,7 @@ class ExampleDrawStress : public entry::AppI bgfx::reset(m_width, m_height, m_reset); const bgfx::Caps* caps = bgfx::getCaps(); - m_maxDim = (int32_t)powf(float(caps->maxDrawCalls), 1.0f/3.0f); + m_maxDim = (int32_t)bx::fpow(float(caps->limits.maxDrawCalls), 1.0f/3.0f); // Enable debug text. bgfx::setDebug(m_debug); diff --git a/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h b/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h index 2a2fcef2ada..84704de4e7d 100644 --- a/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h +++ b/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h @@ -81,9 +81,9 @@ static const uint8_t vs_drawstress_dx11[510] = 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_drawstress_mtl[647] = +static const uint8_t vs_drawstress_mtl[651] = { - 0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x78, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH....I..x...us + 0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x7c, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH....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 { @@ -112,16 +112,16 @@ static const uint8_t vs_drawstress_mtl[647] = 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;.}... + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, // mpvar_1 = 0;. 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, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // = _mtl_i.a_posit + 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, // ion;. _mtl_o.gl + 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, // _Position = (_mt + 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // l_u.u_modelViewP + 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, // roj * tmpvar_1); + 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // . _mtl_o.v_colo + 0x72, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, // r0 = _mtl_i.a_co + 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, // lor0;. return _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mtl_o;.}... }; diff --git a/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp b/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp index 206bca10237..a53fb5b55ed 100644 --- a/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp +++ b/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp @@ -570,7 +570,7 @@ void drawThumbnails(struct NVGcontext* vg, float x, float y, float w, float h, c ix = -(iw-thumb)*0.5f; iy = 0; } - imgPaint = nvgImagePattern(vg, tx+ix, ty+iy, iw,ih, 0.0f/180.0f*NVG_PI, images[i], 0); + imgPaint = nvgImagePattern(vg, tx+ix, ty+iy, iw,ih, 0.0f/180.0f*NVG_PI, images[i], 1.0f); nvgBeginPath(vg); nvgRoundedRect(vg, tx,ty, thumb,thumb, 5); nvgFillPaint(vg, imgPaint); diff --git a/3rdparty/bgfx/examples/21-deferred/deferred.cpp b/3rdparty/bgfx/examples/21-deferred/deferred.cpp index 47937f12a95..871ba7af6ec 100644 --- a/3rdparty/bgfx/examples/21-deferred/deferred.cpp +++ b/3rdparty/bgfx/examples/21-deferred/deferred.cpp @@ -393,7 +393,7 @@ class ExampleDeferred : public entry::AppI bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: MRT rendering and deferred shading."); bgfx::dbgTextPrintf(0, 3, 0x0f, "Frame: % 7.3f[ms]", double(frameTime)*toMs); - if (2 > m_caps->maxFBAttachments) + if (2 > m_caps->limits.maxFBAttachments) { // When multiple render targets (MRT) is not supported by GPU, // implement alternative code path that doesn't use MRT. diff --git a/3rdparty/bgfx/examples/30-picking/picking.cpp b/3rdparty/bgfx/examples/30-picking/picking.cpp index 4ed99066cae..a4fc99ffe7c 100644 --- a/3rdparty/bgfx/examples/30-picking/picking.cpp +++ b/3rdparty/bgfx/examples/30-picking/picking.cpp @@ -214,30 +214,32 @@ class ExamplePicking : public entry::AppI bgfx::setViewTransform(RENDER_PASS_SHADING, view, proj); // Set up picking pass - float pickView[16]; - float pickAt[4]; // Need to inversly project the mouse pointer to determin what we're looking at - float pickEye[3] = { eye[0], eye[1], eye[2] }; // Eye is same location as before float viewProj[16]; bx::mtxMul(viewProj, view, proj); + float invViewProj[16]; bx::mtxInverse(invViewProj, viewProj); + // Mouse coord in NDC - float mouseXNDC = (m_mouseState.m_mx / (float)m_width) * 2.0f - 1.0f; + float mouseXNDC = ( m_mouseState.m_mx / (float)m_width ) * 2.0f - 1.0f; float mouseYNDC = ((m_height - m_mouseState.m_my) / (float)m_height) * 2.0f - 1.0f; - float mousePosNDC[4] = { mouseXNDC, mouseYNDC, 0, 1.0f }; - // Unproject and perspective divide - bx::vec4MulMtx(pickAt, mousePosNDC, invViewProj); - pickAt[3] = 1.0f / pickAt[3]; - pickAt[0] *= pickAt[3]; - pickAt[1] *= pickAt[3]; - pickAt[2] *= pickAt[3]; + + float pickEye[3]; + float mousePosNDC[3] = { mouseXNDC, mouseYNDC, 0.0f }; + bx::vec3MulMtxH(pickEye, mousePosNDC, invViewProj); + + float pickAt[3]; + float mousePosNDCEnd[3] = { mouseXNDC, mouseYNDC, 1.0f }; + bx::vec3MulMtxH(pickAt, mousePosNDCEnd, invViewProj); // Look at our unprojected point + float pickView[16]; bx::mtxLookAt(pickView, pickEye, pickAt); - float pickProj[16]; // Tight FOV is best for picking + float pickProj[16]; bx::mtxProj(pickProj, m_fov, 1, 0.1f, 100.0f); + // View rect and transforms for picking pass bgfx::setViewRect(RENDER_PASS_ID, 0, 0, ID_DIM, ID_DIM); bgfx::setViewTransform(RENDER_PASS_ID, pickView, pickProj); diff --git a/3rdparty/bgfx/examples/31-rsm/fs_rsm_combine.sc b/3rdparty/bgfx/examples/31-rsm/fs_rsm_combine.sc index af4f5fc23f7..ae684960e71 100644 --- a/3rdparty/bgfx/examples/31-rsm/fs_rsm_combine.sc +++ b/3rdparty/bgfx/examples/31-rsm/fs_rsm_combine.sc @@ -115,7 +115,11 @@ void main() vec2 texelSize = vec2_splat(u_shadowDimsInv.x); shadowCoord.xy /= shadowCoord.w; - shadowCoord.xy = shadowCoord.xy*0.5+0.5; + shadowCoord.xy = shadowCoord.xy*0.5 + 0.5; + +#if BGFX_SHADER_LANGUAGE_GLSL + shadowCoord.z = shadowCoord.z*0.5 + 0.5; +#endif // BGFX_SHADER_LANGUAGE_GLSL float visibility = PCF(s_shadowMap, shadowCoord, shadowMapBias, texelSize); diff --git a/3rdparty/bgfx/examples/common/bgfx_utils.cpp b/3rdparty/bgfx/examples/common/bgfx_utils.cpp index 6f2d29f0fef..7216b067088 100644 --- a/3rdparty/bgfx/examples/common/bgfx_utils.cpp +++ b/3rdparty/bgfx/examples/common/bgfx_utils.cpp @@ -108,28 +108,22 @@ static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name { char filePath[512]; - const char* shaderPath = "shaders/dx9/"; + const char* shaderPath = "???"; switch (bgfx::getRendererType() ) { + case bgfx::RendererType::Noop: + case bgfx::RendererType::Direct3D9: shaderPath = "shaders/dx9/"; break; case bgfx::RendererType::Direct3D11: - case bgfx::RendererType::Direct3D12: - shaderPath = "shaders/dx11/"; - break; - - case bgfx::RendererType::OpenGL: - shaderPath = "shaders/glsl/"; - break; - - case bgfx::RendererType::Metal: - shaderPath = "shaders/metal/"; - break; - - case bgfx::RendererType::OpenGLES: - shaderPath = "shaders/gles/"; - break; - - default: + case bgfx::RendererType::Direct3D12: shaderPath = "shaders/dx11/"; break; + case bgfx::RendererType::Gnm: shaderPath = "shaders/pssl/"; break; + case bgfx::RendererType::Metal: shaderPath = "shaders/metal/"; break; + case bgfx::RendererType::OpenGL: shaderPath = "shaders/glsl/"; break; + case bgfx::RendererType::OpenGLES: shaderPath = "shaders/essl/"; break; + case bgfx::RendererType::Vulkan: shaderPath = "shaders/spirv/"; break; + + case bgfx::RendererType::Count: + BX_CHECK(false, "You should not be here!"); break; } @@ -760,7 +754,7 @@ Args::Args(int _argc, char** _argv) } else if (cmdLine.hasArg("noop") ) { - m_type = bgfx::RendererType::Null; + m_type = bgfx::RendererType::Noop; } else if (BX_ENABLED(BX_PLATFORM_WINDOWS) ) { diff --git a/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp b/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp index 37973b18e59..cba7fbbfea5 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp @@ -7,6 +7,13 @@ #if ENTRY_CONFIG_USE_GLFW +#define GLFW_INCLUDE_NONE +#include <GLFW/glfw3.h> + +#if GLFW_VERSION_MINOR < 2 +# error "GLFW 3.2 or later is required" +#endif // GLFW_VERSION_MINOR < 2 + #if BX_PLATFORM_LINUX || BX_PLATFORM_BSD # define GLFW_EXPOSE_NATIVE_X11 # define GLFW_EXPOSE_NATIVE_GLX @@ -17,16 +24,15 @@ # define GLFW_EXPOSE_NATIVE_WIN32 # define GLFW_EXPOSE_NATIVE_WGL #endif // - -#define GLFW_DLL -#include <GLFW/glfw3.h> #include <GLFW/glfw3native.h> #include <bgfx/bgfxplatform.h> -#include "dbg.h" -// This is just trivial implementation of GLFW3 integration. -// It's here just for testing purpose. +#include <bx/thread.h> +#include <bx/handlealloc.h> +#include <tinystl/string.h> + +#include "dbg.h" namespace entry { @@ -34,85 +40,700 @@ namespace entry { bgfx::PlatformData pd; # if BX_PLATFORM_LINUX || BX_PLATFORM_BSD - pd.ndt = glfwGetX11Display(); - pd.nwh = (void*)(uintptr_t)glfwGetGLXWindow(_window); - pd.context = glfwGetGLXContext(_window); + pd.ndt = glfwGetX11Display(); + pd.nwh = (void*)(uintptr_t)glfwGetX11Window(_window); # elif BX_PLATFORM_OSX - pd.ndt = NULL; - pd.nwh = glfwGetCocoaWindow(_window); - pd.context = glfwGetNSGLContext(_window); + pd.ndt = NULL; + pd.nwh = glfwGetCocoaWindow(_window); # elif BX_PLATFORM_WINDOWS - pd.ndt = NULL; - pd.nwh = glfwGetWin32Window(_window); - pd.context = NULL; + pd.ndt = NULL; + pd.nwh = glfwGetWin32Window(_window); + pd.context = NULL; # endif // BX_PLATFORM_WINDOWS - pd.backBuffer = NULL; + pd.backBuffer = NULL; pd.backBufferDS = NULL; bgfx::setPlatformData(pd); } + static uint8_t translateKeyModifiers(int _glfw) + { + uint8_t modifiers = 0; + + if (_glfw & GLFW_MOD_ALT) + { + modifiers |= Modifier::LeftAlt; + } + + if (_glfw & GLFW_MOD_CONTROL) + { + modifiers |= Modifier::LeftCtrl; + } + + if (_glfw & GLFW_MOD_SUPER) + { + modifiers |= Modifier::LeftMeta; + } + + if (_glfw & GLFW_MOD_SHIFT) + { + modifiers |= Modifier::LeftShift; + } + + return modifiers; + } + + static Key::Enum s_translateKey[GLFW_KEY_LAST + 1]; + + static Key::Enum translateKey(int _key) + { + return s_translateKey[_key]; + } + + static MouseButton::Enum translateMouseButton(int _button) + { + if (_button == GLFW_MOUSE_BUTTON_LEFT) + { + return MouseButton::Left; + } + else if (_button == GLFW_MOUSE_BUTTON_RIGHT) + { + return MouseButton::Right; + } + + return MouseButton::Middle; + } + + static GamepadAxis::Enum translateGamepadAxis(int _axis) + { + // HACK: Map XInput 360 controller until GLFW gamepad API + + static GamepadAxis::Enum axes[] = + { + GamepadAxis::LeftX, + GamepadAxis::LeftY, + GamepadAxis::RightX, + GamepadAxis::RightY, + GamepadAxis::LeftZ, + GamepadAxis::RightZ, + }; + return axes[_axis]; + } + + static Key::Enum translateGamepadButton(int _button) + { + // HACK: Map XInput 360 controller until GLFW gamepad API + + static Key::Enum buttons[] = + { + Key::GamepadA, + Key::GamepadB, + Key::GamepadX, + Key::GamepadY, + Key::GamepadShoulderL, + Key::GamepadShoulderR, + Key::GamepadBack, + Key::GamepadStart, + Key::GamepadThumbL, + Key::GamepadThumbR, + Key::GamepadUp, + Key::GamepadRight, + Key::GamepadDown, + Key::GamepadLeft, + Key::GamepadGuide, + }; + return buttons[_button]; + } + + struct GamepadGLFW + { + GamepadGLFW() + : m_connected(false) + { + memset(m_axes, 0, sizeof(m_axes)); + memset(m_buttons, 0, sizeof(m_buttons)); + } + + void update(EventQueue& _eventQueue) + { + int numButtons, numAxes; + const unsigned char* buttons = glfwGetJoystickButtons(m_handle.idx, &numButtons); + const float* axes = glfwGetJoystickAxes(m_handle.idx, &numAxes); + + if (NULL == buttons || NULL == axes) + { + return; + } + + if (numAxes > GamepadAxis::Count) + { + numAxes = GamepadAxis::Count; + } + + if (numButtons > Key::Count - Key::GamepadA) + { + numButtons = Key::Count - Key::GamepadA; + } + + WindowHandle defaultWindow = { 0 }; + + for (int ii = 0; ii < numAxes; ++ii) + { + GamepadAxis::Enum axis = translateGamepadAxis(ii); + int32_t value = (int32_t) (axes[ii] * 32768.f); + if (GamepadAxis::LeftY == axis || GamepadAxis::RightY == axis) + { + value = -value; + } + + if (m_axes[ii] != value) + { + m_axes[ii] = value; + _eventQueue.postAxisEvent(defaultWindow + , m_handle + , axis + , value); + } + } + + for (int ii = 0; ii < numButtons; ++ii) + { + Key::Enum key = translateGamepadButton(ii); + if (m_buttons[ii] != buttons[ii]) + { + m_buttons[ii] = buttons[ii]; + _eventQueue.postKeyEvent(defaultWindow + , key + , 0 + , buttons[ii] != 0); + } + } + } + + bool m_connected; + GamepadHandle m_handle; + int32_t m_axes[GamepadAxis::Count]; + uint8_t m_buttons[Key::Count - Key::GamepadA]; + }; + + struct MainThreadEntry + { + int m_argc; + char** m_argv; + + static int32_t threadFunc(void* _userData); + }; + + static void* glfwNativeWindowHandle(GLFWwindow* _window) + { +# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD + return (void*)(uintptr_t)glfwGetX11Window(_window); +# elif BX_PLATFORM_OSX + return glfwGetCocoaWindow(_window); +# elif BX_PLATFORM_WINDOWS + return glfwGetWin32Window(_window); +# endif // BX_PLATFORM_ + } + + enum MsgType + { + GLFW_WINDOW_CREATE, + GLFW_WINDOW_DESTROY, + GLFW_WINDOW_SET_TITLE, + GLFW_WINDOW_SET_POS, + GLFW_WINDOW_SET_SIZE, + GLFW_WINDOW_TOGGLE_FRAME, + GLFW_WINDOW_TOGGLE_FULL_SCREEN, + GLFW_WINDOW_MOUSE_LOCK, + }; + + struct Msg + { + Msg(MsgType _type) + : m_type(_type) + , m_x(0) + , m_y(0) + , m_width(0) + , m_height(0) + , m_value(false) + { + } + + MsgType m_type; + int32_t m_x; + int32_t m_y; + uint32_t m_width; + uint32_t m_height; + uint32_t m_flags; + bool m_value; + tinystl::string m_title; + WindowHandle m_handle; + }; + static void errorCb(int _error, const char* _description) { DBG("GLFW error %d: %s", _error, _description); } + static void joystickCb(int _jid, int _action); + + // Based on cutef8 by Jeff Bezanson (Public Domain) + static uint8_t encodeUTF8(uint8_t _chars[4], unsigned int _scancode) + { + uint8_t length = 0; + + if (_scancode < 0x80) + { + _chars[length++] = (char) _scancode; + } + else if (_scancode < 0x800) + { + _chars[length++] = (_scancode >> 6) | 0xc0; + _chars[length++] = (_scancode & 0x3f) | 0x80; + } + else if (_scancode < 0x10000) + { + _chars[length++] = (_scancode >> 12) | 0xe0; + _chars[length++] = ((_scancode >> 6) & 0x3f) | 0x80; + _chars[length++] = (_scancode & 0x3f) | 0x80; + } + else if (_scancode < 0x110000) + { + _chars[length++] = (_scancode >> 18) | 0xf0; + _chars[length++] = ((_scancode >> 12) & 0x3f) | 0x80; + _chars[length++] = ((_scancode >> 6) & 0x3f) | 0x80; + _chars[length++] = (_scancode & 0x3f) | 0x80; + } + + return length; + } + struct Context { Context() + : m_scrollPos(0.0) { + memset(s_translateKey, 0, sizeof(s_translateKey)); + s_translateKey[GLFW_KEY_ESCAPE] = Key::Esc; + s_translateKey[GLFW_KEY_ENTER] = Key::Return; + s_translateKey[GLFW_KEY_TAB] = Key::Tab; + s_translateKey[GLFW_KEY_BACKSPACE] = Key::Backspace; + s_translateKey[GLFW_KEY_SPACE] = Key::Space; + s_translateKey[GLFW_KEY_UP] = Key::Up; + s_translateKey[GLFW_KEY_DOWN] = Key::Down; + s_translateKey[GLFW_KEY_LEFT] = Key::Left; + s_translateKey[GLFW_KEY_RIGHT] = Key::Right; + s_translateKey[GLFW_KEY_PAGE_UP] = Key::PageUp; + s_translateKey[GLFW_KEY_PAGE_DOWN] = Key::PageDown; + s_translateKey[GLFW_KEY_HOME] = Key::Home; + s_translateKey[GLFW_KEY_END] = Key::End; + s_translateKey[GLFW_KEY_PRINT_SCREEN] = Key::Print; + s_translateKey[GLFW_KEY_KP_ADD] = Key::Plus; + s_translateKey[GLFW_KEY_KP_SUBTRACT] = Key::Minus; + s_translateKey[GLFW_KEY_F1] = Key::F1; + s_translateKey[GLFW_KEY_F2] = Key::F2; + s_translateKey[GLFW_KEY_F3] = Key::F3; + s_translateKey[GLFW_KEY_F4] = Key::F4; + s_translateKey[GLFW_KEY_F5] = Key::F5; + s_translateKey[GLFW_KEY_F6] = Key::F6; + s_translateKey[GLFW_KEY_F7] = Key::F7; + s_translateKey[GLFW_KEY_F8] = Key::F8; + s_translateKey[GLFW_KEY_F9] = Key::F9; + s_translateKey[GLFW_KEY_F10] = Key::F10; + s_translateKey[GLFW_KEY_F11] = Key::F11; + s_translateKey[GLFW_KEY_F12] = Key::F12; + s_translateKey[GLFW_KEY_KP_0] = Key::NumPad0; + s_translateKey[GLFW_KEY_KP_1] = Key::NumPad1; + s_translateKey[GLFW_KEY_KP_2] = Key::NumPad2; + s_translateKey[GLFW_KEY_KP_3] = Key::NumPad3; + s_translateKey[GLFW_KEY_KP_4] = Key::NumPad4; + s_translateKey[GLFW_KEY_KP_5] = Key::NumPad5; + s_translateKey[GLFW_KEY_KP_6] = Key::NumPad6; + s_translateKey[GLFW_KEY_KP_7] = Key::NumPad7; + s_translateKey[GLFW_KEY_KP_8] = Key::NumPad8; + s_translateKey[GLFW_KEY_KP_9] = Key::NumPad9; + s_translateKey[GLFW_KEY_0] = Key::Key0; + s_translateKey[GLFW_KEY_1] = Key::Key1; + s_translateKey[GLFW_KEY_2] = Key::Key2; + s_translateKey[GLFW_KEY_3] = Key::Key3; + s_translateKey[GLFW_KEY_4] = Key::Key4; + s_translateKey[GLFW_KEY_5] = Key::Key5; + s_translateKey[GLFW_KEY_6] = Key::Key6; + s_translateKey[GLFW_KEY_7] = Key::Key7; + s_translateKey[GLFW_KEY_8] = Key::Key8; + s_translateKey[GLFW_KEY_9] = Key::Key9; + s_translateKey[GLFW_KEY_A] = Key::KeyA; + s_translateKey[GLFW_KEY_B] = Key::KeyB; + s_translateKey[GLFW_KEY_C] = Key::KeyC; + s_translateKey[GLFW_KEY_D] = Key::KeyD; + s_translateKey[GLFW_KEY_E] = Key::KeyE; + s_translateKey[GLFW_KEY_F] = Key::KeyF; + s_translateKey[GLFW_KEY_G] = Key::KeyG; + s_translateKey[GLFW_KEY_H] = Key::KeyH; + s_translateKey[GLFW_KEY_I] = Key::KeyI; + s_translateKey[GLFW_KEY_J] = Key::KeyJ; + s_translateKey[GLFW_KEY_K] = Key::KeyK; + s_translateKey[GLFW_KEY_L] = Key::KeyL; + s_translateKey[GLFW_KEY_M] = Key::KeyM; + s_translateKey[GLFW_KEY_N] = Key::KeyN; + s_translateKey[GLFW_KEY_O] = Key::KeyO; + s_translateKey[GLFW_KEY_P] = Key::KeyP; + s_translateKey[GLFW_KEY_Q] = Key::KeyQ; + s_translateKey[GLFW_KEY_R] = Key::KeyR; + s_translateKey[GLFW_KEY_S] = Key::KeyS; + s_translateKey[GLFW_KEY_T] = Key::KeyT; + s_translateKey[GLFW_KEY_U] = Key::KeyU; + s_translateKey[GLFW_KEY_V] = Key::KeyV; + s_translateKey[GLFW_KEY_W] = Key::KeyW; + s_translateKey[GLFW_KEY_X] = Key::KeyX; + s_translateKey[GLFW_KEY_Y] = Key::KeyY; + s_translateKey[GLFW_KEY_Z] = Key::KeyZ; } int run(int _argc, char** _argv) { - glfwSetErrorCallback(errorCb); + m_mte.m_argc = _argc; + m_mte.m_argv = _argv; - glfwInit(); - m_window = glfwCreateWindow(1280, 720, "bgfx", NULL, NULL); - glfwMakeContextCurrent(m_window); - - glfwSetKeyCallback(m_window, keyCb); + glfwSetErrorCallback(errorCb); + glfwSetJoystickCallback(joystickCb); + + if (!glfwInit() ) + { + DBG("glfwInit failed!"); + return EXIT_FAILURE; + } + + glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); + + WindowHandle handle = { m_windowAlloc.alloc() }; + m_windows[0] = glfwCreateWindow(ENTRY_DEFAULT_WIDTH + , ENTRY_DEFAULT_HEIGHT + , "bgfx" + , NULL + , NULL + ); + + if (!m_windows[0]) + { + DBG("glfwCreateWindow failed!"); + glfwTerminate(); + return EXIT_FAILURE; + } + + glfwSetKeyCallback(m_windows[0], keyCb); + glfwSetCharCallback(m_windows[0], charCb); + glfwSetScrollCallback(m_windows[0], scrollCb); + glfwSetCursorPosCallback(m_windows[0], cursorPosCb); + glfwSetMouseButtonCallback(m_windows[0], mouseButtonCb); + glfwSetWindowSizeCallback(m_windows[0], windowSizeCb); + + glfwSetWindow(m_windows[0]); + m_eventQueue.postSizeEvent(handle, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT); + + for (uint32_t ii = 0; ii < ENTRY_CONFIG_MAX_GAMEPADS; ++ii) + { + m_gamepad[ii].m_handle.idx = ii; + if (glfwJoystickPresent(ii)) + { + m_gamepad[ii].m_connected = true; + m_eventQueue.postGamepadEvent(handle + , m_gamepad[ii].m_handle + , true); + } + } + + m_thread.init(MainThreadEntry::threadFunc, &m_mte); + + while (NULL != m_windows[0] + && !glfwWindowShouldClose(m_windows[0])) + { + glfwWaitEvents(); + + for (uint32_t ii = 0; ii < ENTRY_CONFIG_MAX_GAMEPADS; ++ii) + { + if (m_gamepad[ii].m_connected) + { + m_gamepad[ii].update(m_eventQueue); + } + } + + while (Msg* msg = m_msgs.pop()) + { + switch (msg->m_type) + { + case GLFW_WINDOW_CREATE: + { + GLFWwindow* window = glfwCreateWindow(msg->m_width + , msg->m_height + , msg->m_title.c_str() + , NULL + , NULL); + if (!window) + { + break; + } + + glfwSetWindowPos(window, msg->m_x, msg->m_y); + if (msg->m_flags & ENTRY_WINDOW_FLAG_ASPECT_RATIO) + { + glfwSetWindowAspectRatio(window, msg->m_width, msg->m_height); + } + + glfwSetKeyCallback(window, keyCb); + glfwSetCharCallback(window, charCb); + glfwSetScrollCallback(window, scrollCb); + glfwSetCursorPosCallback(window, cursorPosCb); + glfwSetMouseButtonCallback(window, mouseButtonCb); + glfwSetWindowSizeCallback(window, windowSizeCb); + + m_windows[msg->m_handle.idx] = window; + m_eventQueue.postSizeEvent(msg->m_handle, msg->m_width, msg->m_height); + m_eventQueue.postWindowEvent(msg->m_handle, glfwNativeWindowHandle(window)); + } + break; + + case GLFW_WINDOW_DESTROY: + { + if (isValid(msg->m_handle) ) + { + GLFWwindow* window = m_windows[msg->m_handle.idx]; + m_eventQueue.postWindowEvent(msg->m_handle); + glfwDestroyWindow(window); + m_windows[msg->m_handle.idx] = NULL; + } + } + break; + + case GLFW_WINDOW_SET_TITLE: + { + GLFWwindow* window = m_windows[msg->m_handle.idx]; + glfwSetWindowTitle(window, msg->m_title.c_str()); + } + break; + + case GLFW_WINDOW_SET_POS: + { + GLFWwindow* window = m_windows[msg->m_handle.idx]; + glfwSetWindowPos(window, msg->m_x, msg->m_y); + } + break; + + case GLFW_WINDOW_SET_SIZE: + { + GLFWwindow* window = m_windows[msg->m_handle.idx]; + glfwSetWindowSize(window, msg->m_width, msg->m_height); + } + break; + + case GLFW_WINDOW_TOGGLE_FRAME: + { + // Wait for glfwSetWindowDecorated to exist + } + break; + + case GLFW_WINDOW_TOGGLE_FULL_SCREEN: + { + GLFWwindow* window = m_windows[msg->m_handle.idx]; + if (glfwGetWindowMonitor(window)) + { + int width, height; + glfwGetWindowSize(window, &width, &height); + glfwSetWindowMonitor(window, NULL, 0, 0, width, height, 0); + } + else + { + GLFWmonitor* monitor = glfwGetPrimaryMonitor(); + if (NULL != monitor) + { + const GLFWvidmode* mode = glfwGetVideoMode(monitor); + glfwSetWindowMonitor(window + , monitor + , 0 + , 0 + , mode->width + , mode->height + , mode->refreshRate + ); + } + + } + } + break; + + case GLFW_WINDOW_MOUSE_LOCK: + { + GLFWwindow* window = m_windows[msg->m_handle.idx]; + if (msg->m_value) + { + glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); + } + else + { + glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); + } + } + break; + } + + delete msg; + } + } + + m_eventQueue.postExitEvent(); + m_thread.shutdown(); + + glfwDestroyWindow(m_windows[0]); + glfwTerminate(); - glfwSetWindow(m_window); - int result = main(_argc, _argv); + return m_thread.getExitCode(); + } - glfwDestroyWindow(m_window); - glfwTerminate(); - return result; + WindowHandle findHandle(GLFWwindow* _window) + { + bx::LwMutexScope scope(m_lock); + for (uint32_t ii = 0, num = m_windowAlloc.getNumHandles(); ii < num; ++ii) + { + uint16_t idx = m_windowAlloc.getHandleAt(ii); + if (_window == m_windows[idx]) + { + WindowHandle handle = { idx }; + return handle; + } + } + + WindowHandle invalid = { UINT16_MAX }; + return invalid; } static void keyCb(GLFWwindow* _window, int _key, int _scancode, int _action, int _mods); + static void charCb(GLFWwindow* _window, unsigned int _scancode); + static void scrollCb(GLFWwindow* _window, double _dx, double _dy); + static void cursorPosCb(GLFWwindow* _window, double _mx, double _my); + static void mouseButtonCb(GLFWwindow* _window, int _button, int _action, int _mods); + static void windowSizeCb(GLFWwindow* _window, int _width, int _height); + + MainThreadEntry m_mte; + bx::Thread m_thread; EventQueue m_eventQueue; + bx::LwMutex m_lock; + + GLFWwindow* m_windows[ENTRY_CONFIG_MAX_WINDOWS]; + bx::HandleAllocT<ENTRY_CONFIG_MAX_WINDOWS> m_windowAlloc; + + GamepadGLFW m_gamepad[ENTRY_CONFIG_MAX_GAMEPADS]; + + bx::SpScUnboundedQueueLf<Msg> m_msgs; - GLFWwindow* m_window; + double m_scrollPos; }; Context s_ctx; void Context::keyCb(GLFWwindow* _window, int _key, int _scancode, int _action, int _mods) { - BX_UNUSED(_window, _scancode, _mods); - if (_key == GLFW_KEY_Q - && _action == GLFW_PRESS - && _mods == GLFW_MOD_CONTROL) + BX_UNUSED(_scancode); + if (_key == GLFW_KEY_UNKNOWN) { - s_ctx.m_eventQueue.postExitEvent(); + return; } + WindowHandle handle = s_ctx.findHandle(_window); + int mods = translateKeyModifiers(_mods); + Key::Enum key = translateKey(_key); + bool down = (_action == GLFW_PRESS || _action == GLFW_REPEAT); + s_ctx.m_eventQueue.postKeyEvent(handle, key, mods, down); } - const Event* poll() + void Context::charCb(GLFWwindow* _window, unsigned int _scancode) { - glfwPollEvents(); + WindowHandle handle = s_ctx.findHandle(_window); + uint8_t chars[4]; + uint8_t length = encodeUTF8(chars, _scancode); + if (!length) + { + return; + } + + s_ctx.m_eventQueue.postCharEvent(handle, length, chars); + } + + void Context::scrollCb(GLFWwindow* _window, double _dx, double _dy) + { + BX_UNUSED(_dx); + WindowHandle handle = s_ctx.findHandle(_window); + double mx, my; + glfwGetCursorPos(_window, &mx, &my); + s_ctx.m_scrollPos += _dy; + s_ctx.m_eventQueue.postMouseEvent(handle + , (int32_t) mx + , (int32_t) my + , (int32_t) s_ctx.m_scrollPos + ); + } + + void Context::cursorPosCb(GLFWwindow* _window, double _mx, double _my) + { + WindowHandle handle = s_ctx.findHandle(_window); + s_ctx.m_eventQueue.postMouseEvent(handle + , (int32_t) _mx + , (int32_t) _my + , (int32_t) s_ctx.m_scrollPos + ); + } + + void Context::mouseButtonCb(GLFWwindow* _window, int _button, int _action, int _mods) + { + BX_UNUSED(_mods); + WindowHandle handle = s_ctx.findHandle(_window); + bool down = _action == GLFW_PRESS; + double mx, my; + glfwGetCursorPos(_window, &mx, &my); + s_ctx.m_eventQueue.postMouseEvent(handle + , (int32_t) mx + , (int32_t) my + , (int32_t) s_ctx.m_scrollPos + , translateMouseButton(_button) + , down + ); + } + + void Context::windowSizeCb(GLFWwindow* _window, int _width, int _height) + { + WindowHandle handle = s_ctx.findHandle(_window); + s_ctx.m_eventQueue.postSizeEvent(handle, _width, _height); + } - if (glfwWindowShouldClose(s_ctx.m_window) ) + static void joystickCb(int _jid, int _action) + { + if (_jid >= ENTRY_CONFIG_MAX_GAMEPADS) + { + return; + } + + WindowHandle defaultWindow = { 0 }; + GamepadHandle handle = { (uint16_t) _jid }; + + if (_action == GLFW_CONNECTED) + { + s_ctx.m_gamepad[_jid].m_connected = true; + s_ctx.m_eventQueue.postGamepadEvent(defaultWindow, handle, true); + } + else if (_action == GLFW_DISCONNECTED) { - s_ctx.m_eventQueue.postExitEvent(); + s_ctx.m_gamepad[_jid].m_connected = false; + s_ctx.m_eventQueue.postGamepadEvent(defaultWindow, handle, false); } + } + + const Event* poll() + { + glfwPostEmptyEvent(); return s_ctx.m_eventQueue.poll(); } const Event* poll(WindowHandle _handle) { + glfwPostEmptyEvent(); return s_ctx.m_eventQueue.poll(_handle); } @@ -123,44 +744,93 @@ namespace entry WindowHandle createWindow(int32_t _x, int32_t _y, uint32_t _width, uint32_t _height, uint32_t _flags, const char* _title) { - BX_UNUSED(_x, _y, _width, _height, _flags, _title); - WindowHandle handle = { UINT16_MAX }; - return handle; + Msg* msg = new Msg(GLFW_WINDOW_CREATE); + msg->m_x = _x; + msg->m_y = _y; + msg->m_width = _width; + msg->m_height = _height; + msg->m_flags = _flags; + msg->m_title = _title; + msg->m_handle.idx = s_ctx.m_windowAlloc.alloc(); + s_ctx.m_msgs.push(msg); + glfwPostEmptyEvent(); + return msg->m_handle; } void destroyWindow(WindowHandle _handle) { - BX_UNUSED(_handle); + Msg* msg = new Msg(GLFW_WINDOW_DESTROY); + msg->m_handle = _handle; + s_ctx.m_msgs.push(msg); + glfwPostEmptyEvent(); } void setWindowPos(WindowHandle _handle, int32_t _x, int32_t _y) { - BX_UNUSED(_handle, _x, _y); + Msg* msg = new Msg(GLFW_WINDOW_SET_POS); + msg->m_x = _x; + msg->m_y = _y; + msg->m_handle = _handle; + s_ctx.m_msgs.push(msg); + glfwPostEmptyEvent(); } void setWindowSize(WindowHandle _handle, uint32_t _width, uint32_t _height) { - BX_UNUSED(_handle, _width, _height); + Msg* msg = new Msg(GLFW_WINDOW_SET_SIZE); + msg->m_width = _width; + msg->m_height = _height; + msg->m_handle = _handle; + s_ctx.m_msgs.push(msg); + glfwPostEmptyEvent(); } void setWindowTitle(WindowHandle _handle, const char* _title) { - BX_UNUSED(_handle, _title); + Msg* msg = new Msg(GLFW_WINDOW_SET_TITLE); + msg->m_title = _title; + msg->m_handle = _handle; + s_ctx.m_msgs.push(msg); + glfwPostEmptyEvent(); } void toggleWindowFrame(WindowHandle _handle) { - BX_UNUSED(_handle); + Msg* msg = new Msg(GLFW_WINDOW_TOGGLE_FRAME); + msg->m_handle = _handle; + s_ctx.m_msgs.push(msg); + glfwPostEmptyEvent(); } void toggleFullscreen(WindowHandle _handle) { - BX_UNUSED(_handle); + Msg* msg = new Msg(GLFW_WINDOW_TOGGLE_FULL_SCREEN); + msg->m_handle = _handle; + s_ctx.m_msgs.push(msg); + glfwPostEmptyEvent(); } void setMouseLock(WindowHandle _handle, bool _lock) { - BX_UNUSED(_handle, _lock); + Msg* msg = new Msg(GLFW_WINDOW_MOUSE_LOCK); + msg->m_value = _lock; + msg->m_handle = _handle; + s_ctx.m_msgs.push(msg); + glfwPostEmptyEvent(); + } + + int32_t MainThreadEntry::threadFunc(void* _userData) + { + MainThreadEntry* self = (MainThreadEntry*)_userData; + int32_t result = main(self->m_argc, self->m_argv); + + // Destroy main window on exit... + Msg* msg = new Msg(GLFW_WINDOW_DESTROY); + msg->m_handle.idx = 0; + s_ctx.m_msgs.push(msg); + glfwPostEmptyEvent(); + + return result; } } diff --git a/3rdparty/bgfx/examples/common/entry/entry_p.h b/3rdparty/bgfx/examples/common/entry/entry_p.h index 971b880552d..cc1e892dbd4 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_p.h +++ b/3rdparty/bgfx/examples/common/entry/entry_p.h @@ -14,7 +14,7 @@ #include <string.h> // memcpy #ifndef ENTRY_CONFIG_USE_NOOP -# define ENTRY_CONFIG_USE_NOOP (BX_PLATFORM_QNX) +# define ENTRY_CONFIG_USE_NOOP (BX_PLATFORM_QNX || BX_PLATFORM_PS4) #endif // ENTRY_CONFIG_USE_NOOP #ifndef ENTRY_CONFIG_USE_SDL diff --git a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp index 29f8c65e881..401e971e6d4 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp @@ -34,11 +34,8 @@ namespace entry inline void winSetHwnd(::HWND _window) { bgfx::PlatformData pd; - pd.ndt = NULL; - pd.nwh = _window; - pd.context = NULL; - pd.backBuffer = NULL; - pd.backBufferDS = NULL; + memset(&pd, 0, sizeof(pd) ); + pd.nwh = _window; bgfx::setPlatformData(pd); } diff --git a/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h index 4bf319a2ecf..5d395db57d9 100644 --- a/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h +++ b/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h @@ -111,9 +111,9 @@ static const uint8_t fs_font_basic_dx11[617] = 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x01, 0x00, 0x00, // .r ......F...... 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, // .>....... }; -static const uint8_t fs_font_basic_mtl[950] = +static const uint8_t fs_font_basic_mtl[964] = { - 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xa7, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH...........us + 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xb5, 0x03, 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 { @@ -143,34 +143,35 @@ static const uint8_t fs_font_basic_mtl[950] = 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, 0x68, 0x61, 0x6c, 0x66, 0x20, // _mtl_o;. half 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, // rgba_1[4];. hal - 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, // f4 tmpvar_2;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, // mpvar_2 = half4( - 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, // s_texColor.sampl - 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // e(_mtlsmp_s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x29, 0x28, 0x5f, // olor, (float3)(_ - 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // mtl_i.v_texcoord - 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x20, // 0.xyz)));. int - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpvar_3;. tmpv - 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x74, 0x28, 0x28, 0x28, 0x5f, 0x6d, 0x74, // ar_3 = int(((_mt - 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, // l_i.v_texcoord0. - 0x77, 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, 0x29, 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, // w * 4.0) + 0.5)) - 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x30, 0x5d, 0x20, 0x3d, 0x20, // ;. rgba_1[0] = - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, // tmpvar_2.z;. rg - 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x31, 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ba_1[1] = tmpvar - 0x5f, 0x32, 0x2e, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x32, // _2.y;. rgba_1[2 - 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x3b, 0x0a, // ] = tmpvar_2.x;. - 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x33, 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, // rgba_1[3] = tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // pvar_2.w;. half - 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // 4 tmpvar_4;. tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, // pvar_4.xyz = hal - 0x66, 0x33, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // f3(_mtl_i.v_colo - 0x72, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // r0.xyz);. tmpva - 0x72, 0x5f, 0x34, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, // r_4.w = ((half)( - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, // _mtl_i.v_color0. - 0x77, 0x20, 0x2a, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x29, 0x72, 0x67, 0x62, 0x61, 0x5f, // w * (float)rgba_ - 0x31, 0x5b, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x5d, 0x29, 0x29, 0x3b, 0x0a, 0x20, // 1[tmpvar_3]));. - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, // _mtl_o.gl_FragC - 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, // olor = tmpvar_4; - 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // . return _mtl_o - 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ;.}... + 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, // f4 tmpvar_2 = 0; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x68, 0x61, // . tmpvar_2 = ha + 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, // lf4(s_texColor.s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, // ample(_mtlsmp_s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, // texColor, (float + 0x33, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // 3)(_mtl_i.v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // oord0.xyz)));. + 0x69, 0x6e, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x30, // int tmpvar_3 = 0 + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x69, // ;. tmpvar_3 = i + 0x6e, 0x74, 0x28, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, // nt(((_mtl_i.v_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, 0x29, // xcoord0.w * 4.0) + 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, // + 0.5));. rgba + 0x5f, 0x31, 0x5b, 0x30, 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // _1[0] = tmpvar_2 + 0x2e, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x31, 0x5d, 0x20, // .z;. rgba_1[1] + 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x79, 0x3b, 0x0a, 0x20, 0x20, // = tmpvar_2.y;. + 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x32, 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // rgba_1[2] = tmpv + 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, // ar_2.x;. rgba_1 + 0x5b, 0x33, 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, // [3] = tmpvar_2.w + 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ;. half4 tmpvar + 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // _4 = 0;. tmpvar + 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x28, 0x5f, // _4.xyz = half3(_ + 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x78, // mtl_i.v_color0.x + 0x79, 0x7a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, // yz);. tmpvar_4. + 0x77, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // w = ((half)(_mtl + 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x77, 0x20, 0x2a, 0x20, // _i.v_color0.w * + 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x29, 0x28, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x74, // (float)(rgba_1[t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x5d, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // mpvar_3])));. _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, // mtl_o.gl_FragCol + 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // or = tmpvar_4;. + 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/font/fs_font_distance_field.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h index c3d5b95de55..ca380f1ffd5 100644 --- a/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h +++ b/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h @@ -185,9 +185,9 @@ static const uint8_t fs_font_distance_field_dx11[1053] = 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, // .6...r ......F.. 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, // .....>....... }; -static const uint8_t fs_font_distance_field_mtl[1493] = +static const uint8_t fs_font_distance_field_mtl[1539] = { - 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xc6, 0x05, 0x00, 0x00, 0x75, 0x73, // FSH...........us + 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xf4, 0x05, 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 { @@ -217,68 +217,71 @@ static const uint8_t fs_font_distance_field_mtl[1493] = 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, 0x68, 0x61, 0x6c, 0x66, 0x20, // _mtl_o;. half 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, // rgba_1[4];. hal - 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, // f4 tmpvar_2;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, // mpvar_2 = half4( - 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, // s_texColor.sampl - 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // e(_mtlsmp_s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x29, 0x28, 0x5f, // olor, (float3)(_ - 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // mtl_i.v_texcoord - 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x6e, 0x74, 0x20, // 0.xyz)));. int - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpvar_3;. tmpv - 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x74, 0x28, 0x28, 0x28, 0x5f, 0x6d, 0x74, // ar_3 = int(((_mt - 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, // l_i.v_texcoord0. - 0x77, 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, 0x29, 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, // w * 4.0) + 0.5)) - 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x30, 0x5d, 0x20, 0x3d, 0x20, // ;. rgba_1[0] = - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, // tmpvar_2.z;. rg - 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x31, 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ba_1[1] = tmpvar - 0x5f, 0x32, 0x2e, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x32, // _2.y;. rgba_1[2 - 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x3b, 0x0a, // ] = tmpvar_2.x;. - 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x33, 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, // rgba_1[3] = tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // pvar_2.w;. floa - 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, // t3 tmpvar_4;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x64, 0x66, 0x64, 0x78, 0x28, 0x5f, // mpvar_4 = dfdx(_ - 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // mtl_i.v_texcoord - 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, // 0.xyz);. float3 - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_5;. tmp + 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, // f4 tmpvar_2 = 0; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x68, 0x61, // . tmpvar_2 = ha + 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, // lf4(s_texColor.s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, // ample(_mtlsmp_s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, // texColor, (float + 0x33, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // 3)(_mtl_i.v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // oord0.xyz)));. + 0x69, 0x6e, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x30, // int tmpvar_3 = 0 + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x69, // ;. tmpvar_3 = i + 0x6e, 0x74, 0x28, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, // nt(((_mtl_i.v_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, 0x29, // xcoord0.w * 4.0) + 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, // + 0.5));. rgba + 0x5f, 0x31, 0x5b, 0x30, 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // _1[0] = tmpvar_2 + 0x2e, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x31, 0x5d, 0x20, // .z;. rgba_1[1] + 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x79, 0x3b, 0x0a, 0x20, 0x20, // = tmpvar_2.y;. + 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x32, 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // rgba_1[2] = tmpv + 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, // ar_2.x;. rgba_1 + 0x5b, 0x33, 0x5d, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, // [3] = tmpvar_2.w + 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ;. float3 tmpva + 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // r_4 = 0;. tmpva + 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x64, 0x66, 0x64, 0x78, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // r_4 = dfdx(_mtl_ + 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, // i.v_texcoord0.xy + 0x7a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, // z);. float3 tmp + 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // var_5 = 0;. tmp 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x64, 0x66, 0x64, 0x79, 0x28, 0x2d, 0x5f, 0x6d, // var_5 = dfdy(-_m 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tl_i.v_texcoord0 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, // .xyz);. float t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // mpvar_6;. tmpva - 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x38, 0x2e, 0x30, 0x20, 0x2a, 0x20, 0x28, 0x73, 0x71, // r_6 = (8.0 * (sq - 0x72, 0x74, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, // rt(. dot (tmp - 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, // var_4, tmpvar_4) - 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2b, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x0a, 0x20, 0x20, 0x20, // . ) + sqrt(. - 0x20, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x2c, 0x20, // dot (tmpvar_5, - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x29, 0x3b, // tmpvar_5). ))); - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x37, // . float edge0_7 - 0x3b, 0x0a, 0x20, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x28, 0x30, // ;. edge0_7 = (0 - 0x2e, 0x35, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x3b, 0x0a, // .5 - tmpvar_6);. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x65, 0x64, 0x67, 0x65, 0x31, 0x5f, 0x38, 0x3b, // float edge1_8; - 0x0a, 0x20, 0x20, 0x65, 0x64, 0x67, 0x65, 0x31, 0x5f, 0x38, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, // . edge1_8 = (0. - 0x35, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x3b, 0x0a, 0x20, // 5 + tmpvar_6);. - 0x20, 0x68, 0x61, 0x6c, 0x66, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x3b, 0x0a, // half tmpvar_9;. + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, // mpvar_6 = 0;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x38, 0x2e, 0x30, 0x20, 0x2a, // mpvar_6 = (8.0 * + 0x20, 0x28, 0x73, 0x71, 0x72, 0x74, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x6f, 0x74, 0x20, // (sqrt(. dot + 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // (tmpvar_4, tmpva + 0x72, 0x5f, 0x34, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2b, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, // r_4). ) + sqrt( + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // . dot (tmpvar + 0x5f, 0x35, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x0a, 0x20, 0x20, // _5, tmpvar_5). + 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x65, 0x64, 0x67, // )));. float edg + 0x65, 0x30, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x65, 0x64, 0x67, 0x65, // e0_7 = 0;. edge + 0x30, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x35, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, // 0_7 = (0.5 - tmp + 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, // var_6);. float + 0x65, 0x64, 0x67, 0x65, 0x31, 0x5f, 0x38, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x65, // edge1_8 = 0;. e + 0x64, 0x67, 0x65, 0x31, 0x5f, 0x38, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x35, 0x20, 0x2b, 0x20, // dge1_8 = (0.5 + + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, // tmpvar_6);. hal + 0x66, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // f tmpvar_9 = 0;. 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x63, 0x6c, 0x61, // tmpvar_9 = cla 0x6d, 0x70, 0x20, 0x28, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, // mp (((half)((flo - 0x61, 0x74, 0x29, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, // at)((half)((floa - 0x74, 0x29, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // t)rgba_1[tmpvar_ - 0x33, 0x5d, 0x20, 0x2d, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x37, 0x29, 0x29, 0x20, 0x2f, // 3] - edge0_7)) / - 0x20, 0x28, 0x65, 0x64, 0x67, 0x65, 0x31, 0x5f, 0x38, 0x20, 0x2d, 0x20, 0x65, 0x64, 0x67, 0x65, // (edge1_8 - edge - 0x30, 0x5f, 0x37, 0x29, 0x29, 0x29, 0x2c, 0x20, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x30, 0x2e, // 0_7))), (half)0. - 0x30, 0x2c, 0x20, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, // 0, (half)1.0);. - 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, // half4 tmpvar_10 - 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x78, 0x79, // ;. tmpvar_10.xy - 0x7a, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // z = half3(_mtl_i - 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, 0x0a, // .v_color0.xyz);. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x77, 0x20, 0x3d, 0x20, // tmpvar_10.w = - 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, // ((half)(_mtl_i.v - 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x28, 0x66, 0x6c, 0x6f, // _color0.w * (flo - 0x61, 0x74, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x20, 0x2a, 0x20, 0x28, // at)(tmpvar_9 * ( - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x20, 0x2a, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, // tmpvar_9 * . - 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x33, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x28, 0x28, 0x68, // ((half)3.0 - ((h - 0x61, 0x6c, 0x66, 0x29, 0x32, 0x2e, 0x30, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // alf)2.0 * tmpvar - 0x5f, 0x39, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // _9)). ))));. _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, // mtl_o.gl_FragCol - 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, // or = tmpvar_10;. - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // return _mtl_o; - 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... + 0x61, 0x74, 0x29, 0x28, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, // at)(((half)((flo + 0x61, 0x74, 0x29, 0x28, 0x72, 0x67, 0x62, 0x61, 0x5f, 0x31, 0x5b, 0x74, 0x6d, 0x70, 0x76, 0x61, // at)(rgba_1[tmpva + 0x72, 0x5f, 0x33, 0x5d, 0x29, 0x20, 0x2d, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x37, 0x29, // r_3]) - edge0_7) + 0x29, 0x29, 0x20, 0x2f, 0x20, 0x28, 0x65, 0x64, 0x67, 0x65, 0x31, 0x5f, 0x38, 0x20, 0x2d, 0x20, // )) / (edge1_8 - + 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x37, 0x29, 0x29, 0x29, 0x2c, 0x20, 0x28, 0x68, 0x61, 0x6c, // edge0_7))), (hal + 0x66, 0x29, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x31, 0x2e, 0x30, // f)0.0, (half)1.0 + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // );. half4 tmpva + 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // r_10 = 0;. tmpv + 0x61, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, // ar_10.xyz = half + 0x33, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // 3(_mtl_i.v_color + 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // 0.xyz);. tmpvar + 0x5f, 0x31, 0x30, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, // _10.w = ((half)( + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, // _mtl_i.v_color0. + 0x77, 0x20, 0x2a, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x29, 0x28, 0x28, 0x74, 0x6d, 0x70, // w * (float)((tmp + 0x76, 0x61, 0x72, 0x5f, 0x39, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_9 * (tmpvar_ + 0x39, 0x20, 0x2a, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, // 9 * . ((half) + 0x28, 0x33, 0x2e, 0x30, 0x29, 0x20, 0x2d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, // (3.0) - ((half)( + 0x32, 0x2e, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x29, // 2.0) * tmpvar_9) + 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // ). )))));. _mt + 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // l_o.gl_FragColor + 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, // = tmpvar_10;. + 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/font/fs_font_distance_field_subpixel.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h index f338948d50c..d4342e4fbdc 100644 --- a/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h +++ b/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h @@ -226,9 +226,9 @@ static const uint8_t fs_font_distance_field_subpixel_dx11[1305] = 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x1f, 0x10, 0x00, 0x01, 0x00, 0x00, // .F.............. 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, // .>....... }; -static const uint8_t fs_font_distance_field_subpixel_mtl[1946] = +static const uint8_t fs_font_distance_field_subpixel_mtl[2024] = { - 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x8b, 0x07, 0x00, 0x00, 0x75, 0x73, // FSH...........us + 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xd9, 0x07, 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 { @@ -257,97 +257,102 @@ static const uint8_t fs_font_distance_field_subpixel_mtl[1946] = 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, 0x69, 0x6e, 0x74, 0x20, 0x74, // _mtl_o;. int 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, 0x69, 0x6e, 0x74, 0x28, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // r_1 = int(((_mtl - 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x77, // _i.v_texcoord0.w - 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, 0x29, 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x3b, // * 4.0) + 0.5)); - 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, 0x78, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, // dfdx(_mtl_i.v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, 0x0a, 0x20, // excoord0.xyz);. - 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, // float3 tmpvar_3 - 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x64, // ;. tmpvar_3 = d - 0x66, 0x64, 0x79, 0x28, 0x2d, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, // fdy(-_mtl_i.v_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, 0x0a, 0x20, 0x20, // xcoord0.xyz);. - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, // float3 tmpvar_4; + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, // mpvar_1 = 0;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x69, 0x6e, 0x74, 0x28, 0x28, 0x28, // mpvar_1 = int((( + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // _mtl_i.v_texcoor + 0x64, 0x30, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x34, 0x2e, 0x30, 0x29, 0x20, 0x2b, 0x20, 0x30, 0x2e, // d0.w * 4.0) + 0. + 0x35, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, // 5));. float3 tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // pvar_2 = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x64, 0x66, 0x64, 0x78, 0x28, 0x5f, 0x6d, // pvar_2 = dfdx(_m + 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tl_i.v_texcoord0 + 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, // .xyz);. float3 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, // tmpvar_3 = 0;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x64, 0x66, 0x64, 0x79, 0x28, // tmpvar_3 = dfdy( + 0x2d, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // -_mtl_i.v_texcoo + 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // rd0.xyz);. floa + 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x30, 0x3b, // t3 tmpvar_4 = 0; 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x28, 0x30, // . tmpvar_4 = (0 0x2e, 0x31, 0x36, 0x36, 0x36, 0x36, 0x37, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // .166667 * tmpvar 0x5f, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, // _2);. float3 tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_5;. tmpvar - 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, // _5 = (_mtl_i.v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2d, 0x20, 0x74, // excoord0.xyz - t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // mpvar_4);. floa - 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x74, // t3 tmpvar_6;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // mpvar_6 = (_mtl_ - 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, // i.v_texcoord0.xy - 0x7a, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x3b, 0x0a, 0x20, // z + tmpvar_4);. - 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x3b, // half4 tmpvar_7; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x68, 0x61, // . tmpvar_7 = ha - 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, // lf4(s_texColor.s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, // ample(_mtlsmp_s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, // texColor, (float - 0x33, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x29, 0x3b, 0x0a, // 3)(tmpvar_5)));. - 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x3b, // half tmpvar_8; + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // pvar_5 = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // pvar_5 = (_mtl_i + 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x7a, // .v_texcoord0.xyz + 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x3b, 0x0a, 0x20, 0x20, // - tmpvar_4);. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x20, // float3 tmpvar_6 + 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x20, // = 0;. tmpvar_6 + 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // = (_mtl_i.v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, // oord0.xyz + tmpv + 0x61, 0x72, 0x5f, 0x34, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, // ar_4);. half4 t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, // mpvar_7 = 0;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, // mpvar_7 = half4( + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, // s_texColor.sampl + 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // e(_mtlsmp_s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x29, 0x28, 0x74, // olor, (float3)(t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, // mpvar_5)));. ha + 0x6c, 0x66, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x20, 0x3d, 0x20, 0x30, 0x3b, // lf tmpvar_8 = 0; 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x20, 0x3d, 0x20, 0x28, 0x28, // . tmpvar_8 = (( 0x68, 0x61, 0x6c, 0x66, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x2e, 0x7a, 0x79, // half)tmpvar_7.zy 0x78, 0x77, 0x5b, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x5d, 0x29, 0x3b, 0x0a, 0x20, // xw[tmpvar_1]);. - 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x3b, // half4 tmpvar_9; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x68, 0x61, // . tmpvar_9 = ha - 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, // lf4(s_texColor.s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, // ample(_mtlsmp_s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, // texColor, (float - 0x33, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, 0x29, 0x29, 0x3b, 0x0a, // 3)(tmpvar_6)));. - 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, // half tmpvar_10 - 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, // ;. tmpvar_10 = - 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x2e, // ((half)tmpvar_9. - 0x7a, 0x79, 0x78, 0x77, 0x5b, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x5d, 0x29, 0x3b, // zyxw[tmpvar_1]); - 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // . half tmpvar_1 - 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, // 1;. tmpvar_11 = - 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x30, 0x2e, 0x35, 0x20, 0x2a, 0x20, 0x28, 0x74, // ((half)0.5 * (t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // mpvar_8 + tmpvar - 0x5f, 0x31, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, // _10));. float t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // mpvar_12;. tmpv - 0x61, 0x72, 0x5f, 0x31, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x38, 0x2e, 0x30, 0x20, 0x2a, 0x20, 0x28, // ar_12 = (8.0 * ( - 0x73, 0x71, 0x72, 0x74, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, // sqrt(. dot (t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // mpvar_2, tmpvar_ - 0x32, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2b, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x0a, 0x20, // 2). ) + sqrt(. - 0x20, 0x20, 0x20, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, // dot (tmpvar_3 - 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, // , tmpvar_3). )) - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // );. half3 tmpva - 0x72, 0x5f, 0x31, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // r_13;. tmpvar_1 - 0x33, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x3b, 0x0a, // 3.x = tmpvar_8;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x79, 0x20, 0x3d, 0x20, // tmpvar_13.y = - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_11;. tmp - 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // var_13.z = tmpva - 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x65, 0x64, // r_10;. float ed - 0x67, 0x65, 0x30, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, // ge0_14;. edge0_ - 0x31, 0x34, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x35, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, // 14 = (0.5 - tmpv - 0x61, 0x72, 0x5f, 0x31, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, // ar_12);. float - 0x65, 0x64, 0x67, 0x65, 0x31, 0x5f, 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x65, 0x64, 0x67, 0x65, // edge1_15;. edge - 0x31, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x35, 0x20, 0x2b, 0x20, 0x74, 0x6d, // 1_15 = (0.5 + tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // pvar_12);. half - 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x74, // 3 tmpvar_16;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x20, 0x3d, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, // mpvar_16 = clamp - 0x20, 0x28, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, // (((half3)((floa - 0x74, 0x33, 0x29, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, // t3)((half3)((flo - 0x61, 0x74, 0x33, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x2d, 0x20, // at3)tmpvar_13 - - 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x31, 0x34, 0x29, 0x29, 0x20, 0x2f, 0x20, 0x28, 0x65, 0x64, // edge0_14)) / (ed - 0x67, 0x65, 0x31, 0x5f, 0x31, 0x35, 0x20, 0x2d, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x31, // ge1_15 - edge0_1 - 0x34, 0x29, 0x29, 0x29, 0x2c, 0x20, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x30, 0x2e, 0x30, 0x2c, // 4))), (half)0.0, - 0x20, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // (half)1.0);. _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, // mtl_o.gl_FragCol - 0x6f, 0x72, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x33, // or.xyz = ((half3 - 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // )((float3)(tmpva - 0x72, 0x5f, 0x31, 0x36, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // r_16 * (tmpvar_1 - 0x36, 0x20, 0x2a, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, // 6 * . ((half) - 0x33, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x32, 0x2e, 0x30, // 3.0 - ((half)2.0 - 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x29, 0x29, 0x0a, 0x20, // * tmpvar_16)). - 0x20, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, // )) * _mtl_i.v_c - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // olor0.w));. _mt - 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // l_o.gl_FragColor - 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x28, 0x66, 0x6c, // .w = ((half)((fl - 0x6f, 0x61, 0x74, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x2a, 0x20, // oat)tmpvar_11 * - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, // _mtl_i.v_color0. - 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // w));. return _m - 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}... + 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x20, // half4 tmpvar_9 + 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x20, // = 0;. tmpvar_9 + 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, // = half4(s_texCol + 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, // or.sample(_mtlsm + 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, // p_s_texColor, (f + 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x29, // loat3)(tmpvar_6) + 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ));. half tmpva + 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // r_10 = 0;. tmpv + 0x61, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x74, // ar_10 = ((half)t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x2e, 0x7a, 0x79, 0x78, 0x77, 0x5b, 0x74, 0x6d, 0x70, // mpvar_9.zyxw[tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x5d, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x20, // var_1]);. half + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // tmpvar_11 = 0;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, // tmpvar_11 = ((h + 0x61, 0x6c, 0x66, 0x29, 0x28, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, // alf)(0.5) * (tmp + 0x76, 0x61, 0x72, 0x5f, 0x38, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // var_8 + tmpvar_1 + 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, // 0));. float tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // var_12 = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x38, 0x2e, 0x30, 0x20, 0x2a, // pvar_12 = (8.0 * + 0x20, 0x28, 0x73, 0x71, 0x72, 0x74, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x6f, 0x74, 0x20, // (sqrt(. dot + 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // (tmpvar_2, tmpva + 0x72, 0x5f, 0x32, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2b, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, // r_2). ) + sqrt( + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // . dot (tmpvar + 0x5f, 0x33, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x0a, 0x20, 0x20, // _3, tmpvar_3). + 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x20, 0x74, 0x6d, 0x70, // )));. half3 tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // var_13 = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // pvar_13.x = tmpv + 0x61, 0x72, 0x5f, 0x38, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ar_8;. tmpvar_1 + 0x33, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x3b, // 3.y = tmpvar_11; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x7a, 0x20, 0x3d, // . tmpvar_13.z = + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // tmpvar_10;. fl + 0x6f, 0x61, 0x74, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x31, 0x34, 0x20, 0x3d, 0x20, 0x30, // oat edge0_14 = 0 + 0x3b, 0x0a, 0x20, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x31, 0x34, 0x20, 0x3d, 0x20, 0x28, // ;. edge0_14 = ( + 0x30, 0x2e, 0x35, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x29, // 0.5 - tmpvar_12) + 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x65, 0x64, 0x67, 0x65, 0x31, 0x5f, // ;. float edge1_ + 0x31, 0x35, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x65, 0x64, 0x67, 0x65, 0x31, 0x5f, // 15 = 0;. edge1_ + 0x31, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x35, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, // 15 = (0.5 + tmpv + 0x61, 0x72, 0x5f, 0x31, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x20, // ar_12);. half3 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // tmpvar_16 = 0;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x20, 0x3d, 0x20, 0x63, 0x6c, 0x61, // tmpvar_16 = cla + 0x6d, 0x70, 0x20, 0x28, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x29, 0x28, 0x28, 0x66, 0x6c, // mp (((half3)((fl + 0x6f, 0x61, 0x74, 0x33, 0x29, 0x28, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x29, 0x28, 0x28, // oat3)(((half3)(( + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // float3)(tmpvar_1 + 0x33, 0x29, 0x20, 0x2d, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x31, 0x34, 0x29, 0x29, 0x29, // 3) - edge0_14))) + 0x20, 0x2f, 0x20, 0x28, 0x65, 0x64, 0x67, 0x65, 0x31, 0x5f, 0x31, 0x35, 0x20, 0x2d, 0x20, 0x65, // / (edge1_15 - e + 0x64, 0x67, 0x65, 0x30, 0x5f, 0x31, 0x34, 0x29, 0x29, 0x29, 0x2c, 0x20, 0x28, 0x68, 0x61, 0x6c, // dge0_14))), (hal + 0x66, 0x29, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x31, 0x2e, 0x30, // f)0.0, (half)1.0 + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // );. _mtl_o.gl_F + 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, // ragColor.xyz = ( + 0x28, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x29, // (half3)((float3) + 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x20, 0x2a, 0x20, 0x28, 0x74, // ((tmpvar_16 * (t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x20, 0x2a, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, // mpvar_16 * . + 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x33, 0x2e, 0x30, 0x29, 0x20, 0x2d, 0x20, 0x28, // ((half)(3.0) - ( + 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x32, 0x2e, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x74, 0x6d, // (half)(2.0) * tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x29, 0x20, // pvar_16)). ))) + 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // * _mtl_i.v_color + 0x30, 0x2e, 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // 0.w));. _mtl_o. + 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x77, 0x20, 0x3d, // gl_FragColor.w = + 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x29, // ((half)((float) + 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, // (tmpvar_11) * _m + 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x77, 0x29, // tl_i.v_color0.w) + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // );. return _mtl + 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _o;.}... }; diff --git a/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h index 884743b9973..4f76356dd89 100644 --- a/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h +++ b/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h @@ -93,9 +93,9 @@ static const uint8_t vs_font_basic_dx11[580] = 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_font_basic_mtl[764] = +static const uint8_t vs_font_basic_mtl[768] = { - 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xed, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH...........us + 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xf1, 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 { @@ -128,19 +128,19 @@ static const uint8_t vs_font_basic_mtl[764] = 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // ]).{. xlatMtlSh 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // aderOutput _mtl_ 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // o;. float4 tmpv - 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ar_1;. tmpvar_1 - 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, // .zw = float2(0.0 - 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // , 1.0);. tmpvar - 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, // _1.xy = _mtl_i.a - 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // _position;. _mt - 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, // l_o.gl_Position - 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // = (_mtl_u.u_mode - 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, // lViewProj * tmpv - 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // ar_1);. _mtl_o. - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // v_texcoord0 = _m - 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tl_i.a_texcoord0 - 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ;. _mtl_o.v_col - 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, // or0 = _mtl_i.a_c - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, // olor0;. return - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... + 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // ar_1 = 0;. tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, // ar_1.zw = float2 + 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // (0.0, 1.0);. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // pvar_1.xy = _mtl + 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, // _i.a_position;. + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // _mtl_o.gl_Posit + 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // ion = (_mtl_u.u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, // modelViewProj * + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // tmpvar_1);. _mt + 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // l_o.v_texcoord0 + 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // = _mtl_i.a_texco + 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, // ord0;. _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, 0x72, 0x65, 0x74, // .a_color0;. ret + 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // urn _mtl_o;.}... }; diff --git a/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h index ebc7589c408..b80e1f370b7 100644 --- a/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h +++ b/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h @@ -93,9 +93,9 @@ static const uint8_t vs_font_distance_field_dx11[580] = 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_font_distance_field_mtl[764] = +static const uint8_t vs_font_distance_field_mtl[768] = { - 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xed, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH...........us + 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xf1, 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 { @@ -128,19 +128,19 @@ static const uint8_t vs_font_distance_field_mtl[764] = 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // ]).{. xlatMtlSh 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // aderOutput _mtl_ 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // o;. float4 tmpv - 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ar_1;. tmpvar_1 - 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, // .zw = float2(0.0 - 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // , 1.0);. tmpvar - 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, // _1.xy = _mtl_i.a - 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // _position;. _mt - 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, // l_o.gl_Position - 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // = (_mtl_u.u_mode - 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, // lViewProj * tmpv - 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // ar_1);. _mtl_o. - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // v_texcoord0 = _m - 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tl_i.a_texcoord0 - 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ;. _mtl_o.v_col - 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, // or0 = _mtl_i.a_c - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, // olor0;. return - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... + 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // ar_1 = 0;. tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, // ar_1.zw = float2 + 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // (0.0, 1.0);. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // pvar_1.xy = _mtl + 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, // _i.a_position;. + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // _mtl_o.gl_Posit + 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // ion = (_mtl_u.u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, // modelViewProj * + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // tmpvar_1);. _mt + 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // l_o.v_texcoord0 + 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // = _mtl_i.a_texco + 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, // ord0;. _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, 0x72, 0x65, 0x74, // .a_color0;. ret + 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // urn _mtl_o;.}... }; diff --git a/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h index 6b0d75236d6..b8e42e15644 100644 --- a/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h +++ b/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h @@ -93,9 +93,9 @@ static const uint8_t vs_font_distance_field_subpixel_dx11[580] = 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_font_distance_field_subpixel_mtl[764] = +static const uint8_t vs_font_distance_field_subpixel_mtl[768] = { - 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xed, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH...........us + 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xf1, 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 { @@ -128,19 +128,19 @@ static const uint8_t vs_font_distance_field_subpixel_mtl[764] = 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // ]).{. xlatMtlSh 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // aderOutput _mtl_ 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // o;. float4 tmpv - 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ar_1;. tmpvar_1 - 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, // .zw = float2(0.0 - 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // , 1.0);. tmpvar - 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, // _1.xy = _mtl_i.a - 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // _position;. _mt - 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, // l_o.gl_Position - 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // = (_mtl_u.u_mode - 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, // lViewProj * tmpv - 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // ar_1);. _mtl_o. - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // v_texcoord0 = _m - 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tl_i.a_texcoord0 - 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ;. _mtl_o.v_col - 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, // or0 = _mtl_i.a_c - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, // olor0;. return - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... + 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // ar_1 = 0;. tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, // ar_1.zw = float2 + 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // (0.0, 1.0);. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // pvar_1.xy = _mtl + 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, // _i.a_position;. + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // _mtl_o.gl_Posit + 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // ion = (_mtl_u.u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, // modelViewProj * + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // tmpvar_1);. _mt + 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, // l_o.v_texcoord0 + 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // = _mtl_i.a_texco + 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, // ord0;. _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, 0x72, 0x65, 0x74, // .a_color0;. ret + 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // urn _mtl_o;.}... }; diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h index f274ada3d9c..2edc92825de 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h @@ -83,9 +83,9 @@ static const uint8_t fs_imgui_cubemap_dx11[441] = 0x00, 0x01, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x01, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x4c, // ..@....L?.@....L 0x3e, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // >>....... }; -static const uint8_t fs_imgui_cubemap_mtl[812] = +static const uint8_t fs_imgui_cubemap_mtl[824] = { - 0x46, 0x53, 0x48, 0x04, 0xe3, 0xc2, 0x5c, 0x65, 0x00, 0x00, 0x1d, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH....e......us + 0x46, 0x53, 0x48, 0x04, 0xe3, 0xc2, 0x5c, 0x65, 0x00, 0x00, 0x29, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH....e..)...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 { @@ -114,26 +114,27 @@ static const uint8_t fs_imgui_cubemap_mtl[812] = 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, // [sampler(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, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, // half4 tmpvar_1; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, // . tmpvar_1 = ha - 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, // lf4(s_texColor.s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, // ample(_mtlsmp_s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, // texColor, (float - 0x33, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, // 3)(_mtl_i.v_norm - 0x61, 0x6c, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // al), level(_mtl_ - 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, // u.u_imageLodEnab - 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // led.x)));. floa - 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // t tmpvar_2;. tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, // pvar_2 = (0.2 + - 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // (0.8 * _mtl_u.u_ - 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, // imageLodEnabled. - 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, // y));. half4 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, 0x31, // 3.xyz = tmpvar_1 - 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, // .xyz;. tmpvar_3 - 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // .w = half(tmpvar - 0x5f, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, // _2);. _mtl_o.gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp - 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, // var_3;. return - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... + 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, // half4 tmpvar_1 + 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, // = 0;. tmpvar_1 + 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, // = half4(s_texCol + 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, // or.sample(_mtlsm + 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, // p_s_texColor, (f + 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, // loat3)(_mtl_i.v_ + 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, // normal), level(_ + 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, 0x78, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // Enabled.x)));. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, // float tmpvar_2 = + 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, // 0;. tmpvar_2 = + 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, 0x20, 0x3d, 0x20, // alf4 tmpvar_3 = + 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, // 0;. tmpvar_3.xy + 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, // z = tmpvar_1.xyz + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, // ;. tmpvar_3.w = + 0x20, 0x68, 0x61, 0x6c, 0x66, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x3b, // half(tmpvar_2); + 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . _mtl_o.gl_Fra + 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // gColor = tmpvar_ + 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // 3;. return _mtl + 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _o;.}... }; diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h index 618848fa5a1..ec7f01dfbf1 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h @@ -83,9 +83,9 @@ static const uint8_t fs_imgui_image_dx11[445] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x01, 0x40, 0x00, // ......@....L?.@. 0x00, 0xcd, 0xcc, 0x4c, 0x3e, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // ...L>>....... }; -static const uint8_t fs_imgui_image_mtl[816] = +static const uint8_t fs_imgui_image_mtl[828] = { - 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x21, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH.o.><..!...us + 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x2d, 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 { @@ -115,25 +115,26 @@ static const uint8_t fs_imgui_image_mtl[816] = 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // {. xlatMtlShade 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // rOutput _mtl_o;. 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // half4 tmpvar_1 - 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, // ;. tmpvar_1 = h - 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, // alf4(s_texColor. - 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, // sample(_mtlsmp_s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, // _texColor, (floa - 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, // t2)(_mtl_i.v_tex - 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, // coord0), level(_ - 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, 0x78, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // Enabled.x)));. - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, // float tmpvar_2;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, // tmpvar_2 = (0. - 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // 2 + (0.8 * _mtl_ - 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, // u.u_imageLodEnab - 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // led.y));. half4 - 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, 0x74, 0x6d, 0x70, 0x76, // var_3.xyz = tmpv - 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // ar_1.xyz;. tmpv - 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x28, 0x74, 0x6d, // ar_3.w = half(tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // pvar_2);. _mtl_ - 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, // o.gl_FragColor = - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, // tmpvar_3;. ret - 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // urn _mtl_o;.}... + 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // = 0;. tmpvar_1 + 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // = half4(s_texCo + 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, // lor.sample(_mtls + 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, // mp_s_texColor, ( + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, // float2)(_mtl_i.v + 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, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ;. float tmpvar + 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // _2 = 0;. tmpvar + 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, // _2 = (0.2 + (0.8 + 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // * _mtl_u.u_imag + 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, // eLodEnabled.y)); + 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // . half4 tmpvar_ + 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 3 = 0;. tmpvar_ + 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // 3.xyz = tmpvar_1 + 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, // .xyz;. tmpvar_3 + 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // .w = half(tmpvar + 0x5f, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, // _2);. _mtl_o.gl + 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp + 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, // var_3;. return + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... }; 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 11044efd9ae..30f63088565 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 @@ -103,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[1005] = +static const uint8_t fs_imgui_image_swizz_mtl[1025] = { - 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0xde, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH.o.><......us + 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0xf2, 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 { @@ -136,36 +136,38 @@ static const uint8_t fs_imgui_image_swizz_mtl[1005] = 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // ]]).{. xlatMtlS 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // haderOutput _mtl 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // _o;. half4 tmpv - 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ar_1;. tmpvar_1 - 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // = half4(s_texCo - 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, // lor.sample(_mtls - 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, // mp_s_texColor, ( - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, // float2)(_mtl_i.v - 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, 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, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // alf3 tmpvar_4;. + 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // ar_1 = 0;. tmpv + 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, // ar_1 = half4(s_t + 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, // exColor.sample(_ + 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, // mtlsmp_s_texColo + 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // r, (float2)(_mtl + 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x2c, // _i.v_texcoord0), + 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // level(_mtl_u.u_ + 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, // imageLodEnabled. + 0x78, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x20, 0x74, 0x6d, 0x70, // x)));. half tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // var_2 = 0;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x64, // var_2 = ((half)d + 0x6f, 0x74, 0x20, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x74, 0x6d, 0x70, 0x76, // ot ((float4)tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x73, // ar_1, _mtl_u.u_s + 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // wizzle));. floa + 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // t tmpvar_3 = 0;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, // tmpvar_3 = (0. + 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // 2 + (0.8 * _mtl_ + 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, // u.u_imageLodEnab + 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x33, // led.y));. half3 + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // tmpvar_4 = 0;. 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;.}... + 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // 4 tmpvar_5 = 0;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, // tmpvar_5.xyz = + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_4;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x35, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x28, 0x74, // var_5.w = half(t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // mpvar_3);. _mtl + 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // _o.gl_FragColor + 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, // = tmpvar_5;. re + 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // turn _mtl_o;.}.. + 0x00, // . }; diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h index 14d7aef3e0b..a5994c03c1d 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h @@ -122,9 +122,9 @@ static const uint8_t fs_imgui_latlong_dx11[617] = 0x00, 0x01, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x01, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x4c, // ..@....L?.@....L 0x3e, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // >>....... }; -static const uint8_t fs_imgui_latlong_mtl[1091] = +static const uint8_t fs_imgui_latlong_mtl[1115] = { - 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x34, 0x04, 0x00, 0x00, 0x75, 0x73, // FSH.o.><..4...us + 0x46, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x4c, 0x04, 0x00, 0x00, 0x75, 0x73, // FSH.o.><..L...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 { @@ -154,24 +154,25 @@ static const uint8_t fs_imgui_latlong_mtl[1091] = 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, 0x33, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, // ;. float3 resul - 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, // t_1;. float tmp - 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_2;. tmpvar_ - 0x32, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, // 2 = (_mtl_i.v_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x36, 0x2e, 0x32, 0x38, // xcoord0.x * 6.28 - 0x33, 0x31, 0x38, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, // 3185);. float t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // mpvar_3;. tmpva - 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, // r_3 = (_mtl_i.v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, // texcoord0.y * 3. - 0x31, 0x34, 0x31, 0x35, 0x39, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, // 141593);. resul - 0x74, 0x5f, 0x31, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, // t_1.x = (-(sin(t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x6e, 0x28, // mpvar_3)) * sin( - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, // tmpvar_2));. re - 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, // sult_1.y = cos(t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, // mpvar_3);. resu - 0x6c, 0x74, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, // lt_1.z = (-(sin( - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6f, 0x73, // tmpvar_3)) * cos - 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, // (tmpvar_2));. h - 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // alf4 tmpvar_4;. + 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // t_1 = 0;. float + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // tmpvar_2 = 0;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, // tmpvar_2 = (_mt + 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, // l_i.v_texcoord0. + 0x78, 0x20, 0x2a, 0x20, 0x36, 0x2e, 0x32, 0x38, 0x33, 0x31, 0x38, 0x35, 0x29, 0x3b, 0x0a, 0x20, // x * 6.283185);. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, // float tmpvar_3 + 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, // = 0;. tmpvar_3 + 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // = (_mtl_i.v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, 0x31, 0x34, 0x31, 0x35, // oord0.y * 3.1415 + 0x39, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2e, // 93);. result_1. + 0x78, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // x = (-(sin(tmpva + 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, 0x76, // r_3)) * sin(tmpv + 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // ar_2));. result + 0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // _1.y = cos(tmpva + 0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, // r_3);. result_1 + 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, 0x76, // .z = (-(sin(tmpv + 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, 0x70, // ar_3)) * cos(tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // var_2));. half4 + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // tmpvar_4 = 0;. 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, // tmpvar_4 = half 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, // 4(s_texColor.sam 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, // ple(_mtlsmp_s_te @@ -180,17 +181,17 @@ static const uint8_t fs_imgui_latlong_mtl[1091] = 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, // l(_mtl_u.u_image 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x29, 0x29, 0x3b, // LodEnabled.x))); 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // . float tmpvar_ - 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, 0x20, // 5;. tmpvar_5 = - 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, 0x5f, 0x6d, // (0.2 + (0.8 * _m - 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, // tl_u.u_imageLodE - 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, // nabled.y));. ha - 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x3b, 0x0a, 0x20, 0x20, // lf4 tmpvar_6;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, // tmpvar_6.xyz = t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, // mpvar_4.xyz;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, // mpvar_6.w = half - 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, // (tmpvar_5);. _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, 0x36, 0x3b, 0x0a, 0x20, 0x20, // r = tmpvar_6;. - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, // return _mtl_o;.} - 0x0a, 0x0a, 0x00, // ... + 0x35, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 5 = 0;. tmpvar_ + 0x35, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, // 5 = (0.2 + (0.8 + 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, // * _mtl_u.u_image + 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, // LodEnabled.y));. + 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, // half4 tmpvar_6 + 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, // = 0;. tmpvar_6 + 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, // .xyz = tmpvar_4. + 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x36, 0x2e, // xyz;. tmpvar_6. + 0x77, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // w = half(tmpvar_ + 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, // 5);. _mtl_o.gl_ + 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // FragColor = tmpv + 0x61, 0x72, 0x5f, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, // ar_6;. return _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mtl_o;.}... }; diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h index 5fc0768dd13..21ca1430bca 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h @@ -70,9 +70,9 @@ static const uint8_t fs_imgui_texture_dx11[421] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, // .....F.......>.. 0x01, 0x00, 0x00, 0x00, 0x00, // ..... }; -static const uint8_t fs_imgui_texture_mtl[744] = +static const uint8_t fs_imgui_texture_mtl[754] = { - 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xd9, 0x02, 0x00, 0x00, 0x75, 0x73, // FSH...........us + 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xe3, 0x02, 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 { @@ -101,22 +101,23 @@ static const uint8_t fs_imgui_texture_mtl[744] = 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // (0)]]).{. xlatM 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, // tlShaderOutput _ 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, // mtl_o;. half4 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, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, // r_1 = half4(s_te - 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, // xColor.sample(_m - 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // tlsmp_s_texColor - 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // , (float2)(_mtl_ - 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x29, 0x29, // i.v_texcoord0))) - 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ;. half4 tmpvar - 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, // _2;. tmpvar_2.x - 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x33, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // yz = half3(_mtl_ - 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, // i.v_color0.xyz); - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, // . tmpvar_2.w = - 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, // ((half)(_mtl_i.v - 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x77, 0x20, 0x2a, 0x20, 0x28, 0x66, 0x6c, 0x6f, // _color0.w * (flo - 0x61, 0x74, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x29, 0x29, 0x3b, // at)tmpvar_1.x)); - 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . _mtl_o.gl_Fra - 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // gColor = tmpvar_ - 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // 2;. return _mtl - 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _o;.}... + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, // mpvar_1 = 0;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, // mpvar_1 = half4( + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, // s_texColor.sampl + 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // e(_mtlsmp_s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, // olor, (float2)(_ + 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // mtl_i.v_texcoord + 0x30, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, // 0)));. half4 tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // pvar_2 = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, // pvar_2.xyz = hal + 0x66, 0x33, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // f3(_mtl_i.v_colo + 0x72, 0x30, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // r0.xyz);. tmpva + 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, // r_2.w = ((half)( + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, // _mtl_i.v_color0. + 0x77, 0x20, 0x2a, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, // w * (float)(tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // ar_1.x)));. _mt + 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // l_o.gl_FragColor + 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x72, // = tmpvar_2;. 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/imgui/fs_ocornut_imgui.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h index bbfafdf88d5..64ccf1537e0 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h @@ -63,9 +63,9 @@ static const uint8_t fs_ocornut_imgui_dx11[396] = 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, // ....F.......F... 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, // ....>....... }; -static const uint8_t fs_ocornut_imgui_mtl[634] = +static const uint8_t fs_ocornut_imgui_mtl[640] = { - 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x6b, 0x02, 0x00, 0x00, 0x75, 0x73, // FSH.......k...us + 0x46, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x71, 0x02, 0x00, 0x00, 0x75, 0x73, // FSH.......q...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 { @@ -93,16 +93,16 @@ static const uint8_t fs_ocornut_imgui_mtl[634] = 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, // ampler(0)]]).{. 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, // xlatMtlShaderOu 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x68, // tput _mtl_o;. h - 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, // alf4 tmpvar_1;. - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, // tmpvar_1 = half - 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, // 4(s_tex.sample(_ - 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x66, // mtlsmp_s_tex, (f - 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, // loat2)(_mtl_i.v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // texcoord0)));. - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, // _mtl_o.gl_FragCo - 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, // lor = ((half4)(( - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, // float4)tmpvar_1 - 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // * _mtl_i.v_color - 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // 0));. return _m - 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}... + 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // alf4 tmpvar_1 = + 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // 0;. tmpvar_1 = + 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, // half4(s_tex.samp + 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, // le(_mtlsmp_s_tex + 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // , (float2)(_mtl_ + 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x29, 0x29, // i.v_texcoord0))) + 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. _mtl_o.gl_Fr + 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, // agColor = ((half + 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, // 4)((float4)(tmpv + 0x61, 0x72, 0x5f, 0x31, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, // ar_1) * _mtl_i.v + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, // _color0));. ret + 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // urn _mtl_o;.}... }; diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.h b/3rdparty/bgfx/examples/common/imgui/imgui.h index 3b0fc54f875..d6602d13595 100644 --- a/3rdparty/bgfx/examples/common/imgui/imgui.h +++ b/3rdparty/bgfx/examples/common/imgui/imgui.h @@ -28,7 +28,6 @@ #include <bgfx/bgfx.h> #include <ocornut-imgui/imgui.h> -#include <ocornut-imgui/imgui_wm.h> #include <iconfontheaders/icons_kenney.h> #include <iconfontheaders/icons_font_awesome.h> diff --git a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp index f95ab4ef7b8..0fee4cdbc24 100644 --- a/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp +++ b/3rdparty/bgfx/examples/common/imgui/ocornut_imgui.cpp @@ -8,7 +8,6 @@ #include <bx/fpumath.h> #include <bx/timer.h> #include <ocornut-imgui/imgui.h> -#include <ocornut-imgui/imgui_wm.h> #include "imgui.h" #include "ocornut_imgui.h" @@ -50,181 +49,6 @@ static FontRangeMerge s_fontRangeMerge[] = { s_iconsFontAwesomeTtf, sizeof(s_iconsFontAwesomeTtf), { ICON_MIN_FA, ICON_MAX_FA, 0 } }, }; -class PlatformWindow : public ImGuiWM::PlatformWindow -{ - typedef ImGuiWM::PlatformWindow Super; - -public: - PlatformWindow(bool _mainWindow, bool _isDragWindow) - : ImGuiWM::PlatformWindow(_mainWindow, _isDragWindow) - , m_pos(0.0f, 0.0f) - , m_size(0.0f, 0.0f) - , m_drag(false) - { -#if USE_ENTRY - if (!_mainWindow - && !_isDragWindow) - { - m_window = entry::createWindow(0, 0, 640, 380); - extern void pwToWindow(entry::WindowHandle _handle, class PlatformWindow* _pw); - pwToWindow(m_window, this); - } - else - { - m_window.idx = 0; - } -#endif // USE_ENTRY - } - - virtual ~PlatformWindow() - { -#if USE_ENTRY - if (0 != m_window.idx) - { - entry::destroyWindow(m_window); - } -#endif // USE_ENTRY - } - - virtual bool Init(ImGuiWM::PlatformWindow* /*_parent*/) BX_OVERRIDE - { - return true; - } - - virtual const ImVec2& GetPosition() const BX_OVERRIDE - { - return m_pos; - } - - virtual const ImVec2& GetSize() const BX_OVERRIDE - { - return m_size; - } - - virtual void Show() BX_OVERRIDE - { - } - - virtual void Hide() BX_OVERRIDE - { - } - - virtual void SetSize(const ImVec2& _size) BX_OVERRIDE - { -#if USE_ENTRY - if (0 != m_window.idx - && m_size.x != _size.x - && m_size.y != _size.y) - { - entry::setWindowSize(m_window, int32_t(_size.x), int32_t(_size.y) ); - } -#endif // USE_ENTRY - - m_size = _size; - } - - virtual void SetPosition(const ImVec2& _pos) BX_OVERRIDE - { -#if USE_ENTRY - if (0 != m_window.idx - && m_pos.x != _pos.x - && m_pos.y != _pos.y) - { - entry::setWindowPos(m_window, int32_t(_pos.x), int32_t(_pos.y) ); - } -#endif // USE_ENTRY - - m_pos = _pos; - } - - virtual void SetTitle(const char* _title) BX_OVERRIDE - { -#if USE_ENTRY - entry::setWindowTitle(m_window, _title); -#else - BX_UNUSED(_title); -#endif // USE_ENTRY - } - - virtual void PreUpdate() BX_OVERRIDE - { - } - - virtual void PaintBegin() BX_OVERRIDE; - virtual void Paint() BX_OVERRIDE; - virtual void PaintEnd() BX_OVERRIDE; - - virtual void Destroy() BX_OVERRIDE - { - } - - virtual void StartDrag() BX_OVERRIDE - { - m_drag = true; - } - - virtual void StopDrag() BX_OVERRIDE - { - m_drag = false; - } - - virtual bool IsDraging() BX_OVERRIDE - { - return m_drag; - } - -private: - ImVec2 m_pos; - ImVec2 m_size; - bool m_drag; - -#if USE_ENTRY - entry::WindowHandle m_window; -#endif // USE_ENTRY -}; - -class WindowManager : public ImGuiWM::WindowManager -{ - typedef ImGuiWM::WindowManager Super; - -public: - WindowManager() - { - } - - virtual ~WindowManager() - { - } - -protected: - virtual ImGuiWM::PlatformWindow* CreatePlatformWindow(bool _main, ImGuiWM::PlatformWindow* _parent, bool _isDragWindow) BX_OVERRIDE - { -#if USE_ENTRY -#else - if (!_main - && !_isDragWindow) - { - return NULL; - } -#endif // USE_ENTRY - - PlatformWindow* window = new (ImGui::MemAlloc(sizeof(PlatformWindow) ) ) PlatformWindow(_main, _isDragWindow); - window->Init(_parent); - return static_cast<ImGuiWM::PlatformWindow*>(window); - } - - virtual void LogFormatted(const char* _str) BX_OVERRIDE - { - BX_TRACE("%s", _str); BX_UNUSED(_str); - } - - virtual void InternalRun() BX_OVERRIDE - { - PreUpdate(); - Update(); - } -}; - struct OcornutImguiContext { static void* memAlloc(size_t _size); @@ -483,60 +307,12 @@ struct OcornutImguiContext , bgfx::copy(data, width*height*4) ); - m_wm = BX_NEW(m_allocator, WindowManager); - m_wm->Init(); - -#if 0 - { - class Window : public ImGuiWM::Window - { - public: - Window(const char* _title) - : ImGuiWM::Window() - { - SetTitle(_title); - } - - virtual void OnGui() BX_OVERRIDE - { - } - }; - - class WindowX : public ImGuiWM::Window - { - public: - WindowX(const char* _title) - : ImGuiWM::Window() - { - SetTitle(_title); - } - - virtual void OnGui() BX_OVERRIDE - { -#if defined(SCI_NAMESPACE) && 0 - bool opened = true; - ImGuiScintilla("Scintilla Editor", &opened, ImVec2(640.0f, 480.0f) ); -#endif // 0 - } - }; - - Window* w0 = new Window("test"); - WindowX* w1 = new WindowX("Scintilla"); - Window* w2 = new Window("xyzw"); - Window* w3 = new Window("0123"); - - m_wm->Dock(w0); - m_wm->DockWith(w1, w0, ImGuiWM::E_DOCK_ORIENTATION_RIGHT); - m_wm->DockWith(w2, w1, ImGuiWM::E_DOCK_ORIENTATION_BOTTOM); - m_wm->DockWith(w3, w0, ImGuiWM::E_DOCK_ORIENTATION_BOTTOM); - } -#endif // 0 + ImGui::InitDockContext(); } void destroy() { - m_wm->Exit(); - BX_DELETE(m_allocator, m_wm); + ImGui::ShutdownDockContext(); ImGui::Shutdown(); bgfx::destroyUniform(s_tex); @@ -656,36 +432,10 @@ struct OcornutImguiContext ImGui::NewFrame(); ImGuizmo::BeginFrame(); ImGui::PushStyleVar(ImGuiStyleVar_ViewId, (float)_viewId); - -#if 0 - ImGui::ShowTestWindow(); //Debug only. -#endif // 0 - -#if 0 - { - static ImGui::MemoryEditor me; - bool open = true; - if (ImGui::Begin("HexII", &open)) - { - me.Draw(s_iconsKenneyTtf, sizeof(s_iconsKenneyTtf) ); - - ImGui::End(); - } - } -#endif // 0 - -#if 0 - { - extern void ShowExampleAppCustomNodeGraph(bool* opened); - bool opened = true; - ShowExampleAppCustomNodeGraph(&opened); - } -#endif // 0 } void endFrame() { - m_wm->Run(); ImGui::PopStyleVar(1); ImGui::Render(); } @@ -696,114 +446,13 @@ struct OcornutImguiContext bgfx::TextureHandle m_texture; bgfx::UniformHandle s_tex; ImFont* m_font[ImGui::Font::Count]; - WindowManager* m_wm; int64_t m_last; int32_t m_lastScroll; uint8_t m_viewId; - -#if USE_ENTRY - struct Window - { - Window() - { - m_fbh.idx = bgfx::invalidHandle; - } - - entry::WindowState m_state; - PlatformWindow* m_pw; - bgfx::FrameBufferHandle m_fbh; - uint8_t m_viewId; - }; - - Window m_window[16]; -#endif // USE_ENTRY }; static OcornutImguiContext s_ctx; -void PlatformWindow::PaintBegin() -{ -#if USE_ENTRY - if (!m_bIsDragWindow) - { - OcornutImguiContext::Window& win = s_ctx.m_window[m_window.idx]; - entry::WindowState& state = win.m_state; - ImGuiIO& io = ImGui::GetIO(); - io.MousePos = ImVec2((float)state.m_mouse.m_mx, (float)state.m_mouse.m_my); - io.MouseDown[0] = !!state.m_mouse.m_buttons[entry::MouseButton::Left]; - io.MouseDown[1] = !!state.m_mouse.m_buttons[entry::MouseButton::Right]; - io.MouseDown[2] = !!state.m_mouse.m_buttons[entry::MouseButton::Middle]; - io.MouseWheel = float(state.m_mouse.m_mz); - - ImGui::PushStyleVar(ImGuiStyleVar_ViewId, (float)win.m_viewId); - } -#endif // USE_ENTRY -} - -void PlatformWindow::Paint() -{ - if (!m_bIsDragWindow) - { - Super::Paint(); - } -} - -void PlatformWindow::PaintEnd() -{ -#if USE_ENTRY - if (!m_bIsDragWindow) - { - ImGui::PopStyleVar(1); - - entry::WindowState& state = s_ctx.m_window[0].m_state; - ImGuiIO& io = ImGui::GetIO(); - io.MousePos = ImVec2((float)state.m_mouse.m_mx, (float)state.m_mouse.m_my); - io.MouseDown[0] = !!state.m_mouse.m_buttons[entry::MouseButton::Left]; - io.MouseDown[1] = !!state.m_mouse.m_buttons[entry::MouseButton::Right]; - io.MouseDown[2] = !!state.m_mouse.m_buttons[entry::MouseButton::Middle]; - io.MouseWheel = float(state.m_mouse.m_mz); - } -#endif // USE_ENTRY -} - -#if USE_ENTRY - -void pwToWindow(entry::WindowHandle _handle, PlatformWindow* _pw) -{ - s_ctx.m_window[_handle.idx].m_pw = _pw; -} - -void imguiUpdateWindow(const entry::WindowState& _state) -{ - OcornutImguiContext::Window& window = s_ctx.m_window[_state.m_handle.idx]; - - if (window.m_state.m_nwh != _state.m_nwh - || (window.m_state.m_width != _state.m_width - || window.m_state.m_height != _state.m_height) ) - { - // When window changes size or native window handle changed - // frame buffer must be recreated. - if (bgfx::isValid(window.m_fbh) ) - { - bgfx::destroyFrameBuffer(window.m_fbh); - window.m_fbh.idx = bgfx::invalidHandle; - } - - if (NULL != _state.m_nwh) - { - window.m_fbh = bgfx::createFrameBuffer(_state.m_nwh, _state.m_width, _state.m_height); - window.m_viewId = 200 + _state.m_handle.idx; - } - else - { - window.m_viewId = s_ctx.m_viewId; - } - } - - memcpy(&window.m_state, &_state, sizeof(entry::WindowState) ); -} -#endif // USE_ENTRY - void* OcornutImguiContext::memAlloc(size_t _size) { return BX_ALLOC(s_ctx.m_allocator, _size); diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h index 1b8aa95fb28..b95eeff9b0f 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h @@ -77,9 +77,9 @@ static const uint8_t vs_imgui_color_dx11[465] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x02, 0x05, 0x00, 0x01, 0x00, 0x40, // .....>.........@ 0x00, // . }; -static const uint8_t vs_imgui_color_mtl[653] = +static const uint8_t vs_imgui_color_mtl[657] = { - 0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x7e, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH....I..~...us + 0x56, 0x53, 0x48, 0x04, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x82, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH....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 { @@ -108,16 +108,17 @@ static const uint8_t vs_imgui_color_mtl[653] = 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // .{. xlatMtlShad 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // erOutput _mtl_o; 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // . float4 tmpvar - 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, // _1;. tmpvar_1.z - 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, // w = float2(0.0, - 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // 1.0);. tmpvar_1 - 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, // .xy = _mtl_i.a_p - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, // osition.xy;. _m - 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // tl_o.gl_Position - 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x76, 0x69, 0x65, // = (_mtl_u.u_vie - 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // wProj * tmpvar_1 - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, // );. _mtl_o.v_co - 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, // lor0 = _mtl_i.a_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, // color0;. return - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... + 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // _1 = 0;. tmpvar + 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, // _1.zw = float2(0 + 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // .0, 1.0);. tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // ar_1.xy = _mtl_i + 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x3b, 0x0a, // .a_position.xy;. + 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, // _mtl_o.gl_Posi + 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // tion = (_mtl_u.u + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, // _viewProj * tmpv + 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // ar_1);. _mtl_o. + 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // v_color0 = _mtl_ + 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, // i.a_color0;. re + 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // turn _mtl_o;.}.. + 0x00, // . }; diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h index 154c4e416e3..bf04d4761d9 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h @@ -81,9 +81,9 @@ static const uint8_t vs_imgui_cubemap_dx11[510] = 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x00, 0x00, // ..r ......F..... 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x02, 0x02, 0x00, 0x01, 0x00, 0x40, 0x00, // ..>.........@. }; -static const uint8_t vs_imgui_cubemap_mtl[651] = +static const uint8_t vs_imgui_cubemap_mtl[655] = { - 0x56, 0x53, 0x48, 0x04, 0xe3, 0xc2, 0x5c, 0x65, 0x00, 0x00, 0x7c, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH....e..|...us + 0x56, 0x53, 0x48, 0x04, 0xe3, 0xc2, 0x5c, 0x65, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH....e......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 { @@ -112,16 +112,16 @@ static const uint8_t vs_imgui_cubemap_mtl[651] = 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, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x3d, // mtl_o.v_normal = - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, // _mtl_i.a_normal - 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, // .xyz;. return _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mtl_o;.}... + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, // mpvar_1 = 0;. 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, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // = _mtl_i.a_posit + 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, // ion;. _mtl_o.gl + 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, // _Position = (_mt + 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // l_u.u_modelViewP + 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, // roj * tmpvar_1); + 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, // . _mtl_o.v_norm + 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x6e, 0x6f, // al = _mtl_i.a_no + 0x72, 0x6d, 0x61, 0x6c, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, // rmal.xyz;. retu + 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // rn _mtl_o;.}... }; diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h index f3711052b08..28a90e34f18 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h @@ -77,9 +77,9 @@ static const uint8_t vs_imgui_image_dx11[473] = 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, // .....F.......>.. 0x01, 0x00, 0x02, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // .......@. }; -static const uint8_t vs_imgui_image_mtl[665] = +static const uint8_t vs_imgui_image_mtl[669] = { - 0x56, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH.o.><......us + 0x56, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x8e, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH.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 { @@ -108,17 +108,17 @@ static const uint8_t vs_imgui_image_mtl[665] = 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // (0)]]).{. xlatM 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, // tlShaderOutput _ 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // mtl_o;. float4 - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpvar_1;. tmpv - 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, // ar_1.zw = float2 - 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // (0.0, 1.0);. tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // pvar_1.xy = _mtl - 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, // _i.a_position.xy - 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, // ;. _mtl_o.gl_Po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // sition = (_mtl_u - 0x2e, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, // .u_viewProj * tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // pvar_1);. _mtl_ - 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, // o.v_texcoord0 = - 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;.}... + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, // tmpvar_1 = 0;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, // tmpvar_1.zw = fl + 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, // oat2(0.0, 1.0);. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, // tmpvar_1.xy = + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // _mtl_i.a_positio + 0x6e, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, // n.xy;. _mtl_o.g + 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, // l_Position = (_m + 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, // tl_u.u_viewProj + 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, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // mtl_o.v_texcoord + 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, // 0 = _mtl_i.a_tex + 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, // coord0;. return + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... }; diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h index 4cf8bb28af7..20124379dc4 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h @@ -83,9 +83,9 @@ static const uint8_t vs_imgui_latlong_dx11[518] = 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x02, // ..F.......>..... 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // ....@. }; -static const uint8_t vs_imgui_latlong_mtl[659] = +static const uint8_t vs_imgui_latlong_mtl[663] = { - 0x56, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x84, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH.o.><......us + 0x56, 0x53, 0x48, 0x04, 0x6f, 0x1e, 0x3e, 0x3c, 0x00, 0x00, 0x88, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH.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 { @@ -114,17 +114,17 @@ static const uint8_t vs_imgui_latlong_mtl[659] = 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, // uffer(0)]]).{. 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // put _mtl_o;. fl - 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, // oat4 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, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, // z = _mtl_i.a_pos - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // ition;. _mtl_o. - 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, // gl_Position = (_ - 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // mtl_u.u_modelVie - 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // wProj * tmpvar_1 - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, // );. _mtl_o.v_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // xcoord0 = _mtl_i - 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, // .a_texcoord0;. - 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, // return _mtl_o;.} - 0x0a, 0x0a, 0x00, // ... + 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // oat4 tmpvar_1 = + 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, // 0;. tmpvar_1.w + 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // = 1.0;. tmpvar_ + 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, // 1.xyz = _mtl_i.a + 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // _position;. _mt + 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, // l_o.gl_Position + 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // = (_mtl_u.u_mode + 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, // lViewProj * tmpv + 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // ar_1);. _mtl_o. + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // v_texcoord0 = _m + 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tl_i.a_texcoord0 + 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/imgui/vs_imgui_texture.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h index 34ab3e2da96..c8fe4aa61e8 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h @@ -91,9 +91,9 @@ static const uint8_t vs_imgui_texture_dx11[575] = 0x05, 0x32, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, // .2 ......F...... 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // .>...........@. }; -static const uint8_t vs_imgui_texture_mtl[757] = +static const uint8_t vs_imgui_texture_mtl[761] = { - 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xe6, 0x02, 0x00, 0x00, 0x75, 0x73, // VSH...........us + 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xea, 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 { @@ -125,20 +125,20 @@ static const uint8_t vs_imgui_texture_mtl[757] = 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, // [buffer(0)]]).{. 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // xlatMtlShaderO 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, // utput _mtl_o;. - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, // float4 tmpvar_1; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, // . tmpvar_1.zw = - 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, // float2(0.0, 1.0 - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, // );. tmpvar_1.xy - 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, // = _mtl_i.a_posi - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // tion.xy;. _mtl_ - 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, // o.gl_Position = - 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, // (_mtl_u.u_viewPr - 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, // oj * tmpvar_1);. - 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // _mtl_o.v_texco - 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, // ord0 = _mtl_i.a_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // texcoord0;. _mt - 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x5f, // l_o.v_color0 = _ - 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, // mtl_i.a_color0;. - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // return _mtl_o; - 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, // float4 tmpvar_1 + 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // = 0;. tmpvar_1. + 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, // zw = float2(0.0, + 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 1.0);. tmpvar_ + 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, // 1.xy = _mtl_i.a_ + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // position.xy;. _ + 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, 0x76, 0x69, // n = (_mtl_u.u_vi + 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // ewProj * tmpvar_ + 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, // 1);. _mtl_o.v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // excoord0 = _mtl_ + 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, // i.a_texcoord0;. + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // _mtl_o.v_color0 + 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // = _mtl_i.a_colo + 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, // r0;. return _mt + 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // l_o;.}... }; diff --git a/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h index 81ed318597a..26d04c7fc6d 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h @@ -103,9 +103,9 @@ static const uint8_t vs_ocornut_imgui_dx11[612] = 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, // ......>......... 0x10, 0x00, 0x10, 0x00, // .... }; -static const uint8_t vs_ocornut_imgui_mtl[854] = +static const uint8_t vs_ocornut_imgui_mtl[862] = { - 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x47, 0x03, 0x00, 0x00, 0x75, 0x73, // VSH.......G...us + 0x56, 0x53, 0x48, 0x04, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x4f, 0x03, 0x00, 0x00, 0x75, 0x73, // VSH.......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 { @@ -137,26 +137,26 @@ static const uint8_t vs_ocornut_imgui_mtl[854] = 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, // buffer(0)]]).{. 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, // xlatMtlShaderOu 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, // tput _mtl_o;. f - 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, // loat2 tmpvar_1;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x32, // tmpvar_1 = ((2 - 0x2e, 0x30, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, // .0 * _mtl_i.a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, // sition.xy) * _mt - 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x2e, // l_u.u_viewTexel. - 0x78, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, // xy);. float4 tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_2;. tmpvar - 0x5f, 0x32, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, // _2.zw = float2(0 - 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // .0, 1.0);. tmpv - 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ar_2.x = (tmpvar - 0x5f, 0x31, 0x2e, 0x78, 0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, // _1.x - 1.0);. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x28, 0x31, 0x2e, 0x30, // mpvar_2.y = (1.0 - 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x29, 0x3b, 0x0a, // - tmpvar_1.y);. - 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, // _mtl_o.gl_Posi - 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, // tion = tmpvar_2; - 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // . _mtl_o.v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, // oord0 = _mtl_i.a - 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, // _texcoord0;. _m - 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, // tl_o.v_color0 = - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // _mtl_i.a_color0; - 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // . return _mtl_o - 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ;.}... + 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, // loat2 tmpvar_1 = + 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, // 0;. tmpvar_1 = + 0x20, 0x28, 0x28, 0x32, 0x2e, 0x30, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, // ((2.0 * _mtl_i. + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x29, 0x20, 0x2a, // a_position.xy) * + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, // _mtl_u.u_viewTe + 0x78, 0x65, 0x6c, 0x2e, 0x78, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // xel.xy);. float + 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // 4 tmpvar_2 = 0;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, // tmpvar_2.zw = + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, // float2(0.0, 1.0) + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x20, 0x3d, // ;. tmpvar_2.x = + 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x20, 0x2d, 0x20, 0x31, // (tmpvar_1.x - 1 + 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, // .0);. tmpvar_2. + 0x79, 0x20, 0x3d, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // y = (1.0 - tmpva + 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // r_1.y);. _mtl_o + 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, // .gl_Position = t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // mpvar_2;. _mtl_ + 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, // o.v_texcoord0 = + 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, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, // d0;. _mtl_o.v_c + 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, // olor0 = _mtl_i.a + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, // _color0;. retur + 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // n _mtl_o;.}... }; diff --git a/3rdparty/bgfx/examples/common/nanovg/fontstash.h b/3rdparty/bgfx/examples/common/nanovg/fontstash.h index 6fdb664e906..a6c9877f357 100644 --- a/3rdparty/bgfx/examples/common/nanovg/fontstash.h +++ b/3rdparty/bgfx/examples/common/nanovg/fontstash.h @@ -41,7 +41,7 @@ enum FONSalign { enum FONSerrorCode { // Font atlas is full. FONS_ATLAS_FULL = 1, - // Scratch memory used to render glyphs is full, requested size reported in 'val', you may need to bump up FONS_SCRATCH_BUF_SIZE. + // Scratch memory used to render glyphs is full, requested size reported in 'val', you may need to bump up FONS_SCRATCH_BUF_SIZE. FONS_SCRATCH_FULL = 2, // Calls to fonsPushState has created too large stack, if you need deep state stack bump up FONS_MAX_STATES. FONS_STATES_OVERFLOW = 3, @@ -193,16 +193,18 @@ int fons__tt_buildGlyphBitmap(FONSttFontImpl *font, int glyph, float size, float { FT_Error ftError; FT_GlyphSlot ftGlyph; + FT_Fixed advFixed; FONS_NOTUSED(scale); ftError = FT_Set_Pixel_Sizes(font->font, 0, (FT_UInt)(size * (float)font->font->units_per_EM / (float)(font->font->ascender - font->font->descender))); if (ftError) return 0; ftError = FT_Load_Glyph(font->font, glyph, FT_LOAD_RENDER); if (ftError) return 0; - ftError = FT_Get_Advance(font->font, glyph, FT_LOAD_NO_SCALE, (FT_Fixed*)advance); + ftError = FT_Get_Advance(font->font, glyph, FT_LOAD_NO_SCALE, &advFixed); if (ftError) return 0; ftGlyph = font->font->glyph; - *lsb = ftGlyph->metrics.horiBearingX; + *advance = (int)advFixed; + *lsb = (int)ftGlyph->metrics.horiBearingX; *x0 = ftGlyph->bitmap_left; *x1 = *x0 + ftGlyph->bitmap.width; *y0 = -ftGlyph->bitmap_top; @@ -233,7 +235,7 @@ int fons__tt_getGlyphKernAdvance(FONSttFontImpl *font, int glyph1, int glyph2) { FT_Vector ftKerning; FT_Get_Kerning(font->font, glyph1, glyph2, FT_KERNING_DEFAULT, &ftKerning); - return ftKerning.x; + return (int)((ftKerning.x + 32) >> 6); // Round up and convert to integer } #else @@ -311,7 +313,7 @@ int fons__tt_getGlyphKernAdvance(FONSttFontImpl *font, int glyph1, int glyph2) #endif #ifndef FONS_SCRATCH_BUF_SIZE -# define FONS_SCRATCH_BUF_SIZE 16000 +# define FONS_SCRATCH_BUF_SIZE 64000 #endif #ifndef FONS_HASH_LUT_SIZE # define FONS_HASH_LUT_SIZE 256 @@ -331,6 +333,9 @@ int fons__tt_getGlyphKernAdvance(FONSttFontImpl *font, int glyph1, int glyph2) #ifndef FONS_MAX_STATES # define FONS_MAX_STATES 20 #endif +#ifndef FONS_MAX_FALLBACKS +# define FONS_MAX_FALLBACKS 20 +#endif static unsigned int fons__hashint(unsigned int a) { @@ -378,6 +383,8 @@ struct FONSfont int cglyphs; int nglyphs; int lut[FONS_HASH_LUT_SIZE]; + int fallbacks[FONS_MAX_FALLBACKS]; + int nfallbacks; }; typedef struct FONSfont FONSfont; @@ -428,7 +435,8 @@ struct FONScontext void* errorUptr; }; -#if 0 +#if 0 // defined(STB_TRUETYPE_IMPLEMENTATION) + static void* fons__tmpalloc(size_t size, void* up) { unsigned char* ptr; @@ -454,7 +462,8 @@ static void fons__tmpfree(void* ptr, void* up) // empty } -#endif +#endif // STB_TRUETYPE_IMPLEMENTATION + // Copyright (c) 2008-2010 Bjoern Hoehrmann <bjoern@hoehrmann.de> // See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. @@ -760,6 +769,16 @@ static FONSstate* fons__getState(FONScontext* stash) return &stash->states[stash->nstates-1]; } +int fonsAddFallbackFont(FONScontext* stash, int base, int fallback) +{ + FONSfont* baseFont = stash->fonts[base]; + if (baseFont->nfallbacks < FONS_MAX_FALLBACKS) { + baseFont->fallbacks[baseFont->nfallbacks++] = fallback; + return 1; + } + return 0; +} + void fonsSetSize(FONScontext* stash, float size) { fons__getState(stash)->size = size; @@ -1046,6 +1065,15 @@ static FONSglyph* fons__getGlyph(FONScontext* stash, FONSfont* font, unsigned in // Could not find glyph, create it. scale = fons__tt_getPixelHeightScale(&font->font, size); g = fons__tt_getGlyphIndex(&font->font, codepoint); + // Try to find the glyph in fallback fonts. + if (g == 0) { + for (i = 0; i < font->nfallbacks; ++i) { + FONSglyph* fallbackGlyph = fons__getGlyph(stash, stash->fonts[font->fallbacks[i]], codepoint, isize, iblur); + if (fallbackGlyph != NULL && fallbackGlyph->index != 0) { + return fallbackGlyph; + } + } + } fons__tt_buildGlyphBitmap(&font->font, g, size, scale, &advance, &lsb, &x0, &y0, &x1, &y1); gw = x1-x0 + pad*2; gh = y1-y0 + pad*2; diff --git a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h index f042dcfe700..590e557f2de 100644 --- a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h +++ b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h @@ -438,9 +438,9 @@ static const uint8_t fs_nanovg_fill_dx11[2362] = 0x00, 0x00, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, 0x00, 0x01, 0x15, 0x00, // ................ 0x00, 0x01, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0xb0, 0x00, // ..>....... }; -static const uint8_t fs_nanovg_fill_mtl[3466] = +static const uint8_t fs_nanovg_fill_mtl[3542] = { - 0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x7b, 0x0d, 0x00, 0x00, 0x75, 0x73, // FSH.......{...us + 0x46, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0xc7, 0x0d, 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 { @@ -479,10 +479,11 @@ static const uint8_t fs_nanovg_fill_mtl[3466] = 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // .{. xlatMtlShad 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // erOutput _mtl_o; 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, // . half4 result_ - 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // 1;. float tmpva - 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x73, 0x63, // r_2;. float2 sc - 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, // _3;. float3 tmp - 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_4;. tmpvar_ + 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, // 1 = 0;. float t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, // mpvar_2 = 0;. f + 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x73, 0x63, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // loat2 sc_3 = 0;. + 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // float3 tmpvar_ + 0x34, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 4 = 0;. tmpvar_ 0x34, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // 4.z = 1.0;. tmp 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // var_4.xy = _mtl_ 0x69, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, // i.v_position;. @@ -500,25 +501,26 @@ static const uint8_t fs_nanovg_fill_mtl[3466] = 0x31, 0x2e, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x73, 0x63, // 1.0) * clamp (sc 0x5f, 0x33, 0x2e, 0x79, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, // _3.y, 0.0, 1.0)) 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ;. float tmpvar - 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x3d, // _5;. tmpvar_5 = - 0x20, 0x28, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x28, 0x0a, 0x20, 0x20, // (min (1.0, (. - 0x20, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x61, 0x62, 0x73, 0x28, 0x28, 0x28, 0x5f, // (1.0 - abs(((_ - 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // mtl_i.v_texcoord - 0x30, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30, // 0.x * 2.0) - 1.0 - 0x29, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // ))). * _mtl_u. - 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x6d, // u_params.y)) * m - 0x69, 0x6e, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, // in (1.0, _mtl_i. - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x79, 0x29, 0x29, 0x3b, // v_texcoord0.y)); - 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // . if ((_mtl_u.u - 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x30, 0x2e, 0x30, // _params.w == 0.0 - 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // )) {. float4 - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, // color_6;. flo - 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x3b, 0x0a, 0x20, 0x20, // at3 tmpvar_7;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, // tmpvar_7.z = 1 - 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, // .0;. tmpvar_7 - 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x70, // .xy = _mtl_i.v_p - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, // osition;. flo - 0x61, 0x74, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x3b, 0x0a, 0x20, 0x20, // at2 tmpvar_8;. + 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // _5 = 0;. tmpvar + 0x5f, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, // _5 = (min (1.0, + 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x61, 0x62, 0x73, // (. (1.0 - abs + 0x28, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // (((_mtl_i.v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x20, 0x2d, // oord0.x * 2.0) - + 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, // 1.0))). * _mt + 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x29, 0x29, // l_u.u_params.y)) + 0x20, 0x2a, 0x20, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x5f, 0x6d, 0x74, // * min (1.0, _mt + 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, // l_i.v_texcoord0. + 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // y));. if ((_mtl + 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, // _u.u_params.w == + 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, // 0.0)) {. flo + 0x61, 0x74, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x30, 0x3b, // at4 color_6 = 0; + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, // . float3 tmpv + 0x61, 0x72, 0x5f, 0x37, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // ar_7 = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, // pvar_7.z = 1.0;. + 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x2e, 0x78, 0x79, 0x20, // tmpvar_7.xy + 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // = _mtl_i.v_posit + 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, // ion;. float2 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, // tmpvar_8 = 0;. 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x20, 0x3d, 0x20, 0x28, 0x61, 0x62, // tmpvar_8 = (ab 0x73, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, // s((_mtl_u.u_pain 0x74, 0x4d, 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x37, 0x29, // tMat * tmpvar_7) @@ -527,134 +529,137 @@ static const uint8_t fs_nanovg_fill_mtl[3466] = 0x20, 0x2d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, // - _mtl_u.u_exte 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x7a, 0x29, 0x29, 0x3b, 0x0a, 0x20, // ntRadius.zz));. 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // float2 tmpvar - 0x5f, 0x39, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, // _9;. tmpvar_9 - 0x20, 0x3d, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, // = max (tmpvar_8 - 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // , 0.0);. colo - 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // r_6 = (mix (_mtl - 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x5f, // _u.u_innerCol, _ - 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, // mtl_u.u_outerCol - 0x2c, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // , clamp (. - 0x28, 0x28, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x6e, // ((((. min - 0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2e, // (max (tmpvar_8. - 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2e, 0x79, 0x29, 0x2c, 0x20, // x, tmpvar_8.y), - 0x30, 0x2e, 0x30, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x2b, 0x20, 0x0a, 0x20, // 0.0). + . - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, 0x64, 0x6f, 0x74, 0x20, // sqrt(dot - 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // (tmpvar_9, tmpva - 0x72, 0x5f, 0x39, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x29, 0x20, 0x2d, 0x20, // r_9)). ) - - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, // _mtl_u.u_extentR - 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x29, 0x20, 0x2b, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // adius.z) + (_mtl - 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x20, 0x2a, 0x20, // _u.u_params.x * - 0x30, 0x2e, 0x35, 0x29, 0x29, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // 0.5)) / _mtl_u.u - 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x2c, // _params.x). , - 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x28, 0x74, // 0.0, 1.0)) * (t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // mpvar_5 * tmpvar - 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // _2));. result - 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // _1 = half4(color - 0x5f, 0x36, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, // _6);. } else {. - 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // if ((_mtl_u. - 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, // u_params.w == 1. - 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // 0)) {. half - 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // 4 color_10;. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // float3 tmpvar_ - 0x31, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // 11;. tmpvar - 0x5f, 0x31, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, // _11.z = 1.0;. - 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x78, 0x79, 0x20, // tmpvar_11.xy - 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // = _mtl_i.v_posit - 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // ion;. float - 0x32, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 2 tmpvar_12;. + 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // _9 = 0;. tmpv + 0x61, 0x72, 0x5f, 0x39, 0x20, 0x3d, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, // ar_9 = max (tmpv + 0x61, 0x72, 0x5f, 0x38, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // ar_8, 0.0);. + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x69, 0x78, 0x20, 0x28, // color_6 = (mix ( + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, // _mtl_u.u_innerCo + 0x6c, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, // l, _mtl_u.u_oute + 0x72, 0x43, 0x6f, 0x6c, 0x2c, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x0a, 0x20, 0x20, // rCol, clamp (. + 0x20, 0x20, 0x20, 0x20, 0x28, 0x28, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ((((. + 0x20, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // min (max (tmpva + 0x72, 0x5f, 0x38, 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x38, 0x2e, // r_8.x, tmpvar_8. + 0x79, 0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // y), 0.0). + 0x2b, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x73, 0x71, 0x72, 0x74, 0x28, // + . sqrt( + 0x64, 0x6f, 0x74, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x2c, 0x20, 0x74, // dot (tmpvar_9, t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x39, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // mpvar_9)). + 0x29, 0x20, 0x2d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, 0x74, // ) - _mtl_u.u_ext + 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x7a, 0x29, 0x20, 0x2b, 0x20, 0x28, // entRadius.z) + ( + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, // _mtl_u.u_params. + 0x78, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x29, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // x * 0.5)) / _mtl + 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x0a, 0x20, // _u.u_params.x). + 0x20, 0x20, 0x20, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, // , 0.0, 1.0)) + 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, // * (tmpvar_5 * tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, // pvar_2));. re + 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x63, // sult_1 = half4(c + 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x36, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, // olor_6);. } els + 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, // e {. if ((_mt + 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, // l_u.u_params.w = + 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // = 1.0)) {. + 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, // half4 color_10 = + 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, // 0;. float3 + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // tmpvar_11 = 0;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, // tmpvar_11. + 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, // z = 1.0;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, // mpvar_11.xy = _m + 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, // tl_i.v_position; + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x20, 0x74, 0x6d, // . float2 tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, // pvar_12 = 0;. 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x20, 0x3d, 0x20, 0x28, // tmpvar_12 = ( 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, // (_mtl_u.u_paintM 0x61, 0x74, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x31, 0x29, 0x2e, // at * tmpvar_11). 0x78, 0x79, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x65, 0x78, // xy / _mtl_u.u_ex 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x2e, 0x78, 0x79, 0x29, 0x3b, 0x0a, // tentRadius.xy);. 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // half4 tmpv - 0x61, 0x72, 0x5f, 0x31, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, // ar_13;. tmp - 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, // var_13 = half4(s + 0x61, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // ar_13 = 0;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, // tmpvar_13 = hal + 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, // f4(s_tex.sample( + 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, // _mtlsmp_s_tex, ( + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // float2)(tmpvar_1 + 0x32, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // 2)));. colo + 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, // r_10 = tmpvar_13 + 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, // ;. if ((_mt + 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, // l_u.u_params.z = + 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // = 1.0)) {. + 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // half4 tmpvar_1 + 0x34, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, // 4 = 0;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, // mpvar_14.xyz = ( + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, // tmpvar_13.xyz * + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x77, 0x29, 0x3b, 0x0a, 0x20, 0x20, // tmpvar_13.w);. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x2e, // tmpvar_14. + 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x77, 0x3b, // w = tmpvar_13.w; + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // . color_1 + 0x30, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, // 0 = tmpvar_14;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, // };. if + 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ((_mtl_u.u_para + 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, // ms.z == 2.0)) {. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, // color_10 + 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x2e, 0x78, 0x78, 0x78, 0x78, // = color_10.xxxx + 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // ;. };. + 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, // color_10 = ((ha + 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x28, 0x63, 0x6f, // lf4)((float4)(co + 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // lor_10) * _mtl_u + 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, 0x29, 0x3b, 0x0a, 0x20, // .u_innerCol));. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, // color_10 = + 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // ((half4)((float4 + 0x29, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x28, 0x74, // )(color_10) * (t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // mpvar_5 * tmpvar + 0x5f, 0x32, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, // _2)));. res + 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, // ult_1 = color_10 + 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, // ;. } else {. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // if ((_mtl_u + 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x32, // .u_params.w == 2 + 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, // .0)) {. r + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, // esult_1 = half4( + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, // float4(1.0, 1.0, + 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, // 1.0, 1.0));. + 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, // } else {. + 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // if ((_mtl_u. + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, 0x3d, 0x20, 0x33, 0x2e, // u_params.w == 3. + 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 0)) {. + 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, // half4 color_15 = + 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, // 0;. ha + 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x20, 0x3d, 0x20, // lf4 tmpvar_16 = + 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, // 0;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, // var_16 = half4(s 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // _tex.sample(_mtl 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, // smp_s_tex, (floa - 0x74, 0x32, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x32, 0x29, 0x29, 0x29, // t2)(tmpvar_12))) - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, // ;. color_10 - 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x33, 0x3b, 0x0a, 0x20, 0x20, // = tmpvar_13;. - 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // if ((_mtl_u. - 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, // u_params.z == 1. - 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, // 0)) {. ha - 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, // lf4 tmpvar_14;. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, // tmpvar_14 - 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // .xyz = (tmpvar_1 - 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // 3.xyz * tmpvar_1 - 0x33, 0x2e, 0x77, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, // 3.w);. tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x34, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // pvar_14.w = tmpv - 0x61, 0x72, 0x5f, 0x31, 0x33, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ar_13.w;. - 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // color_10 = tmpv - 0x61, 0x72, 0x5f, 0x31, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, // ar_14;. };. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // if ((_mtl_ - 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, // u.u_params.z == - 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 2.0)) {. - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color_10 = color - 0x5f, 0x31, 0x30, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // _10.xxxx;. - 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // };. color_1 - 0x30, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, // 0 = ((half4)((fl - 0x6f, 0x61, 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, 0x2a, 0x20, // oat4)color_10 * - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, // _mtl_u.u_innerCo - 0x6c, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // l));. color - 0x5f, 0x31, 0x30, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, // _10 = ((half4)(( - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x30, 0x20, // float4)color_10 - 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x20, 0x2a, 0x20, 0x74, 0x6d, // * (tmpvar_5 * tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // pvar_2)));. - 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // result_1 = colo - 0x72, 0x5f, 0x31, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, // r_10;. } else - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, // {. if ((_m - 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, // tl_u.u_params.w - 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // == 2.0)) {. - 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, // result_1 = ha - 0x6c, 0x66, 0x34, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, // lf4(float4(1.0, - 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, // 1.0, 1.0, 1.0)); - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, // . } else {. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, // if ((_mt - 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x20, 0x3d, // l_u.u_params.w = - 0x3d, 0x20, 0x33, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // = 3.0)) {. - 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // half4 color_ - 0x31, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x61, // 15;. ha - 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, // lf4 tmpvar_16;. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // tmpvar_ - 0x31, 0x36, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, // 16 = half4(s_tex - 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, // .sample(_mtlsmp_ - 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, // s_tex, (float2)( - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // _mtl_i.v_texcoor - 0x64, 0x30, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // d0)));. - 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // color_15 = tmpv - 0x61, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // ar_16;. - 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, // if ((_mtl_u.u_p - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, // arams.z == 1.0)) - 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, // {. h - 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x3b, 0x0a, // alf4 tmpvar_17;. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpv - 0x61, 0x72, 0x5f, 0x31, 0x37, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, // ar_17.xyz = (tmp - 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, // var_16.xyz * tmp - 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x77, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // var_16.w);. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, // tmpvar_17 - 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x77, // .w = tmpvar_16.w - 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, // ;. co - 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // lor_15 = tmpvar_ - 0x31, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, // 17;. }; - 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, // . if (( - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, // _mtl_u.u_params. - 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, // z == 2.0)) {. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // color_1 - 0x35, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x78, 0x78, 0x78, // 5 = color_15.xxx - 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, // x;. };. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // color_ - 0x31, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, // 15 = ((half4)((f - 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x2a, // loat4)color_15 * - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, // tmpvar_2));. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, // result_1 - 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, // = ((half4)((floa - 0x74, 0x34, 0x29, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x2a, 0x20, 0x5f, 0x6d, // t4)color_15 * _m - 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, // tl_u.u_innerCol) - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, // );. };. - 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, // };. };. - 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // };. _mtl_o.gl_F - 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, // ragColor = resul - 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // t_1;. return _m - 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}... + 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, // t2)(_mtl_i.v_tex + 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // coord0)));. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, // color_15 = + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // tmpvar_16;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // if ((_mtl_u + 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x31, // .u_params.z == 1 + 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // .0)) {. + 0x20, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // half4 tmpvar_ + 0x31, 0x37, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // 17 = 0;. + 0x20, 0x20, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x2e, 0x78, 0x79, // tmpvar_17.xy + 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x78, // z = (tmpvar_16.x + 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x77, // yz * tmpvar_16.w + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, // );. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // mpvar_17.w = tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x36, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // var_16.w;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, // color_15 = + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x37, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, // tmpvar_17;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // };. + 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // if ((_mtl_u.u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x2e, 0x30, // _params.z == 2.0 + 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // )) {. + 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, // color_15 = colo + 0x72, 0x5f, 0x31, 0x35, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, // r_15.xxxx;. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // };. + 0x20, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, // color_15 = ((h + 0x61, 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x28, 0x63, // alf4)((float4)(c + 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x29, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // olor_15) * tmpva + 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // r_2));. + 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, // result_1 = ((ha + 0x6c, 0x66, 0x34, 0x29, 0x28, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x28, 0x63, 0x6f, // lf4)((float4)(co + 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x35, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // lor_15) * _mtl_u + 0x2e, 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x29, 0x29, 0x3b, 0x0a, 0x20, // .u_innerCol));. + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // };. + 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, // };. };. };. + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, // _mtl_o.gl_FragC + 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x3b, // olor = result_1; + 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // . return _mtl_o + 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ;.}... }; diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp index 9904141c103..ae696b3b428 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp @@ -16,8 +16,11 @@ // 3. This notice may not be removed or altered from any source distribution. // +#include <stdlib.h> #include <stdio.h> #include <math.h> +#include <memory.h> + #include "nanovg.h" #include <bx/macros.h> @@ -64,6 +67,10 @@ BX_PRAGMA_DIAGNOSTIC_PUSH(); BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wmissing-field-initializers"); BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wshadow"); BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wint-to-pointer-cast") +#if BX_COMPILER_GCC >= 60000 +BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wmisleading-indentation"); +BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wshift-negative-value"); +#endif // BX_COMPILER_GCC >= 60000_ #define STBI_MALLOC(_size) lodepng_malloc(_size) #define STBI_REALLOC(_ptr, _size) lodepng_realloc(_ptr, _size) #define STBI_FREE(_ptr) lodepng_free(_ptr) @@ -250,7 +257,6 @@ static void nvg__setDevicePixelRatio(NVGcontext* ctx, float ratio) static NVGcompositeOperationState nvg__compositeOperationState(int op) { - // NVG_SOURCE_OVER int sfactor = NVG_ONE; int dfactor = NVG_ONE_MINUS_SRC_ALPHA; @@ -2308,6 +2314,18 @@ int nvgFindFont(NVGcontext* ctx, const char* name) return fonsGetFontByName(ctx->fs, name); } + +int nvgAddFallbackFontId(NVGcontext* ctx, int baseFont, int fallbackFont) +{ + if(baseFont == -1 || fallbackFont == -1) return 0; + return fonsAddFallbackFont(ctx->fs, baseFont, fallbackFont); +} + +int nvgAddFallbackFont(NVGcontext* ctx, const char* baseFont, const char* fallbackFont) +{ + return nvgAddFallbackFontId(ctx, nvgFindFont(ctx, baseFont), nvgFindFont(ctx, fallbackFont)); +} + // State setting void nvgFontSize(NVGcontext* ctx, float size) { diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg.h b/3rdparty/bgfx/examples/common/nanovg/nanovg.h index 99797e21fbb..31109efad28 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg.h +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg.h @@ -267,7 +267,7 @@ void nvgLineCap(NVGcontext* ctx, int cap); void nvgLineJoin(NVGcontext* ctx, int join); // Sets the transparency applied to all rendered shapes. -// Already transparent paths will get proportionally more transparent as well. +// Alreade transparent paths will get proportionally more transparent as well. void nvgGlobalAlpha(NVGcontext* ctx, float alpha); // @@ -399,7 +399,7 @@ NVGpaint nvgLinearGradient(NVGcontext* ctx, float sx, float sy, float ex, float NVGcolor icol, NVGcolor ocol); // Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering -// drop shadows or highlights for boxes. Parameters (x,y) define the top-left corner of the rectangle, +// drop shadows or hilights for boxes. Parameters (x,y) define the top-left corner of the rectangle, // (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry // the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient. // The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint(). @@ -548,6 +548,12 @@ int nvgCreateFontMem(NVGcontext* ctx, const char* name, unsigned char* data, int // Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found. int nvgFindFont(NVGcontext* ctx, const char* name); +// Adds a fallback font by handle. +int nvgAddFallbackFontId(NVGcontext* ctx, int baseFont, int fallbackFont); + +// Adds a fallback font by name. +int nvgAddFallbackFont(NVGcontext* ctx, const char* baseFont, const char* fallbackFont); + // Sets the font size of current text style. void nvgFontSize(NVGcontext* ctx, float size); diff --git a/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h b/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h index e744417898c..eec020a0d32 100644 --- a/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h +++ b/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h @@ -106,9 +106,9 @@ static const uint8_t vs_nanovg_fill_dx11[577] = 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x02, 0x01, 0x00, 0x10, 0x00, 0x10, // .....>.......... 0x00, // . }; -static const uint8_t vs_nanovg_fill_mtl[865] = +static const uint8_t vs_nanovg_fill_mtl[869] = { - 0x56, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x52, 0x03, 0x00, 0x00, 0x75, 0x73, // VSH.......R...us + 0x56, 0x53, 0x48, 0x04, 0xcf, 0xda, 0x1b, 0x94, 0x00, 0x00, 0x56, 0x03, 0x00, 0x00, 0x75, 0x73, // VSH.......V...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 { @@ -146,21 +146,21 @@ static const uint8_t vs_nanovg_fill_mtl[865] = 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // (_mtl_i.a_texcoo 0x72, 0x64, 0x30, 0x20, 0x2b, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x68, // rd0 + _mtl_u.u_h 0x61, 0x6c, 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x2e, 0x78, 0x79, 0x29, 0x3b, 0x0a, 0x20, 0x20, // alfTexel.xy);. - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, // float4 tmpvar_1; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, // . tmpvar_1.zw = - 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, // float2(0.0, 1.0 - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x20, // );. tmpvar_1.x - 0x3d, 0x20, 0x28, 0x28, 0x28, 0x32, 0x2e, 0x30, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // = (((2.0 * _mtl_ - 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x29, 0x20, // i.a_position.x) - 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, // / _mtl_u.u_viewS - 0x69, 0x7a, 0x65, 0x2e, 0x78, 0x29, 0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, // ize.x) - 1.0);. - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x28, 0x31, // tmpvar_1.y = (1 - 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x28, 0x28, 0x32, 0x2e, 0x30, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, // .0 - ((2.0 * _mt - 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x79, // l_i.a_position.y - 0x29, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x76, 0x69, 0x65, // ) / _mtl_u.u_vie - 0x77, 0x53, 0x69, 0x7a, 0x65, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, // wSize.y));. _mt - 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, // l_o.gl_Position - 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, // = tmpvar_1;. re - 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // turn _mtl_o;.}.. - 0x00, // . + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, // float4 tmpvar_1 + 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // = 0;. tmpvar_1. + 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, // zw = float2(0.0, + 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 1.0);. tmpvar_ + 0x31, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x28, 0x32, 0x2e, 0x30, 0x20, 0x2a, 0x20, 0x5f, // 1.x = (((2.0 * _ + 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // mtl_i.a_position + 0x2e, 0x78, 0x29, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x76, // .x) / _mtl_u.u_v + 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x2e, 0x78, 0x29, 0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30, // iewSize.x) - 1.0 + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x20, // );. tmpvar_1.y + 0x3d, 0x20, 0x28, 0x31, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x28, 0x28, 0x32, 0x2e, 0x30, 0x20, 0x2a, // = (1.0 - ((2.0 * + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // _mtl_i.a_positi + 0x6f, 0x6e, 0x2e, 0x79, 0x29, 0x20, 0x2f, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // on.y) / _mtl_u.u + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, // _viewSize.y));. + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // _mtl_o.gl_Posit + 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, // ion = tmpvar_1;. + 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // return _mtl_o; + 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... }; diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_update.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_update.bin Binary files differnew file mode 100644 index 00000000000..1b77e9e7487 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_update.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_indirect.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_indirect.bin Binary files differindex 1faf1aeb562..1faf1aeb562 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_indirect.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_indirect.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_init_instances.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_init_instances.bin Binary files differindex d74d461cfac..d74d461cfac 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_init_instances.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_init_instances.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update.bin Binary files differnew file mode 100644 index 00000000000..6d9efc1491c --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_update_instances.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update_instances.bin Binary files differindex ddd207ccf9a..ddd207ccf9a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/cs_update_instances.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update_instances.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_bump.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_bump.bin Binary files differindex c0d146336e2..c0d146336e2 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_bump.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_bump.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_callback.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_callback.bin Binary files differindex 4be92138513..4be92138513 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_callback.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_callback.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_cubes.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_cubes.bin Binary files differindex de509a3eeb5..de509a3eeb5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_cubes.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_cubes.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_deferred_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_deferred_combine.bin Binary files differindex 9f444cd6809..9f444cd6809 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_deferred_combine.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_deferred_combine.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_deferred_debug.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_deferred_debug.bin Binary files differindex 18195420f57..18195420f57 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_deferred_debug.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_deferred_debug.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_deferred_debug_line.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_deferred_debug_line.bin Binary files differindex de509a3eeb5..de509a3eeb5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_deferred_debug_line.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_deferred_debug_line.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_deferred_geom.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_deferred_geom.bin Binary files differindex 16d128fe345..16d128fe345 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_deferred_geom.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_deferred_geom.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_deferred_light.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_deferred_light.bin Binary files differindex 2730664891e..2730664891e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_deferred_light.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_deferred_light.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_blur.bin Binary files differindex 91adc88bec9..91adc88bec9 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_blur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_blur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_bright.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_bright.bin Binary files differindex f978ba318f9..f978ba318f9 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_bright.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_bright.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_lum.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_lum.bin Binary files differindex 5c24ceba783..5c24ceba783 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_lum.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_lum.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_lumavg.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_lumavg.bin Binary files differindex c1454ba68c7..c1454ba68c7 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_lumavg.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_lumavg.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_mesh.bin Binary files differindex 57551110328..57551110328 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_skybox.bin Binary files differindex ab749d22b16..ab749d22b16 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_tonemap.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_tonemap.bin Binary files differindex 48b5272d87c..48b5272d87c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_hdr_tonemap.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_hdr_tonemap.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_ibl_mesh.bin Binary files differindex a4cd92a1904..a4cd92a1904 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_ibl_skybox.bin Binary files differindex 76079d0ec8d..76079d0ec8d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_instancing.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_instancing.bin Binary files differindex de509a3eeb5..de509a3eeb5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_instancing.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_instancing.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_mesh.bin Binary files differindex 75aeaeeaadf..75aeaeeaadf 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_oit.bin Binary files differindex 8c5294afa49..8c5294afa49 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_oit.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_oit_wb.bin Binary files differindex e594526cf19..e594526cf19 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_oit_wb.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_oit_wb_blit.bin Binary files differindex 4de4a7d474c..4de4a7d474c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_blit.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_oit_wb_blit.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_oit_wb_separate.bin Binary files differindex 3b51e727e87..3b51e727e87 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_oit_wb_separate.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_oit_wb_separate_blit.bin Binary files differindex e85ddbedf34..e85ddbedf34 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_oit_wb_separate_blit.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_oit_wb_separate_blit.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_particle.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_particle.bin Binary files differindex d56a476ee07..d56a476ee07 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_particle.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_particle.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_picking_id.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_picking_id.bin Binary files differindex 91acdf18ecd..91acdf18ecd 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_picking_id.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_picking_id.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_picking_shaded.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_picking_shaded.bin Binary files differindex 62c604c3d4a..62c604c3d4a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_picking_shaded.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_picking_shaded.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_raymarching.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_raymarching.bin Binary files differindex 0fc2f3703ff..0fc2f3703ff 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_raymarching.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_raymarching.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_rsm_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_rsm_combine.bin Binary files differindex 23364eb50e3..5567c79446b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_rsm_combine.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_rsm_combine.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_rsm_gbuffer.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_rsm_gbuffer.bin Binary files differindex 911c8ff6f09..911c8ff6f09 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_rsm_gbuffer.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_rsm_gbuffer.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_rsm_lbuffer.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_rsm_lbuffer.bin Binary files differindex 207c88361b2..207c88361b2 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_rsm_lbuffer.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_rsm_lbuffer.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_rsm_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_rsm_shadow.bin Binary files differindex 6c9adff2df9..6c9adff2df9 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_rsm_shadow.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_rsm_shadow.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_black.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_color_black.bin Binary files differindex 98147ab064a..98147ab064a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_black.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_color_black.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_color_lighting_esm.bin Binary files differindex 72ed5111aee..72ed5111aee 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_esm_csm.bin Binary files differindex 7c77f0cbbfe..7c77f0cbbfe 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_esm_linear.bin Binary files differindex 789141dcccc..789141dcccc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_esm_linear_csm.bin Binary files differindex 3c1d07e15f6..3c1d07e15f6 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_esm_linear_omni.bin Binary files differindex 1503d413ab3..1503d413ab3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_esm_omni.bin Binary files differindex f79e214b2da..f79e214b2da 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_esm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_hard.bin Binary files differindex c6f6593ea1e..c6f6593ea1e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_hard_csm.bin Binary files differindex 74c0c1cf2a9..74c0c1cf2a9 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_hard_linear.bin Binary files differindex c0e05951bdd..c0e05951bdd 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_hard_linear_csm.bin Binary files differindex 19062f01b8c..19062f01b8c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_hard_linear_omni.bin Binary files differindex 6187725d9f2..6187725d9f2 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_hard_omni.bin Binary files differindex 133e398538c..133e398538c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_hard_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_pcf.bin Binary files differindex 422bf35ec8e..422bf35ec8e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_pcf_csm.bin Binary files differindex 9f78cbeee15..9f78cbeee15 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_pcf_linear.bin Binary files differindex 5ee79f73a28..5ee79f73a28 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_pcf_linear_csm.bin Binary files differindex 4bb6fa06e51..4bb6fa06e51 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_pcf_linear_omni.bin Binary files differindex 456040c60a3..456040c60a3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_pcf_omni.bin Binary files differindex fc57ca84ebc..fc57ca84ebc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_pcf_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_vsm.bin Binary files differindex ccababe2e1b..ccababe2e1b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_vsm_csm.bin Binary files differindex 74ff8b8dd26..74ff8b8dd26 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_vsm_linear.bin Binary files differindex 754e424ea12..754e424ea12 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_vsm_linear_csm.bin Binary files differindex 53f2ea31f22..53f2ea31f22 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_vsm_linear_omni.bin Binary files differindex 0b0a1bbbf16..0b0a1bbbf16 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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/essl/fs_shadowmaps_color_lighting_vsm_omni.bin Binary files differindex ad331bd4ffd..ad331bd4ffd 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_lighting_vsm_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_color_lighting_vsm_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_color_texture.bin Binary files differindex d843710a8b0..d843710a8b0 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_color_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_hblur.bin Binary files differindex c50ce9cc452..c50ce9cc452 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_hblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_hblur_vsm.bin Binary files differindex cde87278282..cde87278282 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_hblur_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_hblur_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_packdepth.bin Binary files differindex d6bdeb0b6c9..d6bdeb0b6c9 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_packdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_packdepth_linear.bin Binary files differindex c1c6b516290..c1c6b516290 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_packdepth_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_packdepth_vsm.bin Binary files differindex e50fed3c64d..e50fed3c64d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_packdepth_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_packdepth_vsm_linear.bin Binary files differindex c2ccac516e4..c2ccac516e4 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_packdepth_vsm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_packdepth_vsm_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_texture.bin Binary files differindex 18195420f57..18195420f57 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_unpackdepth.bin Binary files differindex db9d665275d..db9d665275d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_unpackdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_unpackdepth_vsm.bin Binary files differindex 5044da1a692..5044da1a692 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_unpackdepth_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_unpackdepth_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_vblur.bin Binary files differindex c50ce9cc452..c50ce9cc452 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_vblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_vblur_vsm.bin Binary files differindex cde87278282..cde87278282 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowmaps_vblur_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowmaps_vblur_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_color_lighting.bin Binary files differindex a96ffde0b40..a96ffde0b40 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_color_texture.bin Binary files differindex d843710a8b0..d843710a8b0 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_color_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbackblank.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svbackblank.bin Binary files differindex c2fb7eac9cc..c2fb7eac9cc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbackblank.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svbackblank.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbackcolor.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svbackcolor.bin Binary files differindex 037db8cc859..037db8cc859 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbackcolor.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svbackcolor.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbacktex1.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svbacktex1.bin Binary files differindex be30cfc29dc..be30cfc29dc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbacktex1.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svbacktex1.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbacktex2.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svbacktex2.bin Binary files differindex add036b2560..add036b2560 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svbacktex2.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svbacktex2.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfrontblank.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svfrontblank.bin Binary files differindex 4b7b683d8cc..4b7b683d8cc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfrontblank.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svfrontblank.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfrontcolor.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svfrontcolor.bin Binary files differindex 037db8cc859..037db8cc859 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfrontcolor.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svfrontcolor.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfronttex1.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svfronttex1.bin Binary files differindex 3b160781d19..3b160781d19 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfronttex1.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svfronttex1.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfronttex2.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svfronttex2.bin Binary files differindex 92620196e3a..92620196e3a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svfronttex2.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svfronttex2.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svside.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svside.bin Binary files differindex 205d7185386..205d7185386 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svside.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svside.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svsideblank.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svsideblank.bin Binary files differindex 24f593e21da..24f593e21da 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svsideblank.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svsideblank.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svsidecolor.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svsidecolor.bin Binary files differindex 455d85035da..455d85035da 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svsidecolor.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svsidecolor.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svsidetex.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svsidetex.bin Binary files differindex 0e732199535..0e732199535 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_svsidetex.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_svsidetex.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_texture.bin Binary files differindex 18195420f57..18195420f57 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_texture_lighting.bin Binary files differindex 5e59912aba7..5e59912aba7 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_shadowvolume_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_shadowvolume_texture_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_sms_mesh.bin Binary files differindex b9f060dbd20..b9f060dbd20 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_sms_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_sms_mesh_pd.bin Binary files differindex 227b76c4fa2..227b76c4fa2 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_mesh_pd.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_sms_mesh_pd.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_sms_shadow.bin Binary files differindex 81ccc6436e4..81ccc6436e4 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_sms_shadow.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_sms_shadow_pd.bin Binary files differindex 3c4b91fdcca..3c4b91fdcca 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_sms_shadow_pd.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_sms_shadow_pd.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_color_black.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_stencil_color_black.bin Binary files differindex 98147ab064a..98147ab064a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_color_black.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_stencil_color_black.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_stencil_color_lighting.bin Binary files differindex f3e5bd234a5..f3e5bd234a5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_stencil_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_stencil_color_texture.bin Binary files differindex d843710a8b0..d843710a8b0 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_stencil_color_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_stencil_texture.bin Binary files differindex 18195420f57..18195420f57 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_stencil_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_stencil_texture_lighting.bin Binary files differindex f35896a59d8..f35896a59d8 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_stencil_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_stencil_texture_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_terrain.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_terrain.bin Binary files differindex 4a73d9a9985..4a73d9a9985 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_terrain.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_terrain.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_tree.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_tree.bin Binary files differindex d9398b15c40..d9398b15c40 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_tree.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_tree.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_update.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_update.bin Binary files differindex f754924f104..f754924f104 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_update.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_update.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_update_3d.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_update_3d.bin Binary files differindex 1566fb77bef..1566fb77bef 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_update_3d.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_update_3d.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_update_cmp.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_update_cmp.bin Binary files differindex 57a1dc6c27b..57a1dc6c27b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_update_cmp.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_update_cmp.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_vectordisplay_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_vectordisplay_blit.bin Binary files differindex 14776fe31e5..14776fe31e5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_vectordisplay_blit.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_vectordisplay_blit.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_vectordisplay_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_vectordisplay_blur.bin Binary files differindex 9c3bee0bf39..9c3bee0bf39 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_vectordisplay_blur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_vectordisplay_blur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_vectordisplay_fb.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_vectordisplay_fb.bin Binary files differindex 2d63fcfca45..2d63fcfca45 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_vectordisplay_fb.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_vectordisplay_fb.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_wf_mesh.bin Binary files differindex a090c615b90..a090c615b90 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_wf_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_wf_wireframe.bin Binary files differindex f39c7916d82..f39c7916d82 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/fs_wf_wireframe.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_bump.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_bump.bin Binary files differindex bc648979ebf..bc648979ebf 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_bump.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_bump.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_bump_instanced.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_bump_instanced.bin Binary files differindex dca3ab761cc..dca3ab761cc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_bump_instanced.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_bump_instanced.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_callback.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_callback.bin Binary files differindex c476e63c8f1..c476e63c8f1 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_callback.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_callback.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_cubes.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_cubes.bin Binary files differindex e45e21d5221..e45e21d5221 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_cubes.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_cubes.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_deferred_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_deferred_combine.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_deferred_combine.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_deferred_combine.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_deferred_debug.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_deferred_debug.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_deferred_debug.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_deferred_debug.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_deferred_debug_line.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_deferred_debug_line.bin Binary files differindex e45e21d5221..e45e21d5221 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_deferred_debug_line.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_deferred_debug_line.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_deferred_geom.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_deferred_geom.bin Binary files differindex bc648979ebf..bc648979ebf 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_deferred_geom.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_deferred_geom.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_deferred_light.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_deferred_light.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_deferred_light.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_deferred_light.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_blur.bin Binary files differindex b01e8d247be..b01e8d247be 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_blur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_blur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_bright.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_bright.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_bright.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_bright.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_lum.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_lum.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_lum.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_lum.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_lumavg.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_lumavg.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_lumavg.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_lumavg.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_mesh.bin Binary files differindex 54ca679f238..54ca679f238 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_skybox.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_tonemap.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_tonemap.bin Binary files differindex 40e2f68e743..40e2f68e743 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_hdr_tonemap.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_hdr_tonemap.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_ibl_mesh.bin Binary files differindex bbd50acd51f..bbd50acd51f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_ibl_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_ibl_skybox.bin Binary files differindex d518d061f73..d518d061f73 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_ibl_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_ibl_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_instancing.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_instancing.bin Binary files differindex 809e2ef0fd1..809e2ef0fd1 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_instancing.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_instancing.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_mesh.bin Binary files differindex 206f16ac278..206f16ac278 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_oit.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_oit.bin Binary files differindex 0aa675e0471..0aa675e0471 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_oit.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_oit.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_oit_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_oit_blit.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_oit_blit.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_oit_blit.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_particle.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_particle.bin Binary files differindex 319468ccf2b..319468ccf2b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_particle.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_particle.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_picking_shaded.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_picking_shaded.bin Binary files differindex d066f631d54..d066f631d54 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_picking_shaded.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_picking_shaded.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_raymarching.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_raymarching.bin Binary files differindex e1ad85e5d40..e1ad85e5d40 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_raymarching.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_raymarching.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_rsm_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_rsm_combine.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_rsm_combine.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_rsm_combine.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_rsm_gbuffer.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_rsm_gbuffer.bin Binary files differindex e86a13cbb9b..e86a13cbb9b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_rsm_gbuffer.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_rsm_gbuffer.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_rsm_lbuffer.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_rsm_lbuffer.bin Binary files differindex 68d4a767431..68d4a767431 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_rsm_lbuffer.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_rsm_lbuffer.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_rsm_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_rsm_shadow.bin Binary files differindex cd0a5da2676..cd0a5da2676 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_rsm_shadow.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_rsm_shadow.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color.bin Binary files differindex 0f88a6bbb88..0f88a6bbb88 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting.bin Binary files differindex f94a6d8164a..f94a6d8164a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting_csm.bin Binary files differindex 2b37ce8c997..2b37ce8c997 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting_linear.bin Binary files differindex 72c9d7f909f..72c9d7f909f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting_linear_csm.bin Binary files differindex 203531db55f..203531db55f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting_linear_omni.bin Binary files differindex 9a969e29c97..9a969e29c97 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting_omni.bin Binary files differindex 7dc9beebe9e..7dc9beebe9e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_lighting_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_lighting_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_texture.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_color_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_depth.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_depth.bin Binary files differindex 0f88a6bbb88..0f88a6bbb88 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_depth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_depth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_hblur.bin Binary files differindex cbc198fafc3..cbc198fafc3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_hblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_hblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_packdepth.bin Binary files differindex f0322e5fdd6..f0322e5fdd6 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_packdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_packdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_packdepth_linear.bin Binary files differindex 133ae6017cb..133ae6017cb 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_packdepth_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_packdepth_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_texture.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_texture_lighting.bin Binary files differindex b79e5f767a5..b79e5f767a5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_texture_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_unpackdepth.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_unpackdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_unpackdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_vblur.bin Binary files differindex ea2ef934f60..ea2ef934f60 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowmaps_vblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowmaps_vblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_color_lighting.bin Binary files differindex 9e99653dd37..9e99653dd37 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_color_texture.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_color_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_svback.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_svback.bin Binary files differindex 3c54366063d..3c54366063d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_svback.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_svback.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_svfront.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_svfront.bin Binary files differindex 0f88a6bbb88..0f88a6bbb88 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_svfront.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_svfront.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_svside.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_svside.bin Binary files differindex 1bc67deb511..1bc67deb511 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_svside.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_svside.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_texture.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_texture_lighting.bin Binary files differindex b79e5f767a5..b79e5f767a5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_shadowvolume_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_shadowvolume_texture_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_sms_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_sms_mesh.bin Binary files differindex 0b61754c913..0b61754c913 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_sms_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_sms_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_sms_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_sms_shadow.bin Binary files differindex 0f88a6bbb88..0f88a6bbb88 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_sms_shadow.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_sms_shadow.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_sms_shadow_pd.bin Binary files differindex f0322e5fdd6..f0322e5fdd6 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_sms_shadow_pd.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_sms_shadow_pd.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_stencil_color.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_stencil_color.bin Binary files differindex 0f88a6bbb88..0f88a6bbb88 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_stencil_color.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_stencil_color.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_stencil_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_stencil_color_lighting.bin Binary files differindex 9e99653dd37..9e99653dd37 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_stencil_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_stencil_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_stencil_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_stencil_color_texture.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_stencil_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_stencil_color_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_stencil_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_stencil_texture.bin Binary files differindex 3368689b86a..3368689b86a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_stencil_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_stencil_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_stencil_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_stencil_texture_lighting.bin Binary files differindex b79e5f767a5..b79e5f767a5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_stencil_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_stencil_texture_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_terrain.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_terrain.bin Binary files differindex 4376fd3aecf..4376fd3aecf 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_terrain.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_terrain.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_terrain_height_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_terrain_height_texture.bin Binary files differindex 2d84f6c487b..2d84f6c487b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_terrain_height_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_terrain_height_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_tree.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_tree.bin Binary files differindex 4dcda77b709..4dcda77b709 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_tree.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_tree.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_update.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_update.bin Binary files differindex 11ae4ca3876..11ae4ca3876 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_update.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_update.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_vectordisplay_fb.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_vectordisplay_fb.bin Binary files differindex e1ad85e5d40..e1ad85e5d40 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_vectordisplay_fb.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_vectordisplay_fb.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_wf_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_wf_mesh.bin Binary files differindex 39b2f0bbc48..39b2f0bbc48 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_wf_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_wf_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_wf_wireframe.bin Binary files differindex f456e30f22c..f456e30f22c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/gles/vs_wf_wireframe.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/essl/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 2004cc3d3ea..4eb428e0ebf 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 19265eb8f1d..4c0e8a47ffc 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.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update.bin Binary files differnew file mode 100644 index 00000000000..0c75741cec7 --- /dev/null +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update.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 5686edfa68b..7a1ca7734ae 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_rsm_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_rsm_combine.bin Binary files differindex fd9c2e5cf0c..b7809eec282 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_rsm_combine.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_rsm_combine.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_bump.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_bump.bin Binary files differindex d9c2da922fc..6a6f52cb2b0 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_bump.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_bump.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_callback.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_callback.bin Binary files differindex b08e28f567d..58d758e91a4 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_callback.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_callback.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_blur.bin Binary files differindex 14475c3ade0..82a59f2a622 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_blur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_blur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_bright.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_bright.bin Binary files differindex 6ec541f32ad..7581dae0781 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_bright.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_bright.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_lum.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_lum.bin Binary files differindex 76ff3900cd3..f14846d7d66 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_lum.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_lum.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_lumavg.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_lumavg.bin Binary files differindex f4d3784e6da..c60e10f022e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_lumavg.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_lumavg.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_mesh.bin Binary files differindex f650d6686b2..b02ab0f2570 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_skybox.bin Binary files differindex d113a607c3e..096c50c3456 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_tonemap.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_tonemap.bin Binary files differindex bb42a0bdae8..f11227ed238 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_tonemap.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_hdr_tonemap.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 fef2951fc64..df4962a1fb1 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 1fd0392deaa..5e662ec1a15 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_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_mesh.bin Binary files differindex f99861205a3..4ac77897f5b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_mesh.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 e7e9e98bb8e..c4142541367 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 76eb570a740..feddbb4dc0c 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 0cf73b0621a..c6254d22337 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 5b4ccf94d83..00f299e5861 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_particle.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_particle.bin Binary files differindex 39d113334d6..f8c13274c2a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_particle.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_particle.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_raymarching.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_raymarching.bin Binary files differindex 1a3de3d0ab9..1c9c5e917f3 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_raymarching.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_raymarching.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 9b2b3ac0881..703a5f3303a 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 04b4c14e4c1..0ae4396d6a9 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 5c8a98f584a..c24a5dabe25 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 6c95e24e176..753d7be95b4 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 aa490324ea3..6e8ea4430b9 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 eebf557cdfa..44ce6cd599d 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 efd340c5844..94a98e67909 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 f168696c34b..ec2538095a5 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 8b57ab983a7..b0c6f02aba1 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 78c3faa2538..453303e9c1c 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 0e2962e2781..72896240f88 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 7a75fac01a0..e38d6a5a75f 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 5e0d6d5c618..90b333bb9e2 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 f4ea4faa7ac..7468b51fec4 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 a8fa89d7f0e..5903d3bcae1 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 a14ca23e82e..bb7c7e30973 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 89e922cc5c5..15905c5c3ae 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 d9c75ba069a..ef45cbeeb6d 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 b20618eeb15..5d170800a69 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 3822c869067..d67536bbcb1 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 1f0b147ec5a..d05d5931486 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 1dc620e1147..8ceeebe8bff 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 94be509057a..249e9582d4d 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 4490f1ef874..663144e6bbc 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 52de7234847..2f00586e78e 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 76c36a25cde..4242884f842 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 45aba573279..f8d74217926 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 2fe89fbc1e5..d1f5168ad70 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 4d2a474262a..f55e6c3070a 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_packdepth_vsm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth_vsm.bin Binary files differindex 7480677534d..07f4b8a9087 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth_vsm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth_vsm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth_vsm_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth_vsm_linear.bin Binary files differindex 8b2ee2abbd3..e213e723697 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth_vsm_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowmaps_packdepth_vsm_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 e48079000cc..6b0a49b7225 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 60c98b10a77..c446330f907 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 54fe70de383..a237fdd50f0 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 76c36a25cde..4242884f842 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 45aba573279..f8d74217926 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_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_color_lighting.bin Binary files differindex 5f7d4490bb7..ad573738fd6 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_color_texture.bin Binary files differindex 52de7234847..2f00586e78e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_color_texture.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 7fddc0e0d93..8c862f82423 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_svbacktex1.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svbacktex1.bin Binary files differindex 51d0af3c132..03b684d3715 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svbacktex1.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svbacktex1.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svbacktex2.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svbacktex2.bin Binary files differindex 65eefb71cd1..9c6c3b18c4d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svbacktex2.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svbacktex2.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 682bfa5fa57..02c48d50520 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_shadowvolume_svfronttex1.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svfronttex1.bin Binary files differindex 1ee26821e14..04dfa5f37e2 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svfronttex1.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svfronttex1.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svfronttex2.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svfronttex2.bin Binary files differindex d638ce4dbb2..9bb07c416ca 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svfronttex2.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svfronttex2.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svside.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svside.bin Binary files differindex e67e7c2306e..14bbdca33b5 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svside.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svside.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svsidetex.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svsidetex.bin Binary files differindex 843ccfa6f0e..65c09998e0b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svsidetex.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_svsidetex.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_texture.bin Binary files differindex e48079000cc..6b0a49b7225 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_texture_lighting.bin Binary files differindex 7e7bbab26e3..142d2cb9f6b 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_shadowvolume_texture_lighting.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 862531d061c..13a96056e5b 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 fb1631dffaf..eb18f0013d3 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_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_sms_shadow_pd.bin Binary files differindex d4ee3580678..dad7180a259 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 f6898291c93..3c6e58ae4dd 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_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_color_texture.bin Binary files differindex 52de7234847..2f00586e78e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_color_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_texture.bin Binary files differindex e48079000cc..6b0a49b7225 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_stencil_texture.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 229840b069a..cc405c21e2e 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 differindex bb0f5dd11e5..1d49aeb2b5c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_terrain.bin +++ 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 f272476055b..c3d53b41817 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.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_update.bin Binary files differindex 6deeecafcd6..f8156b95d3f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_update.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_update.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 dfdd88e41ce..85af9b02318 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_update_cmp.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_update_cmp.bin Binary files differindex 0e9089a14d1..3d606ca148d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_update_cmp.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_update_cmp.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_blit.bin Binary files differindex e1c858e537a..14ea2790050 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_blit.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_blit.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_blur.bin Binary files differindex 2b71fdb79b3..12b7cf5250d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_blur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_blur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_fb.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_fb.bin Binary files differindex ab9efb8dd6e..759b34e4980 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_fb.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_vectordisplay_fb.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 differindex 995ba28b892..bae59ebce35 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_wf_mesh.bin +++ 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 differindex 5b3d28b2c06..77b50f31799 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_wf_wireframe.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_wf_wireframe.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_bump.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_bump.bin Binary files differindex 7998ca70fb0..8322fd2f629 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_bump.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_bump.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_bump_instanced.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_bump_instanced.bin Binary files differindex 7ed86a0fd2b..fd18b7f2566 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_bump_instanced.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_bump_instanced.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_callback.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_callback.bin Binary files differindex f7f3092c847..9fd41984481 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_callback.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_callback.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_cubes.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_cubes.bin Binary files differindex 66262f6bc11..0adea9dbafc 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_cubes.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_cubes.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_blur.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_blur.bin Binary files differindex 62e916b1c78..bdedf70fc6e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_blur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_blur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_bright.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_bright.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_bright.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_bright.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_lum.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_lum.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_lum.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_lum.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_lumavg.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_lumavg.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_lumavg.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_lumavg.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_mesh.bin Binary files differindex 172750107c5..22fac1d1986 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_skybox.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_skybox.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_skybox.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_skybox.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_tonemap.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_tonemap.bin Binary files differindex 6fb9ab855e1..4207628c76d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_tonemap.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_hdr_tonemap.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 b842f18e72f..b75a067624c 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 78302fa339b..00043ecb308 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_instancing.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_instancing.bin Binary files differindex 3201b941d1e..87bf3aaf559 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_instancing.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_instancing.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_mesh.bin Binary files differindex 53f57d4439a..3e8345c556e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_oit.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_oit.bin Binary files differindex 7dfd658840c..99384be8a7d 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_oit.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_oit.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_oit_blit.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_oit_blit.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_oit_blit.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_oit_blit.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_particle.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_particle.bin Binary files differindex be331f304db..3fa557e6a86 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_particle.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_particle.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_raymarching.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_raymarching.bin Binary files differindex 38f1edfabd4..2d4511b5868 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_raymarching.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_raymarching.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color.bin Binary files differindex cf6de8b45c3..bed3fcda53a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting.bin Binary files differindex 9dcdb61b4ee..e314087a261 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_csm.bin Binary files differindex a143cfc02b8..30f99a35bc0 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear.bin Binary files differindex 02994d2b8b6..c4912e18f02 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear_csm.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear_csm.bin Binary files differindex 8b833673081..c3984bd8521 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear_csm.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear_csm.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear_omni.bin Binary files differindex 54785f92d0e..e29e4f5e249 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_linear_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_omni.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_omni.bin Binary files differindex ac6332a27f3..b7863fdffd2 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_omni.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_lighting_omni.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_texture.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_color_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_depth.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_depth.bin Binary files differindex cf6de8b45c3..bed3fcda53a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_depth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_depth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_hblur.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_hblur.bin Binary files differindex 49949ec67e8..8732030a4f4 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_hblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_hblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_packdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_packdepth.bin Binary files differindex 1c1ec34d8c7..835d17f65d8 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_packdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_packdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_packdepth_linear.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_packdepth_linear.bin Binary files differindex a5471e7cb39..757d3cc715e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_packdepth_linear.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_packdepth_linear.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_texture.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_texture_lighting.bin Binary files differindex 2e7362934bb..078c7a9f03c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_texture_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_unpackdepth.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_unpackdepth.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_unpackdepth.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_unpackdepth.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_vblur.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_vblur.bin Binary files differindex 123787fa57a..fa0091e60d1 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_vblur.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowmaps_vblur.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_color_lighting.bin Binary files differindex 2e782b0cb4c..1f03cc331fa 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_color_texture.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_color_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svback.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svback.bin Binary files differindex 442d4977a71..61e32ea3058 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svback.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svback.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svfront.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svfront.bin Binary files differindex cf6de8b45c3..bed3fcda53a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svfront.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svfront.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svside.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svside.bin Binary files differindex 3b893600359..d8d6d3d811f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svside.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_svside.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_texture.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_texture_lighting.bin Binary files differindex 2e7362934bb..078c7a9f03c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_shadowvolume_texture_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_mesh.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_mesh.bin Binary files differindex 51bac010fba..b92f9647b7e 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_mesh.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_mesh.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_shadow.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_shadow.bin Binary files differindex cf6de8b45c3..bed3fcda53a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_shadow.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_shadow.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_shadow_pd.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_shadow_pd.bin Binary files differindex 1c1ec34d8c7..835d17f65d8 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_shadow_pd.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_sms_shadow_pd.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color.bin Binary files differindex cf6de8b45c3..bed3fcda53a 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color_lighting.bin Binary files differindex 2e782b0cb4c..1f03cc331fa 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color_lighting.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color_texture.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_color_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_texture.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_texture.bin Binary files differindex 10fb2d926e2..7851e637f21 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_texture_lighting.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_texture_lighting.bin Binary files differindex 2e7362934bb..078c7a9f03c 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_texture_lighting.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_stencil_texture_lighting.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 differindex 003bac66ae8..d1da36a61f9 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_terrain.bin +++ 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 differindex 135157b549a..e818302e559 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_terrain_height_texture.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_terrain_height_texture.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_tree.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_tree.bin Binary files differindex 851e55ebc2e..252a09fb0be 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_tree.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_tree.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_update.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_update.bin Binary files differindex 37e19eade16..7a5b8816287 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_update.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_update.bin diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_vectordisplay_fb.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_vectordisplay_fb.bin Binary files differindex 38f1edfabd4..2d4511b5868 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_vectordisplay_fb.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_vectordisplay_fb.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 differindex caec269a5d4..a155348dc42 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_wf_mesh.bin +++ 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 differindex b72c2f84c67..fc496a9245f 100644 --- a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_wf_wireframe.bin +++ b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_wf_wireframe.bin diff --git a/3rdparty/bgfx/include/bgfx/bgfx.h b/3rdparty/bgfx/include/bgfx/bgfx.h index 9902e7ab897..9398837eb8d 100644 --- a/3rdparty/bgfx/include/bgfx/bgfx.h +++ b/3rdparty/bgfx/include/bgfx/bgfx.h @@ -33,7 +33,6 @@ namespace bgfx enum Enum { DebugCheck, - MinimumRequiredSpecs, InvalidShader, UnableToInitialize, UnableToCreateTexture, @@ -52,10 +51,11 @@ namespace bgfx /// Renderer types: enum Enum { - Null, //!< No rendering. + Noop, //!< No rendering. Direct3D9, //!< Direct3D 9.0 Direct3D11, //!< Direct3D 11.0 Direct3D12, //!< Direct3D 12.0 + Gnm, //!< GNM Metal, //!< Metal OpenGLES, //!< OpenGL ES 2.0+ OpenGL, //!< OpenGL 2.1+ @@ -520,15 +520,11 @@ namespace bgfx /// uint64_t supported; - uint32_t maxDrawCalls; //!< Maximum draw calls. - uint16_t maxTextureSize; //!< Maximum texture size. - uint16_t maxViews; //!< Maximum views. - uint8_t maxFBAttachments; //!< Maximum frame buffer attachments. - uint8_t numGPUs; //!< Number of enumerated GPUs. - uint16_t vendorId; //!< Selected GPU vendor id. + uint16_t vendorId; //!< Selected GPU vendor PCI id. uint16_t deviceId; //!< Selected GPU device id. bool homogeneousDepth; //!< True when NDC depth is in [-1, 1] range. bool originBottomLeft; //!< True when NDC origin is at bottom left. + uint8_t numGPUs; //!< Number of enumerated GPUs. /// GPU info. /// @@ -536,12 +532,36 @@ namespace bgfx /// struct GPU { - uint16_t vendorId; - uint16_t deviceId; + uint16_t vendorId; //!< Vendor PCI id. See `BGFX_PCI_ID_*`. + uint16_t deviceId; //!< Device id. }; GPU gpu[4]; //!< Enumerated GPUs. + struct Limits + { + uint32_t maxDrawCalls; //!< Maximum draw calls. + uint32_t maxBlits; //!< Maximum number of blit calls. + uint32_t maxTextureSize; //!< Maximum texture size. + uint32_t maxViews; //!< Maximum views. + uint32_t maxFrameBuffers; //!< Maximum number of frame buffer handles. + uint32_t maxFBAttachments; //!< Maximum frame buffer attachments. + uint32_t maxPrograms; //!< Maximum number of program handles. + uint32_t maxShaders; //!< Maximum number of shader handles. + uint32_t maxTextures; //!< Maximum number of texture handles. + uint32_t maxTextureSamplers; //!< Maximum number of texture samplers. + uint32_t maxVertexDecls; //!< Maximum number of vertex format declarations. + uint32_t maxVertexStreams; //!< Maximum number of vertex streams. + uint32_t maxIndexBuffers; //!< Maximum number of index buffer handles. + uint32_t maxVertexBuffers; //!< Maximum number of vertex buffer handles. + uint32_t maxDynamicIndexBuffers; //!< Maximum number of dynamic index buffer handles. + uint32_t maxDynamicVertexBuffers; //!< Maximum number of dynamic vertex buffer handles. + uint32_t maxUniforms; //!< Maximum number of uniform handles. + uint32_t maxOcclusionQueries; //!< Maximum number of occlusion query handles. + }; + + Limits limits; + /// Supported texture formats. /// - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - Texture format is not supported. /// - `BGFX_CAPS_FORMAT_TEXTURE_2D` - Texture format is supported. @@ -701,11 +721,11 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_vertex_decl_begin`. /// - VertexDecl& begin(RendererType::Enum _renderer = RendererType::Null); + VertexDecl& begin(RendererType::Enum _renderer = RendererType::Noop); /// End VertexDecl. /// - /// @attention C99 equivalent is `bgfx_vertex_decl_begin`. + /// @attention C99 equivalent is `bgfx_vertex_decl_end`. /// void end(); @@ -931,9 +951,14 @@ namespace bgfx /// Returns supported backend API renderers. /// + /// @param[in] _max Maximum number of elements in _enum array. + /// @param[inout] _enum Array where supported renderers will be written. + /// + /// @returns Number of supported renderers. + /// /// @attention C99 equivalent is `bgfx_get_supported_renderers`. /// - uint8_t getSupportedRenderers(RendererType::Enum _enum[RendererType::Count]); + uint8_t getSupportedRenderers(uint8_t _max = 0, RendererType::Enum* _enum = NULL); /// Returns name of renderer. /// @@ -961,7 +986,7 @@ namespace bgfx /// @param[in] _callback Provide application specific callback interface. /// See: `bgfx::CallbackI` /// - /// @param[in] _reallocator Custom allocator. When custom allocator is not + /// @param[in] _allocator Custom allocator. When custom allocator is not /// specified, library uses default CRT allocator. The library assumes /// custom allocator is thread safe. /// @@ -974,7 +999,7 @@ namespace bgfx , uint16_t _vendorId = BGFX_PCI_ID_NONE , uint16_t _deviceId = 0 , CallbackI* _callback = NULL - , bx::AllocatorI* _reallocator = NULL + , bx::AllocatorI* _allocator = NULL ); /// Shutdown bgfx library. @@ -1052,6 +1077,8 @@ namespace bgfx /// Returns performance counters. /// + /// @attention C99 equivalent is `bgfx_get_stats`. + /// const Stats* getStats(); /// Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx. @@ -1790,6 +1817,7 @@ namespace bgfx /// /// @param[in] _handle Texture handle. /// @param[in] _data Destination buffer. + /// @param[in] _mip Mip level. /// /// @returns Frame number when the result will be available. See: `bgfx::frame`. /// @@ -1797,7 +1825,7 @@ namespace bgfx /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`. /// @attention C99 equivalent is `bgfx_read_texture`. /// - uint32_t readTexture(TextureHandle _handle, void* _data); + uint32_t readTexture(TextureHandle _handle, void* _data, uint8_t _mip = 0); /// Read back texture content. /// @@ -2538,7 +2566,7 @@ namespace bgfx /// call submit. /// @returns Number of draw calls. /// - /// @attention C99 equivalent is `bgfx_submit_occlusion_query. + /// @attention C99 equivalent is `bgfx_submit_occlusion_query`. /// uint32_t submit( uint8_t _id diff --git a/3rdparty/bgfx/include/bgfx/bgfxdefines.h b/3rdparty/bgfx/include/bgfx/bgfxdefines.h index c16cdaeedce..7d2b2166219 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(20) +#define BGFX_API_VERSION UINT32_C(28) /// #define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write. @@ -365,29 +365,30 @@ #define BGFX_RESET_RESERVED_MASK UINT32_C(0x80000000) //!< Internal bits mask. /// -#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000000001) //!< Texture compare less equal mode is supported. -#define BGFX_CAPS_TEXTURE_COMPARE_ALL UINT64_C(0x0000000000000003) //!< All texture compare modes are supported. -#define BGFX_CAPS_TEXTURE_3D UINT64_C(0x0000000000000004) //!< 3D textures are supported. -#define BGFX_CAPS_VERTEX_ATTRIB_HALF UINT64_C(0x0000000000000008) //!< Vertex attribute half-float is supported. -#define BGFX_CAPS_VERTEX_ATTRIB_UINT10 UINT64_C(0x0000000000000010) //!< Vertex attribute 10_10_10_2 is supported. -#define BGFX_CAPS_INSTANCING UINT64_C(0x0000000000000020) //!< Instancing is supported. -#define BGFX_CAPS_RENDERER_MULTITHREADED UINT64_C(0x0000000000000040) //!< Renderer is on separate thread. -#define BGFX_CAPS_FRAGMENT_DEPTH UINT64_C(0x0000000000000080) //!< Fragment depth is accessible in fragment shader. -#define BGFX_CAPS_BLEND_INDEPENDENT UINT64_C(0x0000000000000100) //!< Blend independent is supported. -#define BGFX_CAPS_COMPUTE UINT64_C(0x0000000000000200) //!< Compute shaders are supported. -#define BGFX_CAPS_FRAGMENT_ORDERING UINT64_C(0x0000000000000400) //!< Fragment ordering is available in fragment shader. -#define BGFX_CAPS_SWAP_CHAIN UINT64_C(0x0000000000000800) //!< Multiple windows are supported. -#define BGFX_CAPS_HMD UINT64_C(0x0000000000001000) //!< Head Mounted Display is available. -#define BGFX_CAPS_INDEX32 UINT64_C(0x0000000000002000) //!< 32-bit indices are supported. -#define BGFX_CAPS_DRAW_INDIRECT UINT64_C(0x0000000000004000) //!< Draw indirect is supported. -#define BGFX_CAPS_HIDPI UINT64_C(0x0000000000008000) //!< HiDPI rendering is supported. -#define BGFX_CAPS_TEXTURE_BLIT UINT64_C(0x0000000000010000) //!< Texture blit is supported. -#define BGFX_CAPS_TEXTURE_READ_BACK UINT64_C(0x0000000000020000) //!< Read-back texture is supported. -#define BGFX_CAPS_OCCLUSION_QUERY UINT64_C(0x0000000000040000) //!< Occlusion query is supported. -#define BGFX_CAPS_ALPHA_TO_COVERAGE UINT64_C(0x0000000000080000) //!< Alpha to coverage is supported. -#define BGFX_CAPS_CONSERVATIVE_RASTER UINT64_C(0x0000000000100000) //!< Conservative rasterization is supported. -#define BGFX_CAPS_TEXTURE_2D_ARRAY UINT64_C(0x0000000000200000) //!< 2D texture array is supported. -#define BGFX_CAPS_TEXTURE_CUBE_ARRAY UINT64_C(0x0000000000400000) //!< Cubemap texture array is supported. +#define BGFX_CAPS_ALPHA_TO_COVERAGE UINT64_C(0x0000000000000001) //!< Alpha to coverage is supported. +#define BGFX_CAPS_BLEND_INDEPENDENT UINT64_C(0x0000000000000002) //!< Blend independent is supported. +#define BGFX_CAPS_COMPUTE UINT64_C(0x0000000000000004) //!< Compute shaders are supported. +#define BGFX_CAPS_CONSERVATIVE_RASTER UINT64_C(0x0000000000000008) //!< Conservative rasterization is supported. +#define BGFX_CAPS_DRAW_INDIRECT UINT64_C(0x0000000000000010) //!< Draw indirect is supported. +#define BGFX_CAPS_FRAGMENT_DEPTH UINT64_C(0x0000000000000020) //!< Fragment depth is accessible in fragment shader. +#define BGFX_CAPS_FRAGMENT_ORDERING UINT64_C(0x0000000000000040) //!< Fragment ordering is available in fragment shader. +#define BGFX_CAPS_GRAPHICS_DEBUGGER UINT64_C(0x0000000000000080) //!< Graphics debugger is present. +#define BGFX_CAPS_HIDPI UINT64_C(0x0000000000000100) //!< HiDPI rendering is supported. +#define BGFX_CAPS_HMD UINT64_C(0x0000000000000200) //!< Head Mounted Display is available. +#define BGFX_CAPS_INDEX32 UINT64_C(0x0000000000000400) //!< 32-bit indices are supported. +#define BGFX_CAPS_INSTANCING UINT64_C(0x0000000000000800) //!< Instancing is supported. +#define BGFX_CAPS_OCCLUSION_QUERY UINT64_C(0x0000000000001000) //!< Occlusion query is supported. +#define BGFX_CAPS_RENDERER_MULTITHREADED UINT64_C(0x0000000000002000) //!< Renderer is on separate thread. +#define BGFX_CAPS_SWAP_CHAIN UINT64_C(0x0000000000004000) //!< Multiple windows are supported. +#define BGFX_CAPS_TEXTURE_2D_ARRAY UINT64_C(0x0000000000008000) //!< 2D texture array is supported. +#define BGFX_CAPS_TEXTURE_3D UINT64_C(0x0000000000010000) //!< 3D textures are supported. +#define BGFX_CAPS_TEXTURE_BLIT UINT64_C(0x0000000000020000) //!< Texture blit is supported. +#define BGFX_CAPS_TEXTURE_COMPARE_ALL UINT64_C(0x00000000000c0000) //!< All texture compare modes are supported. +#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000080000) //!< Texture compare less equal mode is supported. +#define BGFX_CAPS_TEXTURE_CUBE_ARRAY UINT64_C(0x0000000000100000) //!< Cubemap texture array is supported. +#define BGFX_CAPS_TEXTURE_READ_BACK UINT64_C(0x0000000000200000) //!< Read-back texture is supported. +#define BGFX_CAPS_VERTEX_ATTRIB_HALF UINT64_C(0x0000000000400000) //!< Vertex attribute half-float is supported. +#define BGFX_CAPS_VERTEX_ATTRIB_UINT10 UINT64_C(0x0000000000800000) //!< Vertex attribute 10_10_10_2 is supported. /// #define BGFX_CAPS_FORMAT_TEXTURE_NONE UINT16_C(0x0000) //!< Texture format is not supported. diff --git a/3rdparty/bgfx/include/bgfx/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/bgfxplatform.h index f44bb82f8e4..09962b6d110 100644 --- a/3rdparty/bgfx/include/bgfx/bgfxplatform.h +++ b/3rdparty/bgfx/include/bgfx/bgfxplatform.h @@ -51,6 +51,7 @@ namespace bgfx void* context; //!< GL context, or D3D device. void* backBuffer; //!< GL backbuffer, or D3D render target view. void* backBufferDS; //!< Backbuffer depth/stencil. + void* session; //!< ovrSession, for Oculus SDK }; /// Set platform data. diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfx.h b/3rdparty/bgfx/include/bgfx/c99/bgfx.h index d3faaf4c6e6..04693244174 100644 --- a/3rdparty/bgfx/include/bgfx/c99/bgfx.h +++ b/3rdparty/bgfx/include/bgfx/c99/bgfx.h @@ -43,10 +43,11 @@ typedef enum bgfx_renderer_type { - BGFX_RENDERER_TYPE_NULL, + BGFX_RENDERER_TYPE_NOOP, BGFX_RENDERER_TYPE_DIRECT3D9, BGFX_RENDERER_TYPE_DIRECT3D11, BGFX_RENDERER_TYPE_DIRECT3D12, + BGFX_RENDERER_TYPE_GNM, BGFX_RENDERER_TYPE_METAL, BGFX_RENDERER_TYPE_OPENGLES, BGFX_RENDERER_TYPE_OPENGL, @@ -406,6 +407,29 @@ typedef struct bgfx_caps_gpu } bgfx_caps_gpu_t; +typedef struct bgfx_caps_limits +{ + uint32_t maxDrawCalls; + uint32_t maxBlits; + uint32_t maxTextureSize; + uint32_t maxViews; + uint32_t maxFrameBuffers; + uint32_t maxFBAttachments; + uint32_t maxPrograms; + uint32_t maxShaders; + uint32_t maxTextures; + uint32_t maxTextureSamplers; + uint32_t maxVertexDecls; + uint32_t maxVertexStreams; + uint32_t maxIndexBuffers; + uint32_t maxVertexBuffers; + uint32_t maxDynamicIndexBuffers; + uint32_t maxDynamicVertexBuffers; + uint32_t maxUniforms; + uint32_t maxOcclusionQueries; + +} bgfx_caps_limits_t; + /**/ typedef struct bgfx_caps { @@ -413,17 +437,14 @@ typedef struct bgfx_caps uint64_t supported; - uint32_t maxDrawCalls; - uint16_t maxTextureSize; - uint16_t maxViews; - uint8_t maxFBAttachments; - uint8_t numGPUs; + uint16_t vendorId; + uint16_t deviceId; bool homogeneousDepth; bool originBottomLeft; + uint8_t numGPUs; - uint16_t vendorId; - uint16_t deviceId; bgfx_caps_gpu_t gpu[4]; + bgfx_caps_limits_t limits; uint16_t formats[BGFX_TEXTURE_FORMAT_COUNT]; @@ -433,7 +454,6 @@ typedef struct bgfx_caps typedef enum bgfx_fatal { BGFX_FATAL_DEBUG_CHECK, - BGFX_FATAL_MINIMUM_REQUIRED_SPECS, BGFX_FATAL_INVALID_SHADER, BGFX_FATAL_UNABLE_TO_INITIALIZE, BGFX_FATAL_UNABLE_TO_CREATE_TEXTURE, @@ -516,7 +536,7 @@ BGFX_C_API void bgfx_image_swizzle_bgra8(uint32_t _width, uint32_t _height, uint BGFX_C_API void bgfx_image_rgba8_downsample_2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst); /**/ -BGFX_C_API uint8_t bgfx_get_supported_renderers(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT]); +BGFX_C_API uint8_t bgfx_get_supported_renderers(uint8_t _max, bgfx_renderer_type_t* _enum); /**/ BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type); @@ -684,7 +704,7 @@ BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _m BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); /**/ -BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data); +BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data, uint8_t _mip); /**/ BGFX_C_API uint32_t bgfx_read_frame_buffer(bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, void* _data); diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h index ca3679ea4c2..2b7643ef114 100644 --- a/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h +++ b/3rdparty/bgfx/include/bgfx/c99/bgfxplatform.h @@ -39,6 +39,7 @@ typedef struct bgfx_platform_data void* context; void* backBuffer; void* backBufferDS; + void* session; } bgfx_platform_data_t; @@ -81,7 +82,7 @@ typedef struct bgfx_interface_vtbl void (*topology_sort_tri_list)(bgfx_topology_sort_t _sort, void* _dst, uint32_t _dstSize, const float _dir[3], const float _pos[3], const void* _vertices, uint32_t _stride, 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]); + uint8_t (*get_supported_renderers)(uint8_t _max, bgfx_renderer_type_t* _enum); const char* (*get_renderer_name)(bgfx_renderer_type_t _type); bool (*init)(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_allocator_interface_t* _allocator); void (*shutdown)(); @@ -137,6 +138,8 @@ typedef struct bgfx_interface_vtbl void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); void (*update_texture_3d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem); void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); + uint32_t (*read_texture)(bgfx_texture_handle_t _handle, void* _data, uint8_t _mip); + uint32_t (*read_frame_buffer)(bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, void* _data); void (*destroy_texture)(bgfx_texture_handle_t _handle); bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags); bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags); diff --git a/3rdparty/bgfx/makefile b/3rdparty/bgfx/makefile index 82a054ffa56..8f9aef09164 100644 --- a/3rdparty/bgfx/makefile +++ b/3rdparty/bgfx/makefile @@ -39,28 +39,28 @@ clean: ## Clean all intermediate files. @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 - $(GENIE) --with-tools --with-shared-lib vs2013 - $(GENIE) --with-tools --with-shared-lib vs2015 - $(GENIE) --with-tools --with-shared-lib --gcc=mingw-gcc gmake - $(GENIE) --with-tools --with-shared-lib --gcc=linux-gcc gmake - $(GENIE) --with-tools --with-shared-lib --gcc=osx gmake - $(GENIE) --with-tools --with-shared-lib --xcode=osx xcode4 - $(GENIE) --with-tools --with-shared-lib --xcode=ios xcode4 - $(GENIE) --with-shared-lib --gcc=freebsd gmake - - $(GENIE) --gcc=android-arm gmake - $(GENIE) --gcc=android-mips gmake - $(GENIE) --gcc=android-x86 gmake - $(GENIE) --gcc=asmjs gmake - $(GENIE) --gcc=ios-arm gmake - $(GENIE) --gcc=ios-simulator gmake - $(GENIE) --gcc=nacl gmake - $(GENIE) --gcc=nacl-arm gmake - $(GENIE) --gcc=pnacl gmake - $(GENIE) --gcc=rpi gmake + $(GENIE) --with-tools --with-examples --with-shared-lib vs2008 + $(GENIE) --with-tools --with-examples --with-shared-lib vs2010 + $(GENIE) --with-tools --with-examples --with-shared-lib vs2012 + $(GENIE) --with-tools --with-examples --with-shared-lib vs2013 + $(GENIE) --with-tools --with-examples --with-shared-lib vs2015 + $(GENIE) --with-tools --with-examples --with-shared-lib --gcc=mingw-gcc gmake + $(GENIE) --with-tools --with-examples --with-shared-lib --gcc=linux-gcc gmake + $(GENIE) --with-tools --with-examples --with-shared-lib --gcc=osx gmake + $(GENIE) --with-tools --with-examples --with-shared-lib --xcode=osx xcode4 + $(GENIE) --with-tools --with-examples --with-shared-lib --xcode=ios xcode4 + $(GENIE) --with-examples --with-shared-lib --gcc=freebsd gmake + $(GENIE) --with-examples --gcc=android-arm gmake + $(GENIE) --with-examples --gcc=android-mips gmake + $(GENIE) --with-examples --gcc=android-x86 gmake + $(GENIE) --with-examples --gcc=asmjs gmake + $(GENIE) --with-examples --gcc=ios-arm gmake + $(GENIE) --with-examples --gcc=ios-arm64 gmake + $(GENIE) --with-examples --gcc=ios-simulator gmake + $(GENIE) --with-examples --gcc=nacl gmake + $(GENIE) --with-examples --gcc=nacl-arm gmake + $(GENIE) --with-examples --gcc=pnacl gmake + $(GENIE) --with-examples --gcc=rpi gmake .build/projects/gmake-android-arm: $(GENIE) --gcc=android-arm gmake @@ -95,7 +95,7 @@ asmjs-release: .build/projects/gmake-asmjs ## Build - Emscripten 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 + $(GENIE) --with-tools --with-examples --with-shared-lib --gcc=linux-gcc gmake 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 ## Build - Linux x86 Release @@ -107,7 +107,7 @@ linux-release64: .build/projects/gmake-linux ## Build - Linux x64 Release 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 + $(GENIE) --with-tools --with-examples --with-shared-lib --gcc=freebsd gmake 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 ## Build - FreeBSD x86 Release @@ -119,7 +119,7 @@ freebsd-release64: .build/projects/gmake-freebsd ## Build - FreeBSD x86 Release 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 + $(GENIE) --with-tools --with-examples --with-shared-lib --gcc=mingw-gcc gmake 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 ## Build - MinGW GCC x86 Release @@ -143,7 +143,7 @@ mingw-clang-release64: .build/projects/gmake-mingw-clang ## Build - MinGW Clang 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 + $(GENIE) --with-tools --with-examples --with-shared-lib vs2008 vs2008-debug32: .build/projects/vs2008 ## Build - VS2008 x86 Debug devenv .build/projects/vs2008/bgfx.sln /Build "Debug|Win32" vs2008-release32: .build/projects/vs2008 ## Build - VS2008 x86 Release @@ -155,7 +155,7 @@ vs2008-release64: .build/projects/vs2008 ## Build - VS2008 x64 Release 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 + $(GENIE) --with-tools --with-examples --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 @@ -167,7 +167,7 @@ vs2010-release64: .build/projects/vs2010 ## Build - VS2010 x64 Release 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 + $(GENIE) --with-tools --with-examples --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 @@ -179,7 +179,7 @@ vs2012-release64: .build/projects/vs2012 ## Build - VS2012 x64 Release 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 + $(GENIE) --with-tools --with-examples --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 @@ -191,7 +191,7 @@ vs2013-release64: .build/projects/vs2013 ## Build - VS2013 x64 Release 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 + $(GENIE) --with-tools --with-examples --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 @@ -231,7 +231,7 @@ pnacl-release: .build/projects/gmake-pnacl ## Build - Portable Native Client Rel 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 + $(GENIE) --with-tools --with-examples --with-shared-lib --gcc=osx gmake osx-debug32: .build/projects/gmake-osx ## Build - OSX x86 Debug $(MAKE) -C .build/projects/gmake-osx config=debug32 osx-release32: .build/projects/gmake-osx ## Build - OSX x86 Release @@ -250,6 +250,14 @@ 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 ## Build - iOS ARM Debug and Release +.build/projects/gmake-ios-arm64: + $(GENIE) --gcc=ios-arm64 gmake +ios-arm64-debug: .build/projects/gmake-ios-arm64 ## Build - iOS ARM64 Debug + $(MAKE) -R -C .build/projects/gmake-ios-arm64 config=debug +ios-arm64-release: .build/projects/gmake-ios-arm64 ## Build - iOS ARM64 Release + $(MAKE) -R -C .build/projects/gmake-ios-arm64 config=release +ios-arm64: ios-arm64-debug ios-arm64-release ## Build - iOS ARM64 Debug and Release + .build/projects/gmake-ios-simulator: $(GENIE) --gcc=ios-simulator gmake ios-simulator-debug: .build/projects/gmake-ios-simulator ## Build - iOS Simulator Debug diff --git a/3rdparty/bgfx/scripts/bgfx.lua b/3rdparty/bgfx/scripts/bgfx.lua index 76d6b70258a..a3716b976f3 100644 --- a/3rdparty/bgfx/scripts/bgfx.lua +++ b/3rdparty/bgfx/scripts/bgfx.lua @@ -3,6 +3,38 @@ -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- +function filesexist(_srcPath, _dstPath, _files) + for _, file in ipairs(_files) do + file = path.getrelative(_srcPath, file) + local filePath = path.join(_dstPath, file) + if not os.isfile(filePath) then return false end + end + + return true +end + +function overridefiles(_srcPath, _dstPath, _files) + + local remove = {} + local add = {} + for _, file in ipairs(_files) do + file = path.getrelative(_srcPath, file) + local filePath = path.join(_dstPath, file) + if not os.isfile(filePath) then return end + + table.insert(remove, path.join(_srcPath, file)) + table.insert(add, filePath) + end + + removefiles { + remove, + } + + files { + add, + } +end + function bgfxProject(_name, _kind, _defines) project ("bgfx" .. _name) @@ -98,6 +130,7 @@ function bgfxProject(_name, _kind, _defines) "-framework QuartzCore", "-framework OpenGL", "-weak_framework Metal", + "-weak_framework MetalKit", } configuration { "not nacl", "not linux-steamlink" } @@ -128,25 +161,26 @@ function bgfxProject(_name, _kind, _defines) path.join(BGFX_DIR, "src/**.bin.h"), } + overridefiles(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), { + path.join(BGFX_DIR, "src/renderer_vk.cpp"), + path.join(BGFX_DIR, "src/renderer_vk.h"), + }) + + overridefiles(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), { + path.join(BGFX_DIR, "src/renderer_gnm.cpp"), + path.join(BGFX_DIR, "src/renderer_gnm.h"), + }) + if _OPTIONS["with-amalgamated"] then excludes { path.join(BGFX_DIR, "src/bgfx.cpp"), - path.join(BGFX_DIR, "src/glcontext_egl.cpp"), - path.join(BGFX_DIR, "src/glcontext_glx.cpp"), - path.join(BGFX_DIR, "src/glcontext_ppapi.cpp"), - path.join(BGFX_DIR, "src/glcontext_wgl.cpp"), + path.join(BGFX_DIR, "src/debug_**.cpp"), + path.join(BGFX_DIR, "src/glcontext_**.cpp"), path.join(BGFX_DIR, "src/image.cpp"), - path.join(BGFX_DIR, "src/ovr.cpp"), - path.join(BGFX_DIR, "src/renderdoc.cpp"), - path.join(BGFX_DIR, "src/renderer_d3d9.cpp"), - path.join(BGFX_DIR, "src/renderer_d3d11.cpp"), - path.join(BGFX_DIR, "src/renderer_d3d12.cpp"), - path.join(BGFX_DIR, "src/renderer_null.cpp"), - path.join(BGFX_DIR, "src/renderer_gl.cpp"), - path.join(BGFX_DIR, "src/renderer_vk.cpp"), - path.join(BGFX_DIR, "src/shader_dx9bc.cpp"), - path.join(BGFX_DIR, "src/shader_dxbc.cpp"), - path.join(BGFX_DIR, "src/shader_spirv.cpp"), + path.join(BGFX_DIR, "src/hmd**.cpp"), + path.join(BGFX_DIR, "src/renderer_**.cpp"), + path.join(BGFX_DIR, "src/shader**.cpp"), + path.join(BGFX_DIR, "src/topology.cpp"), path.join(BGFX_DIR, "src/vertexdecl.cpp"), } @@ -156,20 +190,23 @@ function bgfxProject(_name, _kind, _defines) } excludes { - path.join(BGFX_DIR, "src/glcontext_eagl.mm"), - path.join(BGFX_DIR, "src/glcontext_nsgl.mm"), - path.join(BGFX_DIR, "src/renderer_mtl.mm"), + path.join(BGFX_DIR, "src/glcontext_**.mm"), + path.join(BGFX_DIR, "src/renderer_**.mm"), path.join(BGFX_DIR, "src/amalgamated.cpp"), } + configuration { "not (xcode* or osx or ios*)" } + excludes { + path.join(BGFX_DIR, "src/**.mm"), + } + configuration {} else configuration { "xcode* or osx or ios*" } files { - path.join(BGFX_DIR, "src/glcontext_eagl.mm"), - path.join(BGFX_DIR, "src/glcontext_nsgl.mm"), - path.join(BGFX_DIR, "src/renderer_mtl.mm"), + path.join(BGFX_DIR, "src/glcontext_**.mm"), + path.join(BGFX_DIR, "src/renderer_**.mm"), } configuration {} diff --git a/3rdparty/bgfx/scripts/genie.lua b/3rdparty/bgfx/scripts/genie.lua index fe21f0eaa14..2e915603fef 100644 --- a/3rdparty/bgfx/scripts/genie.lua +++ b/3rdparty/bgfx/scripts/genie.lua @@ -43,6 +43,11 @@ newoption { description = "Enable building tools.", } +newoption { + trigger = "with-examples", + description = "Enable building examples.", +} + solution "bgfx" configurations { "Debug", @@ -355,48 +360,52 @@ end dofile "bgfx.lua" -group "examples" -dofile "example-common.lua" - group "libs" bgfxProject("", "StaticLib", {}) -group "examples" -exampleProject("00-helloworld") -exampleProject("01-cubes") -exampleProject("02-metaballs") -exampleProject("03-raymarch") -exampleProject("04-mesh") -exampleProject("05-instancing") -exampleProject("06-bump") -exampleProject("07-callback") -exampleProject("08-update") -exampleProject("09-hdr") -exampleProject("10-font") -exampleProject("11-fontsdf") -exampleProject("12-lod") -exampleProject("13-stencil") -exampleProject("14-shadowvolumes") -exampleProject("15-shadowmaps-simple") -exampleProject("16-shadowmaps") -exampleProject("17-drawstress") -exampleProject("18-ibl") -exampleProject("19-oit") -exampleProject("20-nanovg") -exampleProject("21-deferred") -exampleProject("22-windows") -exampleProject("23-vectordisplay") -exampleProject("24-nbody") -exampleProject("26-occlusion") -exampleProject("27-terrain") -exampleProject("28-wireframe") -exampleProject("29-debugdraw") -exampleProject("30-picking") -exampleProject("31-rsm") - --- C99 source doesn't compile under WinRT settings -if not premake.vstudio.iswinrt() then - exampleProject("25-c99") +if _OPTIONS["with-examples"] or _OPTIONS["with-tools"] then + group "examples" + dofile "example-common.lua" +end + +if _OPTIONS["with-examples"] then + group "examples" + exampleProject("00-helloworld") + exampleProject("01-cubes") + exampleProject("02-metaballs") + exampleProject("03-raymarch") + exampleProject("04-mesh") + exampleProject("05-instancing") + exampleProject("06-bump") + exampleProject("07-callback") + exampleProject("08-update") + exampleProject("09-hdr") + exampleProject("10-font") + exampleProject("11-fontsdf") + exampleProject("12-lod") + exampleProject("13-stencil") + exampleProject("14-shadowvolumes") + exampleProject("15-shadowmaps-simple") + exampleProject("16-shadowmaps") + exampleProject("17-drawstress") + exampleProject("18-ibl") + exampleProject("19-oit") + exampleProject("20-nanovg") + exampleProject("21-deferred") + exampleProject("22-windows") + exampleProject("23-vectordisplay") + exampleProject("24-nbody") + exampleProject("26-occlusion") + exampleProject("27-terrain") + exampleProject("28-wireframe") + exampleProject("29-debugdraw") + exampleProject("30-picking") + exampleProject("31-rsm") + + -- C99 source doesn't compile under WinRT settings + if not premake.vstudio.iswinrt() then + exampleProject("25-c99") + end end if _OPTIONS["with-shared-lib"] then diff --git a/3rdparty/bgfx/scripts/shader.mk b/3rdparty/bgfx/scripts/shader.mk index 7a479ea8896..56937fb1026 100644 --- a/3rdparty/bgfx/scripts/shader.mk +++ b/3rdparty/bgfx/scripts/shader.mk @@ -15,15 +15,18 @@ ifndef TARGET .PHONY: all all: @echo Usage: make TARGET=# [clean, all, rebuild] - @echo " TARGET=0 (hlsl - dx9)" - @echo " TARGET=1 (hlsl - dx11)" - @echo " TARGET=2 (glsl - nacl)" - @echo " TARGET=3 (glsl - android)" - @echo " TARGET=4 (glsl - linux)" - @echo " TARGET=5 (metal - OSX/iOS)" - @echo " VERBOSE=1 show build commands." + @echo " TARGET=0 (hlsl - d3d9)" + @echo " TARGET=1 (hlsl - d3d11)" + @echo " TARGET=2 (essl - nacl)" + @echo " TARGET=3 (essl - android)" + @echo " TARGET=4 (glsl)" + @echo " TARGET=5 (metal)" + @echo " TARGET=6 (pssl)" + @echo " TARGET=7 (spriv)" else +ADDITIONAL_INCLUDES?= + ifeq ($(TARGET), 0) VS_FLAGS=--platform windows -p vs_3_0 -O 3 FS_FLAGS=--platform windows -p ps_3_0 -O 3 @@ -38,13 +41,13 @@ else ifeq ($(TARGET), 2) VS_FLAGS=--platform nacl FS_FLAGS=--platform nacl -SHADER_PATH=shaders/gles +SHADER_PATH=shaders/essl else ifeq ($(TARGET), 3) VS_FLAGS=--platform android FS_FLAGS=--platform android CS_FLAGS=--platform android -SHADER_PATH=shaders/gles +SHADER_PATH=shaders/essl else ifeq ($(TARGET), 4) VS_FLAGS=--platform linux -p 120 @@ -57,6 +60,20 @@ VS_FLAGS=--platform osx -p metal FS_FLAGS=--platform osx -p metal CS_FLAGS=--platform osx -p metal SHADER_PATH=shaders/metal +else +ifeq ($(TARGET), 6) +VS_FLAGS=--platform orbis -p pssl +FS_FLAGS=--platform orbis -p pssl +CS_FLAGS=--platform orbis -p pssl +SHADER_PATH=shaders/pssl +else +ifeq ($(TARGET), 7) +VS_FLAGS=--platform linux -p spirv +FS_FLAGS=--platform linux -p spirv +CS_FLAGS=--platform linux -p spirv +SHADER_PATH=shaders/spirv +endif +endif endif endif endif @@ -65,9 +82,9 @@ endif endif THISDIR := $(dir $(lastword $(MAKEFILE_LIST))) -VS_FLAGS+=-i $(THISDIR)../src/ -FS_FLAGS+=-i $(THISDIR)../src/ -CS_FLAGS+=-i $(THISDIR)../src/ +VS_FLAGS+=-i $(THISDIR)../src/ $(ADDITIONAL_INCLUDES) +FS_FLAGS+=-i $(THISDIR)../src/ $(ADDITIONAL_INCLUDES) +CS_FLAGS+=-i $(THISDIR)../src/ $(ADDITIONAL_INCLUDES) BUILD_OUTPUT_DIR=$(addprefix ./, $(RUNTIME_DIR)/$(SHADER_PATH)) BUILD_INTERMEDIATE_DIR=$(addprefix $(BUILD_DIR)/, $(SHADER_PATH)) diff --git a/3rdparty/bgfx/scripts/shaderc.lua b/3rdparty/bgfx/scripts/shaderc.lua index f45310417e4..3942b6917de 100644 --- a/3rdparty/bgfx/scripts/shaderc.lua +++ b/3rdparty/bgfx/scripts/shaderc.lua @@ -114,4 +114,26 @@ project "shaderc" path.join(GLSL_OPTIMIZER, "src/glsl/builtin_stubs.cpp"), } + if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), { + path.join(BGFX_DIR, "scripts/shaderc.lua"), }) then + + if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), { + path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"), }) then + + removefiles { + path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"), + } + end + + if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), { + path.join(BGFX_DIR, "tools/shaderc/shaderc_spirv.cpp"), }) then + + removefiles { + path.join(BGFX_DIR, "tools/shaderc/shaderc_spirv.cpp"), + } + end + + dofile(path.join(BGFX_DIR, "../bgfx-ext/scripts/shaderc.lua") ) + end + strip() diff --git a/3rdparty/bgfx/src/amalgamated.cpp b/3rdparty/bgfx/src/amalgamated.cpp index 90059ad5585..9e5de6e2b86 100644 --- a/3rdparty/bgfx/src/amalgamated.cpp +++ b/3rdparty/bgfx/src/amalgamated.cpp @@ -9,15 +9,17 @@ #include "glcontext_ppapi.cpp" #include "glcontext_wgl.cpp" #include "image.cpp" +#include "hmd.cpp" #include "hmd_ovr.cpp" #include "hmd_openvr.cpp" #include "debug_renderdoc.cpp" #include "renderer_d3d9.cpp" #include "renderer_d3d11.cpp" #include "renderer_d3d12.cpp" -#include "renderer_null.cpp" +#include "renderer_noop.cpp" #include "renderer_gl.cpp" #include "renderer_vk.cpp" +#include "renderer_gnm.cpp" #include "shader_dxbc.cpp" #include "shader_dx9bc.cpp" #include "shader_spirv.cpp" diff --git a/3rdparty/bgfx/src/bgfx.cpp b/3rdparty/bgfx/src/bgfx.cpp index 627c90b85b2..02b76fa8b09 100644 --- a/3rdparty/bgfx/src/bgfx.cpp +++ b/3rdparty/bgfx/src/bgfx.cpp @@ -426,6 +426,87 @@ namespace bgfx va_end(argList); } +#include "vs_debugfont.bin.h" +#include "fs_debugfont.bin.h" +#include "vs_clear.bin.h" +#include "fs_clear0.bin.h" +#include "fs_clear1.bin.h" +#include "fs_clear2.bin.h" +#include "fs_clear3.bin.h" +#include "fs_clear4.bin.h" +#include "fs_clear5.bin.h" +#include "fs_clear6.bin.h" +#include "fs_clear7.bin.h" + + struct EmbeddedShader + { + struct Data + { + bgfx::RendererType::Enum type; + const uint8_t* data; + uint32_t size; + }; + + const char* name; + Data data[RendererType::Count]; + }; + +#define BGFX_DECLARE_SHADER_EMBEDDED(_name) \ + { \ + #_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::Gnm, BX_CONCATENATE(_name, _pssl), BX_CONCATENATE(_name, _pssl_size) }, \ + { bgfx::RendererType::Metal, BX_CONCATENATE(_name, _mtl ), sizeof(BX_CONCATENATE(_name, _mtl ) ) }, \ + { 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::Count, NULL, 0 }, \ + } \ + } + + static const EmbeddedShader s_embeddedShaders[] = + { + BGFX_DECLARE_SHADER_EMBEDDED(vs_debugfont), + BGFX_DECLARE_SHADER_EMBEDDED(fs_debugfont), + + BGFX_DECLARE_SHADER_EMBEDDED(vs_clear), + + BGFX_DECLARE_SHADER_EMBEDDED(fs_clear0), + BGFX_DECLARE_SHADER_EMBEDDED(fs_clear1), + BGFX_DECLARE_SHADER_EMBEDDED(fs_clear2), + BGFX_DECLARE_SHADER_EMBEDDED(fs_clear3), + BGFX_DECLARE_SHADER_EMBEDDED(fs_clear4), + BGFX_DECLARE_SHADER_EMBEDDED(fs_clear5), + BGFX_DECLARE_SHADER_EMBEDDED(fs_clear6), + BGFX_DECLARE_SHADER_EMBEDDED(fs_clear7), + + { NULL, { { bgfx::RendererType::Count, NULL, 0 } } } + }; + + static ShaderHandle createEmbeddedShader(RendererType::Enum _type, const char* _name) + { + for (const EmbeddedShader* es = s_embeddedShaders; NULL != es->name; ++es) + { + if (0 == strcmp(_name, es->name) ) + { + for (const EmbeddedShader::Data* esd = es->data; RendererType::Count != esd->type; ++esd) + { + if (_type == esd->type) + { + return createShader(makeRef(esd->data, esd->size) ); + } + } + } + } + + ShaderHandle handle = BGFX_INVALID_HANDLE; + return handle; + } + + #include "charset.h" void charsetFillTexture(const uint8_t* _charset, uint8_t* _rgba, uint32_t _height, uint32_t _pitch, uint32_t _bpp) @@ -461,10 +542,10 @@ namespace bgfx .add(Attrib::TexCoord0, 2, AttribType::Float) .end(); - uint16_t width = 2048; + uint16_t width = 2048; uint16_t height = 24; - uint8_t bpp = 1; - uint32_t pitch = width*bpp; + uint8_t bpp = 1; + uint32_t pitch = width*bpp; const Memory* mem; @@ -481,49 +562,8 @@ namespace bgfx , mem ); - switch (g_caps.rendererType) - { - case RendererType::Direct3D9: - mem = makeRef(vs_debugfont_dx9, sizeof(vs_debugfont_dx9) ); - break; - - case RendererType::Direct3D11: - case RendererType::Direct3D12: - mem = makeRef(vs_debugfont_dx11, sizeof(vs_debugfont_dx11) ); - break; - - case RendererType::Metal: - mem = makeRef(vs_debugfont_mtl, sizeof(vs_debugfont_mtl) ); - break; - - default: - mem = makeRef(vs_debugfont_glsl, sizeof(vs_debugfont_glsl) ); - break; - } - - ShaderHandle vsh = createShader(mem); - - switch (g_caps.rendererType) - { - case RendererType::Direct3D9: - mem = makeRef(fs_debugfont_dx9, sizeof(fs_debugfont_dx9) ); - break; - - case RendererType::Direct3D11: - case RendererType::Direct3D12: - mem = makeRef(fs_debugfont_dx11, sizeof(fs_debugfont_dx11) ); - break; - - case RendererType::Metal: - mem = makeRef(fs_debugfont_mtl, sizeof(fs_debugfont_mtl) ); - break; - - default: - mem = makeRef(fs_debugfont_glsl, sizeof(fs_debugfont_glsl) ); - break; - } - - ShaderHandle fsh = createShader(mem); + ShaderHandle vsh = createEmbeddedShader(g_caps.rendererType, "vs_debugfont"); + ShaderHandle fsh = createEmbeddedShader(g_caps.rendererType, "fs_debugfont"); m_program = createProgram(vsh, fsh, true); @@ -535,7 +575,11 @@ namespace bgfx { BGFX_CHECK_MAIN_THREAD(); - destroyProgram(m_program); + if (isValid(m_program) ) + { + destroyProgram(m_program); + } + destroyTexture(m_texture); s_ctx->destroyTransientVertexBuffer(m_vb); s_ctx->destroyTransientIndexBuffer(m_ib); @@ -651,123 +695,21 @@ namespace bgfx { BGFX_CHECK_MAIN_THREAD(); - if (RendererType::Null != g_caps.rendererType) + if (RendererType::Noop != g_caps.rendererType) { m_decl .begin() .add(Attrib::Position, 3, AttribType::Float) .end(); - ShaderHandle vsh = BGFX_INVALID_HANDLE; - - struct Mem - { - Mem(const void* _data, size_t _size) - : data(_data) - , size(_size) - { - } - - const void* data; - size_t size; - }; - - const Memory* fragMem[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; - if (RendererType::Direct3D9 == g_caps.rendererType) - { - vsh = createShader(makeRef(vs_clear_dx9, sizeof(vs_clear_dx9) ) ); - - const Mem mem[] = - { - Mem(fs_clear0_dx9, sizeof(fs_clear0_dx9) ), - Mem(fs_clear1_dx9, sizeof(fs_clear1_dx9) ), - Mem(fs_clear2_dx9, sizeof(fs_clear2_dx9) ), - Mem(fs_clear3_dx9, sizeof(fs_clear3_dx9) ), - Mem(fs_clear4_dx9, sizeof(fs_clear4_dx9) ), - Mem(fs_clear5_dx9, sizeof(fs_clear5_dx9) ), - Mem(fs_clear6_dx9, sizeof(fs_clear6_dx9) ), - Mem(fs_clear7_dx9, sizeof(fs_clear7_dx9) ), - }; - - for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii) - { - fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) ); - } - } - else if (RendererType::Direct3D11 == g_caps.rendererType - || RendererType::Direct3D12 == g_caps.rendererType) - { - vsh = createShader(makeRef(vs_clear_dx11, sizeof(vs_clear_dx11) ) ); - - const Mem mem[] = - { - Mem(fs_clear0_dx11, sizeof(fs_clear0_dx11) ), - Mem(fs_clear1_dx11, sizeof(fs_clear1_dx11) ), - Mem(fs_clear2_dx11, sizeof(fs_clear2_dx11) ), - Mem(fs_clear3_dx11, sizeof(fs_clear3_dx11) ), - Mem(fs_clear4_dx11, sizeof(fs_clear4_dx11) ), - Mem(fs_clear5_dx11, sizeof(fs_clear5_dx11) ), - Mem(fs_clear6_dx11, sizeof(fs_clear6_dx11) ), - Mem(fs_clear7_dx11, sizeof(fs_clear7_dx11) ), - }; - - for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii) - { - fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) ); - } - } - else if (RendererType::OpenGLES == g_caps.rendererType - || RendererType::OpenGL == g_caps.rendererType - || RendererType::Vulkan == g_caps.rendererType) - { - vsh = createShader(makeRef(vs_clear_glsl, sizeof(vs_clear_glsl) ) ); + ShaderHandle vsh = createEmbeddedShader(g_caps.rendererType, "vs_clear"); - const Mem mem[] = - { - Mem(fs_clear0_glsl, sizeof(fs_clear0_glsl) ), - Mem(fs_clear1_glsl, sizeof(fs_clear1_glsl) ), - Mem(fs_clear2_glsl, sizeof(fs_clear2_glsl) ), - Mem(fs_clear3_glsl, sizeof(fs_clear3_glsl) ), - Mem(fs_clear4_glsl, sizeof(fs_clear4_glsl) ), - Mem(fs_clear5_glsl, sizeof(fs_clear5_glsl) ), - Mem(fs_clear6_glsl, sizeof(fs_clear6_glsl) ), - Mem(fs_clear7_glsl, sizeof(fs_clear7_glsl) ), - }; - - for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii) - { - fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) ); - } - } - else if (RendererType::Metal == g_caps.rendererType) + for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) { - vsh = createShader(makeRef(vs_clear_mtl, sizeof(vs_clear_mtl) ) ); + char name[32]; + bx::snprintf(name, BX_COUNTOF(name), "fs_clear%d", ii); + ShaderHandle fsh = createEmbeddedShader(g_caps.rendererType, name); - const Mem mem[] = - { - Mem(fs_clear0_mtl, sizeof(fs_clear0_mtl) ), - Mem(fs_clear1_mtl, sizeof(fs_clear1_mtl) ), - Mem(fs_clear2_mtl, sizeof(fs_clear2_mtl) ), - Mem(fs_clear3_mtl, sizeof(fs_clear3_mtl) ), - Mem(fs_clear4_mtl, sizeof(fs_clear4_mtl) ), - Mem(fs_clear5_mtl, sizeof(fs_clear5_mtl) ), - Mem(fs_clear6_mtl, sizeof(fs_clear6_mtl) ), - Mem(fs_clear7_mtl, sizeof(fs_clear7_mtl) ), - }; - - for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii) - { - fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) ); - } - } - else - { - BGFX_FATAL(false, Fatal::UnableToInitialize, "Unknown renderer type %d", g_caps.rendererType); - } - - for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii) - { - ShaderHandle fsh = createShader(fragMem[ii]); m_program[ii] = createProgram(vsh, fsh); BX_CHECK(isValid(m_program[ii]), "Failed to create clear quad program."); destroyShader(fsh); @@ -783,9 +725,9 @@ namespace bgfx { BGFX_CHECK_MAIN_THREAD(); - if (RendererType::Null != g_caps.rendererType) + if (RendererType::Noop != g_caps.rendererType) { - for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii) + for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) { if (isValid(m_program[ii]) ) { @@ -898,6 +840,18 @@ namespace bgfx m_draw.m_constEnd = m_uniformEnd; m_draw.m_stateFlags |= m_stateFlags; + uint32_t numVertices = UINT32_MAX; + for (uint32_t idx = 0, streamMask = m_draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) + ; 0 != streamMask + ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask) + ) + { + streamMask >>= ntz; + idx += ntz; + numVertices = bx::uint32_min(numVertices, m_numVertices[idx]); + } + m_draw.m_numVertices = numVertices; + if (isValid(_occlusionQuery) ) { BX_CHECK(!isValid(m_draw.m_occlusionQuery), ""); @@ -1026,7 +980,7 @@ namespace bgfx if (s_ctx->renderFrame() ) { Context* ctx = s_ctx; - ctx->gameSemWait(); + ctx->apiSemWait(); s_ctx = NULL; ctx->renderSemPost(); return RenderFrame::Exiting; @@ -1080,34 +1034,47 @@ namespace bgfx static const CapsFlags s_capsFlags[] = { #define CAPS_FLAGS(_x) { _x, #_x } - CAPS_FLAGS(BGFX_CAPS_TEXTURE_COMPARE_LEQUAL), - CAPS_FLAGS(BGFX_CAPS_TEXTURE_COMPARE_ALL), - CAPS_FLAGS(BGFX_CAPS_TEXTURE_3D), - CAPS_FLAGS(BGFX_CAPS_VERTEX_ATTRIB_HALF), - CAPS_FLAGS(BGFX_CAPS_VERTEX_ATTRIB_UINT10), - CAPS_FLAGS(BGFX_CAPS_INSTANCING), - CAPS_FLAGS(BGFX_CAPS_RENDERER_MULTITHREADED), - CAPS_FLAGS(BGFX_CAPS_FRAGMENT_DEPTH), + CAPS_FLAGS(BGFX_CAPS_ALPHA_TO_COVERAGE), CAPS_FLAGS(BGFX_CAPS_BLEND_INDEPENDENT), CAPS_FLAGS(BGFX_CAPS_COMPUTE), + CAPS_FLAGS(BGFX_CAPS_CONSERVATIVE_RASTER), + CAPS_FLAGS(BGFX_CAPS_DRAW_INDIRECT), + CAPS_FLAGS(BGFX_CAPS_FRAGMENT_DEPTH), CAPS_FLAGS(BGFX_CAPS_FRAGMENT_ORDERING), - CAPS_FLAGS(BGFX_CAPS_SWAP_CHAIN), + CAPS_FLAGS(BGFX_CAPS_GRAPHICS_DEBUGGER), + CAPS_FLAGS(BGFX_CAPS_HIDPI), CAPS_FLAGS(BGFX_CAPS_HMD), CAPS_FLAGS(BGFX_CAPS_INDEX32), - CAPS_FLAGS(BGFX_CAPS_DRAW_INDIRECT), - CAPS_FLAGS(BGFX_CAPS_HIDPI), - CAPS_FLAGS(BGFX_CAPS_TEXTURE_BLIT), - CAPS_FLAGS(BGFX_CAPS_TEXTURE_READ_BACK), + CAPS_FLAGS(BGFX_CAPS_INSTANCING), CAPS_FLAGS(BGFX_CAPS_OCCLUSION_QUERY), - CAPS_FLAGS(BGFX_CAPS_ALPHA_TO_COVERAGE), - CAPS_FLAGS(BGFX_CAPS_CONSERVATIVE_RASTER), + CAPS_FLAGS(BGFX_CAPS_RENDERER_MULTITHREADED), + CAPS_FLAGS(BGFX_CAPS_SWAP_CHAIN), CAPS_FLAGS(BGFX_CAPS_TEXTURE_2D_ARRAY), + CAPS_FLAGS(BGFX_CAPS_TEXTURE_3D), + CAPS_FLAGS(BGFX_CAPS_TEXTURE_BLIT), + CAPS_FLAGS(BGFX_CAPS_TEXTURE_COMPARE_ALL), + CAPS_FLAGS(BGFX_CAPS_TEXTURE_COMPARE_LEQUAL), CAPS_FLAGS(BGFX_CAPS_TEXTURE_CUBE_ARRAY), + CAPS_FLAGS(BGFX_CAPS_TEXTURE_READ_BACK), + CAPS_FLAGS(BGFX_CAPS_VERTEX_ATTRIB_HALF), + CAPS_FLAGS(BGFX_CAPS_VERTEX_ATTRIB_UINT10), #undef CAPS_FLAGS }; static void dumpCaps() { + BX_TRACE(""); + + RendererType::Enum renderers[RendererType::Count]; + uint8_t num = getSupportedRenderers(BX_COUNTOF(renderers), renderers); + + BX_TRACE("Supported renderer backends (%d):", num); + for (uint32_t ii = 0; ii < num; ++ii) + { + BX_TRACE("\t - %s", getRendererName(renderers[ii]) ); + } + + BX_TRACE(""); BX_TRACE("Sort key masks:"); BX_TRACE("\t View %016" PRIx64, SORT_KEY_VIEW_MASK); BX_TRACE("\t Draw bit %016" PRIx64, SORT_KEY_DRAW_BIT); @@ -1117,6 +1084,7 @@ namespace bgfx BX_TRACE("\tC Program %016" PRIx64, SORT_KEY_COMPUTE_PROGRAM_MASK); BX_TRACE("\tD Depth %016" PRIx64, SORT_KEY_DRAW_DEPTH_MASK); + BX_TRACE(""); BX_TRACE("Supported capabilities (renderer %s, vendor 0x%04x, device 0x%04x):" , s_ctx->m_renderCtx->getRendererName() , g_caps.vendorId @@ -1130,6 +1098,30 @@ namespace bgfx } } + BX_TRACE(""); + BX_TRACE("Limits:"); +#define LIMITS(_x) BX_TRACE("\t%-24s %d", #_x, g_caps.limits._x) + LIMITS(maxDrawCalls); + LIMITS(maxBlits); + LIMITS(maxTextureSize); + LIMITS(maxViews); + LIMITS(maxFrameBuffers); + LIMITS(maxFBAttachments); + LIMITS(maxPrograms); + LIMITS(maxShaders); + LIMITS(maxTextures); + LIMITS(maxTextureSamplers); + LIMITS(maxVertexDecls); + LIMITS(maxVertexStreams); + LIMITS(maxIndexBuffers); + LIMITS(maxVertexBuffers); + LIMITS(maxDynamicIndexBuffers); + LIMITS(maxDynamicVertexBuffers); + LIMITS(maxUniforms); + LIMITS(maxOcclusionQueries); +#undef LIMITS + + BX_TRACE(""); BX_TRACE("Supported texture formats:"); BX_TRACE("\t +---------------- 2D: x = supported / * = emulated"); BX_TRACE("\t |+--------------- 2D: sRGB format"); @@ -1169,11 +1161,13 @@ namespace bgfx } } - BX_TRACE("Max FB attachments: %d", g_caps.maxFBAttachments); + BX_TRACE(""); BX_TRACE("NDC depth [%d, 1], origin %s left." , g_caps.homogeneousDepth ? -1 : 0 , g_caps.originBottomLeft ? "bottom" : "top" ); + + BX_TRACE(""); } TextureFormat::Enum getViableTextureFormat(const ImageContainer& _imageContainer) @@ -1312,7 +1306,7 @@ namespace bgfx g_caps.formats[fmt] |= 0 == (g_caps.formats[fmt] & BGFX_CAPS_FORMAT_TEXTURE_CUBE) ? BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED : 0; } - for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) + for (uint32_t ii = 0; ii < TextureFormat::UnknownDepth; ++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; @@ -1325,6 +1319,7 @@ namespace bgfx g_caps.supported |= 0 | (BX_ENABLED(BGFX_CONFIG_MULTITHREADED) && !m_singleThreaded ? BGFX_CAPS_RENDERER_MULTITHREADED : 0) + | (isGraphicsDebuggerPresent() ? BGFX_CAPS_GRAPHICS_DEBUGGER : 0) ; dumpCaps(); @@ -1374,10 +1369,10 @@ namespace bgfx m_dynVertexBufferAllocator.compact(); m_dynIndexBufferAllocator.compact(); - BX_CHECK(m_vertexDeclHandle.getNumHandles() == uint16_t(m_declRef.m_vertexDeclMap.size() ) + BX_CHECK(m_vertexDeclHandle.getNumHandles() == m_declRef.m_vertexDeclMap.getNumElements() , "VertexDeclRef mismatch, num handles %d, handles in hash map %d." , m_vertexDeclHandle.getNumHandles() - , m_declRef.m_vertexDeclMap.size() + , m_declRef.m_vertexDeclMap.getNumElements() ); m_declRef.shutdown(m_vertexDeclHandle); @@ -1495,6 +1490,11 @@ namespace bgfx m_occlusionQuerySet.clear(); } + if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) + { + m_uniformSet.clear(); + } + m_submit->m_capture = _capture; BGFX_PROFILER_SCOPE(bgfx, main_thread_frame, 0xff2040ff); @@ -1560,15 +1560,7 @@ namespace bgfx const char* Context::getName(UniformHandle _handle) const { - for (UniformHashMap::const_iterator it = m_uniformHashMap.begin(), itEnd = m_uniformHashMap.end(); it != itEnd; ++it) - { - if (it->second.idx == _handle.idx) - { - return it->first.c_str(); - } - } - - return NULL; + return m_uniformRef[_handle.idx].m_name.getPtr(); } bool Context::renderFrame() @@ -1581,22 +1573,23 @@ namespace bgfx m_renderCtx->flip(m_render->m_hmd); } - gameSemWait(); - - rendererExecCommands(m_render->m_cmdPre); - if (m_rendererInitialized) + if (apiSemWait(BGFX_CONFIG_API_SEMAPHORE_TIMEOUT) ) { - BGFX_PROFILER_SCOPE(bgfx, render_submit, 0xff2040ff); - m_renderCtx->submit(m_render, m_clearQuad, m_textVideoMemBlitter); - } - rendererExecCommands(m_render->m_cmdPost); + rendererExecCommands(m_render->m_cmdPre); + if (m_rendererInitialized) + { + BGFX_PROFILER_SCOPE(bgfx, render_submit, 0xff2040ff); + m_renderCtx->submit(m_render, m_clearQuad, m_textVideoMemBlitter); + } + rendererExecCommands(m_render->m_cmdPost); - renderSemPost(); + renderSemPost(); - if (m_rendererInitialized - && m_flipAfterRender) - { - m_renderCtx->flip(m_render->m_hmd); + if (m_rendererInitialized + && m_flipAfterRender) + { + m_renderCtx->flip(m_render->m_hmd); + } } return m_exit; @@ -1720,6 +1713,7 @@ namespace bgfx BGFX_RENDERER_CONTEXT(mtl); BGFX_RENDERER_CONTEXT(gl); BGFX_RENDERER_CONTEXT(vk); + BGFX_RENDERER_CONTEXT(gnm); #undef BGFX_RENDERER_CONTEXT @@ -1733,14 +1727,15 @@ namespace bgfx static RendererCreator s_rendererCreator[] = { - { noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NULL_NAME, !!BGFX_CONFIG_RENDERER_NULL }, // Noop + { noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NOOP_NAME, !!BGFX_CONFIG_RENDERER_NOOP }, // Noop { d3d9::rendererCreate, d3d9::rendererDestroy, BGFX_RENDERER_DIRECT3D9_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D9 }, // Direct3D9 { d3d11::rendererCreate, d3d11::rendererDestroy, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11 { d3d12::rendererCreate, d3d12::rendererDestroy, BGFX_RENDERER_DIRECT3D12_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D12 }, // Direct3D12 + { gnm::rendererCreate, gnm::rendererDestroy, BGFX_RENDERER_GNM_NAME, !!BGFX_CONFIG_RENDERER_GNM }, // GNM #if BX_PLATFORM_OSX || BX_PLATFORM_IOS { mtl::rendererCreate, mtl::rendererDestroy, BGFX_RENDERER_METAL_NAME, !!BGFX_CONFIG_RENDERER_METAL }, // Metal #else - { noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NULL_NAME, !!BGFX_CONFIG_RENDERER_NULL }, // Noop + { noop::rendererCreate, noop::rendererDestroy, BGFX_RENDERER_NOOP_NAME, false }, // Noop #endif // BX_PLATFORM_OSX || BX_PLATFORM_IOS { gl::rendererCreate, gl::rendererDestroy, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGLES }, // OpenGLES { gl::rendererCreate, gl::rendererDestroy, BGFX_RENDERER_OPENGL_NAME, !!BGFX_CONFIG_RENDERER_OPENGL }, // OpenGL @@ -1808,7 +1803,7 @@ namespace bgfx score += 1000; } - score += RendererType::Null != renderer ? 1 : 0; + score += RendererType::Noop != renderer ? 1 : 0; if (BX_ENABLED(BX_PLATFORM_WINDOWS) ) { @@ -1828,6 +1823,15 @@ namespace bgfx score += RendererType::Direct3D12 == renderer ? -100 : 0; } } + else if (BX_ENABLED(BX_PLATFORM_LINUX) ) + { + score += RendererType::OpenGL == renderer ? 20 : 0; + score += RendererType::OpenGLES == renderer ? 10 : 0; + } + else if (BX_ENABLED(BX_PLATFORM_OSX) ) + { + score += RendererType::OpenGL == renderer ? 20 : 0; + } else if (BX_ENABLED(0 || BX_PLATFORM_ANDROID || BX_PLATFORM_EMSCRIPTEN @@ -1838,6 +1842,10 @@ namespace bgfx { score += RendererType::OpenGLES == renderer ? 20 : 0; } + else if (BX_ENABLED(BX_PLATFORM_PS4) ) + { + score += RendererType::Gnm == renderer ? 20 : 0; + } else if (BX_ENABLED(0 || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT @@ -2236,7 +2244,10 @@ namespace bgfx void* data; _cmdbuf.read(data); - m_renderCtx->readTexture(handle, data); + uint8_t mip; + _cmdbuf.read(mip); + + m_renderCtx->readTexture(handle, data,mip); } break; @@ -2386,10 +2397,12 @@ namespace bgfx topologySortTriList(_sort, _dst, _dstSize, _dir, _pos, _vertices, _stride, _indices, _numIndices, _index32, g_allocator); } - uint8_t getSupportedRenderers(RendererType::Enum _enum[RendererType::Count]) + uint8_t getSupportedRenderers(uint8_t _max, RendererType::Enum* _enum) { + _enum = _max == 0 ? NULL : _enum; + uint8_t num = 0; - for (uint8_t ii = 0; ii < uint8_t(RendererType::Count); ++ii) + for (uint8_t ii = 0; ii < RendererType::Count; ++ii) { if ( (RendererType::Direct3D11 == ii || RendererType::Direct3D12 == ii) && windowsVersionIs(Condition::LessEqual, 0x0502) ) @@ -2397,9 +2410,17 @@ namespace bgfx continue; } - if (s_rendererCreator[ii].supported) + if (NULL == _enum) { - _enum[num++] = RendererType::Enum(ii); + num++; + } + else + { + if (num < _max + && s_rendererCreator[ii].supported) + { + _enum[num++] = RendererType::Enum(ii); + } } } @@ -2452,21 +2473,39 @@ namespace bgfx s_callbackStub = BX_NEW(g_allocator, CallbackStub); } - if (!BX_ENABLED(BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_NACL) + if (true + && !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_NACL || BX_PLATFORM_PS4) + && RendererType::Noop != _type && NULL == g_platformData.ndt && NULL == g_platformData.nwh && NULL == g_platformData.context && NULL == g_platformData.backBuffer - && NULL == g_platformData.backBufferDS) + && NULL == g_platformData.backBufferDS + ) { BX_TRACE("bgfx platform data like window handle or backbuffer must be set."); goto error; } memset(&g_caps, 0, sizeof(g_caps) ); - g_caps.maxViews = BGFX_CONFIG_MAX_VIEWS; - g_caps.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS; - g_caps.maxFBAttachments = 1; + g_caps.limits.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS; + g_caps.limits.maxBlits = BGFX_CONFIG_MAX_BLIT_ITEMS; + g_caps.limits.maxViews = BGFX_CONFIG_MAX_VIEWS; + g_caps.limits.maxFrameBuffers = BGFX_CONFIG_MAX_FRAME_BUFFERS; + g_caps.limits.maxPrograms = BGFX_CONFIG_MAX_PROGRAMS; + g_caps.limits.maxShaders = BGFX_CONFIG_MAX_SHADERS; + g_caps.limits.maxTextures = BGFX_CONFIG_MAX_TEXTURES; + g_caps.limits.maxTextureSamplers = BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; + g_caps.limits.maxVertexDecls = BGFX_CONFIG_MAX_VERTEX_DECLS; + g_caps.limits.maxVertexStreams = BGFX_CONFIG_MAX_VERTEX_STREAMS; + g_caps.limits.maxIndexBuffers = BGFX_CONFIG_MAX_INDEX_BUFFERS; + g_caps.limits.maxVertexBuffers = BGFX_CONFIG_MAX_VERTEX_BUFFERS; + g_caps.limits.maxDynamicIndexBuffers = BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS; + g_caps.limits.maxDynamicVertexBuffers = BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS; + g_caps.limits.maxUniforms = BGFX_CONFIG_MAX_UNIFORMS; + g_caps.limits.maxOcclusionQueries = BGFX_CONFIG_MAX_OCCUSION_QUERIES; + g_caps.limits.maxFBAttachments = 1; + g_caps.vendorId = _vendorId; g_caps.deviceId = _deviceId; @@ -2474,7 +2513,7 @@ namespace bgfx errorState = ErrorState::ContextAllocated; - s_ctx = BX_ALIGNED_NEW(g_allocator, Context, 16); + s_ctx = BX_ALIGNED_NEW(g_allocator, Context, 64); if (s_ctx->init(_type) ) { BX_TRACE("Init complete."); @@ -2487,7 +2526,7 @@ error: switch (errorState) { case ErrorState::ContextAllocated: - BX_ALIGNED_DELETE(g_allocator, s_ctx, 16); + BX_ALIGNED_DELETE(g_allocator, s_ctx, 64); s_ctx = NULL; case ErrorState::Default: @@ -3132,7 +3171,7 @@ error: { BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _mem, "_mem can't be NULL"); - if (_width == 0 + if (_width == 0 || _height == 0) { release(_mem); @@ -3177,12 +3216,12 @@ error: } } - uint32_t readTexture(TextureHandle _handle, void* _data) + uint32_t readTexture(TextureHandle _handle, void* _data, uint8_t _mip) { BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _data, "_data can't be NULL"); BGFX_CHECK_CAPS(BGFX_CAPS_TEXTURE_READ_BACK, "Texture read-back is not supported!"); - return s_ctx->readTexture(_handle, _data); + return s_ctx->readTexture(_handle, _data, _mip); } uint32_t readTexture(FrameBufferHandle _handle, uint8_t _attachment, void* _data) @@ -3503,7 +3542,7 @@ error: void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) { BGFX_CHECK_MAIN_THREAD(); - s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices); + s_ctx->setVertexBuffer(0, _handle, _startVertex, _numVertices); } void setVertexBuffer(DynamicVertexBufferHandle _handle) @@ -3514,7 +3553,7 @@ error: void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) { BGFX_CHECK_MAIN_THREAD(); - s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices); + s_ctx->setVertexBuffer(0, _handle, _startVertex, _numVertices); } void setVertexBuffer(const TransientVertexBuffer* _tvb) @@ -3526,7 +3565,7 @@ error: { BGFX_CHECK_MAIN_THREAD(); BX_CHECK(NULL != _tvb, "_tvb can't be NULL"); - s_ctx->setVertexBuffer(_tvb, _startVertex, _numVertices); + s_ctx->setVertexBuffer(0, _tvb, _startVertex, _numVertices); } void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num) @@ -3551,12 +3590,15 @@ error: void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags) { BGFX_CHECK_MAIN_THREAD(); + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); s_ctx->setTexture(_stage, _sampler, _handle, _flags); } void setTexture(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, uint32_t _flags) { BGFX_CHECK_MAIN_THREAD(); + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BX_CHECK(_attachment < g_caps.limits.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment); s_ctx->setTexture(_stage, _sampler, _handle, _attachment, _flags); } @@ -3592,42 +3634,50 @@ error: void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) { BGFX_CHECK_MAIN_THREAD(); + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); s_ctx->setBuffer(_stage, _handle, _access); } void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access) { BGFX_CHECK_MAIN_THREAD(); + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); s_ctx->setBuffer(_stage, _handle, _access); } void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access) { BGFX_CHECK_MAIN_THREAD(); + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); s_ctx->setBuffer(_stage, _handle, _access); } void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access) { BGFX_CHECK_MAIN_THREAD(); + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); s_ctx->setBuffer(_stage, _handle, _access); } void setBuffer(uint8_t _stage, IndirectBufferHandle _handle, Access::Enum _access) { BGFX_CHECK_MAIN_THREAD(); + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); s_ctx->setBuffer(_stage, _handle, _access); } void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) { BGFX_CHECK_MAIN_THREAD(); + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); s_ctx->setImage(_stage, _sampler, _handle, _mip, _access, _format); } void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, Access::Enum _access, TextureFormat::Enum _format) { BGFX_CHECK_MAIN_THREAD(); + BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BX_CHECK(_attachment < g_caps.limits.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment); s_ctx->setImage(_stage, _sampler, _handle, _attachment, _access, _format); } @@ -3670,6 +3720,7 @@ error: { BGFX_CHECK_MAIN_THREAD(); BGFX_CHECK_CAPS(BGFX_CAPS_TEXTURE_BLIT, "Texture blit is not supported!"); + BX_CHECK(_attachment < g_caps.limits.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment); s_ctx->blit(_id, _dst, _dstMip, _dstX, _dstY, _dstZ, _src, _attachment, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth); } @@ -3739,6 +3790,7 @@ BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InstanceDataBuffer, bgfx_instance_data_buffe BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TextureInfo, bgfx_texture_info_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Attachment, bgfx_attachment_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::GPU, bgfx_caps_gpu_t); +BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::Limits, bgfx_caps_limits_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); @@ -3891,9 +3943,9 @@ BGFX_C_API void bgfx_image_rgba8_downsample_2x2(uint32_t _width, uint32_t _heigh bgfx::imageRgba8Downsample2x2(_width, _height, _pitch, _src, _dst); } -BGFX_C_API uint8_t bgfx_get_supported_renderers(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT]) +BGFX_C_API uint8_t bgfx_get_supported_renderers(uint8_t _max, bgfx_renderer_type_t* _enum) { - return bgfx::getSupportedRenderers( (bgfx::RendererType::Enum*)_enum); + return bgfx::getSupportedRenderers(_max, (bgfx::RendererType::Enum*)_enum); } BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type) @@ -4240,10 +4292,10 @@ BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t bgfx::updateTextureCube(handle.cpp, _layer, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch); } -BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data) +BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data, uint8_t _mip) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; - return bgfx::readTexture(handle.cpp, _data); + return bgfx::readTexture(handle.cpp, _data, _mip); } BGFX_C_API uint32_t bgfx_read_frame_buffer(bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, void* _data) @@ -4725,6 +4777,8 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) BGFX_IMPORT_FUNC(update_texture_2d) \ BGFX_IMPORT_FUNC(update_texture_3d) \ BGFX_IMPORT_FUNC(update_texture_cube) \ + BGFX_IMPORT_FUNC(read_texture) \ + BGFX_IMPORT_FUNC(read_frame_buffer) \ BGFX_IMPORT_FUNC(destroy_texture) \ BGFX_IMPORT_FUNC(create_frame_buffer) \ BGFX_IMPORT_FUNC(create_frame_buffer_scaled) \ @@ -4787,7 +4841,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) static bgfx_interface_vtbl_t s_bgfx_interface = { -#define BGFX_IMPORT_FUNC(_name) bgfx_##_name, +#define BGFX_IMPORT_FUNC(_name) BX_CONCATENATE(bgfx_, _name), BGFX_IMPORT #undef BGFX_IMPORT_FUNC }; diff --git a/3rdparty/bgfx/src/bgfx_compute.sh b/3rdparty/bgfx/src/bgfx_compute.sh index 32cdac319da..f6dd7541f29 100644 --- a/3rdparty/bgfx/src/bgfx_compute.sh +++ b/3rdparty/bgfx/src/bgfx_compute.sh @@ -19,6 +19,7 @@ #define rg16f float2 #define rgba16f float4 #define rgba8 float4 +#define rgba32f float4 #define IMAGE2D_RO( _name, _format, _reg) Texture2D<_format> _name : register(t[_reg]) #define UIMAGE2D_RO(_name, _format, _reg) Texture2D<_format> _name : register(t[_reg]) @@ -27,6 +28,13 @@ #define IMAGE2D_RW( _name, _reg) RWTexture2D<float> _name : register(u[_reg]) #define UIMAGE2D_RW(_name, _reg) RWTexture2D<uint> _name : register(u[_reg]) +#define IMAGE2D_ARRAY_RO( _name, _format, _reg) Texture2DArray<_format> _name : register(t[_reg]) +#define UIMAGE2D_ARRAY_RO(_name, _format, _reg) Texture2DArray<_format> _name : register(t[_reg]) +#define IMAGE2D_ARRAY_WR( _name, _format, _reg) RWTexture2DArray<_format> _name : register(u[_reg]) +#define UIMAGE2D_ARRAY_WR(_name, _format, _reg) RWTexture2DArray<_format> _name : register(u[_reg]) +#define IMAGE2D_ARRAY_RW( _name, _reg) RWTexture2DArray<float> _name : register(u[_reg]) +#define UIMAGE2D_ARRAY_RW(_name, _reg) RWTexture2DArray<uint> _name : register(u[_reg]) + #define IMAGE3D_RO( _name, _format, _reg) Texture3D<_format> _name : register(t[_reg]) #define UIMAGE3D_RO(_name, _format, _reg) Texture3D<_format> _name : register(t[_reg]) #define IMAGE3D_WR( _name, _format, _reg) RWTexture3D<_format> _name : register(u[_reg]) @@ -41,12 +49,15 @@ #define NUM_THREADS(_x, _y, _z) [numthreads(_x, _y, _z)] #define __IMAGE_IMPL(_textureType, _storeComponents, _type, _loadComponents) \ - _type imageLoad( Texture2D<_textureType> _image, ivec2 _uv) { return _image[_uv ]._loadComponents; } \ - _type imageLoad( Texture3D<_textureType> _image, ivec3 _uvw) { return _image[_uvw]._loadComponents; } \ - _type imageLoad(RWTexture2D<_textureType> _image, ivec2 _uv) { return _image[_uv ]._loadComponents; } \ - _type imageLoad(RWTexture3D<_textureType> _image, ivec3 _uvw, _type _value) { return _image[_uvw]._loadComponents; } \ - void imageStore(RWTexture2D<_textureType> _image, ivec2 _uv, _type _value) { _image[_uv ] = _value._storeComponents; } \ - void imageStore(RWTexture3D<_textureType> _image, ivec3 _uvw, _type _value) { _image[_uvw] = _value._storeComponents; } + _type imageLoad( Texture2D<_textureType> _image, ivec2 _uv) { return _image[_uv ]._loadComponents; } \ + _type imageLoad(RWTexture2DArray<_textureType> _image, ivec3 _uvw) { return _image[_uvw ]._loadComponents; } \ + _type imageLoad( Texture3D<_textureType> _image, ivec3 _uvw) { return _image[_uvw]._loadComponents; } \ + _type imageLoad( RWTexture2D<_textureType> _image, ivec2 _uv) { return _image[_uv ]._loadComponents; } \ + _type imageLoad(RWTexture2DArray<_textureType> _image, ivec3 _uvw, _type _value) { return _image[_uvw]._loadComponents; } \ + _type imageLoad( RWTexture3D<_textureType> _image, ivec3 _uvw, _type _value) { return _image[_uvw]._loadComponents; } \ + void imageStore( RWTexture2D<_textureType> _image, ivec2 _uv, _type _value) { _image[_uv ] = _value._storeComponents; } \ + void imageStore(RWTexture2DArray<_textureType> _image, ivec3 _uvw, _type _value) { _image[_uvw] = _value._storeComponents; } \ + void imageStore( RWTexture3D<_textureType> _image, ivec3 _uvw, _type _value) { _image[_uvw] = _value._storeComponents; } __IMAGE_IMPL(float, x, vec4, xxxx) __IMAGE_IMPL(vec2, xy, vec4, xyyy) @@ -148,6 +159,13 @@ uint atomicCompSwap(uint _mem, uint _compare, uint _data) #define IMAGE2D_RW( _name, _reg) __IMAGE_XX(_name, r32f, _reg, image2D, readwrite) #define UIMAGE2D_RW(_name, _reg) __IMAGE_XX(_name, r32ui, _reg, uimage2D, readwrite) +#define IMAGE2D_ARRAY_RO( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2DArray, readonly) +#define UIMAGE2D_ARRAY_RO(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2DArray, readonly) +#define IMAGE2D_ARRAY_WR( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image2DArray, writeonly) +#define UIMAGE2D_ARRAY_WR(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage2DArray, writeonly) +#define IMAGE2D_ARRAY_RW( _name, _reg) __IMAGE_XX(_name, r32f, _reg, image2DArray, readwrite) +#define UIMAGE2D_ARRAY_RW(_name, _reg) __IMAGE_XX(_name, r32ui, _reg, uimage2DArray, readwrite) + #define IMAGE3D_RO( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image3D, readonly) #define UIMAGE3D_RO(_name, _format, _reg) __IMAGE_XX(_name, _format, _reg, uimage3D, readonly) #define IMAGE3D_WR( _name, _format, _reg) __IMAGE_XX(_name, _format, _reg, image3D, writeonly) diff --git a/3rdparty/bgfx/src/bgfx_p.h b/3rdparty/bgfx/src/bgfx_p.h index 561a9fa2c99..ea6e4331ca6 100644 --- a/3rdparty/bgfx/src/bgfx_p.h +++ b/3rdparty/bgfx/src/bgfx_p.h @@ -220,7 +220,8 @@ namespace stl #define BGFX_RENDERER_DIRECT3D12_NAME "Direct3D 12" #define BGFX_RENDERER_METAL_NAME "Metal" #define BGFX_RENDERER_VULKAN_NAME "Vulkan" -#define BGFX_RENDERER_NULL_NAME "NULL" +#define BGFX_RENDERER_GNM_NAME "GNM" +#define BGFX_RENDERER_NOOP_NAME "Noop" #if BGFX_CONFIG_RENDERER_OPENGL # if BGFX_CONFIG_RENDERER_OPENGL >= 31 && BGFX_CONFIG_RENDERER_OPENGL <= 33 @@ -332,6 +333,8 @@ namespace bgfx extern bx::AllocatorI* g_allocator; extern Caps g_caps; + typedef bx::StringT<&g_allocator> String; + void setGraphicsDebuggerPresent(bool _present); bool isGraphicsDebuggerPresent(); void release(const Memory* _mem); @@ -399,13 +402,13 @@ namespace bgfx void resize(bool _small = false, uint32_t _width = BGFX_DEFAULT_WIDTH, uint32_t _height = BGFX_DEFAULT_HEIGHT) { - uint32_t width = bx::uint32_max(1, _width/8); - uint32_t height = bx::uint32_max(1, _height/(_small ? 8 : 16) ); + uint32_t width = bx::uint32_imax(1, _width/8); + uint32_t height = bx::uint32_imax(1, _height/(_small ? 8 : 16) ); if (NULL == m_mem - || m_width != width + || m_width != width || m_height != height - || m_small != _small) + || m_small != _small) { m_small = _small; m_width = (uint16_t)width; @@ -1146,40 +1149,40 @@ namespace bgfx { } - const UniformInfo* find(const char* _name) const - { - UniformHashMap::const_iterator it = m_uniforms.find(_name); - if (it != m_uniforms.end() ) + const UniformInfo* find(const char* _name) const + { + uint16_t handle = m_uniforms.find(bx::hashMurmur2A(_name) ); + if (UniformHashMap::invalid != handle) { - return &it->second; + return &m_info[handle]; } - return NULL; - } + return NULL; + } const UniformInfo& add(UniformHandle _handle, const char* _name, const void* _data) { - UniformHashMap::iterator it = m_uniforms.find(_name); - if (it == m_uniforms.end() ) - { - UniformInfo info; - info.m_data = _data; - info.m_handle = _handle; + BX_CHECK(isValid(_handle), "Uniform handle is invalid (name: %s)!", _name); + const uint32_t key = bx::hashMurmur2A(_name); + m_uniforms.removeByKey(key); + m_uniforms.insert(key, _handle.idx); - stl::pair<UniformHashMap::iterator, bool> result = m_uniforms.insert(UniformHashMap::value_type(_name, info) ); - return result.first->second; - } - - UniformInfo& info = it->second; + UniformInfo& info = m_info[_handle.idx]; info.m_data = _data; info.m_handle = _handle; return info; } + void remove(UniformHandle _handle) + { + m_uniforms.removeByHandle(_handle.idx); + } + private: - typedef stl::unordered_map<stl::string, UniformInfo> UniformHashMap; + typedef bx::HandleHashMapT<BGFX_CONFIG_MAX_UNIFORMS*2> UniformHashMap; UniformHashMap m_uniforms; + UniformInfo m_info[BGFX_CONFIG_MAX_UNIFORMS]; }; struct Binding @@ -1214,6 +1217,20 @@ namespace bgfx } m_un; }; + struct Stream + { + void clear() + { + m_startVertex = 0; + m_handle.idx = invalidHandle; + m_decl.idx = invalidHandle; + } + + uint32_t m_startVertex; + VertexBufferHandle m_handle; + VertexDeclHandle m_decl; + }; + struct RenderDraw { void clear() @@ -1226,7 +1243,6 @@ namespace bgfx m_matrix = 0; m_startIndex = 0; m_numIndices = UINT32_MAX; - m_startVertex = 0; m_numVertices = UINT32_MAX; m_instanceDataOffset = 0; m_instanceDataStride = 0; @@ -1236,8 +1252,8 @@ namespace bgfx m_num = 1; m_submitFlags = BGFX_SUBMIT_EYE_FIRST; m_scissor = UINT16_MAX; - m_vertexBuffer.idx = invalidHandle; - m_vertexDecl.idx = invalidHandle; + m_streamMask = 0; + m_stream[0].clear(); m_indexBuffer.idx = invalidHandle; m_instanceDataBuffer.idx = invalidHandle; m_indirectBuffer.idx = invalidHandle; @@ -1252,7 +1268,17 @@ namespace bgfx } } + bool setStreamBit(uint8_t _stream, VertexBufferHandle _handle) + { + const uint8_t bit = 1<<_stream; + const uint8_t mask = m_streamMask & ~bit; + const uint8_t tmp = isValid(_handle) ? bit : 0; + m_streamMask = mask | tmp; + return 0 != tmp; + } + Binding m_bind[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS]; + Stream m_stream[BGFX_CONFIG_MAX_VERTEX_STREAMS]; uint64_t m_stateFlags; uint64_t m_stencil; uint32_t m_rgba; @@ -1261,7 +1287,6 @@ namespace bgfx uint32_t m_matrix; uint32_t m_startIndex; uint32_t m_numIndices; - uint32_t m_startVertex; uint32_t m_numVertices; uint32_t m_instanceDataOffset; uint32_t m_numInstances; @@ -1271,9 +1296,8 @@ namespace bgfx uint16_t m_num; uint16_t m_scissor; uint8_t m_submitFlags; + uint8_t m_streamMask; - VertexBufferHandle m_vertexBuffer; - VertexDeclHandle m_vertexDecl; IndexBufferHandle m_indexBuffer; VertexBufferHandle m_instanceDataBuffer; IndirectBufferHandle m_indirectBuffer; @@ -1553,27 +1577,44 @@ namespace bgfx m_discard = 0 == _numIndices; } - void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) + void setVertexBuffer(uint8_t _stream, VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) { - m_draw.m_startVertex = _startVertex; - m_draw.m_numVertices = _numVertices; - m_draw.m_vertexBuffer = _handle; + if (m_draw.setStreamBit(_stream, _handle) ) + { + Stream& stream = m_draw.m_stream[_stream]; + stream.m_startVertex = _startVertex; + stream.m_handle = _handle; + stream.m_decl.idx = invalidHandle; + m_numVertices[_stream] = _numVertices; + } } - void setVertexBuffer(const DynamicVertexBuffer& _dvb, uint32_t _startVertex, uint32_t _numVertices) + void setVertexBuffer(uint8_t _stream, const DynamicVertexBuffer& _dvb, uint32_t _startVertex, uint32_t _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; + if (m_draw.setStreamBit(_stream, _dvb.m_handle) ) + { + Stream& stream = m_draw.m_stream[_stream]; + stream.m_startVertex = _dvb.m_startVertex + _startVertex; + stream.m_handle = _dvb.m_handle; + stream.m_decl = _dvb.m_decl; + m_numVertices[_stream] = + bx::uint32_min(bx::uint32_imax(0, _dvb.m_numVertices - _startVertex), _numVertices) + ; + } } - void setVertexBuffer(const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) + void setVertexBuffer(uint8_t _stream, const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) { - m_draw.m_startVertex = _tvb->startVertex + _startVertex; - 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; + if (m_draw.setStreamBit(_stream, _tvb->handle) ) + { + Stream& stream = m_draw.m_stream[_stream]; + stream.m_startVertex = _tvb->startVertex + _startVertex; + stream.m_handle = _tvb->handle; + stream.m_decl = _tvb->decl; + m_numVertices[_stream] = + bx::uint32_min(bx::uint32_imax(0, _tvb->size/_tvb->stride - _startVertex), _numVertices) + ; + } } void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num) @@ -1799,6 +1840,7 @@ namespace bgfx RenderItem m_renderItem[BGFX_CONFIG_MAX_DRAW_CALLS+1]; RenderDraw m_draw; RenderCompute m_compute; + uint32_t m_numVertices[BGFX_CONFIG_MAX_VERTEX_STREAMS]; uint32_t m_blitKeys[BGFX_CONFIG_MAX_BLIT_ITEMS+1]; BlitItem m_blitItem[BGFX_CONFIG_MAX_BLIT_ITEMS+1]; uint64_t m_stateFlags; @@ -1872,31 +1914,25 @@ namespace bgfx template <uint16_t MaxHandlesT> void shutdown(bx::HandleAllocT<MaxHandlesT>& _handleAlloc) { - for (VertexDeclMap::iterator it = m_vertexDeclMap.begin(), itEnd = m_vertexDeclMap.end(); it != itEnd; ++it) + for (VertexDeclMap::Iterator it = m_vertexDeclMap.first(); m_vertexDeclMap.next(it); ) { - _handleAlloc.free(it->second.idx); + _handleAlloc.free(it.handle); } - m_vertexDeclMap.clear(); + m_vertexDeclMap.reset(); } VertexDeclHandle find(uint32_t _hash) { - VertexDeclMap::const_iterator it = m_vertexDeclMap.find(_hash); - if (it != m_vertexDeclMap.end() ) - { - return it->second; - } - - VertexDeclHandle result = BGFX_INVALID_HANDLE; - return result; + VertexDeclHandle handle = { m_vertexDeclMap.find(_hash) }; + return handle; } void add(VertexBufferHandle _handle, VertexDeclHandle _declHandle, uint32_t _hash) { m_vertexBufferRef[_handle.idx] = _declHandle; m_vertexDeclRef[_declHandle.idx]++; - m_vertexDeclMap.insert(stl::make_pair(_hash, _declHandle) ); + m_vertexDeclMap.insert(_hash, _declHandle.idx); } VertexDeclHandle release(VertexBufferHandle _handle) @@ -1913,13 +1949,14 @@ namespace bgfx } } - bx::mapRemove(m_vertexDeclMap, declHandle); + m_vertexDeclMap.removeByHandle(declHandle.idx); return declHandle; } - typedef stl::unordered_map<uint32_t, VertexDeclHandle> VertexDeclMap; + typedef bx::HandleHashMapT<BGFX_CONFIG_MAX_VERTEX_DECLS*2> VertexDeclMap; VertexDeclMap m_vertexDeclMap; + uint16_t m_vertexDeclRef[BGFX_CONFIG_MAX_VERTEX_DECLS]; VertexDeclHandle m_vertexBufferRef[BGFX_CONFIG_MAX_VERTEX_BUFFERS]; }; @@ -2073,7 +2110,7 @@ namespace bgfx virtual void updateTextureBegin(TextureHandle _handle, uint8_t _side, uint8_t _mip) = 0; virtual void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) = 0; virtual void updateTextureEnd() = 0; - virtual void readTexture(TextureHandle _handle, void* _data) = 0; + virtual void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) = 0; virtual void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) = 0; virtual void overrideInternal(TextureHandle _handle, uintptr_t _ptr) = 0; virtual uintptr_t getInternal(TextureHandle _handle) = 0; @@ -2150,9 +2187,14 @@ namespace bgfx BGFX_API_FUNC(void reset(uint32_t _width, uint32_t _height, uint32_t _flags) ) { - BX_WARN(0 != _width && 0 != _height, "Frame buffer resolution width or height cannot be 0 (width %d, height %d).", _width, _height); - m_resolution.m_width = bx::uint32_max(1, _width); - m_resolution.m_height = bx::uint32_max(1, _height); + BX_WARN(1 <= int32_t(_width) + && 1 <= int32_t(_height) + , "Frame buffer resolution width or height cannot be 0 (width %d, height %d)." + , _width + , _height + ); + m_resolution.m_width = bx::uint32_imax(1, _width); + m_resolution.m_height = bx::uint32_imax(1, _height); m_resolution.m_flags = 0 | _flags | (g_platformDataChangedSinceReset ? BGFX_RESET_INTERNAL_FORCE : 0) @@ -2799,8 +2841,16 @@ namespace bgfx { bx::MemoryReader reader(_mem->data, _mem->size); + bx::Error err; + uint32_t magic; - bx::read(&reader, magic); + bx::read(&reader, magic, &err); + + if (!err.isOk() ) + { + ShaderHandle invalid = BGFX_INVALID_HANDLE; + return invalid; + } if (BGFX_CHUNK_MAGIC_CSH != magic && BGFX_CHUNK_MAGIC_FSH != magic @@ -2956,15 +3006,15 @@ namespace bgfx if (!isValid(_vsh) || !isValid(_fsh) ) { - BX_WARN(false, "Vertex/fragment shader is invalid (vsh %d, fsh %d).", _vsh.idx, _fsh.idx); + BX_TRACE("Vertex/fragment shader is invalid (vsh %d, fsh %d).", _vsh.idx, _fsh.idx); ProgramHandle invalid = BGFX_INVALID_HANDLE; return invalid; } - ProgramHashMap::const_iterator it = m_programHashMap.find(uint32_t(_fsh.idx<<16)|_vsh.idx); - if (it != m_programHashMap.end() ) + uint16_t idx = m_programHashMap.find(uint32_t(_fsh.idx<<16)|_vsh.idx); + if (ProgramHashMap::invalid != idx) { - ProgramHandle handle = it->second; + ProgramHandle handle = { idx }; ProgramRef& pr = m_programRef[handle.idx]; ++pr.m_refCount; return handle; @@ -2974,7 +3024,7 @@ namespace bgfx const ShaderRef& fsr = m_shaderRef[_fsh.idx]; if (vsr.m_hash != fsr.m_hash) { - BX_WARN(vsr.m_hash == fsr.m_hash, "Vertex shader output doesn't match fragment shader input."); + BX_TRACE("Vertex shader output doesn't match fragment shader input."); ProgramHandle invalid = BGFX_INVALID_HANDLE; return invalid; } @@ -2992,7 +3042,9 @@ namespace bgfx pr.m_fsh = _fsh; pr.m_refCount = 1; - m_programHashMap.insert(stl::make_pair(uint32_t(_fsh.idx<<16)|_vsh.idx, handle) ); + const uint32_t key = uint32_t(_fsh.idx<<16)|_vsh.idx; + bool ok = m_programHashMap.insert(key, handle.idx); + BX_CHECK(ok, "Program already exists (key: %x, handle: %3d)!", key, handle.idx); BX_UNUSED(ok); CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateProgram); cmdbuf.write(handle); @@ -3018,10 +3070,10 @@ namespace bgfx return invalid; } - ProgramHashMap::const_iterator it = m_programHashMap.find(_vsh.idx); - if (it != m_programHashMap.end() ) + uint16_t idx = m_programHashMap.find(_vsh.idx); + if (ProgramHashMap::invalid != idx) { - ProgramHandle handle = it->second; + ProgramHandle handle = { idx }; ProgramRef& pr = m_programRef[handle.idx]; ++pr.m_refCount; return handle; @@ -3040,7 +3092,9 @@ namespace bgfx pr.m_fsh = fsh; pr.m_refCount = 1; - m_programHashMap.insert(stl::make_pair(uint32_t(_vsh.idx), handle) ); + const uint32_t key = uint32_t(_vsh.idx); + bool ok = m_programHashMap.insert(key, handle.idx); + BX_CHECK(ok, "Program already exists (key: %x, handle: %3d)!", key, handle.idx); BX_UNUSED(ok); CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateProgram); cmdbuf.write(handle); @@ -3077,7 +3131,7 @@ namespace bgfx hash |= pr.m_fsh.idx << 16; } - bx::mapRemove(m_programHashMap, hash); + m_programHashMap.removeByHandle(_handle.idx); } } @@ -3148,11 +3202,17 @@ namespace bgfx textureDecRef(_handle); } - BGFX_API_FUNC(uint32_t readTexture(TextureHandle _handle, void* _data) ) + BGFX_API_FUNC(uint32_t readTexture(TextureHandle _handle, void* _data, uint8_t _mip) ) { + BGFX_CHECK_HANDLE("readTexture", m_textureHandle, _handle); + + const TextureRef& ref = m_textureRef[_handle.idx]; + BX_CHECK(_mip < ref.m_numMips, "Invalid mip: %d num mips:", _mip, ref.m_numMips); BX_UNUSED(ref); + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::ReadTexture); cmdbuf.write(_handle); cmdbuf.write(_data); + cmdbuf.write(_mip); return m_frames + 2; } @@ -3160,9 +3220,11 @@ namespace bgfx { const FrameBufferRef& ref = m_frameBufferRef[_handle.idx]; BX_CHECK(!ref.m_window, "Can't sample window frame buffer."); + TextureHandle textureHandle = ref.un.m_th[_attachment]; - BX_CHECK(isValid(textureHandle), "Frame buffer texture %d is invalid.", _attachment); - return readTexture(textureHandle, _data); + BGFX_CHECK_HANDLE("readTexture", m_textureHandle, textureHandle); + + return readTexture(textureHandle, _data,0); } void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) @@ -3263,7 +3325,7 @@ namespace bgfx } } - return color <= g_caps.maxFBAttachments + return color <= g_caps.limits.maxFBAttachments && depth <= 1 ; } @@ -3273,7 +3335,7 @@ namespace bgfx BX_CHECK(checkFrameBuffer(_num, _attachment) , "Too many frame buffer attachments (num attachments: %d, max color attachments %d)!" , _num - , g_caps.maxFBAttachments + , g_caps.limits.maxFBAttachments ); FrameBufferHandle handle = { m_frameBufferHandle.alloc() }; @@ -3369,11 +3431,16 @@ namespace bgfx return handle; } - UniformHashMap::iterator it = m_uniformHashMap.find(_name); - if (it != m_uniformHashMap.end() ) + uint16_t idx = m_uniformHashMap.find(bx::hashMurmur2A(_name) ); + if (UniformHashMap::invalid != idx) { - UniformHandle handle = it->second; + UniformHandle handle = { idx }; UniformRef& uniform = m_uniformRef[handle.idx]; + BX_CHECK(uniform.m_type == _type + , "Uniform type mismatch (type: %d, expected %d)." + , _type + , uniform.m_type + ); uint32_t oldsize = g_uniformTypeSize[uniform.m_type]; uint32_t newsize = g_uniformTypeSize[_type]; @@ -3399,17 +3466,18 @@ namespace bgfx UniformHandle handle = { m_uniformHandle.alloc() }; - BX_WARN(isValid(handle), "Failed to allocate uniform handle."); if (isValid(handle) ) { BX_TRACE("Creating uniform (handle %3d) %s", handle.idx, _name); UniformRef& uniform = m_uniformRef[handle.idx]; + uniform.m_name.set(_name); uniform.m_refCount = 1; uniform.m_type = _type; uniform.m_num = _num; - m_uniformHashMap.insert(stl::make_pair(stl::string(_name), handle) ); + bool ok = m_uniformHashMap.insert(bx::hashMurmur2A(_name), handle.idx); + BX_CHECK(ok, "Uniform already exists (name: %s)!", _name); BX_UNUSED(ok); CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateUniform); cmdbuf.write(handle); @@ -3419,6 +3487,10 @@ namespace bgfx cmdbuf.write(len); cmdbuf.write(_name, len); } + else + { + BX_TRACE("Failed to allocate uniform handle."); + } return handle; } @@ -3433,7 +3505,8 @@ namespace bgfx if (0 == refs) { - bx::mapRemove(m_uniformHashMap, _handle); + uniform.m_name.clear(); + m_uniformHashMap.removeByHandle(_handle.idx); CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyUniform); cmdbuf.write(_handle); @@ -3666,6 +3739,7 @@ namespace bgfx { BGFX_CHECK_HANDLE("setUniform", m_uniformHandle, _handle); UniformRef& uniform = m_uniformRef[_handle.idx]; + BX_CHECK(isValid(_handle) && 0 < uniform.m_refCount, "Setting invalid uniform (handle %3d)!", _handle.idx); BX_CHECK(_num == UINT16_MAX || uniform.m_num >= _num, "Truncated uniform update. %d (max: %d)", _num, uniform.m_num); if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) ) { @@ -3697,22 +3771,25 @@ namespace bgfx m_submit->setIndexBuffer(_tib, _firstIndex, _numIndices); } - BGFX_API_FUNC(void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) ) + BGFX_API_FUNC(void setVertexBuffer(uint8_t _stream, VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) ) { BGFX_CHECK_HANDLE("setVertexBuffer", m_vertexBufferHandle, _handle); - m_submit->setVertexBuffer(_handle, _startVertex, _numVertices); + BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); + m_submit->setVertexBuffer(_stream, _handle, _startVertex, _numVertices); } - BGFX_API_FUNC(void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) ) + BGFX_API_FUNC(void setVertexBuffer(uint8_t _stream, DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) ) { BGFX_CHECK_HANDLE("setVertexBuffer", m_dynamicVertexBufferHandle, _handle); - m_submit->setVertexBuffer(m_dynamicVertexBuffers[_handle.idx], _startVertex, _numVertices); + BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); + m_submit->setVertexBuffer(_stream, m_dynamicVertexBuffers[_handle.idx], _startVertex, _numVertices); } - BGFX_API_FUNC(void setVertexBuffer(const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) ) + BGFX_API_FUNC(void setVertexBuffer(uint8_t _stream, const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) ) { BGFX_CHECK_HANDLE("setVertexBuffer", m_vertexBufferHandle, _tvb->handle); - m_submit->setVertexBuffer(_tvb, _startVertex, _numVertices); + BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); + m_submit->setVertexBuffer(_stream, _tvb, _startVertex, _numVertices); } BGFX_API_FUNC(void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num) ) @@ -3749,7 +3826,6 @@ namespace bgfx BGFX_API_FUNC(void setTexture(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, uint32_t _flags) ) { BGFX_CHECK_HANDLE_INVALID_OK("setTexture/FrameBufferHandle", m_frameBufferHandle, _handle); - BX_CHECK(_attachment < g_caps.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment); TextureHandle textureHandle = BGFX_INVALID_HANDLE; if (isValid(_handle) ) { @@ -3841,7 +3917,6 @@ namespace bgfx BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, Access::Enum _access, TextureFormat::Enum _format) ) { - BX_CHECK(_attachment < g_caps.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment); TextureHandle textureHandle = BGFX_INVALID_HANDLE; if (isValid(_handle) ) { @@ -3922,21 +3997,28 @@ namespace bgfx { if (!m_singleThreaded) { - m_gameSem.post(); + m_apiSem.post(); } } - void gameSemWait() + bool apiSemWait(int32_t _msecs = -1) { - if (!m_singleThreaded) + if (m_singleThreaded) + { + return true; + } + + BGFX_PROFILER_SCOPE(bgfx, main_thread_wait, 0xff2040ff); + int64_t start = bx::getHPCounter(); + bool ok = m_apiSem.wait(_msecs); + if (ok) { - BGFX_PROFILER_SCOPE(bgfx, main_thread_wait, 0xff2040ff); - int64_t start = bx::getHPCounter(); - bool ok = m_gameSem.wait(); - BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok); m_render->m_waitSubmit = bx::getHPCounter()-start; m_submit->m_perfStats.waitSubmit = m_submit->m_waitSubmit; + return true; } + + return false; } void renderSemPost() @@ -3961,15 +4043,17 @@ namespace bgfx } bx::Semaphore m_renderSem; - bx::Semaphore m_gameSem; + bx::Semaphore m_apiSem; bx::Thread m_thread; #else void gameSemPost() { } - void gameSemWait() + bool apiSemWait(int32_t _msecs = -1) { + BX_UNUSED(_msecs); + return true; } void renderSemPost() @@ -4027,14 +4111,15 @@ namespace bgfx { ShaderHandle m_vsh; ShaderHandle m_fsh; - int16_t m_refCount; + int16_t m_refCount; }; struct UniformRef { + String m_name; UniformType::Enum m_type; - uint16_t m_num; - int16_t m_refCount; + uint16_t m_num; + int16_t m_refCount; }; struct TextureRef @@ -4060,13 +4145,13 @@ namespace bgfx HandleSet m_uniformSet; HandleSet m_occlusionQuerySet; - typedef stl::unordered_map<stl::string, UniformHandle> UniformHashMap; + typedef bx::HandleHashMapT<BGFX_CONFIG_MAX_UNIFORMS*2> UniformHashMap; UniformHashMap m_uniformHashMap; UniformRef m_uniformRef[BGFX_CONFIG_MAX_UNIFORMS]; ShaderRef m_shaderRef[BGFX_CONFIG_MAX_SHADERS]; - typedef stl::unordered_map<uint32_t, ProgramHandle> ProgramHashMap; + typedef bx::HandleHashMapT<BGFX_CONFIG_MAX_PROGRAMS*2> ProgramHashMap; ProgramHashMap m_programHashMap; ProgramRef m_programRef[BGFX_CONFIG_MAX_PROGRAMS]; diff --git a/3rdparty/bgfx/src/bgfx_shader.sh b/3rdparty/bgfx/src/bgfx_shader.sh index f607f17d74e..c84e4bdc62a 100644 --- a/3rdparty/bgfx/src/bgfx_shader.sh +++ b/3rdparty/bgfx/src/bgfx_shader.sh @@ -28,7 +28,7 @@ # define EARLY_DEPTH_STENCIL #endif // BGFX_SHADER_LANGUAGE_HLSL > 3 && BGFX_SHADER_TYPE_FRAGMENT -#if BGFX_SHADER_LANGUAGE_HLSL +#if BGFX_SHADER_LANGUAGE_HLSL || BGFX_SHADER_LANGUAGE_PSSL # define CONST(_x) static const _x # define dFdx(_x) ddx(_x) # define dFdy(_y) ddy(-_y) @@ -39,18 +39,26 @@ # define bvec3 bool3 # define bvec4 bool4 -# if BGFX_SHADER_LANGUAGE_HLSL > 3 -# if BGFX_SHADER_LANGUAGE_HLSL > 4 +# if BGFX_SHADER_LANGUAGE_HLSL > 4 +# define REGISTER(_type, _reg) register(_type[_reg]) +# else +# define REGISTER(_type, _reg) register(_type ## _reg) +# endif // BGFX_SHADER_LANGUAGE_HLSL + +# if BGFX_SHADER_LANGUAGE_HLSL > 3 || BGFX_SHADER_LANGUAGE_PSSL +# if BGFX_SHADER_LANGUAGE_HLSL > 4 || BGFX_SHADER_LANGUAGE_PSSL # 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 +# if BGFX_SHADER_LANGUAGE_HLSL float intBitsToFloat(int _x) { return asfloat(_x); } vec2 intBitsToFloat(uint2 _x) { return asfloat(_x); } vec3 intBitsToFloat(uint3 _x) { return asfloat(_x); } vec4 intBitsToFloat(uint4 _x) { return asfloat(_x); } +# endif // BGFX_SHADER_LANGUAGE_HLSL float uintBitsToFloat(uint _x) { return asfloat(_x); } vec2 uintBitsToFloat(uint2 _x) { return asfloat(_x); } @@ -192,7 +200,7 @@ vec4 bgfxTexture3DLod(BgfxSampler3D _sampler, vec3 _coord, float _level) ivec4 bgfxTexture3D(BgfxISampler3D _sampler, vec3 _coord) { - ivec3 size; + uvec3 size; _sampler.m_texture.GetDimensions(size.x, size.y, size.z); return _sampler.m_texture.Load(ivec4(_coord * size, 0) ); } @@ -201,7 +209,7 @@ uvec4 bgfxTexture3D(BgfxUSampler3D _sampler, vec3 _coord) { uvec3 size; _sampler.m_texture.GetDimensions(size.x, size.y, size.z); - return _sampler.m_texture.Load(uvec4(_coord * size, 0) ); + return _sampler.m_texture.Load(ivec4(_coord * size, 0) ); } vec4 bgfxTextureCube(BgfxSamplerCube _sampler, vec3 _coord) @@ -240,14 +248,14 @@ vec4 bgfxTexelFetch(BgfxSampler3D _sampler, ivec3 _coord, int _lod) } # define SAMPLER2D(_name, _reg) \ - uniform SamplerState _name ## Sampler : register(s[_reg]); \ - uniform Texture2D _name ## Texture : register(t[_reg]); \ + uniform SamplerState _name ## Sampler : REGISTER(s, _reg); \ + uniform Texture2D _name ## Texture : REGISTER(t, _reg); \ static BgfxSampler2D _name = { _name ## Sampler, _name ## Texture } # define ISAMPLER2D(_name, _reg) \ - uniform Texture2D<ivec4> _name ## Texture : register(t[_reg]); \ + uniform Texture2D<ivec4> _name ## Texture : REGISTER(t, _reg); \ static BgfxISampler2D _name = { _name ## Texture } # define USAMPLER2D(_name, _reg) \ - uniform Texture2D<uvec4> _name ## Texture : register(t[_reg]); \ + uniform Texture2D<uvec4> _name ## Texture : REGISTER(t, _reg); \ static BgfxUSampler2D _name = { _name ## Texture } # define sampler2D BgfxSampler2D # define texture2D(_sampler, _coord) bgfxTexture2D(_sampler, _coord) @@ -255,43 +263,43 @@ vec4 bgfxTexelFetch(BgfxSampler3D _sampler, ivec3 _coord, int _lod) # define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord) # define SAMPLER2DARRAY(_name, _reg) \ - uniform SamplerState _name ## Sampler : register(s[_reg]); \ - uniform Texture2DArray _name ## Texture : register(t[_reg]); \ + uniform SamplerState _name ## Sampler : REGISTER(s, _reg); \ + uniform Texture2DArray _name ## Texture : REGISTER(t, _reg); \ static BgfxSampler2DArray _name = { _name ## Sampler, _name ## Texture } # define sampler2DArray BgfxSampler2DArray # define texture2DArray(_sampler, _coord) bgfxTexture2DArray(_sampler, _coord) # define texture2DArrayLod(_sampler, _coord, _lod) bgfxTexture2DArrayLod(_sampler, _coord, _lod) # define SAMPLER2DMS(_name, _reg) \ - uniform Texture2DMS<vec4> _name ## Texture : register(t[_reg]); \ + uniform Texture2DMS<vec4> _name ## Texture : REGISTER(t, _reg); \ static BgfxSampler2DMS _name = { _name ## Texture } # define sampler2DMS BgfxSampler2DMS # define SAMPLER2DSHADOW(_name, _reg) \ - uniform SamplerComparisonState _name ## Sampler : register(s[_reg]); \ - uniform Texture2D _name ## Texture : register(t[_reg]); \ + uniform SamplerComparisonState _name ## Sampler : REGISTER(s, _reg); \ + uniform Texture2D _name ## Texture : REGISTER(t, _reg); \ static BgfxSampler2DShadow _name = { _name ## Sampler, _name ## Texture } # define sampler2DShadow BgfxSampler2DShadow # define shadow2D(_sampler, _coord) bgfxShadow2D(_sampler, _coord) # define shadow2DProj(_sampler, _coord) bgfxShadow2DProj(_sampler, _coord) # define SAMPLER3D(_name, _reg) \ - uniform SamplerState _name ## Sampler : register(s[_reg]); \ - uniform Texture3D _name ## Texture : register(t[_reg]); \ + uniform SamplerState _name ## Sampler : REGISTER(s, _reg); \ + uniform Texture3D _name ## Texture : REGISTER(t, _reg); \ static BgfxSampler3D _name = { _name ## Sampler, _name ## Texture } # define ISAMPLER3D(_name, _reg) \ - uniform Texture3D<ivec4> _name ## Texture : register(t[_reg]); \ + uniform Texture3D<ivec4> _name ## Texture : REGISTER(t, _reg); \ static BgfxISampler3D _name = { _name ## Texture } # define USAMPLER3D(_name, _reg) \ - uniform Texture3D<uvec4> _name ## Texture : register(t[_reg]); \ + uniform Texture3D<uvec4> _name ## Texture : REGISTER(t, _reg); \ static BgfxUSampler3D _name = { _name ## Texture } # define sampler3D BgfxSampler3D # define texture3D(_sampler, _coord) bgfxTexture3D(_sampler, _coord) # define texture3DLod(_sampler, _coord, _level) bgfxTexture3DLod(_sampler, _coord, _level) # define SAMPLERCUBE(_name, _reg) \ - uniform SamplerState _name ## Sampler : register(s[_reg]); \ - uniform TextureCube _name ## Texture : register(t[_reg]); \ + uniform SamplerState _name ## Sampler : REGISTER(s, _reg); \ + uniform TextureCube _name ## Texture : REGISTER(t, _reg); \ static BgfxSamplerCube _name = { _name ## Sampler, _name ## Texture } # define samplerCube BgfxSamplerCube # define textureCube(_sampler, _coord) bgfxTextureCube(_sampler, _coord) @@ -333,19 +341,19 @@ float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord) #endif // 0 } -# define SAMPLER2D(_name, _reg) uniform sampler2D _name : register(s ## _reg) -# define SAMPLER2DMS(_name, _reg) uniform sampler2DMS _name : register(s ## _reg) +# define SAMPLER2D(_name, _reg) uniform sampler2D _name : REGISTER(s, _reg) +# define SAMPLER2DMS(_name, _reg) uniform sampler2DMS _name : REGISTER(s, _reg) # define texture2D(_sampler, _coord) tex2D(_sampler, _coord) # define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord) -# define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name : register(s ## _reg) +# define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name : REGISTER(s, _reg) # define shadow2D(_sampler, _coord) bgfxShadow2D(_sampler, _coord) # define shadow2DProj(_sampler, _coord) bgfxShadow2DProj(_sampler, _coord) -# define SAMPLER3D(_name, _reg) uniform sampler3D _name : register(s ## _reg) +# define SAMPLER3D(_name, _reg) uniform sampler3D _name : REGISTER(s, _reg) # define texture3D(_sampler, _coord) tex3D(_sampler, _coord) -# define SAMPLERCUBE(_name, _reg) uniform samplerCUBE _name : register(s[_reg]) +# define SAMPLERCUBE(_name, _reg) uniform samplerCUBE _name : REGISTER(s, _reg) # define textureCube(_sampler, _coord) texCUBE(_sampler, _coord) # if BGFX_SHADER_LANGUAGE_HLSL == 2 @@ -441,11 +449,11 @@ 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 +#if BGFX_SHADER_LANGUAGE_GLSL >= 130 || BGFX_SHADER_LANGUAGE_HLSL || BGFX_SHADER_LANGUAGE_PSSL 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 +#endif // BGFX_SHADER_LANGUAGE_GLSL >= 130 || BGFX_SHADER_LANGUAGE_HLSL || BGFX_SHADER_LANGUAGE_PSSL uniform vec4 u_viewRect; uniform vec4 u_viewTexel; diff --git a/3rdparty/bgfx/src/charset.h b/3rdparty/bgfx/src/charset.h index 15b3f81b645..32938ae260b 100644 --- a/3rdparty/bgfx/src/charset.h +++ b/3rdparty/bgfx/src/charset.h @@ -522,16 +522,3 @@ static const uint8_t vga8x16[256*16] = 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - -#include "vs_debugfont.bin.h" -#include "fs_debugfont.bin.h" - -#include "vs_clear.bin.h" -#include "fs_clear0.bin.h" -#include "fs_clear1.bin.h" -#include "fs_clear2.bin.h" -#include "fs_clear3.bin.h" -#include "fs_clear4.bin.h" -#include "fs_clear5.bin.h" -#include "fs_clear6.bin.h" -#include "fs_clear7.bin.h" diff --git a/3rdparty/bgfx/src/config.h b/3rdparty/bgfx/src/config.h index f9e4ddd2408..6ef37b421b8 100644 --- a/3rdparty/bgfx/src/config.h +++ b/3rdparty/bgfx/src/config.h @@ -19,7 +19,8 @@ && !defined(BGFX_CONFIG_RENDERER_OPENGL) \ && !defined(BGFX_CONFIG_RENDERER_OPENGLES) \ && !defined(BGFX_CONFIG_RENDERER_VULKAN) \ - && !defined(BGFX_CONFIG_RENDERER_NULL) + && !defined(BGFX_CONFIG_RENDERER_GNM) \ + && !defined(BGFX_CONFIG_RENDERER_NOOP) # ifndef BGFX_CONFIG_RENDERER_DIRECT3D9 # define BGFX_CONFIG_RENDERER_DIRECT3D9 (0 \ @@ -72,11 +73,21 @@ # endif // BGFX_CONFIG_RENDERER_OPENGLES # ifndef BGFX_CONFIG_RENDERER_VULKAN -# define BGFX_CONFIG_RENDERER_VULKAN 0 +# define BGFX_CONFIG_RENDERER_VULKAN (0 \ + || BX_PLATFORM_ANDROID \ + || BX_PLATFORM_LINUX \ + || BX_PLATFORM_WINDOWS \ + ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_VULKAN -# ifndef BGFX_CONFIG_RENDERER_NULL -# define BGFX_CONFIG_RENDERER_NULL (!(0 \ +# ifndef BGFX_CONFIG_RENDERER_GNM +# define BGFX_CONFIG_RENDERER_GNM (0 \ + || BX_PLATFORM_PS4 \ + ? 1 : 0) +# endif // BGFX_CONFIG_RENDERER_GNM + +# ifndef BGFX_CONFIG_RENDERER_NOOP +# define BGFX_CONFIG_RENDERER_NOOP (!(0 \ || BGFX_CONFIG_RENDERER_DIRECT3D9 \ || BGFX_CONFIG_RENDERER_DIRECT3D11 \ || BGFX_CONFIG_RENDERER_DIRECT3D12 \ @@ -84,8 +95,9 @@ || BGFX_CONFIG_RENDERER_OPENGL \ || BGFX_CONFIG_RENDERER_OPENGLES \ || BGFX_CONFIG_RENDERER_VULKAN \ + || BGFX_CONFIG_RENDERER_GNM \ ? 1 : 0) ) -# endif // BGFX_CONFIG_RENDERER_NULL +# endif // BGFX_CONFIG_RENDERER_NOOP #else # ifndef BGFX_CONFIG_RENDERER_DIRECT3D9 # define BGFX_CONFIG_RENDERER_DIRECT3D9 0 @@ -115,9 +127,13 @@ # define BGFX_CONFIG_RENDERER_VULKAN 0 # endif // BGFX_CONFIG_RENDERER_VULKAN -# ifndef BGFX_CONFIG_RENDERER_NULL -# define BGFX_CONFIG_RENDERER_NULL 0 -# endif // BGFX_CONFIG_RENDERER_NULL +# ifndef BGFX_CONFIG_RENDERER_GNM +# define BGFX_CONFIG_RENDERER_GNM 0 +# endif // BGFX_CONFIG_RENDERER_GNM + +# ifndef BGFX_CONFIG_RENDERER_NOOP +# define BGFX_CONFIG_RENDERER_NOOP 0 +# endif // BGFX_CONFIG_RENDERER_NOOP #endif // !defined... #if BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGL < 21 @@ -237,6 +253,10 @@ # define BGFX_CONFIG_MAX_VERTEX_BUFFERS (4<<10) #endif // BGFX_CONFIG_MAX_VERTEX_BUFFERS +#ifndef BGFX_CONFIG_MAX_VERTEX_STREAMS +# define BGFX_CONFIG_MAX_VERTEX_STREAMS 1 +#endif // BGFX_CONFIG_MAX_VERTEX_STREAMS + #ifndef BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS # define BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS (4<<10) #endif // BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS @@ -315,4 +335,16 @@ # define BGFX_CONFIG_PROFILER_REMOTERY_BUILD_LIB BGFX_CONFIG_PROFILER_REMOTERY #endif // BGFX_CONFIG_PROFILER_REMOTERY_BUILD_LIB +#ifndef BGFX_CONFIG_RENDERDOC_LOG_FILEPATH +# define BGFX_CONFIG_RENDERDOC_LOG_FILEPATH "temp/bgfx" +#endif // BGFX_CONFIG_RENDERDOC_LOG_FILEPATH + +#ifndef BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS +# define BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS { eRENDERDOC_Key_F11 } +#endif // BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS + +#ifndef BGFX_CONFIG_API_SEMAPHORE_TIMEOUT +# define BGFX_CONFIG_API_SEMAPHORE_TIMEOUT (-1) +#endif // BGFX_CONFIG_API_SEMAPHORE_TIMEOUT + #endif // BGFX_CONFIG_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/debug_renderdoc.cpp b/3rdparty/bgfx/src/debug_renderdoc.cpp index 0aca626468b..db1fabbab94 100644 --- a/3rdparty/bgfx/src/debug_renderdoc.cpp +++ b/3rdparty/bgfx/src/debug_renderdoc.cpp @@ -74,12 +74,12 @@ namespace bgfx if (NULL != RENDERDOC_GetAPI && 1 == RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_1_0, (void**)&s_renderDoc) ) { - s_renderDoc->SetLogFilePathTemplate("temp/bgfx"); + s_renderDoc->SetLogFilePathTemplate(BGFX_CONFIG_RENDERDOC_LOG_FILEPATH); s_renderDoc->SetFocusToggleKeys(NULL, 0); - RENDERDOC_InputButton captureKey = eRENDERDOC_Key_F11; - s_renderDoc->SetCaptureKeys(&captureKey, 1); + RENDERDOC_InputButton captureKeys[] = BGFX_CONFIG_RENDERDOC_CAPTURE_KEYS; + s_renderDoc->SetCaptureKeys(captureKeys, BX_COUNTOF(captureKeys) ); s_renderDoc->SetCaptureOptionU32(eRENDERDOC_Option_AllowVSync, 1); s_renderDoc->SetCaptureOptionU32(eRENDERDOC_Option_SaveAllInitials, 1); diff --git a/3rdparty/bgfx/src/fs_clear0.bin.h b/3rdparty/bgfx/src/fs_clear0.bin.h index 1bc08adc675..e9e8cc6f6c1 100644 --- a/3rdparty/bgfx/src/fs_clear0.bin.h +++ b/3rdparty/bgfx/src/fs_clear0.bin.h @@ -9,11 +9,11 @@ static const uint8_t fs_clear0_glsl[128] = 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, // olor = bgfx_clea 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_color[0];.}... }; -static const uint8_t fs_clear0_dx9[204] = +static const uint8_t fs_clear0_dx9[208] = { 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x01, // clear_color..... - 0x00, 0xa8, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........$.CTAB. + 0x00, 0xac, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b @@ -21,9 +21,9 @@ static const uint8_t fs_clear0_dx9[204] = 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 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, 0x39, 0x2e, 0x32, // der Compiler 9.2 - 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, // 9.952.3111...... - 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ............ + 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, 0x00, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ................ }; static const uint8_t fs_clear0_dx11[339] = { @@ -80,3 +80,5 @@ static const uint8_t fs_clear0_mtl[426] = 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // [0];. return _m 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}... }; +extern const uint8_t* fs_clear0_pssl; +extern const uint32_t fs_clear0_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear0.sc b/3rdparty/bgfx/src/fs_clear0.sc index 07131b43823..cedd5a6f652 100644 --- a/3rdparty/bgfx/src/fs_clear0.sc +++ b/3rdparty/bgfx/src/fs_clear0.sc @@ -3,6 +3,8 @@ * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ +#include "bgfx_shader.sh" + uniform vec4 bgfx_clear_color[8]; void main() diff --git a/3rdparty/bgfx/src/fs_clear1.bin.h b/3rdparty/bgfx/src/fs_clear1.bin.h index 78195927d3f..40bb8481160 100644 --- a/3rdparty/bgfx/src/fs_clear1.bin.h +++ b/3rdparty/bgfx/src/fs_clear1.bin.h @@ -12,11 +12,11 @@ static const uint8_t fs_clear1_glsl[170] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[1];.}... }; -static const uint8_t fs_clear1_dx9[216] = +static const uint8_t fs_clear1_dx9[220] = { 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x02, // clear_color..... - 0x00, 0xb4, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........$.CTAB. + 0x00, 0xb8, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b @@ -24,10 +24,10 @@ static const uint8_t fs_clear1_dx9[216] = 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 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, 0x39, 0x2e, 0x32, // der Compiler 9.2 - 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, // 9.952.3111...... - 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, // ................ - 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ........ + 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, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ + 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ............ }; static const uint8_t fs_clear1_dx11[411] = { @@ -95,3 +95,5 @@ static const uint8_t fs_clear1_mtl[531] = 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, // return _mtl_o;.} 0x0a, 0x0a, 0x00, // ... }; +extern const uint8_t* fs_clear1_pssl; +extern const uint32_t fs_clear1_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear1.sc b/3rdparty/bgfx/src/fs_clear1.sc index 160c1a83193..277a455c0bf 100644 --- a/3rdparty/bgfx/src/fs_clear1.sc +++ b/3rdparty/bgfx/src/fs_clear1.sc @@ -3,6 +3,8 @@ * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ +#include "bgfx_shader.sh" + uniform vec4 bgfx_clear_color[8]; void main() diff --git a/3rdparty/bgfx/src/fs_clear2.bin.h b/3rdparty/bgfx/src/fs_clear2.bin.h index 049708bfe32..7d19bb38b53 100644 --- a/3rdparty/bgfx/src/fs_clear2.bin.h +++ b/3rdparty/bgfx/src/fs_clear2.bin.h @@ -15,11 +15,11 @@ static const uint8_t fs_clear2_glsl[210] = 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, // ear_color[2];.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_clear2_dx9[228] = +static const uint8_t fs_clear2_dx9[232] = { 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x03, // clear_color..... - 0x00, 0xc0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........$.CTAB. + 0x00, 0xc4, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b @@ -27,11 +27,11 @@ static const uint8_t fs_clear2_dx9[228] = 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 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, 0x39, 0x2e, 0x32, // der Compiler 9.2 - 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, // 9.952.3111...... - 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0xff, // ................ - 0xff, 0x00, 0x00, 0x00, // .... + 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, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ + 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ + 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ........ }; static const uint8_t fs_clear2_dx11[483] = { @@ -109,3 +109,5 @@ static const uint8_t fs_clear2_mtl[621] = 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, // lor[2];. return 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... }; +extern const uint8_t* fs_clear2_pssl; +extern const uint32_t fs_clear2_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear2.sc b/3rdparty/bgfx/src/fs_clear2.sc index f0a849efae2..bfab0e8d31e 100644 --- a/3rdparty/bgfx/src/fs_clear2.sc +++ b/3rdparty/bgfx/src/fs_clear2.sc @@ -3,6 +3,8 @@ * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ +#include "bgfx_shader.sh" + uniform vec4 bgfx_clear_color[8]; void main() diff --git a/3rdparty/bgfx/src/fs_clear3.bin.h b/3rdparty/bgfx/src/fs_clear3.bin.h index 667d2f12f02..82f60bc695a 100644 --- a/3rdparty/bgfx/src/fs_clear3.bin.h +++ b/3rdparty/bgfx/src/fs_clear3.bin.h @@ -17,11 +17,11 @@ static const uint8_t fs_clear3_glsl[250] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[3];.}... }; -static const uint8_t fs_clear3_dx9[240] = +static const uint8_t fs_clear3_dx9[244] = { 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x04, // clear_color..... - 0x00, 0xcc, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........$.CTAB. + 0x00, 0xd0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b @@ -29,11 +29,12 @@ static const uint8_t fs_clear3_dx9[240] = 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 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, 0x39, 0x2e, 0x32, // der Compiler 9.2 - 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, // 9.952.3111...... - 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, // ................ - 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ................ + 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, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ + 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ + 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, // ................ + 0xff, 0x00, 0x00, 0x00, // .... }; static const uint8_t fs_clear3_dx11[555] = { @@ -121,3 +122,5 @@ static const uint8_t fs_clear3_mtl[711] = 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;.}... }; +extern const uint8_t* fs_clear3_pssl; +extern const uint32_t fs_clear3_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear3.sc b/3rdparty/bgfx/src/fs_clear3.sc index 529faaadbfa..de4c0729110 100644 --- a/3rdparty/bgfx/src/fs_clear3.sc +++ b/3rdparty/bgfx/src/fs_clear3.sc @@ -3,6 +3,8 @@ * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ +#include "bgfx_shader.sh" + uniform vec4 bgfx_clear_color[8]; void main() diff --git a/3rdparty/bgfx/src/fs_clear4.bin.h b/3rdparty/bgfx/src/fs_clear4.bin.h index 0272fdb11c7..8d91172fc31 100644 --- a/3rdparty/bgfx/src/fs_clear4.bin.h +++ b/3rdparty/bgfx/src/fs_clear4.bin.h @@ -20,11 +20,11 @@ static const uint8_t fs_clear4_glsl[290] = 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, // ear_color[4];.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_clear4_dx9[240] = +static const uint8_t fs_clear4_dx9[244] = { 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x04, // clear_color..... - 0x00, 0xcc, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........$.CTAB. + 0x00, 0xd0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b @@ -32,11 +32,12 @@ static const uint8_t fs_clear4_dx9[240] = 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 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, 0x39, 0x2e, 0x32, // der Compiler 9.2 - 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, // 9.952.3111...... - 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, // ................ - 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ................ + 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, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ + 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ + 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, // ................ + 0xff, 0x00, 0x00, 0x00, // .... }; static const uint8_t fs_clear4_dx11[499] = { @@ -127,3 +128,5 @@ static const uint8_t fs_clear4_mtl[801] = 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // turn _mtl_o;.}.. 0x00, // . }; +extern const uint8_t* fs_clear4_pssl; +extern const uint32_t fs_clear4_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear4.sc b/3rdparty/bgfx/src/fs_clear4.sc index efc69e23776..725ada0829a 100644 --- a/3rdparty/bgfx/src/fs_clear4.sc +++ b/3rdparty/bgfx/src/fs_clear4.sc @@ -3,6 +3,8 @@ * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ +#include "bgfx_shader.sh" + uniform vec4 bgfx_clear_color[8]; void main() diff --git a/3rdparty/bgfx/src/fs_clear5.bin.h b/3rdparty/bgfx/src/fs_clear5.bin.h index 4321d7999d0..455fa0b6f25 100644 --- a/3rdparty/bgfx/src/fs_clear5.bin.h +++ b/3rdparty/bgfx/src/fs_clear5.bin.h @@ -22,11 +22,11 @@ static const uint8_t fs_clear5_glsl[330] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x35, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[5];.}... }; -static const uint8_t fs_clear5_dx9[240] = +static const uint8_t fs_clear5_dx9[244] = { 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x04, // clear_color..... - 0x00, 0xcc, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........$.CTAB. + 0x00, 0xd0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b @@ -34,11 +34,12 @@ static const uint8_t fs_clear5_dx9[240] = 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 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, 0x39, 0x2e, 0x32, // der Compiler 9.2 - 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, // 9.952.3111...... - 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, // ................ - 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ................ + 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, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ + 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ + 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, // ................ + 0xff, 0x00, 0x00, 0x00, // .... }; static const uint8_t fs_clear5_dx11[559] = { @@ -137,3 +138,5 @@ static const uint8_t fs_clear5_mtl[891] = 0x72, 0x5b, 0x35, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, // r[5];. return _ 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mtl_o;.}... }; +extern const uint8_t* fs_clear5_pssl; +extern const uint32_t fs_clear5_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear5.sc b/3rdparty/bgfx/src/fs_clear5.sc index 625dcc42493..7444467ffbe 100644 --- a/3rdparty/bgfx/src/fs_clear5.sc +++ b/3rdparty/bgfx/src/fs_clear5.sc @@ -3,6 +3,8 @@ * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ +#include "bgfx_shader.sh" + uniform vec4 bgfx_clear_color[8]; void main() diff --git a/3rdparty/bgfx/src/fs_clear6.bin.h b/3rdparty/bgfx/src/fs_clear6.bin.h index fb602785679..dd845365996 100644 --- a/3rdparty/bgfx/src/fs_clear6.bin.h +++ b/3rdparty/bgfx/src/fs_clear6.bin.h @@ -25,11 +25,11 @@ static const uint8_t fs_clear6_glsl[370] = 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x36, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, // ear_color[6];.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_clear6_dx9[240] = +static const uint8_t fs_clear6_dx9[244] = { 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x04, // clear_color..... - 0x00, 0xcc, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........$.CTAB. + 0x00, 0xd0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b @@ -37,11 +37,12 @@ static const uint8_t fs_clear6_dx9[240] = 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 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, 0x39, 0x2e, 0x32, // der Compiler 9.2 - 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, // 9.952.3111...... - 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, // ................ - 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ................ + 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, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ + 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ + 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, // ................ + 0xff, 0x00, 0x00, 0x00, // .... }; static const uint8_t fs_clear6_dx11[619] = { @@ -150,3 +151,5 @@ static const uint8_t fs_clear6_mtl[981] = 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // return _mtl_o; 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... }; +extern const uint8_t* fs_clear6_pssl; +extern const uint32_t fs_clear6_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear6.sc b/3rdparty/bgfx/src/fs_clear6.sc index c7ae56a3e14..c5843fdcb24 100644 --- a/3rdparty/bgfx/src/fs_clear6.sc +++ b/3rdparty/bgfx/src/fs_clear6.sc @@ -3,6 +3,8 @@ * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ +#include "bgfx_shader.sh" + uniform vec4 bgfx_clear_color[8]; void main() diff --git a/3rdparty/bgfx/src/fs_clear7.bin.h b/3rdparty/bgfx/src/fs_clear7.bin.h index 1716ac32d86..caf3798fea4 100644 --- a/3rdparty/bgfx/src/fs_clear7.bin.h +++ b/3rdparty/bgfx/src/fs_clear7.bin.h @@ -27,11 +27,11 @@ static const uint8_t fs_clear7_glsl[410] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x37, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[7];.}... }; -static const uint8_t fs_clear7_dx9[240] = +static const uint8_t fs_clear7_dx9[244] = { 0x46, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x04, // clear_color..... - 0x00, 0xcc, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........$.CTAB. + 0x00, 0xd0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x25, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, // .........%.CTAB. 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, // ...[............ 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, // .......T...0.... 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, // .......D.......b @@ -39,11 +39,12 @@ static const uint8_t fs_clear7_dx9[240] = 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 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, 0x39, 0x2e, 0x32, // der Compiler 9.2 - 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, // 9.952.3111...... - 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x01, // ................ - 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, // ................ - 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ................ + 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, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, // ................ + 0x08, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x02, // ................ + 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x03, 0x08, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0xff, // ................ + 0xff, 0x00, 0x00, 0x00, // .... }; static const uint8_t fs_clear7_dx11[679] = { @@ -161,3 +162,5 @@ static const uint8_t fs_clear7_mtl[1071] = 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x37, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, // color[7];. retu 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // rn _mtl_o;.}... }; +extern const uint8_t* fs_clear7_pssl; +extern const uint32_t fs_clear7_pssl_size; diff --git a/3rdparty/bgfx/src/fs_clear7.sc b/3rdparty/bgfx/src/fs_clear7.sc index fc8a11e4b94..4c58ba924da 100644 --- a/3rdparty/bgfx/src/fs_clear7.sc +++ b/3rdparty/bgfx/src/fs_clear7.sc @@ -3,6 +3,8 @@ * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ +#include "bgfx_shader.sh" + uniform vec4 bgfx_clear_color[8]; void main() diff --git a/3rdparty/bgfx/src/fs_debugfont.bin.h b/3rdparty/bgfx/src/fs_debugfont.bin.h index 00e22f744cd..eaca9aaa6da 100644 --- a/3rdparty/bgfx/src/fs_debugfont.bin.h +++ b/3rdparty/bgfx/src/fs_debugfont.bin.h @@ -24,32 +24,32 @@ static const uint8_t fs_debugfont_glsl[354] = 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, // r = tmpvar_1;.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_debugfont_dx9[370] = +static const uint8_t fs_debugfont_dx9[374] = { 0x46, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH..."f...s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x54, 0x01, 0x00, 0x03, 0xff, // Color0.....T.... - 0xff, 0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...".CTAB....S.. + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x58, 0x01, 0x00, 0x03, 0xff, // Color0.....X.... + 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // ...#.CTAB....S.. 0x00, 0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................ 0x00, 0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, // .L...0.......... 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .<.......s_texCo 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, // lor............. 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, // .....ps_3_0.Micr 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, // osoft (R) HLSL S - 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, // hader Compiler 9 - 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, // .29.952.3111.Q.. - 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x81, 0x80, 0x80, 0xbb, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, // ................ - 0xbf, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, // ................ - 0x90, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x01, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................ - 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ - 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, // .....B.......... - 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, // ................ - 0x90, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x81, 0x00, 0x00, 0xe4, // ................ - 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, // ................ - 0x80, 0x01, 0x00, 0xe4, 0x90, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, // ................ - 0x80, 0x00, 0x00, 0x00, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, // .....X.......... - 0x80, 0x00, 0x00, 0x55, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x41, 0x00, 0x00, 0x01, 0x01, 0x00, 0x0f, // ...U.....A...... - 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, // ................ - 0x00, 0x00, // .. + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, // hader Compiler 1 + 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2e, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, // 0.0.10011.16384. + 0xab, 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x81, 0x80, 0x80, 0xbb, 0x00, 0x00, 0x00, // .Q.............. + 0x80, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, // ................ + 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x01, 0x80, 0x01, 0x00, 0x0f, // ................ + 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, // ................ + 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // .........B...... + 0x80, 0x02, 0x00, 0xe4, 0x90, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, // ................ + 0x80, 0x01, 0x00, 0xe4, 0x90, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, // ................ + 0x81, 0x00, 0x00, 0xe4, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, // ................ + 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, // ................ + 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, // .........X...... + 0x80, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x41, 0x00, 0x00, // .......U.....A.. + 0x01, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, // ................ + 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ...... }; static const uint8_t fs_debugfont_dx11[772] = { @@ -103,9 +103,9 @@ static const uint8_t fs_debugfont_dx11[772] = 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, // ....SV_TARGET... 0x00, 0x00, 0x00, 0x00, // .... }; -static const uint8_t fs_debugfont_mtl[810] = +static const uint8_t fs_debugfont_mtl[820] = { - 0x46, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x1b, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH..."f......us + 0x46, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x25, 0x03, 0x00, 0x00, 0x75, 0x73, // FSH..."f..%...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,25 +135,28 @@ static const uint8_t fs_debugfont_mtl[810] = 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, // ler(0)]]).{. xl 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, // atMtlShaderOutpu 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, // t _mtl_o;. half - 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // 4 tmpvar_1;. tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x28, 0x73, // pvar_1 = half4(s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // _texColor.sample - 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // (_mtlsmp_s_texCo - 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, // lor, (float2)(_m - 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tl_i.v_texcoord0 - 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x20, 0x74, 0x6d, 0x70, // )));. half4 tmp - 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_2;. tmpvar_ - 0x32, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x34, 0x29, 0x6d, 0x69, 0x78, 0x20, // 2 = ((half4)mix - 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, // (_mtl_i.v_color1 - 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // , _mtl_i.v_color - 0x30, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, // 0, (float4)tmpva - 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x78, 0x78, 0x78, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, // r_1.xxxx));. if - 0x20, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3c, 0x20, // ((tmpvar_2.w < - 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x30, 0x2e, 0x30, 0x30, 0x33, 0x39, 0x32, 0x31, 0x35, 0x36, // (half)0.00392156 - 0x39, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x69, 0x73, 0x63, 0x61, 0x72, // 9)) {. discar - 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x28, 0x29, 0x3b, 0x0a, 0x20, 0x20, // d_fragment();. - 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // };. _mtl_o.gl_F - 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva - 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // r_2;. return _m - 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}... + 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // 4 tmpvar_1 = 0;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x68, 0x61, 0x6c, // tmpvar_1 = hal + 0x66, 0x34, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, // f4(s_texColor.sa + 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, // mple(_mtlsmp_s_t + 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, // exColor, (float2 + 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // )(_mtl_i.v_texco + 0x6f, 0x72, 0x64, 0x30, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x68, 0x61, 0x6c, 0x66, 0x34, // ord0)));. half4 + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // tmpvar_2 = 0;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x68, 0x61, // tmpvar_2 = ((ha + 0x6c, 0x66, 0x34, 0x29, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, // lf4)mix (_mtl_i. + 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // v_color1, _mtl_i + 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, // .v_color0, (floa + 0x74, 0x34, 0x29, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x78, 0x78, 0x78, // t4)tmpvar_1.xxxx + 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // ));. if ((tmpva + 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3c, 0x20, 0x28, 0x68, 0x61, 0x6c, 0x66, 0x29, 0x28, 0x30, // r_2.w < (half)(0 + 0x2e, 0x30, 0x30, 0x33, 0x39, 0x32, 0x31, 0x35, 0x36, 0x39, 0x29, 0x29, 0x29, 0x20, 0x7b, 0x0a, // .003921569))) {. + 0x20, 0x20, 0x20, 0x20, 0x64, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, // discard_frag + 0x6d, 0x65, 0x6e, 0x74, 0x28, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // ment();. };. _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, // mtl_o.gl_FragCol + 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, // or = tmpvar_2;. + 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // return _mtl_o;. + 0x7d, 0x0a, 0x0a, 0x00, // }... }; +extern const uint8_t* fs_debugfont_pssl; +extern const uint32_t fs_debugfont_pssl_size; diff --git a/3rdparty/bgfx/src/glcontext_nsgl.mm b/3rdparty/bgfx/src/glcontext_nsgl.mm index 61a39272253..50f35e42cd2 100644 --- a/3rdparty/bgfx/src/glcontext_nsgl.mm +++ b/3rdparty/bgfx/src/glcontext_nsgl.mm @@ -126,7 +126,7 @@ namespace bgfx { namespace gl [glContext makeCurrentContext]; GLint interval = 0; [glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval]; - + // When initializing NSOpenGLView programatically (as we are), this sometimes doesn't // get hooked up properly (especially when there are existing window elements). This ensures // we are valid. Otherwise, you'll probably get a GL_INVALID_FRAMEBUFFER_OPERATION when diff --git a/3rdparty/bgfx/src/glimports.h b/3rdparty/bgfx/src/glimports.h index 40781f43da0..dfc345af7f3 100644 --- a/3rdparty/bgfx/src/glimports.h +++ b/3rdparty/bgfx/src/glimports.h @@ -162,6 +162,7 @@ typedef void (GL_APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, G typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param); typedef void (GL_APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size); +typedef void (GL_APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode); typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); @@ -404,7 +405,8 @@ GL_IMPORT______(false, PFNGLVIEWPORTPROC, glViewport); # if BGFX_CONFIG_RENDERER_OPENGL GL_IMPORT______(false, PFNGLCLEARDEPTHPROC, glClearDepth); -GL_IMPORT______(false, PFNGLPOINTSIZEPROC, glPointSize); +GL_IMPORT______(true, PFNGLPOINTSIZEPROC, glPointSize); +GL_IMPORT______(true, PFNGLPOLYGONMODEPROC, glPolygonMode); GL_IMPORT_ARB__(true, PFNGLDEBUGMESSAGECONTROLPROC, glDebugMessageControl); GL_IMPORT_ARB__(true, PFNGLDEBUGMESSAGEINSERTPROC, glDebugMessageInsert); @@ -467,6 +469,8 @@ GL_IMPORT______(true, PFNGLFRAMETERMINATORGREMEDYPROC, glFrameTermin GL_IMPORT______(true, PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC, glGetTranslatedShaderSourceANGLE); #if !BGFX_CONFIG_RENDERER_OPENGL +GL_IMPORT______(true, PFNGLPOINTSIZEPROC, glPointSize); +GL_IMPORT______(true, PFNGLPOLYGONMODEPROC, glPolygonMode); GL_IMPORT_ANGLE(true, PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer); GL_IMPORT_ANGLE(true, PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample); diff --git a/3rdparty/bgfx/src/hmd.cpp b/3rdparty/bgfx/src/hmd.cpp new file mode 100644 index 00000000000..fa23c3811b1 --- /dev/null +++ b/3rdparty/bgfx/src/hmd.cpp @@ -0,0 +1,212 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "hmd.h" + +namespace bgfx +{ + VR::VR() + : m_impl(NULL) + , m_framesUntilReconnect(0) + , m_enabled(false) + { + } + + void VR::init(VRImplI* _impl) + { + if (NULL == _impl) + { + return; + } + + if (!_impl->init() ) + { + return; + } + + m_impl = _impl; + m_impl->connect(&m_desc); + + if (!m_impl->isConnected() ) + { + connectFailed(); + return; + } + + m_hmdSize.m_w = m_desc.m_eyeSize[0].m_w + m_desc.m_eyeSize[1].m_w; + m_hmdSize.m_h = bx::uint32_max(m_desc.m_eyeSize[0].m_h, m_desc.m_eyeSize[1].m_h); + } + + void VR::shutdown() + { + if (NULL == m_impl) + { + return; + } + + m_impl->destroySwapChain(); + + if (m_impl->isConnected() ) + { + m_impl->disconnect(); + } + + m_impl->shutdown(); + m_impl = NULL; + m_enabled = false; + } + + void VR::renderEyeStart(uint8_t _eye, Rect* _viewport) + { + BX_CHECK(m_enabled, "VR::renderEyeStart called while not enabled - render usage error"); + + _viewport->m_x = 0; + _viewport->m_y = 0; + _viewport->m_width = uint16_t(m_desc.m_eyeSize[_eye].m_w); + _viewport->m_height = uint16_t(m_desc.m_eyeSize[_eye].m_h); + + m_impl->renderEyeStart(m_desc, _eye); + } + + void VR::recenter() + { + if (NULL != m_impl) + { + m_impl->recenter(); + } + } + + void VR::preReset() + { + if (NULL != m_impl) + { + m_impl->destroyMirror(); + } + + m_enabled = false; + } + + void VR::postReset(int _msaaSamples, int _mirrorWidth, int _mirrorHeight) + { + if (NULL != m_impl + && m_impl->createSwapChain(m_desc, _msaaSamples, _mirrorWidth, _mirrorHeight) ) + { + m_enabled = true; + } + } + + void VR::flip() + { + if (NULL == m_impl + || !m_enabled) + { + return; + } + else if (!m_impl->isConnected() + && !tryReconnect() ) + { + return; + } + + if (!m_impl->submitSwapChain(m_desc) ) + { + m_impl->destroySwapChain(); + m_impl->disconnect(); + return; + } + } + + void VR::swap(HMD& _hmd) + { + _hmd.flags = BGFX_HMD_NONE; + + if (NULL == m_impl) + { + return; + } + + _hmd.flags = BGFX_HMD_DEVICE_RESOLUTION; + _hmd.deviceWidth = m_desc.m_deviceSize.m_w; + _hmd.deviceHeight = m_desc.m_deviceSize.m_h; + _hmd.width = uint16_t(m_hmdSize.m_w); + _hmd.height = uint16_t(m_hmdSize.m_h); + + if (!m_impl->updateTracking(_hmd) ) + { + m_impl->destroySwapChain(); + m_impl->disconnect(); + } + + if (!m_impl->isConnected() ) + { + return; + } + + for (int eye = 0; eye < 2; ++eye) + { + _hmd.eye[eye].fov[0] = m_desc.m_eyeFov[eye].m_up; + _hmd.eye[eye].fov[1] = m_desc.m_eyeFov[eye].m_down; + _hmd.eye[eye].fov[2] = m_desc.m_eyeFov[eye].m_left; + _hmd.eye[eye].fov[3] = m_desc.m_eyeFov[eye].m_right; + } + + m_impl->updateInput(_hmd); + if (m_enabled) + { + _hmd.flags |= BGFX_HMD_RENDERING; + } + } + + bool VR::tryReconnect() + { + if (!m_impl) + { + return false; + } + + BX_CHECK(!m_impl->isConnected(), "VR::tryReconnect called when already connected. Usage error"); + + --m_framesUntilReconnect; + if (m_framesUntilReconnect > 0) + { + return false; + } + + m_framesUntilReconnect = 90; + m_impl->connect(&m_desc); + if (!m_impl->isConnected() ) + { + connectFailed(); + return false; + } + + m_hmdSize.m_w = m_desc.m_eyeSize[0].m_w + m_desc.m_eyeSize[1].m_w; + m_hmdSize.m_h = bx::uint32_max(m_desc.m_eyeSize[0].m_h, m_desc.m_eyeSize[1].m_h); + return true; + } + + void VR::connectFailed() + { + // sane defaults + m_desc.m_deviceSize.m_w = 2160; + m_desc.m_deviceSize.m_h = 1200; + m_desc.m_deviceType = 0; + m_desc.m_refreshRate = 90.0f; + m_desc.m_neckOffset[0] = 0.0805f; + m_desc.m_neckOffset[1] = 0.075f; + + for (int eye = 0; eye < 2; ++eye) + { + m_desc.m_eyeFov[eye].m_up = 1.32928634f; + m_desc.m_eyeFov[eye].m_down = 1.32928634f; + } + + m_desc.m_eyeFov[0].m_left = 1.05865765f; + m_desc.m_eyeFov[0].m_right = 1.09236801f; + m_desc.m_eyeFov[1].m_left = 1.09236801f; + m_desc.m_eyeFov[1].m_right = 1.05865765f; + } + +} // namesapce bgfx diff --git a/3rdparty/bgfx/src/hmd.h b/3rdparty/bgfx/src/hmd.h new file mode 100644 index 00000000000..5832909eab7 --- /dev/null +++ b/3rdparty/bgfx/src/hmd.h @@ -0,0 +1,101 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#ifndef BGFX_HMD_H_HEADER_GUARD +#define BGFX_HMD_H_HEADER_GUARD + +#include "bgfx_p.h" + +namespace bgfx +{ + struct VRSize + { + uint32_t m_w; + uint32_t m_h; + }; + + struct VRFovTan + { + float m_up; + float m_down; + float m_left; + float m_right; + }; + + struct VRDesc + { + uint32_t m_deviceType; + float m_refreshRate; + VRSize m_deviceSize; + VRSize m_eyeSize[2]; + VRFovTan m_eyeFov[2]; + float m_neckOffset[2]; + }; + + struct BX_NO_VTABLE VRImplI + { + virtual ~VRImplI() = 0; + + virtual bool init() = 0; + virtual void shutdown() = 0; + virtual void connect(VRDesc* _desc) = 0; + virtual void disconnect() = 0; + virtual bool isConnected() const = 0; + + virtual bool updateTracking(HMD& _hmd) = 0; + virtual void updateInput(HMD& _hmd) = 0; + virtual void recenter() = 0; + + virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight); + virtual void destroySwapChain() = 0; + virtual void destroyMirror() = 0; + virtual void renderEyeStart(const VRDesc& _desc, uint8_t _eye) = 0; + virtual bool submitSwapChain(const VRDesc& _desc) = 0; + }; + + inline VRImplI::~VRImplI() + { + } + + class VR + { + public: + VR(); + + void init(VRImplI* _impl); + void shutdown(); + + bool isInitialized() const + { + return NULL != m_impl; + } + + bool isEnabled() const + { + return m_enabled; + } + + void renderEyeStart(uint8_t _eye, Rect* _viewport); + void recenter(); + + void preReset(); + void postReset(int _msaaSamples, int _mirrorWidth, int _mirrorHeight); + void flip(); + void swap(HMD& _hmd); + + private: + bool tryReconnect(); + void connectFailed(); + + VRImplI* m_impl; + VRDesc m_desc; + VRSize m_hmdSize; + uint32_t m_framesUntilReconnect; + bool m_enabled; + }; + +} // namespace bgfx + +#endif // BGFX_HMD_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/hmd_openvr.cpp b/3rdparty/bgfx/src/hmd_openvr.cpp index 59ae813afe8..9e360cbf18e 100644 --- a/3rdparty/bgfx/src/hmd_openvr.cpp +++ b/3rdparty/bgfx/src/hmd_openvr.cpp @@ -5,10 +5,8 @@ #include "hmd_openvr.h" -BX_PRAGMA_DIAGNOSTIC_PUSH() BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-variable") #include <openvr/openvr_capi.h> -BX_PRAGMA_DIAGNOSTIC_POP() namespace bgfx { diff --git a/3rdparty/bgfx/src/hmd_ovr.cpp b/3rdparty/bgfx/src/hmd_ovr.cpp index c63f9d90c6d..648f5638121 100644 --- a/3rdparty/bgfx/src/hmd_ovr.cpp +++ b/3rdparty/bgfx/src/hmd_ovr.cpp @@ -3,10 +3,12 @@ * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ -#include "hmd_ovr.h" +#include "bgfx_p.h" #if BGFX_CONFIG_USE_OVR +#include "hmd_ovr.h" + namespace bgfx { #define _OVR_CHECK(_call) \ @@ -21,244 +23,183 @@ namespace bgfx # define OVR_CHECK(_call) _call #endif // BGFX_CONFIG_DEBUG - OVR::OVR() - : m_hmd(NULL) - , m_enabled(false) - , m_mirror(NULL) - , m_frameIndex(0) - , m_sensorSampleTime(0) + VRImplOVR::VRImplOVR() + : m_session(NULL) { - memset(m_eyeBuffers, 0, sizeof(m_eyeBuffers)); } - OVR::~OVR() + VRImplOVR::~VRImplOVR() { - BX_CHECK(NULL == m_hmd, "OVR not shutdown properly."); - } - - void OVR::init() - { - ovrResult result = ovr_Initialize(NULL); - - if (result != ovrSuccess) - { - BX_TRACE("Unable to create OVR device."); - return; - } - - ovrGraphicsLuid luid; - result = ovr_Create(&m_hmd, &luid); - if (result != ovrSuccess) + if (NULL != g_platformData.session) { - BX_TRACE("Unable to create OVR device."); return; } - m_hmdDesc = ovr_GetHmdDesc(m_hmd); - - BX_TRACE("HMD: %s, %s, firmware: %d.%d" - , m_hmdDesc.ProductName - , m_hmdDesc.Manufacturer - , m_hmdDesc.FirmwareMajor - , m_hmdDesc.FirmwareMinor - ); - - ovrSizei sizeL = ovr_GetFovTextureSize(m_hmd, ovrEye_Left, m_hmdDesc.DefaultEyeFov[0], 1.0f); - ovrSizei sizeR = ovr_GetFovTextureSize(m_hmd, ovrEye_Right, m_hmdDesc.DefaultEyeFov[1], 1.0f); - m_hmdSize.w = sizeL.w + sizeR.w; - m_hmdSize.h = bx::uint32_max(sizeL.h, sizeR.h); + BX_CHECK(NULL == m_session, "OVR not shutdown properly."); } - void OVR::shutdown() + bool VRImplOVR::init() { - BX_CHECK(!m_enabled, "HMD not disabled."); - - for (uint32_t ii = 0; ii < 2; ++ii) + if (NULL != g_platformData.session) { - if (NULL != m_eyeBuffers[ii]) - { - m_eyeBuffers[ii]->destroy(m_hmd); - m_eyeBuffers[ii] = NULL; - } + return true; } - if (NULL != m_mirror) + ovrResult initialized = ovr_Initialize(NULL); + if (!OVR_SUCCESS(initialized)) { - m_mirror->destroy(m_hmd); - m_mirror = NULL; + BX_TRACE("Unable to initialize OVR runtime."); + return false; } - ovr_Destroy(m_hmd); - m_hmd = NULL; - ovr_Shutdown(); + return true; } - void OVR::getViewport(uint8_t _eye, Rect* _viewport) + void VRImplOVR::shutdown() { - _viewport->m_x = 0; - _viewport->m_y = 0; - _viewport->m_width = m_eyeBuffers[_eye]->m_eyeTextureSize.w; - _viewport->m_height = m_eyeBuffers[_eye]->m_eyeTextureSize.h; - } + if (NULL != g_platformData.session) + { + return; + } - void OVR::renderEyeStart(uint8_t _eye) - { - m_eyeBuffers[_eye]->render(m_hmd); + ovr_Shutdown(); } - bool OVR::postReset() + void VRImplOVR::connect(VRDesc* _desc) { - if (NULL == m_hmd) + if (NULL == g_platformData.session) { - return false; + ovrGraphicsLuid luid; + ovrResult result = ovr_Create(&m_session, &luid); + if (!OVR_SUCCESS(result)) + { + BX_TRACE("Failed to create OVR device."); + return; + } } - - for (uint32_t ii = 0; ii < 2; ++ii) + else { - m_erd[ii] = ovr_GetRenderDesc(m_hmd, ovrEyeType(ii), m_hmdDesc.DefaultEyeFov[ii]); + m_session = (ovrSession)g_platformData.session; } - m_enabled = true; - - return true; - } + ovrHmdDesc hmdDesc = ovr_GetHmdDesc(m_session); + _desc->m_deviceType = hmdDesc.Type; + _desc->m_refreshRate = hmdDesc.DisplayRefreshRate; + _desc->m_deviceSize.m_w = hmdDesc.Resolution.w; + _desc->m_deviceSize.m_h = hmdDesc.Resolution.h; + + BX_TRACE("OVR HMD: %s, %s, firmware: %d.%d" + , hmdDesc.ProductName + , hmdDesc.Manufacturer + , hmdDesc.FirmwareMajor + , hmdDesc.FirmwareMinor + ); - void OVR::preReset() - { - if (m_enabled) + ovrSizei eyeSize[2] = { - // on window resize this will recreate the mirror texture in ovrPostReset - m_mirror->destroy(m_hmd); - m_mirror = NULL; - m_enabled = false; - } - } + ovr_GetFovTextureSize(m_session, ovrEye_Left, hmdDesc.DefaultEyeFov[0], 1.0f), + ovr_GetFovTextureSize(m_session, ovrEye_Right, hmdDesc.DefaultEyeFov[0], 1.0f), + }; - OVR::Enum OVR::swap(HMD& _hmd, bool originBottomLeft) - { - _hmd.flags = BGFX_HMD_NONE; - - if (NULL != m_hmd) + for (int eye = 0; eye < 2; ++eye) { - _hmd.flags |= BGFX_HMD_DEVICE_RESOLUTION; - _hmd.deviceWidth = m_hmdDesc.Resolution.w; - _hmd.deviceHeight = m_hmdDesc.Resolution.h; + BX_STATIC_ASSERT(sizeof(_desc->m_eyeFov[eye]) == sizeof(hmdDesc.DefaultEyeFov[eye])); + memcpy(&_desc->m_eyeFov[eye], &hmdDesc.DefaultEyeFov[eye], sizeof(_desc->m_eyeFov[eye])); + _desc->m_eyeSize[eye].m_w = eyeSize[eye].w; + _desc->m_eyeSize[eye].m_h = eyeSize[eye].h; } - if (!m_enabled) + float neckOffset[2] = {OVR_DEFAULT_NECK_TO_EYE_HORIZONTAL, OVR_DEFAULT_NECK_TO_EYE_VERTICAL}; + ovr_GetFloatArray(m_session, OVR_KEY_NECK_TO_EYE_DISTANCE, neckOffset, 2); + _desc->m_neckOffset[0] = neckOffset[0]; + _desc->m_neckOffset[1] = neckOffset[1]; + + // build constant layer settings + m_renderLayer.Header.Type = ovrLayerType_EyeFov; + m_renderLayer.Header.Flags = 0; + for (int eye = 0; eye < 2; ++eye) { - return NotEnabled; + m_renderLayer.Fov[eye] = hmdDesc.DefaultEyeFov[eye]; + m_renderLayer.Viewport[eye].Pos.x = 0; + m_renderLayer.Viewport[eye].Pos.y = 0; + m_renderLayer.Viewport[eye].Size = eyeSize[eye]; } - ovrResult result; - - for (uint32_t ii = 0; ii < 2; ++ii) + m_viewScale.HmdSpaceToWorldScaleInMeters = 1.0f; + for (int eye = 0; eye < 2; ++eye) { - m_eyeBuffers[ii]->postRender(m_hmd); - result = ovr_CommitTextureSwapChain(m_hmd, m_eyeBuffers[ii]->m_textureSwapChain); - if (!OVR_SUCCESS(result) ) - { - return DeviceLost; - } + ovrEyeRenderDesc erd = ovr_GetRenderDesc(m_session, static_cast<ovrEyeType>(eye), hmdDesc.DefaultEyeFov[eye]); + m_viewScale.HmdToEyeOffset[eye] = erd.HmdToEyeOffset; + m_eyeFov[eye] = erd.Fov; + m_pixelsPerTanAngleAtCenter[eye] = erd.PixelsPerTanAngleAtCenter; } + } - _hmd.flags |= BGFX_HMD_RENDERING; - - // finish frame for current eye - ovrViewScaleDesc viewScaleDesc; - viewScaleDesc.HmdSpaceToWorldScaleInMeters = 1.0f; - viewScaleDesc.HmdToEyeOffset[0] = m_hmdToEyeOffset[0]; - viewScaleDesc.HmdToEyeOffset[1] = m_hmdToEyeOffset[1]; - - // create the main eye layer - ovrLayerEyeFov eyeLayer; - eyeLayer.Header.Type = ovrLayerType_EyeFov; - eyeLayer.Header.Flags = originBottomLeft ? ovrLayerFlag_TextureOriginAtBottomLeft : 0; - - for (uint32_t ii = 0; ii < 2; ++ii) + void VRImplOVR::disconnect() + { + if (NULL != g_platformData.session) { - eyeLayer.ColorTexture[ii] = m_eyeBuffers[ii]->m_textureSwapChain; - eyeLayer.Viewport[ii].Pos.x = 0; - eyeLayer.Viewport[ii].Pos.y = 0; - eyeLayer.Viewport[ii].Size.w = m_eyeBuffers[ii]->m_eyeTextureSize.w; - eyeLayer.Viewport[ii].Size.h = m_eyeBuffers[ii]->m_eyeTextureSize.h; - eyeLayer.Fov[ii] = m_hmdDesc.DefaultEyeFov[ii]; - eyeLayer.RenderPose[ii] = m_pose[ii]; - eyeLayer.SensorSampleTime = m_sensorSampleTime; + return; } - // append all the layers to global list - ovrLayerHeader* layerList = &eyeLayer.Header; - - result = ovr_SubmitFrame(m_hmd, m_frameIndex, NULL, &layerList, 1); - if (!OVR_SUCCESS(result) ) + if (NULL != m_session) { - return DeviceLost; + ovr_Destroy(m_session); + m_session = NULL; } - - // perform mirror texture blit right after the entire frame is submitted to HMD - m_mirror->blit(m_hmd); - - m_hmdToEyeOffset[0] = m_erd[0].HmdToEyeOffset; - m_hmdToEyeOffset[1] = m_erd[1].HmdToEyeOffset; - - ovr_GetEyePoses(m_hmd, m_frameIndex, ovrTrue, m_hmdToEyeOffset, m_pose, &m_sensorSampleTime); - - getEyePose(_hmd); - - return Success; } - void OVR::recenter() + bool VRImplOVR::updateTracking(HMD& _hmd) { - if (NULL != m_hmd) + if (NULL == m_session) { - OVR_CHECK(ovr_RecenterTrackingOrigin(m_hmd) ); + return false; } - } - void OVR::getEyePose(HMD& _hmd) - { - if (NULL != m_hmd) + ovr_GetEyePoses(m_session, 0, ovrTrue, m_viewScale.HmdToEyeOffset, m_renderLayer.RenderPose, &m_renderLayer.SensorSampleTime); + + for (int eye = 0; eye < 2; ++eye) { - for (uint32_t ii = 0; ii < 2; ++ii) + const ovrPosef& pose = m_renderLayer.RenderPose[eye]; + HMD::Eye& hmdEye = _hmd.eye[eye]; + + hmdEye.rotation[0] = pose.Orientation.x; + hmdEye.rotation[1] = pose.Orientation.y; + hmdEye.rotation[2] = pose.Orientation.z; + hmdEye.rotation[3] = pose.Orientation.w; + hmdEye.translation[0] = pose.Position.x; + hmdEye.translation[1] = pose.Position.y; + hmdEye.translation[2] = pose.Position.z; + hmdEye.viewOffset[0] = -m_viewScale.HmdToEyeOffset[eye].x; + hmdEye.viewOffset[1] = -m_viewScale.HmdToEyeOffset[eye].y; + hmdEye.viewOffset[2] = -m_viewScale.HmdToEyeOffset[eye].z; + + hmdEye.pixelsPerTanAngle[0] = m_pixelsPerTanAngleAtCenter[eye].x; + hmdEye.pixelsPerTanAngle[1] = m_pixelsPerTanAngleAtCenter[eye].y; + + ovrMatrix4f projection = ovrMatrix4f_Projection(m_eyeFov[eye], 0.1f, 1000.0f, ovrProjection_LeftHanded); + for (uint32_t ii = 0; ii < 4; ++ii) { - const ovrPosef& pose = m_pose[ii]; - HMD::Eye& eye = _hmd.eye[ii]; - eye.rotation[0] = pose.Orientation.x; - eye.rotation[1] = pose.Orientation.y; - eye.rotation[2] = pose.Orientation.z; - eye.rotation[3] = pose.Orientation.w; - eye.translation[0] = pose.Position.x; - eye.translation[1] = pose.Position.y; - eye.translation[2] = pose.Position.z; - - const ovrEyeRenderDesc& erd = m_erd[ii]; - eye.fov[0] = erd.Fov.UpTan; - eye.fov[1] = erd.Fov.DownTan; - eye.fov[2] = erd.Fov.LeftTan; - eye.fov[3] = erd.Fov.RightTan; - - ovrMatrix4f eyeProj = ovrMatrix4f_Projection(m_erd[ii].Fov, 0.01f, 1000.0f, ovrProjection_LeftHanded); for (uint32_t jj = 0; jj < 4; ++jj) { - for (uint32_t kk = 0; kk < 4; ++kk) - { - eye.projection[4 * jj + kk] = eyeProj.M[kk][jj]; - } + hmdEye.projection[4*ii + jj] = projection.M[jj][ii]; } - - eye.viewOffset[0] = -erd.HmdToEyeOffset.x; - eye.viewOffset[1] = -erd.HmdToEyeOffset.y; - eye.viewOffset[2] = -erd.HmdToEyeOffset.z; - - eye.pixelsPerTanAngle[0] = erd.PixelsPerTanAngleAtCenter.x; - eye.pixelsPerTanAngle[1] = erd.PixelsPerTanAngleAtCenter.y; } } - _hmd.width = uint16_t(m_hmdSize.w); - _hmd.height = uint16_t(m_hmdSize.h); + return true; + } + + void VRImplOVR::updateInput(HMD& /* _hmd */) + { + } + + void VRImplOVR::recenter() + { + if (NULL != m_session) + { + ovr_RecenterTrackingOrigin(m_session); + } } } // namespace bgfx diff --git a/3rdparty/bgfx/src/hmd_ovr.h b/3rdparty/bgfx/src/hmd_ovr.h index 675e711c01e..a2a2d34a63b 100644 --- a/3rdparty/bgfx/src/hmd_ovr.h +++ b/3rdparty/bgfx/src/hmd_ovr.h @@ -10,6 +10,7 @@ #if BGFX_CONFIG_USE_OVR +# include "hmd.h" # include <OVR_Version.h> # define OVR_VERSION_(_a, _b, _c) (_a * 10000 + _b * 100 + _c) @@ -25,157 +26,41 @@ # include <OVR_CAPI_GL.h> # endif // BGFX_CONFIG_RENDERER_OPENGL -namespace bgfx -{ - // single eye buffer - struct OVRBufferI - { - virtual ~OVRBufferI() {}; - virtual void create(const ovrSession& _session, int _eyeIdx, int _msaaSamples) = 0; - virtual void destroy(const ovrSession& _session) = 0; - virtual void render(const ovrSession& _session) = 0; - virtual void postRender(const ovrSession& _session) = 0; - ovrSizei m_eyeTextureSize; - ovrTextureSwapChain m_textureSwapChain; - }; - - // mirrored window output - struct OVRMirrorI - { - virtual ~OVRMirrorI() {}; - virtual void create(const ovrSession& _session, int windowWidth, int windowHeight) = 0; - virtual void destroy(const ovrSession& _session) = 0; - virtual void blit(const ovrSession& _session) = 0; - - ovrMirrorTexture m_mirrorTexture; - ovrMirrorTextureDesc m_mirrorTextureDesc; - }; - - struct OVR - { - enum Enum - { - NotEnabled, - DeviceLost, - Success, - - Count - }; - - OVR(); - ~OVR(); - - bool isInitialized() const - { - return NULL != m_hmd; - } - - bool isEnabled() const - { - return m_enabled; - } - - void init(); - void shutdown(); - - void getViewport(uint8_t _eye, Rect* _viewport); - void renderEyeStart(uint8_t _eye); - bool postReset(); - void preReset(); - Enum swap(HMD& _hmd, bool originBottomLeft); - void recenter(); - void getEyePose(HMD& _hmd); - - ovrSession m_hmd; - ovrHmdDesc m_hmdDesc; - ovrEyeRenderDesc m_erd[2]; - ovrRecti m_rect[2]; - ovrPosef m_pose[2]; - ovrVector3f m_hmdToEyeOffset[2]; - ovrSizei m_hmdSize; - OVRBufferI *m_eyeBuffers[2]; - OVRMirrorI *m_mirror; - uint64_t m_frameIndex; - double m_sensorSampleTime; - bool m_enabled; - }; - -} // namespace bgfx - -#else namespace bgfx { - struct OVR + class VRImplOVR : public VRImplI { - enum Enum - { - NotEnabled, - DeviceLost, - Success, + public: + VRImplOVR(); + virtual ~VRImplOVR() = 0; - Count - }; + virtual bool init() BX_OVERRIDE; + virtual void shutdown() BX_OVERRIDE; + virtual void connect(VRDesc* _desc) BX_OVERRIDE; + virtual void disconnect() BX_OVERRIDE; - OVR() + virtual bool isConnected() const BX_OVERRIDE { + return NULL != m_session; } - ~OVR() - { - } - - bool isInitialized() const - { - return false; - } - - bool isEnabled() const - { - return false; - } - - bool isDebug() const - { - return false; - } - - void init() - { - } - - void shutdown() - { - } - - void getViewport(uint8_t /*_eye*/, Rect* _viewport) - { - _viewport->m_x = 0; - _viewport->m_y = 0; - _viewport->m_width = 0; - _viewport->m_height = 0; - } - - void renderEyeStart(uint8_t /*_eye*/) - { - } - - Enum swap(HMD& _hmd, bool /*originBottomLeft*/) - { - _hmd.flags = BGFX_HMD_NONE; - getEyePose(_hmd); - return NotEnabled; - } - - void recenter() - { - } - - void getEyePose(HMD& _hmd) - { - _hmd.width = 0; - _hmd.height = 0; - } + virtual bool updateTracking(HMD& _hmd) BX_OVERRIDE; + virtual void updateInput(HMD& _hmd) BX_OVERRIDE; + virtual void recenter() BX_OVERRIDE; + + virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) BX_OVERRIDE = 0; + virtual void destroySwapChain() BX_OVERRIDE = 0; + virtual void destroyMirror() BX_OVERRIDE = 0; + virtual void renderEyeStart(const VRDesc& _desc, uint8_t _eye) BX_OVERRIDE = 0; + virtual bool submitSwapChain(const VRDesc& _desc) BX_OVERRIDE = 0; + + protected: + ovrSession m_session; + ovrLayerEyeFov m_renderLayer; + ovrViewScaleDesc m_viewScale; + ovrFovPort m_eyeFov[2]; + ovrVector2f m_pixelsPerTanAngleAtCenter[2]; }; } // namespace bgfx diff --git a/3rdparty/bgfx/src/image.cpp b/3rdparty/bgfx/src/image.cpp index 81557c0ea11..9284aad20b0 100644 --- a/3rdparty/bgfx/src/image.cpp +++ b/3rdparty/bgfx/src/image.cpp @@ -93,9 +93,9 @@ namespace bgfx { 24, 1, 1, 3, 1, 1, 24, 0, 0, 0, 0, 0, uint8_t(EncodingType::Unorm) }, // D24 { 32, 1, 1, 4, 1, 1, 24, 8, 0, 0, 0, 0, uint8_t(EncodingType::Unorm) }, // D24S8 { 32, 1, 1, 4, 1, 1, 32, 0, 0, 0, 0, 0, uint8_t(EncodingType::Unorm) }, // D32 - { 16, 1, 1, 2, 1, 1, 16, 0, 0, 0, 0, 0, uint8_t(EncodingType::Unorm) }, // D16F - { 24, 1, 1, 3, 1, 1, 24, 0, 0, 0, 0, 0, uint8_t(EncodingType::Unorm) }, // D24F - { 32, 1, 1, 4, 1, 1, 32, 0, 0, 0, 0, 0, uint8_t(EncodingType::Unorm) }, // D32F + { 16, 1, 1, 2, 1, 1, 16, 0, 0, 0, 0, 0, uint8_t(EncodingType::Float) }, // D16F + { 24, 1, 1, 3, 1, 1, 24, 0, 0, 0, 0, 0, uint8_t(EncodingType::Float) }, // D24F + { 32, 1, 1, 4, 1, 1, 32, 0, 0, 0, 0, 0, uint8_t(EncodingType::Float) }, // D32F { 8, 1, 1, 1, 1, 1, 0, 8, 0, 0, 0, 0, uint8_t(EncodingType::Unorm) }, // D0S8 }; BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_imageBlockInfo) ); @@ -258,9 +258,9 @@ namespace bgfx _depth = bx::uint16_max(1, _depth); uint32_t max = bx::uint32_max(_width, bx::uint32_max(_height, _depth) ); - uint8_t numMips = uint8_t(bx::flog2(float(max) ) ); + uint32_t numMips = bx::uint32_max(1, uint8_t(bx::flog2(float(max) ) ) ); - return numMips; + return uint8_t(numMips); } uint32_t imageGetSize(TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, uint16_t _numLayers, bool _cubeMap, uint8_t _numMips) @@ -1251,6 +1251,57 @@ namespace bgfx _dst[3] = bx::halfToFloat(src[3]); } + // R24 + void packR24(void* _dst, const float* _src) + { + uint8_t* dst = (uint8_t*)_dst; + const uint32_t rr = uint32_t(toUnorm(_src[0], 16777216.0f) ); + dst[0] = uint8_t(rr ); + dst[1] = uint8_t(rr>> 8); + dst[2] = uint8_t(rr>>16); + } + + void unpackR24(float* _dst, const void* _src) + { + const uint8_t* src = (const uint8_t*)_src; + const uint32_t rr = 0 + | (src[0] ) + | (src[1]<< 8) + | (src[2]<<16) + ; + + _dst[0] = fromUnorm(rr, 16777216.0f); + _dst[1] = 0.0f; + _dst[2] = 0.0f; + _dst[3] = 1.0f; + } + + // R24G8 + void packR24G8(void* _dst, const float* _src) + { + uint8_t* dst = (uint8_t*)_dst; + const uint32_t rr = uint32_t(toUnorm(_src[0], 16777216.0f) ); + dst[0] = uint8_t(rr ); + dst[1] = uint8_t(rr>> 8); + dst[2] = uint8_t(rr>>16); + dst[3] = uint8_t(toUnorm(_src[1], 255.0f) ); + } + + void unpackR24G8(float* _dst, const void* _src) + { + const uint8_t* src = (const uint8_t*)_src; + const uint32_t rr = 0 + | (src[0] ) + | (src[1]<< 8) + | (src[2]<<16) + ; + + _dst[0] = fromUnorm(rr, 16777216.0f); + _dst[1] = fromUnorm(src[3], 255.0f); + _dst[2] = 0.0f; + _dst[3] = 1.0f; + } + // R32I void packR32I(void* _dst, const float* _src) { @@ -1632,14 +1683,14 @@ namespace bgfx { packRgb10A2, unpackRgb10A2 }, // RGB10A2 { packR11G11B10F, unpackR11G11B10F }, // R11G11B10F { NULL, NULL }, // UnknownDepth - { NULL, NULL }, // D16 - { NULL, NULL }, // D24 - { NULL, NULL }, // D24S8 + { packR16, unpackR16 }, // D16 + { packR24, unpackR24 }, // D24 + { packR24G8, unpackR24G8 }, // D24S8 { NULL, NULL }, // D32 - { NULL, NULL }, // D16F + { packR16F, unpackR16F }, // D16F { NULL, NULL }, // D24F - { NULL, NULL }, // D32F - { NULL, NULL }, // D0S8 + { packR32F, unpackR32F }, // D32F + { packR8, unpackR8 }, // D0S8 }; BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_packUnpack) ); diff --git a/3rdparty/bgfx/src/image.h b/3rdparty/bgfx/src/image.h index d9479bb82c4..4fce6d7bd1d 100644 --- a/3rdparty/bgfx/src/image.h +++ b/3rdparty/bgfx/src/image.h @@ -395,7 +395,7 @@ namespace bgfx void imageDecodeToRgba32f(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format); /// - bool imageGetRawData(const ImageContainer& _imageContainer, uint16_t _side, uint8_t _index, const void* _data, uint32_t _size, ImageMip& _mip); + bool imageGetRawData(const ImageContainer& _imageContainer, uint16_t _side, uint8_t _lod, const void* _data, uint32_t _size, ImageMip& _mip); } // namespace bgfx diff --git a/3rdparty/bgfx/src/makefile b/3rdparty/bgfx/src/makefile index 6de6e838350..3fade997ed2 100644 --- a/3rdparty/bgfx/src/makefile +++ b/3rdparty/bgfx/src/makefile @@ -25,7 +25,7 @@ all: $(BIN) define shader-embedded @echo [$(<)] - $(SILENT) $(SHADERC) --type $(1) --platform linux -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl + $(SILENT) $(SHADERC) --type $(1) --platform linux -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl @cat $(SHADER_TMP) > $(@) -$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(2) -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx9 -@cat $(SHADER_TMP) >> $(@) @@ -33,6 +33,8 @@ define shader-embedded -@cat $(SHADER_TMP) >> $(@) -$(SILENT) $(SHADERC) --type $(1) --platform ios -p metal -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_mtl -@cat $(SHADER_TMP) >> $(@) + -@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@) + -@echo extern const uint32_t $(basename $(<))_pssl_size;>> $(@) endef vs_debugfont.bin.h : vs_debugfont.sc diff --git a/3rdparty/bgfx/src/renderer.h b/3rdparty/bgfx/src/renderer.h index a85cc9bc75c..5f0ff9ea109 100644 --- a/3rdparty/bgfx/src/renderer.h +++ b/3rdparty/bgfx/src/renderer.h @@ -12,7 +12,10 @@ namespace bgfx { struct ViewState { - ViewState() { } + ViewState() + { + } + ViewState(Frame* _render, bool _hmdEnabled) { reset(_render, _hmdEnabled); diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp index 6bab23dd024..29b5d392511 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.cpp +++ b/3rdparty/bgfx/src/renderer_d3d11.cpp @@ -29,6 +29,10 @@ # define BGFX_GPU_PROFILER_END() BX_NOOP() #endif +#if BGFX_CONFIG_USE_OVR +# include "hmd_ovr.h" +#endif // BGFX_CONFIG_USE_OVR + namespace bgfx { namespace d3d11 { static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; @@ -601,6 +605,30 @@ namespace bgfx { namespace d3d11 static PFN_GET_DEBUG_INTERFACE1 DXGIGetDebugInterface1; #endif // USE_D3D11_DYNAMIC_LIB +#if BGFX_CONFIG_USE_OVR + class VRImplOVRD3D11 : public VRImplOVR + { + public: + VRImplOVRD3D11(); + + virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) BX_OVERRIDE; + virtual void destroySwapChain() BX_OVERRIDE; + virtual void destroyMirror() BX_OVERRIDE; + virtual void renderEyeStart(const VRDesc& _desc, uint8_t _eye) BX_OVERRIDE; + virtual bool submitSwapChain(const VRDesc& _desc) BX_OVERRIDE; + + private: + ID3D11RenderTargetView* m_eyeRtv[2][4]; + ID3D11DepthStencilView* m_depthBuffer[2]; + ID3D11Texture2D* m_msaaTexture[2]; + ID3D11ShaderResourceView* m_msaaSv[2]; + ID3D11RenderTargetView* m_msaaRtv[2]; + + ovrTextureSwapChain m_textureSwapChain[2]; + ovrMirrorTexture m_mirrorTexture; + }; +#endif // BGFX_CONFIG_USE_OVR + struct RendererContextD3D11 : public RendererContextI { RendererContextD3D11() @@ -662,7 +690,11 @@ namespace bgfx { namespace d3d11 ErrorState::Enum errorState = ErrorState::Default; // Must be before device creation, and before RenderDoc. - m_ovr.init(); + VRImplI* vrImpl = NULL; +#if BGFX_CONFIG_USE_OVR + vrImpl = &m_ovrRender; +#endif // BGFX_CONFIG_USE_OVR + m_ovr.init(vrImpl); if (!m_ovr.isInitialized() ) { @@ -1231,12 +1263,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } { - UniformHandle handle = BGFX_INVALID_HANDLE; - for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii) - { - m_uniformReg.add(handle, getPredefinedUniformName(PredefinedUniform::Enum(ii) ), &m_predefinedUniforms[ii]); - } - g_caps.supported |= (0 | BGFX_CAPS_TEXTURE_3D | BGFX_CAPS_VERTEX_ATTRIB_HALF @@ -1259,19 +1285,19 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (m_featureLevel <= D3D_FEATURE_LEVEL_9_2) { - g_caps.maxTextureSize = D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; - g_caps.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); + g_caps.limits.maxTextureSize = D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION; + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); } else if (m_featureLevel == D3D_FEATURE_LEVEL_9_3) { - g_caps.maxTextureSize = D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION; - g_caps.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); + g_caps.limits.maxTextureSize = D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION; + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); } else { g_caps.supported |= BGFX_CAPS_TEXTURE_COMPARE_ALL; - g_caps.maxTextureSize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; - g_caps.maxFBAttachments = uint8_t(bx::uint32_min(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); + g_caps.limits.maxTextureSize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); } // 32-bit indices only supported on 9_2+. @@ -1814,22 +1840,24 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { } - void readTexture(TextureHandle _handle, void* _data) BX_OVERRIDE + void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) BX_OVERRIDE { const TextureD3D11& texture = m_textures[_handle.idx]; D3D11_MAPPED_SUBRESOURCE mapped; - DX_CHECK(m_deviceCtx->Map(texture.m_ptr, 0, D3D11_MAP_READ, 0, &mapped) ); + DX_CHECK(m_deviceCtx->Map(texture.m_ptr, _mip, D3D11_MAP_READ, 0, &mapped) ); - uint8_t* src = (uint8_t*)mapped.pData; - uint32_t srcPitch = mapped.RowPitch; + uint32_t srcWidth = bx::uint32_max(1, texture.m_width >>_mip); + uint32_t srcHeight = bx::uint32_max(1, texture.m_height>>_mip); + uint8_t* src = (uint8_t*)mapped.pData; + uint32_t srcPitch = mapped.RowPitch; const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(texture.m_textureFormat) ); uint8_t* dst = (uint8_t*)_data; - uint32_t dstPitch = texture.m_width*bpp/8; + uint32_t dstPitch = srcWidth*bpp/8; uint32_t pitch = bx::uint32_min(srcPitch, dstPitch); - for (uint32_t yy = 0, height = texture.m_height; yy < height; ++yy) + for (uint32_t yy = 0, height = srcHeight; yy < height; ++yy) { memcpy(dst, src, pitch); @@ -1837,7 +1865,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); dst += dstPitch; } - m_deviceCtx->Unmap(texture.m_ptr, 0); + m_deviceCtx->Unmap(texture.m_ptr, _mip); } void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) BX_OVERRIDE @@ -1934,6 +1962,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { BX_FREE(g_allocator, m_uniforms[_handle.idx]); m_uniforms[_handle.idx] = NULL; + m_uniformReg.remove(_handle); } void saveScreenShot(const char* _filePath) BX_OVERRIDE @@ -2231,18 +2260,12 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (SUCCEEDED(hr) ) { - switch (m_ovr.swap(_hmd, false) ) + m_ovr.flip(); + m_ovr.swap(_hmd); // TODO - move this out of end-of-frame + + if (!m_ovr.isEnabled()) { - case OVR::NotEnabled: hr = m_swapChain->Present(syncInterval, 0); - break; - - case OVR::DeviceLost: - ovrPreReset(); - break; - - default: - break; } } @@ -3067,11 +3090,17 @@ BX_PRAGMA_DIAGNOSTIC_POP(); switch (texture.m_type) { case TextureD3D11::Texture2D: - case TextureD3D11::TextureCube: desc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2D; desc.Texture2D.MipSlice = _mip; break; + case TextureD3D11::TextureCube: + desc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2DARRAY; + desc.Texture2DArray.ArraySize = 6; + desc.Texture2DArray.FirstArraySlice = 0; + desc.Texture2DArray.MipSlice = _mip; + break; + case TextureD3D11::Texture3D: desc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE3D; desc.Texture3D.MipSlice = _mip; @@ -3153,24 +3182,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); #if BGFX_CONFIG_USE_OVR if (m_resolution.m_flags & (BGFX_RESET_HMD|BGFX_RESET_HMD_DEBUG) ) { - if (m_ovr.postReset() ) - { - const uint32_t msaaSamples = 1 << ((m_resolution.m_flags&BGFX_RESET_MSAA_MASK) >> BGFX_RESET_MSAA_SHIFT); - - for (uint32_t ii = 0; ii < 2; ++ii) - { - // eye buffers need to be initialized only once during application lifetime - if (NULL == m_ovr.m_eyeBuffers[ii]) - { - m_ovr.m_eyeBuffers[ii] = &m_ovrBuffers[ii]; - m_ovr.m_eyeBuffers[ii]->create(m_ovr.m_hmd, ii, msaaSamples); - } - } - - // recreate mirror texture - m_ovr.m_mirror = &m_ovrMirror; - m_ovr.m_mirror->create(m_ovr.m_hmd, m_resolution.m_width, m_resolution.m_height); - } + const uint32_t msaaSamples = 1 << ((m_resolution.m_flags&BGFX_RESET_MSAA_MASK) >> BGFX_RESET_MSAA_SHIFT); + m_ovr.postReset(msaaSamples, m_resolution.m_width, m_resolution.m_height); } #endif // BGFX_CONFIG_USE_OVR } @@ -3569,10 +3582,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); bool m_rtMsaa; bool m_timerQuerySupport; - OVR m_ovr; + VR m_ovr; #if BGFX_CONFIG_USE_OVR - OVRMirrorD3D11 m_ovrMirror; - OVRBufferD3D11 m_ovrBuffers[2]; + VRImplOVRD3D11 m_ovrRender; #endif // BGFX_CONFIG_USE_OVR }; @@ -3627,204 +3639,248 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } #if BGFX_CONFIG_USE_OVR - void OVRBufferD3D11::create(const ovrSession& _session, int _eyeIdx, int _msaaSamples) + + VRImplOVRD3D11::VRImplOVRD3D11() + : m_mirrorTexture(NULL) { - ovrHmdDesc hmdDesc = ovr_GetHmdDesc(_session); - m_eyeTextureSize = ovr_GetFovTextureSize(_session, (ovrEyeType)_eyeIdx, hmdDesc.DefaultEyeFov[_eyeIdx], 1.0f); - m_msaaTexture = NULL; - m_msaaRtv = NULL; - m_msaaSv = NULL; - - ovrTextureSwapChainDesc desc = {}; - desc.Type = ovrTexture_2D; - desc.ArraySize = 1; - desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; - desc.Width = m_eyeTextureSize.w; - desc.Height = m_eyeTextureSize.h; - desc.MipLevels = 1; - desc.SampleCount = 1; - desc.MiscFlags = ovrTextureMisc_DX_Typeless; - desc.BindFlags = ovrTextureBind_DX_RenderTarget; - desc.StaticImage = ovrFalse; + memset(m_textureSwapChain, 0, sizeof(m_textureSwapChain)); + } + bool VRImplOVRD3D11::createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) + { ID3D11Device* device = s_renderD3D11->m_device; - ovrResult result = ovr_CreateTextureSwapChainDX(_session, device, &desc, &m_textureSwapChain); + for (int eye = 0; eye < 2; ++eye) + { + if (NULL == m_textureSwapChain[eye]) + { + m_msaaTexture[eye] = NULL; + m_msaaRtv[eye] = NULL; + m_msaaSv[eye] = NULL; + + ovrTextureSwapChainDesc swapchainDesc = {}; + swapchainDesc.Type = ovrTexture_2D; + swapchainDesc.ArraySize = 1; + swapchainDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; + swapchainDesc.Width = _desc.m_eyeSize[eye].m_w; + swapchainDesc.Height = _desc.m_eyeSize[eye].m_h; + swapchainDesc.MipLevels = 1; + swapchainDesc.SampleCount = 1; + swapchainDesc.MiscFlags = ovrTextureMisc_DX_Typeless; + swapchainDesc.BindFlags = ovrTextureBind_DX_RenderTarget; + swapchainDesc.StaticImage = ovrFalse; + + ovrResult result = ovr_CreateTextureSwapChainDX(m_session, device, &swapchainDesc, &m_textureSwapChain[eye]); + if (!OVR_SUCCESS(result)) + { + destroySwapChain(); + return false; + } - if (!OVR_SUCCESS(result) ) + memset(m_eyeRtv[eye], 0, sizeof(m_eyeRtv[eye])); + int textureCount; + ovr_GetTextureSwapChainLength(m_session, m_textureSwapChain[eye], &textureCount); + + for (int ii = 0; ii < textureCount; ++ii) + { + ID3D11Texture2D* tex = NULL; + ovr_GetTextureSwapChainBufferDX(m_session, m_textureSwapChain[eye], ii, IID_PPV_ARGS(&tex)); + D3D11_RENDER_TARGET_VIEW_DESC rtvd = {}; + rtvd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + rtvd.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + + ID3D11RenderTargetView* rtv; + DX_CHECK(device->CreateRenderTargetView(tex, &rtvd, &rtv)); + m_eyeRtv[eye][ii] = rtv; + DX_RELEASE(tex, 1); + } + + // setup depth buffer + D3D11_TEXTURE2D_DESC dbDesc; + dbDesc.Width = _desc.m_eyeSize[eye].m_w; + dbDesc.Height = _desc.m_eyeSize[eye].m_h; + dbDesc.MipLevels = 1; + dbDesc.ArraySize = 1; + dbDesc.Format = DXGI_FORMAT_D32_FLOAT; + dbDesc.SampleDesc.Count = _msaaSamples; + dbDesc.SampleDesc.Quality = 0; + dbDesc.Usage = D3D11_USAGE_DEFAULT; + dbDesc.CPUAccessFlags = 0; + dbDesc.MiscFlags = 0; + dbDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL; + ID3D11Texture2D* tex; + DX_CHECK(device->CreateTexture2D(&dbDesc, NULL, &tex)); + DX_CHECK(device->CreateDepthStencilView(tex, NULL, &m_depthBuffer[eye])); + DX_RELEASE(tex, 0); + + // create MSAA render target + if (_msaaSamples > 1) + { + D3D11_TEXTURE2D_DESC dsDesc; + dsDesc.Width = _desc.m_eyeSize[eye].m_w; + dsDesc.Height = _desc.m_eyeSize[eye].m_h; + dsDesc.MipLevels = 1; + dsDesc.ArraySize = 1; + dsDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + dsDesc.SampleDesc.Count = _msaaSamples; + dsDesc.SampleDesc.Quality = 0; + dsDesc.Usage = D3D11_USAGE_DEFAULT; + dsDesc.CPUAccessFlags = 0; + dsDesc.MiscFlags = 0; + dsDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; + + DX_CHECK(device->CreateTexture2D(&dsDesc, NULL, &m_msaaTexture[eye])); + DX_CHECK(device->CreateShaderResourceView(m_msaaTexture[eye], NULL, &m_msaaSv[eye])); + DX_CHECK(device->CreateRenderTargetView(m_msaaTexture[eye], NULL, &m_msaaRtv[eye])); + } + } + } + + if (NULL == m_mirrorTexture) { - BX_CHECK(false, "Could not create D3D11 OVR swap texture"); + ovrMirrorTextureDesc mirrorDesc = {}; + mirrorDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; + mirrorDesc.Width = _mirrorWidth; + mirrorDesc.Height = _mirrorHeight; + ovrResult result = ovr_CreateMirrorTextureDX(m_session, device, &mirrorDesc, &m_mirrorTexture); + BX_WARN(OVR_SUCCESS(result), "Could not create D3D11 OVR mirror texture"); + BX_UNUSED(result); } - memset(m_eyeRtv, 0, sizeof(m_eyeRtv) ); - int textureCount = 0; - ovr_GetTextureSwapChainLength(_session, m_textureSwapChain, &textureCount); + m_renderLayer.ColorTexture[0] = m_textureSwapChain[0]; + m_renderLayer.ColorTexture[1] = m_textureSwapChain[1]; + return true; + } - for (int ii = 0; ii < textureCount; ++ii) + void VRImplOVRD3D11::destroySwapChain() + { + for (int eye = 0; eye < 2; ++eye) { - ID3D11Texture2D* tex = NULL; - ovr_GetTextureSwapChainBufferDX(_session, m_textureSwapChain, ii, IID_PPV_ARGS(&tex) ); - D3D11_RENDER_TARGET_VIEW_DESC rtvd = {}; - rtvd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - rtvd.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; - - ID3D11RenderTargetView* rtv; - DX_CHECK(device->CreateRenderTargetView(tex, &rtvd, &rtv) ); - m_eyeRtv[ii] = rtv; - DX_RELEASE(tex, 1); + if (m_textureSwapChain[eye]) + { + for (uint32_t ii = 0; ii < BX_COUNTOF(m_eyeRtv[eye]); ++ii) + { + DX_RELEASE(m_eyeRtv[eye][ii], 0); + } + + ovr_DestroyTextureSwapChain(m_session, m_textureSwapChain[eye]); + m_textureSwapChain[eye] = NULL; + m_depthBuffer[eye]->Release(); + + if (NULL != m_msaaTexture[eye]) + { + m_msaaTexture[eye]->Release(); + m_msaaTexture[eye] = NULL; + } + + if (NULL != m_msaaSv[eye]) + { + m_msaaSv[eye]->Release(); + m_msaaSv[eye] = NULL; + } + + if (NULL != m_msaaRtv[eye]) + { + m_msaaRtv[eye]->Release(); + m_msaaRtv[eye] = NULL; + } + } } - // setup depth buffer - D3D11_TEXTURE2D_DESC dbDesc; - dbDesc.Width = m_eyeTextureSize.w; - dbDesc.Height = m_eyeTextureSize.h; - dbDesc.MipLevels = 1; - dbDesc.ArraySize = 1; - dbDesc.Format = DXGI_FORMAT_D32_FLOAT; - dbDesc.SampleDesc.Count = _msaaSamples; - dbDesc.SampleDesc.Quality = 0; - dbDesc.Usage = D3D11_USAGE_DEFAULT; - dbDesc.CPUAccessFlags = 0; - dbDesc.MiscFlags = 0; - dbDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL; - ID3D11Texture2D* tex; - DX_CHECK(device->CreateTexture2D(&dbDesc, NULL, &tex) ); - DX_CHECK(device->CreateDepthStencilView(tex, NULL, &m_depthBuffer) ); - DX_RELEASE(tex, 0); - - // create MSAA render target - if (_msaaSamples > 1) - { - D3D11_TEXTURE2D_DESC dsDesc; - dsDesc.Width = m_eyeTextureSize.w; - dsDesc.Height = m_eyeTextureSize.h; - dsDesc.MipLevels = 1; - dsDesc.ArraySize = 1; - dsDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - dsDesc.SampleDesc.Count = _msaaSamples; - dsDesc.SampleDesc.Quality = 0; - dsDesc.Usage = D3D11_USAGE_DEFAULT; - dsDesc.CPUAccessFlags = 0; - dsDesc.MiscFlags = 0; - dsDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; - - ID3D11Device* device = s_renderD3D11->m_device; - DX_CHECK(device->CreateTexture2D(&dsDesc, NULL, &m_msaaTexture)); - DX_CHECK(device->CreateShaderResourceView(m_msaaTexture, NULL, &m_msaaSv)); - DX_CHECK(device->CreateRenderTargetView(m_msaaTexture, NULL, &m_msaaRtv)); + destroyMirror(); + } + + void VRImplOVRD3D11::destroyMirror() + { + if (NULL != m_mirrorTexture) + { + ovr_DestroyMirrorTexture(m_session, m_mirrorTexture); + m_mirrorTexture = NULL; } } - void OVRBufferD3D11::render(const ovrSession& _session) + void VRImplOVRD3D11::renderEyeStart(const VRDesc& _desc, uint8_t _eye) { ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; float black[] = { 0.0f, 0.0f, 0.0f, 0.0f }; // Important that alpha=0, if want pixels to be transparent, for manual layers // render to MSAA target - if (NULL != m_msaaTexture) + if (NULL != m_msaaTexture[_eye]) { - deviceCtx->OMSetRenderTargets(1, &m_msaaRtv, m_depthBuffer); - deviceCtx->ClearRenderTargetView(m_msaaRtv, black); - deviceCtx->ClearDepthStencilView(m_depthBuffer, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1, 0); + deviceCtx->OMSetRenderTargets(1, &m_msaaRtv[_eye], m_depthBuffer[_eye]); + deviceCtx->ClearRenderTargetView(m_msaaRtv[_eye], black); + deviceCtx->ClearDepthStencilView(m_depthBuffer[_eye], D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1, 0); } else // MSAA disabled? render directly to eye buffer { int texIndex = 0; - ovr_GetTextureSwapChainCurrentIndex(_session, m_textureSwapChain, &texIndex); + ovr_GetTextureSwapChainCurrentIndex(m_session, m_textureSwapChain[_eye], &texIndex); - deviceCtx->OMSetRenderTargets(1, &m_eyeRtv[texIndex], m_depthBuffer); - deviceCtx->ClearRenderTargetView(m_eyeRtv[texIndex], black); - deviceCtx->ClearDepthStencilView(m_depthBuffer, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1, 0); + deviceCtx->OMSetRenderTargets(1, &m_eyeRtv[_eye][texIndex], m_depthBuffer[_eye]); + deviceCtx->ClearRenderTargetView(m_eyeRtv[_eye][texIndex], black); + deviceCtx->ClearDepthStencilView(m_depthBuffer[_eye], D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1, 0); D3D11_VIEWPORT D3Dvp; D3Dvp.TopLeftX = 0; D3Dvp.TopLeftY = 0; - D3Dvp.Width = (FLOAT)m_eyeTextureSize.w; - D3Dvp.Height = (FLOAT)m_eyeTextureSize.h; + D3Dvp.Width = (FLOAT)_desc.m_eyeSize[_eye].m_w; + D3Dvp.Height = (FLOAT)_desc.m_eyeSize[_eye].m_h; D3Dvp.MinDepth = 0; D3Dvp.MaxDepth = 1; deviceCtx->RSSetViewports(1, &D3Dvp); } } - void OVRBufferD3D11::postRender(const ovrSession& _session) + bool VRImplOVRD3D11::submitSwapChain(const VRDesc& /* _desc */) { - if (NULL != m_msaaTexture) - { - ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; - int destIndex = 0; - ovr_GetTextureSwapChainCurrentIndex(_session, m_textureSwapChain, &destIndex); - ID3D11Resource* dstTex = NULL; - ovr_GetTextureSwapChainBufferDX(_session, m_textureSwapChain, destIndex, IID_PPV_ARGS(&dstTex)); - deviceCtx->ResolveSubresource(dstTex, 0, m_msaaTexture, 0, DXGI_FORMAT_R8G8B8A8_UNORM); - dstTex->Release(); - } - } + ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; + IDXGISwapChain* swapChain = s_renderD3D11->m_swapChain; - void OVRBufferD3D11::destroy(const ovrSession& _session) - { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_eyeRtv); ++ii) + // resolve MSAA render targets + for (int eye = 0; eye < 2; ++eye) { - DX_RELEASE(m_eyeRtv[ii], 0); - } + if (NULL != m_msaaTexture[eye]) + { + int destIndex = 0; + ovr_GetTextureSwapChainCurrentIndex(m_session, m_textureSwapChain[eye], &destIndex); - ovr_DestroyTextureSwapChain(_session, m_textureSwapChain); - m_depthBuffer->Release(); + ID3D11Resource* dstTex = NULL; + ovr_GetTextureSwapChainBufferDX(m_session, m_textureSwapChain[eye], destIndex, IID_PPV_ARGS(&dstTex)); + deviceCtx->ResolveSubresource(dstTex, 0, m_msaaTexture[eye], 0, DXGI_FORMAT_R8G8B8A8_UNORM); + dstTex->Release(); + } - if (NULL != m_msaaTexture) - { - m_msaaTexture->Release(); - m_msaaTexture = NULL; + ovrResult result = ovr_CommitTextureSwapChain(m_session, m_textureSwapChain[eye]); + if (!OVR_SUCCESS(result)) + { + return false; + } } - if (NULL != m_msaaSv) + ovrLayerHeader* layerList = &m_renderLayer.Header; + ovrResult result = ovr_SubmitFrame(m_session, 0, NULL, &layerList, 1); + if (!OVR_SUCCESS(result)) { - m_msaaSv->Release(); - m_msaaSv = NULL; + return false; } - if (NULL != m_msaaRtv) + if (result != ovrSuccess_NotVisible && NULL != m_mirrorTexture) { - m_msaaRtv->Release(); - m_msaaRtv = NULL; - } - } + ID3D11Texture2D* tex = NULL; + ovr_GetMirrorTextureBufferDX(m_session, m_mirrorTexture, IID_PPV_ARGS(&tex)); + ID3D11Texture2D* backBuffer; + DX_CHECK(swapChain->GetBuffer(0, IID_PPV_ARGS(&backBuffer))); - void OVRMirrorD3D11::create(const ovrSession& _session, int _width, int _height) - { - m_mirrorTextureDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; - m_mirrorTextureDesc.Width = _width; - m_mirrorTextureDesc.Height = _height; - ovrResult result = ovr_CreateMirrorTextureDX(_session, s_renderD3D11->m_device, &m_mirrorTextureDesc, &m_mirrorTexture); - BX_WARN(OVR_SUCCESS(result), "Could not create D3D11 OVR mirror texture"); - BX_UNUSED(result); - } + deviceCtx->CopyResource(backBuffer, tex); + DX_CHECK(swapChain->Present(0, 0)); - void OVRMirrorD3D11::destroy(const ovrSession& session) - { - if (NULL != m_mirrorTexture) - { - ovr_DestroyMirrorTexture(session, m_mirrorTexture); - m_mirrorTexture = NULL; - } + DX_RELEASE(tex, 1); + DX_RELEASE(backBuffer, 0); } - void OVRMirrorD3D11::blit(const ovrSession& _session) - { - if (NULL != m_mirrorTexture) - { - ID3D11Texture2D* tex = NULL; - ovr_GetMirrorTextureBufferDX(_session, m_mirrorTexture, IID_PPV_ARGS(&tex) ); - ID3D11Texture2D* backBuffer; - DX_CHECK(s_renderD3D11->m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer) ); - - s_renderD3D11->m_deviceCtx->CopyResource(backBuffer, tex); - DX_CHECK(s_renderD3D11->m_swapChain->Present(0, 0) ); + return true; + } - DX_RELEASE(tex, 1); - DX_RELEASE(backBuffer, 0); - } - } #endif // BGFX_CONFIG_USE_OVR struct UavFormat @@ -4152,7 +4208,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); else if (0 == (BGFX_UNIFORM_SAMPLERBIT & type) ) { const UniformInfo* info = s_renderD3D11->m_uniformReg.find(name); - BX_CHECK(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); + BX_WARN(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); if (NULL != info) { @@ -5181,7 +5237,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); _render->m_hmdInitialized = m_ovr.isInitialized(); const bool hmdEnabled = m_ovr.isEnabled(); - ViewState viewState(_render, hmdEnabled); + static ViewState viewState; + viewState.reset(_render, hmdEnabled); bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME); bool scissorEnabled = false; @@ -5306,8 +5363,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (m_ovr.isEnabled() ) { - m_ovr.getViewport(eye, &viewState.m_rect); - m_ovr.renderEyeStart(eye); + m_ovr.renderEyeStart(eye, &viewState.m_rect); } else { @@ -5821,24 +5877,26 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } if (programChanged - || currentState.m_vertexDecl.idx != draw.m_vertexDecl.idx - || currentState.m_vertexBuffer.idx != draw.m_vertexBuffer.idx + || currentState.m_streamMask != draw.m_streamMask + || currentState.m_stream[0].m_decl.idx != draw.m_stream[0].m_decl.idx + || currentState.m_stream[0].m_handle.idx != draw.m_stream[0].m_handle.idx || currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx || currentState.m_instanceDataOffset != draw.m_instanceDataOffset || currentState.m_instanceDataStride != draw.m_instanceDataStride) { - currentState.m_vertexDecl = draw.m_vertexDecl; - currentState.m_vertexBuffer = draw.m_vertexBuffer; + currentState.m_streamMask = draw.m_streamMask; + currentState.m_stream[0].m_decl = draw.m_stream[0].m_decl; + currentState.m_stream[0].m_handle = draw.m_stream[0].m_handle; currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; currentState.m_instanceDataOffset = draw.m_instanceDataOffset; currentState.m_instanceDataStride = draw.m_instanceDataStride; - uint16_t handle = draw.m_vertexBuffer.idx; + uint16_t handle = draw.m_stream[0].m_handle.idx; if (invalidHandle != handle) { const VertexBufferD3D11& vb = m_vertexBuffers[handle]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; + uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; const VertexDecl& vertexDecl = m_vertexDecls[decl]; uint32_t stride = vertexDecl.m_stride; uint32_t offset = 0; @@ -5882,13 +5940,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } - if (isValid(currentState.m_vertexBuffer) ) + if (0 != currentState.m_streamMask) { uint32_t numVertices = draw.m_numVertices; if (UINT32_MAX == numVertices) { - const VertexBufferD3D11& vb = m_vertexBuffers[currentState.m_vertexBuffer.idx]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; + const VertexBufferD3D11& vb = m_vertexBuffers[currentState.m_stream[0].m_handle.idx]; + uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; const VertexDecl& vertexDecl = m_vertexDecls[decl]; numVertices = vb.m_size/vertexDecl.m_stride; } @@ -5954,7 +6012,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); deviceCtx->DrawIndexedInstanced(numIndices , draw.m_numInstances , 0 - , draw.m_startVertex + , draw.m_stream[0].m_startVertex , 0 ); } @@ -5962,7 +6020,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { deviceCtx->DrawIndexed(numIndices , 0 - , draw.m_startVertex + , draw.m_stream[0].m_startVertex ); } } @@ -5978,7 +6036,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); deviceCtx->DrawIndexedInstanced(numIndices , draw.m_numInstances , draw.m_startIndex - , draw.m_startVertex + , draw.m_stream[0].m_startVertex , 0 ); } @@ -5986,7 +6044,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { deviceCtx->DrawIndexed(numIndices , draw.m_startIndex - , draw.m_startVertex + , draw.m_stream[0].m_startVertex ); } } @@ -6001,14 +6059,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { deviceCtx->DrawInstanced(numVertices , draw.m_numInstances - , draw.m_startVertex + , draw.m_stream[0].m_startVertex , 0 ); } else { deviceCtx->Draw(numVertices - , draw.m_startVertex + , draw.m_stream[0].m_startVertex ); } } diff --git a/3rdparty/bgfx/src/renderer_d3d11.h b/3rdparty/bgfx/src/renderer_d3d11.h index 5d8614a7301..796e99c39e8 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.h +++ b/3rdparty/bgfx/src/renderer_d3d11.h @@ -32,7 +32,7 @@ BX_PRAGMA_DIAGNOSTIC_POP() #include "renderer.h" #include "renderer_d3d.h" #include "shader_dxbc.h" -#include "hmd_ovr.h" +#include "hmd.h" #include "hmd_openvr.h" #include "debug_renderdoc.h" @@ -60,29 +60,6 @@ BX_PRAGMA_DIAGNOSTIC_POP() namespace bgfx { namespace d3d11 { -#if BGFX_CONFIG_USE_OVR - struct OVRBufferD3D11 : public OVRBufferI - { - virtual void create(const ovrSession& _session, int _eyeIdx, int _msaaSamples) BX_OVERRIDE; - virtual void destroy(const ovrSession& _session) BX_OVERRIDE; - virtual void render(const ovrSession& _session) BX_OVERRIDE; - virtual void postRender(const ovrSession& _session) BX_OVERRIDE; - - ID3D11RenderTargetView* m_eyeRtv[4]; - ID3D11DepthStencilView* m_depthBuffer; - ID3D11Texture2D* m_msaaTexture; - ID3D11ShaderResourceView* m_msaaSv; - ID3D11RenderTargetView* m_msaaRtv; - }; - - struct OVRMirrorD3D11 : public OVRMirrorI - { - virtual void create(const ovrSession& _session, int _width, int _height) BX_OVERRIDE; - virtual void destroy(const ovrSession& session) BX_OVERRIDE; - virtual void blit(const ovrSession& session) BX_OVERRIDE; - }; -#endif // BGFX_CONFIG_USE_OVR - struct BufferD3D11 { BufferD3D11() diff --git a/3rdparty/bgfx/src/renderer_d3d12.cpp b/3rdparty/bgfx/src/renderer_d3d12.cpp index f66e735e38f..d7a449ea82d 100644 --- a/3rdparty/bgfx/src/renderer_d3d12.cpp +++ b/3rdparty/bgfx/src/renderer_d3d12.cpp @@ -987,12 +987,6 @@ namespace bgfx { namespace d3d12 , (void**)&m_rootSignature ) ); - UniformHandle handle = BGFX_INVALID_HANDLE; - for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii) - { - m_uniformReg.add(handle, getPredefinedUniformName(PredefinedUniform::Enum(ii) ), &m_predefinedUniforms[ii]); - } - g_caps.supported |= ( 0 | BGFX_CAPS_TEXTURE_3D | BGFX_CAPS_TEXTURE_COMPARE_ALL @@ -1011,8 +1005,8 @@ namespace bgfx { namespace d3d12 | BGFX_CAPS_TEXTURE_2D_ARRAY | BGFX_CAPS_TEXTURE_CUBE_ARRAY ); - g_caps.maxTextureSize = 16384; - g_caps.maxFBAttachments = uint8_t(bx::uint32_min(16, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); + g_caps.limits.maxTextureSize = 16384; + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(16, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) { @@ -1407,7 +1401,7 @@ namespace bgfx { namespace d3d12 { } - void readTexture(TextureHandle _handle, void* _data) BX_OVERRIDE + void readTexture(TextureHandle _handle, void* _data, uint8_t _mip ) BX_OVERRIDE { const TextureD3D12& texture = m_textures[_handle.idx]; @@ -1418,7 +1412,7 @@ namespace bgfx { namespace d3d12 uint64_t total; uint64_t srcPitch; m_device->GetCopyableFootprints(&desc - , 0 + , _mip , 1 , 0 , &layout @@ -1444,16 +1438,18 @@ namespace bgfx { namespace d3d12 finish(); m_commandList = m_cmd.alloc(); + uint32_t srcWidth = bx::uint32_max(1, texture.m_width >>_mip); + uint32_t srcHeight = bx::uint32_max(1, texture.m_height>>_mip); uint8_t* src; readback->Map(0, NULL, (void**)&src); const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(texture.m_textureFormat) ); uint8_t* dst = (uint8_t*)_data; - uint32_t dstPitch = texture.m_width*bpp/8; + uint32_t dstPitch = srcWidth*bpp/8; uint32_t pitch = bx::uint32_min(uint32_t(srcPitch), dstPitch); - for (uint32_t yy = 0, height = texture.m_height; yy < height; ++yy) + for (uint32_t yy = 0, height = srcHeight; yy < height; ++yy) { memcpy(dst, src, pitch); @@ -1555,6 +1551,7 @@ namespace bgfx { namespace d3d12 { BX_FREE(g_allocator, m_uniforms[_handle.idx]); m_uniforms[_handle.idx] = NULL; + m_uniformReg.remove(_handle); } void saveScreenShot(const char* _filePath) BX_OVERRIDE @@ -3017,6 +3014,7 @@ data.NumQualityLevels = 0; D3D12_UNORDERED_ACCESS_VIEW_DESC tmpUavd; D3D12_UNORDERED_ACCESS_VIEW_DESC* uavd = &_texture.m_uavd; + if (0 != _mip) { memcpy(&tmpUavd, uavd, sizeof(tmpUavd) ); @@ -3029,6 +3027,10 @@ data.NumQualityLevels = 0; uavd->Texture2D.MipSlice = _mip; uavd->Texture2D.PlaneSlice = 0; break; + case D3D12_UAV_DIMENSION_TEXTURE2DARRAY: + uavd->Texture2DArray.MipSlice = _mip; + uavd->Texture2DArray.PlaneSlice = 0; + break; case D3D12_UAV_DIMENSION_TEXTURE3D: uavd->Texture3D.MipSlice = _mip; @@ -3436,10 +3438,10 @@ data.NumQualityLevels = 0; { Enum type = Enum(!!isValid(_draw.m_indexBuffer) ); - VertexBufferD3D12& vb = s_renderD3D12->m_vertexBuffers[_draw.m_vertexBuffer.idx]; + VertexBufferD3D12& vb = s_renderD3D12->m_vertexBuffers[_draw.m_stream[0].m_handle.idx]; vb.setState(_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); - uint16_t declIdx = !isValid(vb.m_decl) ? _draw.m_vertexDecl.idx : vb.m_decl.idx; + uint16_t declIdx = !isValid(vb.m_decl) ? _draw.m_stream[0].m_decl.idx : vb.m_decl.idx; const VertexDecl& vertexDecl = s_renderD3D12->m_vertexDecls[declIdx]; uint32_t numIndices = 0; @@ -3469,7 +3471,7 @@ data.NumQualityLevels = 0; } cmd.draw.InstanceCount = _draw.m_numInstances; cmd.draw.VertexCountPerInstance = numVertices; - cmd.draw.StartVertexLocation = _draw.m_startVertex; + cmd.draw.StartVertexLocation = _draw.m_stream[0].m_startVertex; cmd.draw.StartInstanceLocation = 0; } else @@ -3511,7 +3513,7 @@ data.NumQualityLevels = 0; cmd.drawIndexed.IndexCountPerInstance = numIndices; cmd.drawIndexed.InstanceCount = _draw.m_numInstances; cmd.drawIndexed.StartIndexLocation = _draw.m_startIndex; - cmd.drawIndexed.BaseVertexLocation = _draw.m_startVertex; + cmd.drawIndexed.BaseVertexLocation = _draw.m_stream[0].m_startVertex; cmd.drawIndexed.StartInstanceLocation = 0; } @@ -3879,7 +3881,7 @@ data.NumQualityLevels = 0; else if (0 == (BGFX_UNIFORM_SAMPLERBIT & type) ) { const UniformInfo* info = s_renderD3D12->m_uniformReg.find(name); - BX_CHECK(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); + BX_WARN(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); if (NULL != info) { @@ -4244,6 +4246,14 @@ data.NumQualityLevels = 0; m_uavd.Texture2D.MipSlice = 0; m_uavd.Texture2D.PlaneSlice = 0; } + + if( m_type==TextureCube ) + { + m_uavd.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2DARRAY; + m_uavd.Texture2DArray.MipSlice = 0; + m_uavd.Texture2DArray.ArraySize = 6; + } + break; case Texture3D: @@ -4766,7 +4776,7 @@ data.NumQualityLevels = 0; _render->m_hmdInitialized = false; const bool hmdEnabled = false; - ViewState viewState(_render, hmdEnabled); + static ViewState viewState; viewState.reset(_render, hmdEnabled); // bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME); @@ -5205,7 +5215,7 @@ data.NumQualityLevels = 0; rendererUpdateUniforms(this, _render->m_uniformBuffer, draw.m_constBegin, draw.m_constEnd); - if (isValid(draw.m_vertexBuffer) ) + if (isValid(draw.m_stream[0].m_handle) ) { const uint64_t state = draw.m_stateFlags; bool hasFactor = 0 @@ -5215,8 +5225,8 @@ data.NumQualityLevels = 0; || f3 == (state & f3) ; - const VertexBufferD3D12& vb = m_vertexBuffers[draw.m_vertexBuffer.idx]; - uint16_t declIdx = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; + const VertexBufferD3D12& vb = m_vertexBuffers[draw.m_stream[0].m_handle.idx]; + uint16_t declIdx = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; ID3D12PipelineState* pso = getPipelineState(state diff --git a/3rdparty/bgfx/src/renderer_d3d9.cpp b/3rdparty/bgfx/src/renderer_d3d9.cpp index be388785ada..1b26f9a9193 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.cpp +++ b/3rdparty/bgfx/src/renderer_d3d9.cpp @@ -578,11 +578,10 @@ namespace bgfx { namespace d3d9 | BGFX_CAPS_TEXTURE_READ_BACK | (m_occlusionQuerySupport ? BGFX_CAPS_OCCLUSION_QUERY : 0) ); - g_caps.maxTextureSize = uint16_t(bx::uint32_min(m_caps.MaxTextureWidth, m_caps.MaxTextureHeight) ); -// g_caps.maxVertexIndex = m_caps.MaxVertexIndex; + g_caps.limits.maxTextureSize = uint16_t(bx::uint32_min(m_caps.MaxTextureWidth, m_caps.MaxTextureHeight) ); m_caps.NumSimultaneousRTs = uint8_t(bx::uint32_min(m_caps.NumSimultaneousRTs, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); - g_caps.maxFBAttachments = uint8_t(m_caps.NumSimultaneousRTs); + g_caps.limits.maxFBAttachments = uint8_t(m_caps.NumSimultaneousRTs); m_caps.MaxAnisotropy = bx::uint32_max(m_caps.MaxAnisotropy, 1); @@ -988,27 +987,29 @@ namespace bgfx { namespace d3d9 m_updateTexture = NULL; } - void readTexture(TextureHandle _handle, void* _data) BX_OVERRIDE + void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) BX_OVERRIDE { TextureD3D9& texture = m_textures[_handle.idx]; D3DLOCKED_RECT lockedRect; - DX_CHECK(texture.m_texture2d->LockRect(0 + DX_CHECK(texture.m_texture2d->LockRect(_mip , &lockedRect , NULL , D3DLOCK_NO_DIRTY_UPDATE|D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY ) ); - uint32_t srcPitch = lockedRect.Pitch; - uint8_t* src = (uint8_t*)lockedRect.pBits; + uint32_t srcWidth = bx::uint32_max(1, texture.m_width >>_mip); + uint32_t srcHeight = bx::uint32_max(1, texture.m_height>>_mip); + uint32_t srcPitch = lockedRect.Pitch; + uint8_t* src = (uint8_t*)lockedRect.pBits; const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(texture.m_textureFormat) ); uint8_t* dst = (uint8_t*)_data; - uint32_t dstPitch = texture.m_width*bpp/8; + uint32_t dstPitch = srcWidth*bpp/8; uint32_t pitch = bx::uint32_min(srcPitch, dstPitch); - for (uint32_t yy = 0, height = texture.m_height; yy < height; ++yy) + for (uint32_t yy = 0, height = srcHeight; yy < height; ++yy) { memcpy(dst, src, pitch); @@ -1016,7 +1017,7 @@ namespace bgfx { namespace d3d9 dst += dstPitch; } - DX_CHECK(texture.m_texture2d->UnlockRect(0) ); + DX_CHECK(texture.m_texture2d->UnlockRect(_mip) ); } void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) BX_OVERRIDE @@ -1113,6 +1114,7 @@ namespace bgfx { namespace d3d9 { BX_FREE(g_allocator, m_uniforms[_handle.idx]); m_uniforms[_handle.idx] = NULL; + m_uniformReg.remove(_handle); } void saveScreenShot(const char* _filePath) BX_OVERRIDE @@ -1357,7 +1359,7 @@ namespace bgfx { namespace d3d9 if (!isValid(_fbh) ) { DX_CHECK(m_device->SetRenderTarget(0, m_backBufferColor) ); - for (uint32_t ii = 1, num = g_caps.maxFBAttachments; ii < num; ++ii) + for (uint32_t ii = 1, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) { DX_CHECK(m_device->SetRenderTarget(ii, NULL) ); } @@ -1390,7 +1392,7 @@ namespace bgfx { namespace d3d9 } } - for (uint32_t ii = rtIdx, num = g_caps.maxFBAttachments; ii < num; ++ii) + for (uint32_t ii = rtIdx, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) { DX_CHECK(m_device->SetRenderTarget(ii, NULL) ); } @@ -1507,7 +1509,7 @@ namespace bgfx { namespace d3d9 } DX_CHECK(m_device->SetRenderTarget(0, m_backBufferColor) ); - for (uint32_t ii = 1, num = g_caps.maxFBAttachments; ii < num; ++ii) + for (uint32_t ii = 1, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) { DX_CHECK(m_device->SetRenderTarget(ii, NULL) ); } @@ -2426,7 +2428,7 @@ namespace bgfx { namespace d3d9 else if (0 == (BGFX_UNIFORM_SAMPLERBIT & type) ) { const UniformInfo* info = s_renderD3D9->m_uniformReg.find(name); - BX_CHECK(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); + BX_WARN(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); if (NULL != info) { @@ -4020,22 +4022,24 @@ namespace bgfx { namespace d3d9 } if (programChanged - || currentState.m_vertexBuffer.idx != draw.m_vertexBuffer.idx + || currentState.m_streamMask != draw.m_streamMask + || currentState.m_stream[0].m_handle.idx != draw.m_stream[0].m_handle.idx || currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx - || currentState.m_instanceDataOffset != draw.m_instanceDataOffset - || currentState.m_instanceDataStride != draw.m_instanceDataStride) + || currentState.m_instanceDataOffset != draw.m_instanceDataOffset + || currentState.m_instanceDataStride != draw.m_instanceDataStride) { - currentState.m_vertexBuffer = draw.m_vertexBuffer; + currentState.m_streamMask = draw.m_streamMask; + currentState.m_stream[0].m_handle = draw.m_stream[0].m_handle; currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; - currentState.m_instanceDataOffset = draw.m_instanceDataOffset; - currentState.m_instanceDataStride = draw.m_instanceDataStride; + currentState.m_instanceDataOffset = draw.m_instanceDataOffset; + currentState.m_instanceDataStride = draw.m_instanceDataStride; - uint16_t handle = draw.m_vertexBuffer.idx; + uint16_t handle = draw.m_stream[0].m_handle.idx; if (invalidHandle != handle) { const VertexBufferD3D9& vb = m_vertexBuffers[handle]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; + uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; const VertexDeclD3D9& vertexDecl = m_vertexDecls[decl]; DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, vertexDecl.m_decl.m_stride) ); @@ -4081,13 +4085,13 @@ namespace bgfx { namespace d3d9 } } - if (isValid(currentState.m_vertexBuffer) ) + if (0 != currentState.m_streamMask) { uint32_t numVertices = draw.m_numVertices; if (UINT32_MAX == numVertices) { - const VertexBufferD3D9& vb = m_vertexBuffers[currentState.m_vertexBuffer.idx]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; + const VertexBufferD3D9& vb = m_vertexBuffers[currentState.m_stream[0].m_handle.idx]; + uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; const VertexDeclD3D9& vertexDecl = m_vertexDecls[decl]; numVertices = vb.m_size/vertexDecl.m_decl.m_stride; } @@ -4114,7 +4118,7 @@ namespace bgfx { namespace d3d9 numPrimsRendered = numPrimsSubmitted*draw.m_numInstances; DX_CHECK(device->DrawIndexedPrimitive(prim.m_type - , draw.m_startVertex + , draw.m_stream[0].m_startVertex , 0 , numVertices , 0 @@ -4129,7 +4133,7 @@ namespace bgfx { namespace d3d9 numPrimsRendered = numPrimsSubmitted*draw.m_numInstances; DX_CHECK(device->DrawIndexedPrimitive(prim.m_type - , draw.m_startVertex + , draw.m_stream[0].m_startVertex , 0 , numVertices , draw.m_startIndex @@ -4144,7 +4148,7 @@ namespace bgfx { namespace d3d9 numPrimsRendered = numPrimsSubmitted*draw.m_numInstances; DX_CHECK(device->DrawPrimitive(prim.m_type - , draw.m_startVertex + , draw.m_stream[0].m_startVertex , numPrimsSubmitted ) ); } diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp index 75e3a4ef3a7..73122fe74ff 100644 --- a/3rdparty/bgfx/src/renderer_gl.cpp +++ b/3rdparty/bgfx/src/renderer_gl.cpp @@ -9,6 +9,7 @@ # include "renderer_gl.h" # include <bx/timer.h> # include <bx/uint32_t.h> +# include "hmd_ovr.h" #if BGFX_CONFIG_PROFILER_REMOTERY # define BGFX_GPU_PROFILER_BIND() rmt_BindOpenGL() @@ -1014,6 +1015,10 @@ namespace bgfx { namespace gl } } + static void GL_APIENTRY stubPolygonMode(GLenum /*_face*/, GLenum /*_mode*/) + { + } + typedef void (*PostSwapBuffersFn)(uint32_t _width, uint32_t _height); static const char* getGLString(GLenum _name) @@ -1131,7 +1136,7 @@ namespace bgfx { namespace gl void flushGlError() { - for (GLenum err = glGetError(); err != 0; err = glGetError()); + for (GLenum err = glGetError(); err != 0; err = glGetError() ); } GLenum initTestTexture(TextureFormat::Enum _format, bool _srgb, bool _mipmaps) @@ -1352,6 +1357,47 @@ namespace bgfx { namespace gl BX_UNUSED(supported); } +#if BGFX_CONFIG_USE_OVR + class VRImplOVRGL : public VRImplOVR + { + public: + VRImplOVRGL(); + + virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) BX_OVERRIDE; + virtual void destroySwapChain() BX_OVERRIDE; + virtual void destroyMirror() BX_OVERRIDE; + virtual void renderEyeStart(const VRDesc& _desc, uint8_t _eye) BX_OVERRIDE; + virtual bool submitSwapChain(const VRDesc& _desc) BX_OVERRIDE; + + private: + GLuint m_eyeFbo[2]; + GLuint m_eyeTexId[2][4]; + GLuint m_depthBuffer[2]; + GLuint m_msaaEyeFbo[2]; + GLuint m_msaaEyeTexId[2]; + GLuint m_msaaDepthBuffer[2]; + GLuint m_mirrorFbo; + GLint m_mirrorWidth; + GLint m_mirrorHeight; + + ovrTextureSwapChain m_textureSwapChain[2]; + ovrMirrorTexture m_mirrorTexture; + }; +#endif // BGFX_CONFIG_USE_OVR + + struct VendorId + { + const char* name; + uint16_t id; + }; + + static const VendorId s_vendorIds[] = + { + { "NVIDIA Corporation", BGFX_PCI_ID_NVIDIA }, + { "Advanced Micro Devices, Inc.", BGFX_PCI_ID_AMD }, + { "Intel", BGFX_PCI_ID_INTEL }, + }; + struct RendererContextGL : public RendererContextI { RendererContextGL() @@ -1401,13 +1447,27 @@ namespace bgfx { namespace gl setRenderContextSize(BGFX_DEFAULT_WIDTH, BGFX_DEFAULT_HEIGHT); // Must be after context is initialized?! - m_ovr.init(); + VRImplI* vrImpl = NULL; +#if BGFX_CONFIG_USE_OVR + vrImpl = &m_ovrRender; +#endif + m_ovr.init(vrImpl); m_vendor = getGLString(GL_VENDOR); m_renderer = getGLString(GL_RENDERER); m_version = getGLString(GL_VERSION); m_glslVersion = getGLString(GL_SHADING_LANGUAGE_VERSION); + for (uint32_t ii = 0; ii < BX_COUNTOF(s_vendorIds); ++ii) + { + const VendorId& vendorId = s_vendorIds[ii]; + if (0 == strncmp(vendorId.name, m_vendor, strlen(vendorId.name) ) ) + { + g_caps.vendorId = vendorId.id; + break; + } + } + GLint numCmpFormats = 0; GL_CHECK(glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCmpFormats) ); BX_TRACE("GL_NUM_COMPRESSED_TEXTURE_FORMATS %d", numCmpFormats); @@ -1872,6 +1932,11 @@ namespace bgfx { namespace gl : 0 ; + if (NULL == glPolygonMode) + { + glPolygonMode = stubPolygonMode; + } + if (s_extension[Extension::ARB_copy_image].m_supported || s_extension[Extension::EXT_copy_image].m_supported || s_extension[Extension:: NV_copy_image].m_supported @@ -1904,14 +1969,14 @@ namespace bgfx { namespace gl : 0 ; - g_caps.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) ); + g_caps.limits.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) ); if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) || s_extension[Extension::EXT_draw_buffers ].m_supported || s_extension[Extension::WEBGL_draw_buffers].m_supported) { - g_caps.maxFBAttachments = uint8_t(bx::uint32_min(glGet(GL_MAX_DRAW_BUFFERS) + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(glGet(GL_MAX_DRAW_BUFFERS) , BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); } @@ -2205,15 +2270,8 @@ namespace bgfx { namespace gl m_glctx.swap(m_frameBuffers[m_windows[ii].idx].m_swapChain); } - switch (m_ovr.swap(_hmd, true) ) - { - case OVR::DeviceLost: - ovrPreReset(); - break; - - default: - break; - } + m_ovr.flip(); + m_ovr.swap(_hmd); // TODO - move this out of end-of-frame // need to swap GL render context even if OVR is enabled to get the mirror texture in the output m_glctx.swap(); @@ -2321,7 +2379,7 @@ namespace bgfx { namespace gl { } - void readTexture(TextureHandle _handle, void* _data) BX_OVERRIDE + void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) BX_OVERRIDE { if (m_readBackSupported) { @@ -2333,14 +2391,14 @@ namespace bgfx { namespace gl if (compressed) { GL_CHECK(glGetCompressedTexImage(texture.m_target - , 0 + , _mip , _data ) ); } else { GL_CHECK(glGetTexImage(texture.m_target - , 0 + , _mip , texture.m_fmt , texture.m_type , _data @@ -2439,6 +2497,7 @@ namespace bgfx { namespace gl { BX_FREE(g_allocator, m_uniforms[_handle.idx]); m_uniforms[_handle.idx] = NULL; + m_uniformReg.remove(_handle); } void saveScreenShot(const char* _filePath) BX_OVERRIDE @@ -2956,24 +3015,8 @@ namespace bgfx { namespace gl #if BGFX_CONFIG_USE_OVR if (m_resolution.m_flags & (BGFX_RESET_HMD|BGFX_RESET_HMD_DEBUG) ) { - if (m_ovr.postReset() ) - { - const uint32_t msaaSamples = 1 << ((m_resolution.m_flags&BGFX_RESET_MSAA_MASK) >> BGFX_RESET_MSAA_SHIFT); - - for (uint32_t ii = 0; ii < 2; ++ii) - { - // eye buffers need to be initialized only once during application lifetime - if (NULL == m_ovr.m_eyeBuffers[ii]) - { - m_ovr.m_eyeBuffers[ii] = &m_ovrBuffers[ii]; - m_ovr.m_eyeBuffers[ii]->create(m_ovr.m_hmd, ii, msaaSamples); - } - } - - // recreate mirror texture - m_ovr.m_mirror = &m_ovrMirror; - m_ovr.m_mirror->create(m_ovr.m_hmd, m_resolution.m_width, m_resolution.m_height); - } + const uint32_t msaaSamples = 1 << ( (m_resolution.m_flags&BGFX_RESET_MSAA_MASK) >> BGFX_RESET_MSAA_SHIFT); + m_ovr.postReset(msaaSamples, m_resolution.m_width, m_resolution.m_height); } #endif // BGFX_CONFIG_USE_OVR } @@ -3404,10 +3447,9 @@ namespace bgfx { namespace gl const char* m_version; const char* m_glslVersion; - OVR m_ovr; + VR m_ovr; #if BGFX_CONFIG_USE_OVR - OVRMirrorGL m_ovrMirror; - OVRBufferGL m_ovrBuffers[2]; + VRImplOVRGL m_ovrRender; #endif // BGFX_CONFIG_USE_OVR }; @@ -3428,215 +3470,247 @@ namespace bgfx { namespace gl } #if BGFX_CONFIG_USE_OVR - void OVRBufferGL::create(const ovrSession& _session, int _eyeIdx, int _msaaSamples) + + VRImplOVRGL::VRImplOVRGL() + : m_mirrorTexture(NULL) + { + memset(&m_textureSwapChain, 0, sizeof(m_textureSwapChain) ); + } + + static void setDefaultSamplerState() { - m_eyeFbo = 0; - m_eyeTexId = 0; - m_depthBuffer = 0; - m_msaaEyeFbo = 0; - m_msaaEyeTexId = 0; - m_msaaDepthBuffer = 0; + GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) ); + GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) ); + GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) ); + GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) ); + } - ovrHmdDesc hmdDesc = ovr_GetHmdDesc(_session); - m_eyeTextureSize = ovr_GetFovTextureSize(_session, ovrEyeType(_eyeIdx), hmdDesc.DefaultEyeFov[_eyeIdx], 1.0f); + bool VRImplOVRGL::createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) + { + for (int eye = 0; eye < 2; ++eye) + { + if (NULL == m_textureSwapChain[eye]) + { + m_eyeFbo[eye] = 0; + m_depthBuffer[eye] = 0; + m_msaaEyeFbo[eye] = 0; + m_msaaEyeTexId[eye] = 0; + m_msaaDepthBuffer[eye] = 0; + memset(&m_eyeTexId[eye], 0, sizeof(m_eyeTexId[eye]) ); + + ovrTextureSwapChainDesc swapchainDesc = {}; + swapchainDesc.Type = ovrTexture_2D; + swapchainDesc.ArraySize = 1; + swapchainDesc.Width = _desc.m_eyeSize[eye].m_w; + swapchainDesc.Height = _desc.m_eyeSize[eye].m_h; + swapchainDesc.MipLevels = 1; + swapchainDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; + swapchainDesc.SampleCount = 1; + swapchainDesc.StaticImage = ovrFalse; + + ovrResult result = ovr_CreateTextureSwapChainGL(m_session, &swapchainDesc, &m_textureSwapChain[eye]); + if (!OVR_SUCCESS(result) ) + { + destroySwapChain(); + return false; + } - ovrTextureSwapChainDesc desc = {}; - desc.Type = ovrTexture_2D; - desc.ArraySize = 1; - desc.Width = m_eyeTextureSize.w; - desc.Height = m_eyeTextureSize.h; - desc.MipLevels = 1; - desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; - desc.SampleCount = 1; - desc.StaticImage = ovrFalse; + int textureCount = 0; + ovr_GetTextureSwapChainLength(m_session, m_textureSwapChain[eye], &textureCount); + for (int ii = 0; ii < textureCount; ++ii) + { + ovr_GetTextureSwapChainBufferGL(m_session, m_textureSwapChain[eye], ii, &m_eyeTexId[eye][ii]); + GL_CHECK(glBindTexture(GL_TEXTURE_2D, m_eyeTexId[eye][ii]) ); + setDefaultSamplerState(); + } - ovr_CreateTextureSwapChainGL(_session, &desc, &m_textureSwapChain); + GL_CHECK(glGenFramebuffers(1, &m_eyeFbo[eye]) ); - int textureCount = 0; - ovr_GetTextureSwapChainLength(_session, m_textureSwapChain, &textureCount); + // create depth buffer + GL_CHECK(glGenTextures(1, &m_depthBuffer[eye]) ); + GL_CHECK(glBindTexture(GL_TEXTURE_2D, m_depthBuffer[eye]) ); + setDefaultSamplerState(); - for (int j = 0; j < textureCount; ++j) - { - GLuint chainTexId; - ovr_GetTextureSwapChainBufferGL(_session, m_textureSwapChain, j, &chainTexId); - GL_CHECK(glBindTexture(GL_TEXTURE_2D, chainTexId) ); + GL_CHECK(glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, _desc.m_eyeSize[eye].m_w, _desc.m_eyeSize[eye].m_h, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) ); - } + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_eyeFbo[eye]) ); + GL_CHECK(glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthBuffer[eye], 0) ); + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, 0) ); - GL_CHECK(glGenFramebuffers(1, &m_eyeFbo) ); + // create MSAA targets if needed + if (_msaaSamples > 1) + { + GL_CHECK(glGenFramebuffers(1, &m_msaaEyeFbo[eye]) ); + + // create color MSAA texture + GL_CHECK(glGenTextures(1, &m_msaaEyeTexId[eye]) ); + GL_CHECK(glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_msaaEyeTexId[eye]) ); + GL_CHECK(glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, _msaaSamples, GL_RGBA, _desc.m_eyeSize[eye].m_w, _desc.m_eyeSize[eye].m_h, false) ); + setDefaultSamplerState(); + + // create MSAA depth buffer + GL_CHECK(glGenTextures(1, &m_msaaDepthBuffer[eye]) ); + GL_CHECK(glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_depthBuffer[eye]) ); + GL_CHECK(glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, _msaaSamples, GL_DEPTH_COMPONENT, _desc.m_eyeSize[eye].m_w, _desc.m_eyeSize[eye].m_h, false) ); + setDefaultSamplerState(); + + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_msaaEyeFbo[eye]) ); + GL_CHECK(glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, m_msaaEyeTexId[eye], 0) ); + GL_CHECK(glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0) ); + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, 0) ); + } - // create depth buffer - GL_CHECK(glGenTextures(1, &m_depthBuffer) ); - GL_CHECK(glBindTexture(GL_TEXTURE_2D, m_depthBuffer) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) ); + m_renderLayer.ColorTexture[eye] = m_textureSwapChain[eye]; + } + } - GL_CHECK(glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, m_eyeTextureSize.w, m_eyeTextureSize.h, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL) ); + m_renderLayer.Header.Flags |= ovrLayerFlag_TextureOriginAtBottomLeft; - // create MSAA buffers - if (_msaaSamples > 1) + if (NULL == m_mirrorTexture) { - GL_CHECK(glGenFramebuffers(1, &m_msaaEyeFbo) ); + m_mirrorFbo = 0; - // create color MSAA texture - GL_CHECK(glGenTextures(1, &m_msaaEyeTexId) ); - GL_CHECK(glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_msaaEyeTexId) ); + ovrMirrorTextureDesc mirrorDesc = {}; + mirrorDesc.Width = _mirrorWidth; + mirrorDesc.Height = _mirrorHeight; + mirrorDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; - GL_CHECK(glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, _msaaSamples, GL_RGBA, m_eyeTextureSize.w, m_eyeTextureSize.h, false) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LEVEL, 0) ); + // Fallback to doing nothing if mirror was not created. This is to prevent errors with fast window resizes + ovr_CreateMirrorTextureGL(m_session, &mirrorDesc, &m_mirrorTexture); + if (m_mirrorTexture) + { + m_mirrorWidth = _mirrorWidth; + m_mirrorHeight = _mirrorHeight; - // create MSAA depth buffer - GL_CHECK(glGenTextures(1, &m_msaaDepthBuffer) ); - GL_CHECK(glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_msaaDepthBuffer) ); + // Configure the mirror read buffer + GLuint texId; + ovr_GetMirrorTextureBufferGL(m_session, m_mirrorTexture, &texId); + GL_CHECK(glGenFramebuffers(1, &m_mirrorFbo) ); + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_mirrorFbo) ); + GL_CHECK(glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texId, 0) ); + GL_CHECK(glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0) ); + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, 0) ); - GL_CHECK(glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, _msaaSamples, GL_DEPTH_COMPONENT, m_eyeTextureSize.w, m_eyeTextureSize.h, false) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_MAX_LEVEL, 0) ); + if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) + { + GL_CHECK(glDeleteFramebuffers(1, &m_mirrorFbo) ); + ovr_DestroyMirrorTexture(m_session, m_mirrorTexture); + m_mirrorTexture = NULL; + BX_CHECK(false, "Could not initialize VR mirror buffers!"); + } + } } - } - - void OVRBufferGL::render(const ovrSession& _session) - { - // set the current eye texture in swap chain - int curIndex; - ovr_GetTextureSwapChainCurrentIndex(_session, m_textureSwapChain, &curIndex); - ovr_GetTextureSwapChainBufferGL(_session, m_textureSwapChain, curIndex, &m_eyeTexId); - if (0 != m_msaaEyeFbo) - { - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_msaaEyeFbo) ); - GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, m_msaaEyeTexId, 0) ); - GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D_MULTISAMPLE, m_msaaDepthBuffer, 0) ); - } - else // MSAA disabled? render directly to eye buffer - { - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_eyeFbo) ); - GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_eyeTexId, 0) ); - GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthBuffer, 0) ); - } - GL_CHECK(glViewport(0, 0, m_eyeTextureSize.w, m_eyeTextureSize.h) ); - GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ); + return true; } - void OVRBufferGL::postRender(const ovrSession& /*_sesion*/) + void VRImplOVRGL::destroySwapChain() { - if (0 != m_msaaEyeFbo && 0 != m_eyeTexId) + for (int eye = 0; eye < 2; ++eye) { - // blit the contents of MSAA FBO to the regular eye buffer "connected" to the HMD - GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_msaaEyeFbo)); - GL_CHECK(glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, m_msaaEyeTexId, 0) ); - GL_CHECK(glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0) ); - - BX_CHECK(GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) - , "glCheckFramebufferStatus failed 0x%08x" - , glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) ); - - GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_eyeFbo)); - GL_CHECK(glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_eyeTexId, 0) ); - GL_CHECK(glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0) ); - - BX_CHECK(GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) - , "glCheckFramebufferStatus failed 0x%08x" - , glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) ); + if (NULL != m_textureSwapChain[eye]) + { + GL_CHECK(glDeleteFramebuffers(1, &m_eyeFbo[eye]) ); + GL_CHECK(glDeleteTextures(1, &m_depthBuffer[eye]) ); - GL_CHECK(glBlitFramebuffer(0, 0, m_eyeTextureSize.w, m_eyeTextureSize.h, - 0, 0, m_eyeTextureSize.w, m_eyeTextureSize.h, GL_COLOR_BUFFER_BIT, GL_NEAREST) ); + ovr_DestroyTextureSwapChain(m_session, m_textureSwapChain[eye]); + m_textureSwapChain[eye] = NULL; - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, 0) ); + if (0 != m_msaaEyeFbo[eye]) + { + GL_CHECK(glDeleteFramebuffers(1, &m_msaaEyeFbo[eye]) ); + GL_CHECK(glDeleteTextures(1, &m_msaaEyeTexId[eye]) ); + GL_CHECK(glDeleteTextures(1, &m_msaaDepthBuffer[eye]) ); + m_msaaEyeFbo[eye] = 0; + } + } } + + destroyMirror(); } - void OVRBufferGL::destroy(const ovrSession& _session) + void VRImplOVRGL::destroyMirror() { - GL_CHECK(glDeleteFramebuffers(1, &m_eyeFbo) ); - GL_CHECK(glDeleteTextures(1, &m_depthBuffer) ); - - ovr_DestroyTextureSwapChain(_session, m_textureSwapChain); - - if (0 != m_msaaEyeFbo) + if (NULL != m_mirrorTexture) { - GL_CHECK(glDeleteFramebuffers(1, &m_msaaEyeFbo) ); - m_msaaEyeFbo = 0; + GL_CHECK(glDeleteFramebuffers(1, &m_mirrorFbo) ); + ovr_DestroyMirrorTexture(m_session, m_mirrorTexture); + m_mirrorTexture = NULL; } + } - if (0 != m_msaaEyeTexId) + void VRImplOVRGL::renderEyeStart(const VRDesc& _desc, uint8_t _eye) + { + // set the current eye texture in the swap chain + if (0 != m_msaaEyeFbo[_eye]) { - GL_CHECK(glDeleteTextures(1, &m_msaaEyeTexId)); - m_msaaEyeTexId = 0; + GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_msaaEyeFbo[_eye]) ); } - - if (0 != m_msaaDepthBuffer) + else { - GL_CHECK(glDeleteTextures(1, &m_msaaDepthBuffer)); - m_msaaDepthBuffer = 0; + int texIndex; + ovr_GetTextureSwapChainCurrentIndex(m_session, m_textureSwapChain[_eye], &texIndex); + + GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_eyeFbo[_eye]) ); + GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_eyeTexId[_eye][texIndex], 0) ); } + + GL_CHECK(glViewport(0, 0, _desc.m_eyeSize[_eye].m_w, _desc.m_eyeSize[_eye].m_h) ); + GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ); } - void OVRMirrorGL::create(const ovrSession& _session, int _width, int _height) + bool VRImplOVRGL::submitSwapChain(const VRDesc& _desc) { - memset(&m_mirrorTextureDesc, 0, sizeof(m_mirrorTextureDesc) ); - m_mirrorTextureDesc.Width = _width; - m_mirrorTextureDesc.Height = _height; - m_mirrorTextureDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; + for (int eye = 0; eye < 2; ++eye) + { + if (0 != m_msaaEyeFbo[eye]) + { + // blit the contents of MSAA FBO to the regulare eye buffer "connected" to the HMD + int destIndex; + ovr_GetTextureSwapChainCurrentIndex(m_session, m_textureSwapChain[eye], &destIndex); - ovr_CreateMirrorTextureGL(_session, &m_mirrorTextureDesc, &m_mirrorTexture); + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_msaaEyeFbo[eye]) ); + BX_CHECK(GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) + , "glCheckFramebufferStatus failed 0x%08x" + , glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) + ); - // Fallback to doing nothing if mirror was not created. This is to prevent errors with fast window resizes - if (!m_mirrorTexture) - return; + GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_eyeFbo[eye]) ); + GL_CHECK(glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_eyeTexId[eye][destIndex], 0) ); + BX_CHECK(GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) + , "glCheckFramebufferStatus failed 0x%08x" + , glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) + ); - // Configure the mirror read buffer - GLuint texId; - ovr_GetMirrorTextureBufferGL(_session, m_mirrorTexture, &texId); - GL_CHECK(glGenFramebuffers(1, &m_mirrorFBO) ); - GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_mirrorFBO) ); - GL_CHECK(glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texId, 0) ); - GL_CHECK(glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0) ); - GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, 0) ); + GL_CHECK(glBlitFramebuffer(0, 0, _desc.m_eyeSize[eye].m_w, _desc.m_eyeSize[eye].m_h, 0, 0, _desc.m_eyeSize[eye].m_w, _desc.m_eyeSize[eye].m_h, GL_COLOR_BUFFER_BIT, GL_NEAREST) ); + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, 0) ); + } - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) - { - GL_CHECK(glDeleteFramebuffers(1, &m_mirrorFBO) ); - BX_CHECK(false, "Could not initialize VR buffers!"); + ovrResult result = ovr_CommitTextureSwapChain(m_session, m_textureSwapChain[eye]); + if (!OVR_SUCCESS(result) ) + { + return false; + } } - } - void OVRMirrorGL::destroy(const ovrSession& _session) - { - if (NULL != m_mirrorTexture) + ovrLayerHeader* layerList = &m_renderLayer.Header; + ovrResult result = ovr_SubmitFrame(m_session, 0, &m_viewScale, &layerList, 1); + if (!OVR_SUCCESS(result) ) { - GL_CHECK(glDeleteFramebuffers(1, &m_mirrorFBO) ); - ovr_DestroyMirrorTexture(_session, m_mirrorTexture); - m_mirrorTexture = NULL; + return false; } - } - void OVRMirrorGL::blit(const ovrSession& /*_session*/) - { - if (NULL != m_mirrorTexture) + if (result != ovrSuccess_NotVisible && NULL != m_mirrorTexture) { - // Blit mirror texture to back buffer - GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_mirrorFBO) ); + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_mirrorFbo) ); GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0) ); - GLint width = m_mirrorTextureDesc.Width; - GLint height = m_mirrorTextureDesc.Height; - GL_CHECK(glBlitFramebuffer(0, height, width, 0, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_NEAREST) ); + GL_CHECK(glBlitFramebuffer(0, m_mirrorHeight, m_mirrorWidth, 0, 0, 0, m_mirrorWidth, m_mirrorHeight, GL_COLOR_BUFFER_BIT, GL_NEAREST) ); GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, 0) ); } + + return true; } + #endif // BGFX_CONFIG_USE_OVR const char* glslTypeName(GLuint _type) @@ -3689,6 +3763,7 @@ namespace bgfx { namespace gl GLSL_TYPE(GL_UNSIGNED_INT_IMAGE_1D); GLSL_TYPE(GL_IMAGE_2D); + GLSL_TYPE(GL_IMAGE_2D_ARRAY); GLSL_TYPE(GL_INT_IMAGE_2D); GLSL_TYPE(GL_UNSIGNED_INT_IMAGE_2D); @@ -3786,6 +3861,7 @@ namespace bgfx { namespace gl case GL_UNSIGNED_INT_IMAGE_1D: case GL_IMAGE_2D: + case GL_IMAGE_2D_ARRAY: case GL_INT_IMAGE_2D: case GL_UNSIGNED_INT_IMAGE_2D: @@ -4285,6 +4361,11 @@ namespace bgfx { namespace gl , const GLvoid* _data ) { + if (NULL == _data) + { + return; + } + if (_target == GL_TEXTURE_3D || _target == GL_TEXTURE_2D_ARRAY || _target == GL_TEXTURE_CUBE_MAP_ARRAY) @@ -4355,7 +4436,19 @@ namespace bgfx { namespace gl else if (_target == GL_TEXTURE_2D_ARRAY || _target == GL_TEXTURE_CUBE_MAP_ARRAY) { - texSubImage(_target, _level, 0, 0, _depth, _width, _height, 1, _format, _type, _data); + texSubImage( + _target + , _level + , 0 + , 0 + , _depth + , _width + , _height + , 1 + , _format + , _type + , _data + ); } else if (_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) { @@ -5456,7 +5549,7 @@ namespace bgfx { namespace gl if (!!bx::findIdentifierMatch(code, "gl_FragData") ) { - for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii) + for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) { char tmpFragData[16]; bx::snprintf(tmpFragData, BX_COUNTOF(tmpFragData), "gl_FragData[%d]", ii); @@ -5546,7 +5639,7 @@ namespace bgfx { namespace gl if (!!bx::findIdentifierMatch(code, "gl_FragData") ) { - for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii) + for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) { char tmpFragData[16]; bx::snprintf(tmpFragData, BX_COUNTOF(tmpFragData), "gl_FragData[%d]", ii); @@ -5568,7 +5661,7 @@ namespace bgfx { namespace gl } } - if (!!bx::findIdentifierMatch(code, s_ARB_texture_multisample)) + if (!!bx::findIdentifierMatch(code, s_ARB_texture_multisample) ) { writeString(&writer, "#extension GL_ARB_texture_multisample : enable\n"); } @@ -5898,7 +5991,8 @@ namespace bgfx { namespace gl uint32_t dsFlags = _flags & (BGFX_CLEAR_DISCARD_DEPTH|BGFX_CLEAR_DISCARD_STENCIL); if (BGFX_CLEAR_NONE != dsFlags) { - if ( (BGFX_CLEAR_DISCARD_DEPTH|BGFX_CLEAR_DISCARD_STENCIL) == dsFlags) + if (!BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) + && (BGFX_CLEAR_DISCARD_DEPTH|BGFX_CLEAR_DISCARD_STENCIL) == dsFlags) { buffers[idx++] = GL_DEPTH_STENCIL_ATTACHMENT; } @@ -6035,7 +6129,8 @@ namespace bgfx { namespace gl _render->m_hmdInitialized = m_ovr.isInitialized(); const bool hmdEnabled = m_ovr.isEnabled(); - ViewState viewState(_render, hmdEnabled); + static ViewState viewState; + viewState.reset(_render, hmdEnabled); uint16_t programIdx = invalidHandle; SortKey key; @@ -6055,11 +6150,17 @@ namespace bgfx { namespace gl uint8_t primIndex; { - const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : 0; + const uint64_t pt = 0; primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT); } PrimInfo prim = s_primInfo[primIndex]; + GL_CHECK(glPolygonMode(GL_FRONT_AND_BACK + , _render->m_debug&BGFX_DEBUG_WIREFRAME + ? GL_LINE + : GL_FILL + ) ); + uint32_t baseVertex = 0; GLuint currentVao = 0; bool wasCompute = false; @@ -6171,8 +6272,7 @@ namespace bgfx { namespace gl if (m_ovr.isEnabled() ) { - m_ovr.getViewport(eye, &viewState.m_rect); - m_ovr.renderEyeStart(eye); + m_ovr.renderEyeStart(eye, &viewState.m_rect); } else { @@ -6291,7 +6391,7 @@ namespace bgfx { namespace gl GL_CHECK(glBindImageTexture(ii , texture.m_id , bind.m_un.m_compute.m_mip - , GL_FALSE + , texture.isCubeMap()?GL_TRUE:GL_FALSE , 0 , s_access[bind.m_un.m_compute.m_access] , s_imageFormat[bind.m_un.m_compute.m_format]) @@ -6349,7 +6449,7 @@ namespace bgfx { namespace gl uintptr_t args = compute.m_startIndirect * BGFX_CONFIG_DRAW_INDIRECT_STRIDE; for (uint32_t ii = 0; ii < numDrawIndirect; ++ii) { - GL_CHECK(glDispatchComputeIndirect((GLintptr)args) ); + GL_CHECK(glDispatchComputeIndirect( (GLintptr)args) ); args += BGFX_CONFIG_DRAW_INDIRECT_STRIDE; } } @@ -6560,38 +6660,39 @@ namespace bgfx { namespace gl viewState.m_alphaRef = ref/255.0f; } -#if BGFX_CONFIG_RENDERER_OPENGL - if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags) + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) ) { - float pointSize = (float)(bx::uint32_max(1, (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) ); - GL_CHECK(glPointSize(pointSize) ); - } + if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags) + { + float pointSize = (float)(bx::uint32_max(1, (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) ); + GL_CHECK(glPointSize(pointSize) ); + } - if (BGFX_STATE_MSAA & changedFlags) - { - GL_CHECK(BGFX_STATE_MSAA & newFlags - ? glEnable(GL_MULTISAMPLE) - : glDisable(GL_MULTISAMPLE) - ); - } + if (BGFX_STATE_MSAA & changedFlags) + { + GL_CHECK(BGFX_STATE_MSAA & newFlags + ? glEnable(GL_MULTISAMPLE) + : glDisable(GL_MULTISAMPLE) + ); + } - if (BGFX_STATE_LINEAA & changedFlags) - { - GL_CHECK(BGFX_STATE_LINEAA & newFlags - ? glEnable(GL_LINE_SMOOTH) - : glDisable(GL_LINE_SMOOTH) - ); - } + if (BGFX_STATE_LINEAA & changedFlags) + { + GL_CHECK(BGFX_STATE_LINEAA & newFlags + ? glEnable(GL_LINE_SMOOTH) + : glDisable(GL_LINE_SMOOTH) + ); + } - if (m_conservativeRasterSupport - && BGFX_STATE_CONSERVATIVE_RASTER & changedFlags) - { - GL_CHECK(BGFX_STATE_CONSERVATIVE_RASTER & newFlags - ? glEnable(GL_CONSERVATIVE_RASTERIZATION_NV) - : glDisable(GL_CONSERVATIVE_RASTERIZATION_NV) - ); + if (m_conservativeRasterSupport + && BGFX_STATE_CONSERVATIVE_RASTER & changedFlags) + { + GL_CHECK(BGFX_STATE_CONSERVATIVE_RASTER & newFlags + ? glEnable(GL_CONSERVATIVE_RASTERIZATION_NV) + : glDisable(GL_CONSERVATIVE_RASTERIZATION_NV) + ); + } } -#endif // BGFX_CONFIG_RENDERER_OPENGL if ( (BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags) { @@ -6721,7 +6822,7 @@ namespace bgfx { namespace gl blendFactor = draw.m_rgba; } - const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : newFlags&BGFX_STATE_PT_MASK; + const uint64_t pt = newFlags&BGFX_STATE_PT_MASK; primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT); prim = s_primInfo[primIndex]; } @@ -6778,25 +6879,28 @@ namespace bgfx { namespace gl } if (0 != defaultVao - && 0 == draw.m_startVertex + && 0 == draw.m_stream[0].m_startVertex && 0 == draw.m_instanceDataOffset) { if (programChanged - || baseVertex != draw.m_startVertex - || currentState.m_vertexBuffer.idx != draw.m_vertexBuffer.idx - || currentState.m_indexBuffer.idx != draw.m_indexBuffer.idx - || currentState.m_instanceDataOffset != draw.m_instanceDataOffset - || currentState.m_instanceDataStride != draw.m_instanceDataStride + || baseVertex != draw.m_stream[0].m_startVertex + || currentState.m_streamMask != draw.m_streamMask + || currentState.m_stream[0].m_handle.idx != draw.m_stream[0].m_handle.idx + || currentState.m_indexBuffer.idx != draw.m_indexBuffer.idx + || currentState.m_instanceDataOffset != draw.m_instanceDataOffset + || currentState.m_instanceDataStride != draw.m_instanceDataStride || currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx) { bx::HashMurmur2A murmur; murmur.begin(); - murmur.add(draw.m_vertexBuffer.idx); - if (isValid(draw.m_vertexBuffer) ) + const Stream& stream = draw.m_stream[0]; + murmur.add(stream.m_handle.idx); + + if (isValid(stream.m_handle) ) { - const VertexBufferGL& vb = m_vertexBuffers[draw.m_vertexBuffer.idx]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; + const VertexBufferGL& vb = m_vertexBuffers[stream.m_handle.idx]; + uint16_t decl = !isValid(vb.m_decl) ? stream.m_decl.idx : vb.m_decl.idx; murmur.add(decl); } @@ -6807,11 +6911,13 @@ namespace bgfx { namespace gl murmur.add(programIdx); uint32_t hash = murmur.end(); - currentState.m_vertexBuffer = draw.m_vertexBuffer; + currentState.m_streamMask = draw.m_streamMask; + currentState.m_stream[0].m_handle = stream.m_handle; + baseVertex = stream.m_startVertex; + currentState.m_indexBuffer = draw.m_indexBuffer; currentState.m_instanceDataOffset = draw.m_instanceDataOffset; currentState.m_instanceDataStride = draw.m_instanceDataStride; - baseVertex = draw.m_startVertex; GLuint id = m_vaoStateCache.find(hash); if (UINT32_MAX != id) @@ -6827,14 +6933,14 @@ namespace bgfx { namespace gl program.add(hash); - if (isValid(draw.m_vertexBuffer) ) + if (isValid(stream.m_handle) ) { - VertexBufferGL& vb = m_vertexBuffers[draw.m_vertexBuffer.idx]; + VertexBufferGL& vb = m_vertexBuffers[stream.m_handle.idx]; vb.add(hash); GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) ); - uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; - program.bindAttributes(m_vertexDecls[decl], draw.m_startVertex); + uint16_t decl = !isValid(vb.m_decl) ? stream.m_decl.idx : vb.m_decl.idx; + program.bindAttributes(m_vertexDecls[decl], stream.m_startVertex); if (isValid(draw.m_instanceDataBuffer) ) { @@ -6868,24 +6974,27 @@ namespace bgfx { namespace gl && 0 != currentVao) { GL_CHECK(glBindVertexArray(defaultVao) ); - currentState.m_vertexBuffer.idx = invalidHandle; - currentState.m_indexBuffer.idx = invalidHandle; + currentState.m_streamMask = 0; + currentState.m_stream[0].m_handle.idx = invalidHandle; + currentState.m_indexBuffer.idx = invalidHandle; bindAttribs = true; currentVao = 0; } if (programChanged - || currentState.m_vertexBuffer.idx != draw.m_vertexBuffer.idx + || currentState.m_streamMask != draw.m_streamMask + || currentState.m_stream[0].m_handle.idx != draw.m_stream[0].m_handle.idx || currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx - || currentState.m_instanceDataOffset != draw.m_instanceDataOffset - || currentState.m_instanceDataStride != draw.m_instanceDataStride) + || currentState.m_instanceDataOffset != draw.m_instanceDataOffset + || currentState.m_instanceDataStride != draw.m_instanceDataStride) { - currentState.m_vertexBuffer = draw.m_vertexBuffer; + currentState.m_streamMask = draw.m_streamMask; + currentState.m_stream[0].m_handle = draw.m_stream[0].m_handle; currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; - currentState.m_instanceDataOffset = draw.m_instanceDataOffset; - currentState.m_instanceDataStride = draw.m_instanceDataStride; + currentState.m_instanceDataOffset = draw.m_instanceDataOffset; + currentState.m_instanceDataStride = draw.m_instanceDataStride; - uint16_t handle = draw.m_vertexBuffer.idx; + uint16_t handle = draw.m_stream[0].m_handle.idx; if (invalidHandle != handle) { VertexBufferGL& vb = m_vertexBuffers[handle]; @@ -6914,15 +7023,15 @@ namespace bgfx { namespace gl } } - if (isValid(currentState.m_vertexBuffer) ) + if (0 != currentState.m_streamMask) { - if (baseVertex != draw.m_startVertex + if (baseVertex != draw.m_stream[0].m_startVertex || bindAttribs) { - baseVertex = draw.m_startVertex; - const VertexBufferGL& vb = m_vertexBuffers[draw.m_vertexBuffer.idx]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; - program.bindAttributes(m_vertexDecls[decl], draw.m_startVertex); + baseVertex = draw.m_stream[0].m_startVertex; + const VertexBufferGL& vb = m_vertexBuffers[draw.m_stream[0].m_handle.idx]; + uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; + program.bindAttributes(m_vertexDecls[decl], draw.m_stream[0].m_startVertex); if (isValid(draw.m_instanceDataBuffer) ) { @@ -6933,13 +7042,13 @@ namespace bgfx { namespace gl } } - if (isValid(currentState.m_vertexBuffer) ) + if (0 != currentState.m_streamMask) { uint32_t numVertices = draw.m_numVertices; if (UINT32_MAX == numVertices) { - const VertexBufferGL& vb = m_vertexBuffers[currentState.m_vertexBuffer.idx]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; + const VertexBufferGL& vb = m_vertexBuffers[currentState.m_stream[0].m_handle.idx]; + uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; const VertexDecl& vertexDecl = m_vertexDecls[decl]; numVertices = vb.m_size/vertexDecl.m_stride; } diff --git a/3rdparty/bgfx/src/renderer_gl.h b/3rdparty/bgfx/src/renderer_gl.h index 9227d0e00cf..012f90d0fe5 100644 --- a/3rdparty/bgfx/src/renderer_gl.h +++ b/3rdparty/bgfx/src/renderer_gl.h @@ -107,7 +107,7 @@ typedef uint64_t GLuint64; #endif // BGFX_CONFIG_RENDERER_OPENGL #include "renderer.h" -#include "hmd_ovr.h" +#include "hmd.h" #include "hmd_openvr.h" #include "debug_renderdoc.h" @@ -720,6 +720,10 @@ typedef uint64_t GLuint64; # define GL_IMAGE_2D 0x904D #endif // GL_IMAGE_2D +#ifndef GL_IMAGE_2D_ARRAY +# define GL_IMAGE_2D_ARRAY 0x9053 +#endif // GL_IMAGE_2D_ARRAY + #ifndef GL_IMAGE_3D # define GL_IMAGE_3D 0x904E #endif // GL_IMAGE_3D @@ -915,6 +919,22 @@ typedef uint64_t GLuint64; # define GL_DEBUG_SEVERITY_NOTIFICATION 0x826b #endif // GL_DEBUG_SEVERITY_NOTIFICATION +#ifndef GL_LINE +# define GL_LINE 0x1B01 +#endif // GL_LINE + +#ifndef GL_FILL +# define GL_FILL 0x1B02 +#endif // GL_FILL + +#ifndef GL_MULTISAMPLE +# define GL_MULTISAMPLE 0x809D +#endif // GL_MULTISAMPLE + +#ifndef GL_LINE_SMOOTH +# define GL_LINE_SMOOTH 0x0B20 +#endif // GL_LINE_SMOOTH + #if BX_PLATFORM_NACL # include "glcontext_ppapi.h" #elif BX_PLATFORM_WINDOWS @@ -950,32 +970,6 @@ namespace bgfx namespace bgfx { namespace gl { -#if BGFX_CONFIG_USE_OVR - struct OVRBufferGL : public OVRBufferI - { - virtual void create(const ovrSession& _session, int _eyeIdx, int _msaaSamples) BX_OVERRIDE; - virtual void destroy(const ovrSession& _session) BX_OVERRIDE; - virtual void render(const ovrSession& _session) BX_OVERRIDE; - virtual void postRender(const ovrSession& _sesion) BX_OVERRIDE; - - GLuint m_eyeFbo; - GLuint m_eyeTexId; - GLuint m_depthBuffer; - GLuint m_msaaEyeFbo; - GLuint m_msaaEyeTexId; - GLuint m_msaaDepthBuffer; - }; - - struct OVRMirrorGL : public OVRMirrorI - { - virtual void create(const ovrSession& _session, int _width, int _height) BX_OVERRIDE; - virtual void destroy(const ovrSession& _session) BX_OVERRIDE; - virtual void blit(const ovrSession& _session) BX_OVERRIDE; - - GLuint m_mirrorFBO; - }; -#endif // BGFX_CONFIG_USE_OVR - void dumpExtensions(const char* _extensions); const char* glEnumName(GLenum _enum); diff --git a/3rdparty/bgfx/src/renderer_gnm.cpp b/3rdparty/bgfx/src/renderer_gnm.cpp new file mode 100644 index 00000000000..66e7fd30504 --- /dev/null +++ b/3rdparty/bgfx/src/renderer_gnm.cpp @@ -0,0 +1,44 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "bgfx_p.h" + +namespace bgfx +{ + +#define BGFX_DECLARE_EMBEDDED_SHADER(_name) \ + extern const uint8_t* BX_CONCATENATE(_name, _pssl); \ + extern const uint32_t BX_CONCATENATE(_name, _pssl_size); \ + static const uint8_t BX_CONCATENATE(_name, _int_pssl)[] = { 0 }; \ + const uint8_t* BX_CONCATENATE(_name, _pssl) = &BX_CONCATENATE(_name, _int_pssl)[0]; \ + const uint32_t BX_CONCATENATE(_name, _pssl_size) = 1 + +BGFX_DECLARE_EMBEDDED_SHADER(vs_debugfont); +BGFX_DECLARE_EMBEDDED_SHADER(fs_debugfont); +BGFX_DECLARE_EMBEDDED_SHADER(vs_clear); +BGFX_DECLARE_EMBEDDED_SHADER(fs_clear0); +BGFX_DECLARE_EMBEDDED_SHADER(fs_clear1); +BGFX_DECLARE_EMBEDDED_SHADER(fs_clear2); +BGFX_DECLARE_EMBEDDED_SHADER(fs_clear3); +BGFX_DECLARE_EMBEDDED_SHADER(fs_clear4); +BGFX_DECLARE_EMBEDDED_SHADER(fs_clear5); +BGFX_DECLARE_EMBEDDED_SHADER(fs_clear6); +BGFX_DECLARE_EMBEDDED_SHADER(fs_clear7); + +#undef BGFX_DECLARE_EMBEDDED_SHADER + +} // namespace bgfx + +namespace bgfx { namespace gnm +{ + RendererContextI* rendererCreate() + { + return NULL; + } + + void rendererDestroy() + { + } +} /* namespace gnm */ } // namespace bgfx diff --git a/3rdparty/bgfx/src/renderer_mtl.h b/3rdparty/bgfx/src/renderer_mtl.h index 00981372cd0..7936d1b4897 100644 --- a/3rdparty/bgfx/src/renderer_mtl.h +++ b/3rdparty/bgfx/src/renderer_mtl.h @@ -12,6 +12,7 @@ #import <QuartzCore/CAMetalLayer.h> #import <Metal/Metal.h> +#import <MetalKit/MetalKit.h> #if BX_PLATFORM_IOS # import <UIKit/UIKit.h> diff --git a/3rdparty/bgfx/src/renderer_mtl.mm b/3rdparty/bgfx/src/renderer_mtl.mm index d3721c9062d..b45b8a2fe8b 100644 --- a/3rdparty/bgfx/src/renderer_mtl.mm +++ b/3rdparty/bgfx/src/renderer_mtl.mm @@ -378,8 +378,16 @@ namespace bgfx { namespace mtl memset(m_uniforms, 0, sizeof(m_uniforms) ); memset(&m_resolution, 0, sizeof(m_resolution) ); + if (NULL != NSClassFromString(@"MTKView")) { + MTKView *view = (MTKView *)g_platformData.nwh; + if (NULL != view && [view isKindOfClass:NSClassFromString(@"MTKView")]) { + m_metalLayer = (CAMetalLayer *)view.layer; + } + } + if (NULL != NSClassFromString(@"CAMetalLayer") ) { + if (NULL == m_metalLayer) #if BX_PLATFORM_IOS { CAMetalLayer* metalLayer = (CAMetalLayer*)g_platformData.nwh; @@ -496,19 +504,19 @@ namespace bgfx { namespace mtl { if (iOSVersionEqualOrGreater("9.0.0") ) { - g_caps.maxTextureSize = m_device.supportsFeatureSet((MTLFeatureSet)4 /* iOS_GPUFamily3_v1 */) ? 16384 : 8192; + g_caps.limits.maxTextureSize = m_device.supportsFeatureSet((MTLFeatureSet)4 /* iOS_GPUFamily3_v1 */) ? 16384 : 8192; } else { - g_caps.maxTextureSize = 4096; + g_caps.limits.maxTextureSize = 4096; } - g_caps.maxFBAttachments = uint8_t(bx::uint32_min(m_device.supportsFeatureSet((MTLFeatureSet)1 /* MTLFeatureSet_iOS_GPUFamily2_v1 */) ? 8 : 4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS)); + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(m_device.supportsFeatureSet((MTLFeatureSet)1 /* MTLFeatureSet_iOS_GPUFamily2_v1 */) ? 8 : 4, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS)); } else if (BX_ENABLED(BX_PLATFORM_OSX) ) { - g_caps.maxTextureSize = 16384; - g_caps.maxFBAttachments = 8; + g_caps.limits.maxTextureSize = 16384; + g_caps.limits.maxFBAttachments = 8; g_caps.supported |= BGFX_CAPS_TEXTURE_CUBE_ARRAY; } @@ -788,7 +796,7 @@ namespace bgfx { namespace mtl { } - void readTexture(TextureHandle _handle, void* _data) BX_OVERRIDE + void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) BX_OVERRIDE { m_commandBuffer.commit(); m_commandBuffer.waitUntilCompleted(); @@ -796,13 +804,15 @@ namespace bgfx { namespace mtl const TextureMtl& texture = m_textures[_handle.idx]; - uint32_t width = texture.m_ptr.width(); - uint32_t height = texture.m_ptr.height(); + BX_CHECK(_mip<texture.m_numMips,"Invalid mip: %d num mips:",_mip,texture.m_numMips); + + uint32_t srcWidth = bx::uint32_max(1, texture.m_ptr.width() >> _mip); + uint32_t srcHeight = bx::uint32_max(1, texture.m_ptr.height() >> _mip); const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(texture.m_textureFormat) ); - MTLRegion region = { { 0, 0, 0 }, { width, height, 1 } }; + MTLRegion region = { { 0, 0, 0 }, { srcWidth, srcHeight, 1 } }; - texture.m_ptr.getBytes(_data, width*bpp/8, 0, region, 0, 0); + texture.m_ptr.getBytes(_data, srcWidth*bpp/8, 0, region, _mip, 0); m_commandBuffer = m_commandQueue.commandBuffer(); retain(m_commandBuffer); //NOTE: keep alive to be useable at 'flip' @@ -897,6 +907,7 @@ namespace bgfx { namespace mtl { BX_FREE(g_allocator, m_uniforms[_handle.idx]); m_uniforms[_handle.idx] = NULL; + m_uniformReg.remove(_handle); } //cmdPre @@ -970,8 +981,8 @@ namespace bgfx { namespace mtl { RenderCommandEncoder rce = m_renderCommandEncoder; - uint32_t width = getBufferWidth(); - uint32_t height = getBufferHeight(); + uint32_t width = m_resolution.m_width; + uint32_t height = m_resolution.m_height; //if (m_ovr.isEnabled() ) //{ @@ -1260,7 +1271,7 @@ namespace bgfx { namespace mtl RenderPassDescriptor renderPassDescriptor = newRenderPassDescriptor(); setFrameBuffer(renderPassDescriptor, m_renderCommandEncoderFrameBufferHandle); - for(uint32_t ii = 0; ii < g_caps.maxFBAttachments; ++ii) + for(uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii) { MTLRenderPassColorAttachmentDescriptor* desc = renderPassDescriptor.colorAttachments[ii]; if ( desc.texture != NULL) @@ -1413,8 +1424,8 @@ namespace bgfx { namespace mtl } else { - width = getBufferWidth(); - height = getBufferHeight(); + width = m_resolution.m_width; + height = m_resolution.m_height; } @@ -1670,7 +1681,7 @@ namespace bgfx { namespace mtl m_samplerDescriptor.lodMinClamp = 0; m_samplerDescriptor.lodMaxClamp = FLT_MAX; m_samplerDescriptor.normalizedCoordinates = TRUE; - m_samplerDescriptor.maxAnisotropy = m_maxAnisotropy; + m_samplerDescriptor.maxAnisotropy = (0 != (_flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) ) ) ? m_maxAnisotropy : 1; //NOTE: Comparison function can be specified in shader on all metal hw. if ( m_macOS11Runtime || [m_device supportsFeatureSet:(MTLFeatureSet)4/*MTLFeatureSet_iOS_GPUFamily3_v1*/]) @@ -1692,16 +1703,6 @@ namespace bgfx { namespace mtl return _visible == (0 != _render->m_occlusion[_handle.idx]); } - uint32_t getBufferWidth() - { - return m_backBufferDepth.width(); - } - - uint32_t getBufferHeight() - { - return m_backBufferDepth.height(); - } - void sync() { if ( m_prevCommandBuffer ) @@ -2008,6 +2009,8 @@ namespace bgfx { namespace mtl case MTLDataTypeFloat4x4: return UniformType::Mat4; + default: + break; }; BX_CHECK(false, "Unrecognized Mtl Data type 0x%04x.", _type); @@ -2278,6 +2281,8 @@ namespace bgfx { namespace mtl else { const UniformInfo* info = s_renderMtl->m_uniformReg.find(name); + BX_WARN(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); + if (NULL != info) { if (NULL == constantBuffer) @@ -2412,7 +2417,7 @@ namespace bgfx { namespace mtl { if (imageContainer.m_cubeMap) { - desc.textureType = MTLTextureTypeCubeArray; + desc.textureType = MTLTextureType(6); // MTLTextureTypeCubeArray } else { @@ -2684,6 +2689,8 @@ namespace bgfx { namespace mtl void FrameBufferMtl::create(uint8_t _num, const Attachment* _attachment) { m_num = 0; + m_width = 0; + m_height = 0; for (uint32_t ii = 0; ii < _num; ++ii) { TextureHandle handle = _attachment[ii].handle; @@ -2691,6 +2698,12 @@ namespace bgfx { namespace mtl { const TextureMtl& texture = s_renderMtl->m_textures[handle.idx]; + if ( 0 == m_width ) + { + m_width = texture.m_width; + m_height = texture.m_height; + } + if (isDepth( (TextureFormat::Enum)texture.m_textureFormat) ) { m_depthHandle = handle; @@ -2931,7 +2944,8 @@ namespace bgfx { namespace mtl _render->m_hmdInitialized = false; const bool hmdEnabled = false; - ViewState viewState(_render, hmdEnabled); + static ViewState viewState; + viewState.reset(_render, hmdEnabled); uint32_t blendFactor = 0; bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME); @@ -3090,15 +3104,8 @@ namespace bgfx { namespace mtl viewScissorRect = viewHasScissor ? scissorRect : viewState.m_rect; Clear& clr = _render->m_clear[view]; - uint32_t width = getBufferWidth(); - uint32_t height = getBufferHeight(); Rect viewRect = viewState.m_rect; - bool clearWithRenderPass = true - && 0 == viewRect.m_x - && 0 == viewRect.m_y - && width == viewRect.m_width - && height == viewRect.m_height - ; + bool clearWithRenderPass = false; if ( NULL == m_renderCommandEncoder || fbh.idx != _render->m_fb[view].idx ) { @@ -3111,11 +3118,29 @@ namespace bgfx { namespace mtl renderPassDescriptor.visibilityResultBuffer = m_occlusionQuery.m_buffer; fbh = _render->m_fb[view]; + + uint32_t width = m_resolution.m_width; + uint32_t height = m_resolution.m_height; + + if ( isValid(fbh) ) + { + FrameBufferMtl& frameBuffer = m_frameBuffers[fbh.idx]; + width = frameBuffer.m_width; + height = frameBuffer.m_height; + } + + clearWithRenderPass = true + && 0 == viewRect.m_x + && 0 == viewRect.m_y + && width == viewRect.m_width + && height == viewRect.m_height; + setFrameBuffer(renderPassDescriptor, fbh); if ( clearWithRenderPass ) { - for(uint32_t ii = 0; ii < g_caps.maxFBAttachments; ++ii) + + for(uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii) { MTLRenderPassColorAttachmentDescriptor* desc = renderPassDescriptor.colorAttachments[ii]; @@ -3177,7 +3202,7 @@ namespace bgfx { namespace mtl } else { - for(uint32_t ii = 0; ii < g_caps.maxFBAttachments; ++ii) + for(uint32_t ii = 0; ii < g_caps.limits.maxFBAttachments; ++ii) { MTLRenderPassColorAttachmentDescriptor* desc = renderPassDescriptor.colorAttachments[ii]; if ( desc.texture != NULL) @@ -3205,10 +3230,6 @@ namespace bgfx { namespace mtl m_renderCommandEncoderFrameBufferHandle = fbh; MTL_RELEASE(renderPassDescriptor); } - else - { - clearWithRenderPass = false; - } rce.setTriangleFillMode(wireframe? MTLTriangleFillModeLines : MTLTriangleFillModeFill); @@ -3379,13 +3400,15 @@ namespace bgfx { namespace mtl if (key.m_program != programIdx || (BGFX_STATE_BLEND_MASK|BGFX_STATE_BLEND_EQUATION_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE|BGFX_STATE_BLEND_INDEPENDENT|BGFX_STATE_MSAA|BGFX_STATE_BLEND_ALPHA_TO_COVERAGE) & changedFlags - || currentState.m_vertexBuffer.idx != draw.m_vertexBuffer.idx - || currentState.m_vertexDecl.idx != draw.m_vertexDecl.idx - || currentState.m_instanceDataStride != draw.m_instanceDataStride + || currentState.m_streamMask != draw.m_streamMask + || currentState.m_stream[0].m_handle.idx != draw.m_stream[0].m_handle.idx + || currentState.m_stream[0].m_decl.idx != draw.m_stream[0].m_decl.idx + || currentState.m_instanceDataStride != draw.m_instanceDataStride || ( (blendFactor != draw.m_rgba) && !!(newFlags & BGFX_STATE_BLEND_INDEPENDENT) ) ) { programIdx = key.m_program; - currentState.m_vertexDecl = draw.m_vertexDecl; + currentState.m_streamMask = draw.m_streamMask; + currentState.m_stream[0].m_decl = draw.m_stream[0].m_decl; currentState.m_instanceDataStride = draw.m_instanceDataStride; if (invalidHandle == programIdx) @@ -3400,18 +3423,18 @@ namespace bgfx { namespace mtl RenderPipelineState pipelineState = NULL; - if ( isValid(draw.m_vertexBuffer) ) + if (isValid(draw.m_stream[0].m_handle) ) { - uint16_t handle = draw.m_vertexBuffer.idx; + uint16_t handle = draw.m_stream[0].m_handle.idx; const VertexBufferMtl& vb = m_vertexBuffers[handle]; VertexDeclHandle decl; - decl.idx = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; + decl.idx = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; pipelineState = program.getRenderPipelineState(newFlags, draw.m_rgba, fbh, decl, draw.m_instanceDataStride/16); } - if (NULL == pipelineState ) - { //call with invalid program + if (NULL == pipelineState) + { currentProgram = NULL; programIdx = invalidHandle; continue; @@ -3497,24 +3520,26 @@ namespace bgfx { namespace mtl } } - if (currentState.m_vertexBuffer.idx != draw.m_vertexBuffer.idx - || currentState.m_startVertex != draw.m_startVertex - || currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx - || currentState.m_instanceDataOffset != draw.m_instanceDataOffset) + if (currentState.m_streamMask != draw.m_streamMask + || currentState.m_stream[0].m_handle.idx != draw.m_stream[0].m_handle.idx + || currentState.m_stream[0].m_startVertex != draw.m_stream[0].m_startVertex + || currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx + || currentState.m_instanceDataOffset != draw.m_instanceDataOffset) { - currentState.m_vertexBuffer = draw.m_vertexBuffer; - currentState.m_startVertex = draw.m_startVertex; - currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; - currentState.m_instanceDataOffset = draw.m_instanceDataOffset; + currentState.m_streamMask = draw.m_streamMask; + currentState.m_stream[0].m_handle = draw.m_stream[0].m_handle; + currentState.m_stream[0].m_startVertex = draw.m_stream[0].m_startVertex; + currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; + currentState.m_instanceDataOffset = draw.m_instanceDataOffset; - uint16_t handle = draw.m_vertexBuffer.idx; + uint16_t handle = draw.m_stream[0].m_handle.idx; if (invalidHandle != handle) { const VertexBufferMtl& vb = m_vertexBuffers[handle]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; + uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; const VertexDecl& vertexDecl = m_vertexDecls[decl]; - uint32_t offset = draw.m_startVertex * vertexDecl.getStride(); + uint32_t offset = draw.m_stream[0].m_startVertex * vertexDecl.getStride(); rce.setVertexBuffer(vb.getBuffer(), offset, 1); @@ -3526,13 +3551,13 @@ namespace bgfx { namespace mtl } } - if (isValid(currentState.m_vertexBuffer) ) + if (0 != currentState.m_streamMask) { uint32_t numVertices = draw.m_numVertices; if (UINT32_MAX == numVertices) { - const VertexBufferMtl& vb = m_vertexBuffers[currentState.m_vertexBuffer.idx]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx; + const VertexBufferMtl& vb = m_vertexBuffers[currentState.m_stream[0].m_handle.idx]; + uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; const VertexDecl& vertexDecl = m_vertexDecls[decl]; numVertices = vb.m_size/vertexDecl.m_stride; } diff --git a/3rdparty/bgfx/src/renderer_null.cpp b/3rdparty/bgfx/src/renderer_noop.cpp index 1dcd621759a..34a198d3aef 100644 --- a/3rdparty/bgfx/src/renderer_null.cpp +++ b/3rdparty/bgfx/src/renderer_noop.cpp @@ -5,28 +5,51 @@ #include "bgfx_p.h" -#if BGFX_CONFIG_RENDERER_NULL +#if BGFX_CONFIG_RENDERER_NOOP namespace bgfx { namespace noop { - struct RendererContextNULL : public RendererContextI + struct RendererContextNOOP : public RendererContextI { - RendererContextNULL() - { - } - - ~RendererContextNULL() + RendererContextNOOP() + { + // Pretend all features that are not returning results to CPU + // are available. + g_caps.supported = 0 + | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL + | BGFX_CAPS_TEXTURE_COMPARE_ALL + | BGFX_CAPS_TEXTURE_3D + | BGFX_CAPS_VERTEX_ATTRIB_HALF + | BGFX_CAPS_VERTEX_ATTRIB_UINT10 + | BGFX_CAPS_INSTANCING + | BGFX_CAPS_FRAGMENT_DEPTH + | BGFX_CAPS_BLEND_INDEPENDENT + | BGFX_CAPS_COMPUTE + | BGFX_CAPS_FRAGMENT_ORDERING + | BGFX_CAPS_SWAP_CHAIN + | BGFX_CAPS_INDEX32 + | BGFX_CAPS_DRAW_INDIRECT + | BGFX_CAPS_HIDPI + | BGFX_CAPS_TEXTURE_BLIT + | BGFX_CAPS_ALPHA_TO_COVERAGE + | BGFX_CAPS_CONSERVATIVE_RASTER + | BGFX_CAPS_TEXTURE_2D_ARRAY + | BGFX_CAPS_TEXTURE_CUBE_ARRAY + ; + } + + ~RendererContextNOOP() { } RendererType::Enum getRendererType() const BX_OVERRIDE { - return RendererType::Null; + return RendererType::Noop; } const char* getRendererName() const BX_OVERRIDE { - return BGFX_RENDERER_NULL_NAME; + return BGFX_RENDERER_NOOP_NAME; } void flip(HMD& /*_hmd*/) BX_OVERRIDE @@ -113,7 +136,7 @@ namespace bgfx { namespace noop { } - void readTexture(TextureHandle /*_handle*/, void* /*_data*/) BX_OVERRIDE + void readTexture(TextureHandle /*_handle*/, void* /*_data*/, uint8_t /*_mip*/) BX_OVERRIDE { } @@ -183,18 +206,18 @@ namespace bgfx { namespace noop } }; - static RendererContextNULL* s_renderNULL; + static RendererContextNOOP* s_renderNOOP; RendererContextI* rendererCreate() { - s_renderNULL = BX_NEW(g_allocator, RendererContextNULL); - return s_renderNULL; + s_renderNOOP = BX_NEW(g_allocator, RendererContextNOOP); + return s_renderNOOP; } void rendererDestroy() { - BX_DELETE(g_allocator, s_renderNULL); - s_renderNULL = NULL; + BX_DELETE(g_allocator, s_renderNOOP); + s_renderNOOP = NULL; } } /* namespace noop */ } // namespace bgfx @@ -212,4 +235,4 @@ namespace bgfx { namespace noop } } /* namespace noop */ } // namespace bgfx -#endif // BGFX_CONFIG_RENDERER_NULL +#endif // BGFX_CONFIG_RENDERER_NOOP diff --git a/3rdparty/bgfx/src/renderer_vk.cpp b/3rdparty/bgfx/src/renderer_vk.cpp index e885b84e58f..252cd2db5db 100644 --- a/3rdparty/bgfx/src/renderer_vk.cpp +++ b/3rdparty/bgfx/src/renderer_vk.cpp @@ -5,10 +5,6 @@ #include "bgfx_p.h" -#if BGFX_CONFIG_RENDERER_VULKAN -# include "../../bgfx-ext/src/renderer_vk1.cpp" -#else - namespace bgfx { namespace vk { RendererContextI* rendererCreate() @@ -20,5 +16,3 @@ namespace bgfx { namespace vk { } } /* namespace vk */ } // namespace bgfx - -#endif // BGFX_CONFIG_RENDERER_VULKAN diff --git a/3rdparty/bgfx/src/vertexdecl.cpp b/3rdparty/bgfx/src/vertexdecl.cpp index d3945cd3226..49fb683c4d5 100644 --- a/3rdparty/bgfx/src/vertexdecl.cpp +++ b/3rdparty/bgfx/src/vertexdecl.cpp @@ -49,6 +49,7 @@ namespace bgfx &s_attribTypeSizeDx9, // Direct3D9 &s_attribTypeSizeDx1x, // Direct3D11 &s_attribTypeSizeDx1x, // Direct3D12 + &s_attribTypeSizeGl, // Gnm &s_attribTypeSizeGl, // Metal &s_attribTypeSizeGl, // OpenGLES &s_attribTypeSizeGl, // OpenGL diff --git a/3rdparty/bgfx/src/vs_clear.bin.h b/3rdparty/bgfx/src/vs_clear.bin.h index e6a0b191cb9..46160b6bb76 100644 --- a/3rdparty/bgfx/src/vs_clear.bin.h +++ b/3rdparty/bgfx/src/vs_clear.bin.h @@ -12,20 +12,20 @@ static const uint8_t vs_clear_glsl[164] = 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, // ion = tmpvar_1;. 0x7d, 0x0a, 0x0a, 0x00, // }... }; -static const uint8_t vs_clear_dx9[181] = +static const uint8_t vs_clear_dx9[185] = { - 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x03, 0xfe, 0xff, // VSH............. - 0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... + 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x03, 0xfe, 0xff, // VSH............. + 0xfe, 0xff, 0x17, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#... 0x00, 0x03, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, // ................ 0x1c, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....vs_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, 0x39, 0x2e, // ader Compiler 9. - 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, // 29.952.3111.Q... - 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .......?........ - 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, // ................ - 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x04, 0x00, 0x00, 0x04, // ................ - 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x24, 0x90, 0x00, 0x00, 0x40, 0xa0, 0x00, 0x00, 0x15, 0xa0, // ......$...@..... - 0xff, 0xff, 0x00, 0x00, 0x00, // ..... + 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, 0x3f, 0x00, 0x00, 0x00, 0x00, // Q..........?.... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, // ................ + 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, // ................ + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x24, 0x90, 0x00, 0x00, 0x40, 0xa0, // ..........$...@. + 0x00, 0x00, 0x15, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, // ......... }; static const uint8_t vs_clear_dx11[386] = { @@ -55,9 +55,9 @@ static const uint8_t vs_clear_dx11[386] = 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x00, 0x01, 0x01, 0x00, // SV_POSITION..... 0x00, 0x00, // .. }; -static const uint8_t vs_clear_mtl[500] = +static const uint8_t vs_clear_mtl[504] = { - 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe5, 0x01, 0x00, 0x00, 0x75, 0x73, // VSH...........us + 0x56, 0x53, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x01, 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 { @@ -81,12 +81,14 @@ static const uint8_t vs_clear_mtl[500] = 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // ]).{. xlatMtlSh 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // aderOutput _mtl_ 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // o;. float4 tmpv - 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ar_1;. tmpvar_1 - 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // .w = 1.0;. tmpv - 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // ar_1.xyz = _mtl_ - 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, // i.a_position;. - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, // _mtl_o.gl_Positi - 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, // on = tmpvar_1;. - 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // return _mtl_o;. - 0x7d, 0x0a, 0x0a, 0x00, // }... + 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // ar_1 = 0;. tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, // ar_1.w = 1.0;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, // tmpvar_1.xyz = _ + 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // mtl_i.a_position + 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, // ;. _mtl_o.gl_Po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // sition = tmpvar_ + 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // 1;. return _mtl + 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _o;.}... }; +extern const uint8_t* vs_clear_pssl; +extern const uint32_t vs_clear_pssl_size; diff --git a/3rdparty/bgfx/src/vs_debugfont.bin.h b/3rdparty/bgfx/src/vs_debugfont.bin.h index dd46d56c3a2..6d54586dab7 100644 --- a/3rdparty/bgfx/src/vs_debugfont.bin.h +++ b/3rdparty/bgfx/src/vs_debugfont.bin.h @@ -33,11 +33,11 @@ static const uint8_t vs_debugfont_glsl[503] = 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color1 = a_color 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 1;.}... }; -static const uint8_t vs_debugfont_dx9[391] = +static const uint8_t vs_debugfont_dx9[395] = { 0x56, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x64, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // d.......#.CTAB.. + 0x68, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x24, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // h.......$.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_ @@ -45,21 +45,21 @@ static const uint8_t vs_debugfont_dx9[391] = 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, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952 - 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111........... - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x01, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ - 0x00, 0x80, 0x03, 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, 0x0a, 0x00, 0x01, 0x80, 0x02, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ - 0x00, 0x80, 0x03, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, // ................ - 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ....U........... - 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ - 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x02, 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, // ................ - 0x0f, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, 0x03, 0xe0, 0x03, 0x00, // ................ - 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ....... + 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, 0x0a, 0x00, 0x01, 0x80, 0x01, 0x00, // ................ + 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x03, 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, 0x0a, 0x00, 0x01, 0x80, 0x02, 0x00, 0x0f, 0xe0, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x03, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U....... + 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x02, 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, 0x0f, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, // ................ + 0x03, 0xe0, 0x03, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ........... }; static const uint8_t vs_debugfont_dx11[974] = { @@ -125,9 +125,9 @@ static const uint8_t vs_debugfont_dx11[974] = 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, // N.COLOR.TEXCOORD 0x00, 0xab, 0x00, 0x04, 0x05, 0x00, 0x06, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // ............@. }; -static const uint8_t vs_debugfont_mtl[843] = +static const uint8_t vs_debugfont_mtl[847] = { - 0x56, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x3c, 0x03, 0x00, 0x00, 0x75, 0x73, // VSH..."f..<...us + 0x56, 0x53, 0x48, 0x04, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x40, 0x03, 0x00, 0x00, 0x75, 0x73, // VSH..."f..@...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 { @@ -163,21 +163,23 @@ static const uint8_t vs_debugfont_mtl[843] = 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, // fer(0)]]).{. xl 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, // atMtlShaderOutpu 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // t _mtl_o;. floa - 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, // t4 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, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // = _mtl_i.a_posit - 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, // ion;. _mtl_o.gl - 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, // _Position = (_mt - 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // l_u.u_modelViewP - 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, // roj * tmpvar_1); - 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // . _mtl_o.v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, // oord0 = _mtl_i.a - 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, // _texcoord0;. _m - 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, // tl_o.v_color0 = - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // _mtl_i.a_color0; - 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // . _mtl_o.v_colo - 0x72, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, // r1 = _mtl_i.a_co - 0x6c, 0x6f, 0x72, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, // lor1;. return _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mtl_o;.}... + 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, // t4 tmpvar_1 = 0; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, // . tmpvar_1.w = + 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // 1.0;. tmpvar_1. + 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, // xyz = _mtl_i.a_p + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // osition;. _mtl_ + 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, // o.gl_Position = + 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // (_mtl_u.u_modelV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // iewProj * tmpvar + 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, // _1);. _mtl_o.v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // texcoord0 = _mtl + 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, // _i.a_texcoord0;. + 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // _mtl_o.v_color + 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, // 0 = _mtl_i.a_col + 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, // or0;. _mtl_o.v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, // color1 = _mtl_i. + 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, // a_color1;. retu + 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // rn _mtl_o;.}... }; +extern const uint8_t* vs_debugfont_pssl; +extern const uint32_t vs_debugfont_pssl_size; diff --git a/3rdparty/bgfx/tools/shaderc/shaderc.cpp b/3rdparty/bgfx/tools/shaderc/shaderc.cpp index 08f3b4efd26..8a6ff4848de 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc.cpp +++ b/3rdparty/bgfx/tools/shaderc/shaderc.cpp @@ -138,7 +138,13 @@ namespace bgfx const char* getUniformTypeName(UniformType::Enum _enum) { - return s_uniformTypeName[_enum]; + uint32_t idx = _enum & ~(BGFX_UNIFORM_FRAGMENTBIT|BGFX_UNIFORM_SAMPLERBIT); + if (idx < UniformType::Count) + { + return s_uniformTypeName[idx]; + } + + return "Unknown uniform type?!"; } UniformType::Enum nameToUniformTypeEnum(const char* _name) @@ -371,7 +377,7 @@ namespace bgfx strReplace(_str, "\r", "\n"); } - void printCode(const char* _code, int32_t _line, int32_t _start, int32_t _end) + void printCode(const char* _code, int32_t _line, int32_t _start, int32_t _end, int32_t _column) { fprintf(stderr, "Code:\n---\n"); @@ -380,7 +386,20 @@ namespace bgfx { if (line >= _start) { - fprintf(stderr, "%s%3d: %s", _line == line ? ">>> " : " ", line, lr.getLine().c_str() ); + if (_line == line) + { + fprintf(stderr, "\n"); + fprintf(stderr, ">>> %3d: %s", line, lr.getLine().c_str() ); + if (-1 != _column) + { + fprintf(stderr, ">>> %3d: %*s\n", _column, _column, "^"); + } + fprintf(stderr, "\n"); + } + else + { + fprintf(stderr, " %3d: %s", line, lr.getLine().c_str() ); + } } else { @@ -403,7 +422,7 @@ namespace bgfx struct Preprocessor { - Preprocessor(const char* _filePath, bool _gles, const char* _includeDir = NULL) + Preprocessor(const char* _filePath, bool _essl) : m_tagptr(m_tags) , m_scratchPos(0) , m_fgetsPos(0) @@ -440,12 +459,7 @@ namespace bgfx m_tagptr->data = scratch(_filePath); m_tagptr++; - if (NULL != _includeDir) - { - addInclude(_includeDir); - } - - if (!_gles) + if (!_essl) { m_default = "#define lowp\n#define mediump\n#define highp\n"; } @@ -765,17 +779,18 @@ namespace bgfx const char* platform = cmdLine.findOption('\0', "platform"); if (NULL == platform) { - help("Must specify platform."); - return EXIT_FAILURE; + platform = ""; } bool raw = cmdLine.hasArg('\0', "raw"); uint32_t glsl = 0; uint32_t essl = 0; - uint32_t hlsl = 2; + uint32_t hlsl = 0; uint32_t d3d = 11; uint32_t metal = 0; + uint32_t pssl = 0; + uint32_t spirv = 0; const char* profile = cmdLine.findOption('p', "profile"); if (NULL != profile) { @@ -800,6 +815,14 @@ namespace bgfx { metal = 1; } + else if (0 == strcmp(profile, "pssl") ) + { + pssl = 1; + } + else if (0 == strcmp(profile, "spirv") ) + { + spirv = 1; + } else { glsl = atoi(profile); @@ -841,7 +864,13 @@ namespace bgfx bool preprocessOnly = cmdLine.hasArg("preprocess"); const char* includeDir = cmdLine.findOption('i'); - Preprocessor preprocessor(filePath, 0 != essl, includeDir); + Preprocessor preprocessor(filePath, 0 != essl); + + for (int ii = 1; NULL != includeDir; ++ii) + { + preprocessor.addInclude(includeDir); + includeDir = cmdLine.findOption(ii, 'i'); + } std::string dir; { @@ -875,18 +904,28 @@ namespace bgfx preprocessor.setDefaultDefine("BX_PLATFORM_LINUX"); preprocessor.setDefaultDefine("BX_PLATFORM_NACL"); preprocessor.setDefaultDefine("BX_PLATFORM_OSX"); + preprocessor.setDefaultDefine("BX_PLATFORM_PS4"); preprocessor.setDefaultDefine("BX_PLATFORM_WINDOWS"); preprocessor.setDefaultDefine("BX_PLATFORM_XBOX360"); - // preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_ESSL"); + preprocessor.setDefaultDefine("BX_PLATFORM_XBOXONE"); + +// preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_ESSL"); preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_GLSL"); preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_HLSL"); preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_METAL"); + preprocessor.setDefaultDefine("BGFX_SHADER_LANGUAGE_PSSL"); + preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_COMPUTE"); preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_FRAGMENT"); preprocessor.setDefaultDefine("BGFX_SHADER_TYPE_VERTEX"); char glslDefine[128]; - bx::snprintf(glslDefine, BX_COUNTOF(glslDefine), "BGFX_SHADER_LANGUAGE_GLSL=%d", essl ? 1 : glsl); + bx::snprintf(glslDefine, BX_COUNTOF(glslDefine) + , "BGFX_SHADER_LANGUAGE_GLSL=%d" + , essl ? 1 + : spirv ? 130 + : glsl + ); if (0 == bx::stricmp(platform, "android") ) { @@ -933,10 +972,11 @@ namespace bgfx preprocessor.setDefine("BX_PLATFORM_XBOX360=1"); preprocessor.setDefine("BGFX_SHADER_LANGUAGE_HLSL=3"); } - else + else if (0 == bx::stricmp(platform, "orbis") ) { - fprintf(stderr, "Unknown platform %s?!", platform); - return EXIT_FAILURE; + preprocessor.setDefine("BX_PLATFORM_PS4=1"); + preprocessor.setDefine("BGFX_SHADER_LANGUAGE_PSSL=1"); + preprocessor.setDefine("lit=lit_reserved"); } preprocessor.setDefine("M_PI=3.1415926535897932384626433832795"); @@ -1187,6 +1227,10 @@ namespace bgfx compiled = true; } + else if (0 != pssl) + { + compiled = compilePSSLShader(cmdLine, 0, input, writer); + } else { compiled = compileHLSLShader(cmdLine, d3d, input, writer); @@ -1206,7 +1250,8 @@ namespace bgfx { if (0 != glsl || 0 != essl - || 0 != metal) + || 0 != metal + || 0 != spirv) { } else @@ -1348,6 +1393,14 @@ namespace bgfx compiled = compileGLSLShader(cmdLine, essl, code, writer); #endif // 0 } + else if (0 != spirv) + { + compiled = compileSPIRVShader(cmdLine, 0, preprocessor.m_preprocessed, writer); + } + else if (0 != pssl) + { + compiled = compilePSSLShader(cmdLine, 0, preprocessor.m_preprocessed, writer); + } else { compiled = compileHLSLShader(cmdLine, d3d, preprocessor.m_preprocessed, writer); @@ -1385,7 +1438,8 @@ namespace bgfx { if (0 != glsl || 0 != essl - || 0 != metal) + || 0 != metal + || 0 != spirv) { if (0 == essl) { @@ -1461,7 +1515,8 @@ namespace bgfx "#define mat4 float4x4\n" ); - if (hlsl < 4) + if (hlsl != 0 + && hlsl < 4) { preprocessor.writef( "#define centroid\n" @@ -1684,7 +1739,8 @@ namespace bgfx "\t} \\\n" ); - if (hlsl <= 3) + if (hlsl != 0 + && hlsl <= 3) { // preprocessor.writef( // "\tgl_Position.xy += u_viewTexel.xy * gl_Position.w; \\\n" @@ -1765,7 +1821,8 @@ namespace bgfx if (0 != glsl || 0 != essl - || 0 != metal) + || 0 != metal + || 0 != spirv ) { std::string code; @@ -1787,6 +1844,10 @@ namespace bgfx { bx::stringPrintf(code, "#version 120\n"); } + else if (0 != spirv) + { + bx::stringPrintf(code, "#version 130\n"); + } else { bx::stringPrintf(code, "#version %s\n", need130 ? "130" : profile); @@ -1915,19 +1976,39 @@ namespace bgfx } code += preprocessor.m_preprocessed; - compiled = compileGLSLShader(cmdLine + + if (0 != spirv) + { + compiled = compileSPIRVShader(cmdLine + , 0 + , code + , writer + ); + } + else + { + compiled = compileGLSLShader(cmdLine , metal ? BX_MAKEFOURCC('M', 'T', 'L', 0) : essl , code , writer ); + } + } + else if (0 != pssl) + { + compiled = compilePSSLShader(cmdLine + , 0 + , preprocessor.m_preprocessed + , writer + ); } else { compiled = compileHLSLShader(cmdLine - , d3d - , preprocessor.m_preprocessed - , writer - ); + , d3d + , preprocessor.m_preprocessed + , writer + ); } bx::close(writer); diff --git a/3rdparty/bgfx/tools/shaderc/shaderc.h b/3rdparty/bgfx/tools/shaderc/shaderc.h index 47bae98c3aa..c773226090a 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc.h +++ b/3rdparty/bgfx/tools/shaderc/shaderc.h @@ -15,7 +15,7 @@ namespace bgfx BX_MACRO_BLOCK_BEGIN \ if (bgfx::g_verbose) \ { \ - fprintf(stderr, BX_FILE_LINE_LITERAL "" _format "\n", ##__VA_ARGS__); \ + fprintf(stdout, BX_FILE_LINE_LITERAL "" _format "\n", ##__VA_ARGS__); \ } \ BX_MACRO_BLOCK_END @@ -107,8 +107,8 @@ namespace bgfx uint32_t m_size; }; - #define BGFX_UNIFORM_FRAGMENTBIT UINT8_C(0x10) - #define BGFX_UNIFORM_SAMPLERBIT UINT8_C(0x20) +#define BGFX_UNIFORM_FRAGMENTBIT UINT8_C(0x10) +#define BGFX_UNIFORM_SAMPLERBIT UINT8_C(0x20) const char* getUniformTypeName(UniformType::Enum _enum); UniformType::Enum nameToUniformTypeEnum(const char* _name); @@ -124,13 +124,15 @@ namespace bgfx typedef std::vector<Uniform> UniformArray; - void printCode(const char* _code, int32_t _line = 0, int32_t _start = 0, int32_t _end = INT32_MAX); + void printCode(const char* _code, int32_t _line = 0, int32_t _start = 0, int32_t _end = INT32_MAX, int32_t _column = -1); void strReplace(char* _str, const char* _find, const char* _replace); int32_t writef(bx::WriterI* _writer, const char* _format, ...); void writeFile(const char* _filePath, const void* _data, int32_t _size); - bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool firstPass = true); - bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _gles, const std::string& _code, bx::WriterI* _writer); + bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer); + bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer); + bool compilePSSLShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer); + bool compileSPIRVShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer); } // namespace bgfx diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp index 5e1e5a28fe9..f4fe2367c7e 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp +++ b/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp @@ -6,9 +6,9 @@ #include "shaderc.h" #include "glsl_optimizer.h" -namespace bgfx +namespace bgfx { namespace glsl { - bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _gles, const std::string& _code, bx::WriterI* _writer) + static bool compile(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer) { char ch = char(tolower(_cmdLine.findOption('\0', "type")[0]) ); const glslopt_shader_type type = ch == 'f' @@ -16,7 +16,7 @@ namespace bgfx : (ch == 'c' ? kGlslOptShaderCompute : kGlslOptShaderVertex); glslopt_target target = kGlslTargetOpenGL; - switch (_gles) + switch (_version) { case BX_MAKEFOURCC('M', 'T', 'L', 0): target = kGlslTargetMetal; @@ -42,20 +42,24 @@ namespace bgfx if (!glslopt_get_status(shader) ) { const char* log = glslopt_get_log(shader); - int32_t source = 0; - int32_t line = 0; - int32_t column = 0; - int32_t start = 0; - int32_t end = INT32_MAX; + int32_t source = 0; + int32_t line = 0; + int32_t column = 0; + int32_t start = 0; + int32_t end = INT32_MAX; - if (3 == sscanf(log, "%u:%u(%u):", &source, &line, &column) + bool found = false + || 3 == sscanf(log, "%u:%u(%u):", &source, &line, &column) + ; + + if (found && 0 != line) { start = bx::uint32_imax(1, line-10); - end = start + 20; + end = start + 20; } - printCode(_code.c_str(), line, start, end); + printCode(_code.c_str(), line, start, end, column); fprintf(stderr, "Error: %s\n", log); glslopt_cleanup(ctx); return false; @@ -69,7 +73,7 @@ namespace bgfx optimizedShader = bx::strnl(optimizedShader); } - if (0 != _gles) + if (0 != _version) { char* code = const_cast<char*>(optimizedShader); strReplace(code, "gl_FragDepthEXT", "gl_FragDepth"); @@ -220,4 +224,11 @@ namespace bgfx return true; } +} // namespace glsl + + bool compileGLSLShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer) + { + return glsl::compile(_cmdLine, _version, _code, _writer); + } + } // namespace bgfx diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp index 8f861047ded..08067ccaff1 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp +++ b/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp @@ -13,6 +13,7 @@ # define __out #endif // defined(__MINGW32__) +#define COM_NO_WINDOWS_H #include <d3dcompiler.h> #include <d3d11shader.h> #include <bx/os.h> @@ -21,7 +22,7 @@ # define D3D_SVF_USED 2 #endif // D3D_SVF_USED -namespace bgfx +namespace bgfx { namespace hlsl { typedef HRESULT(WINAPI* PFN_D3D_COMPILE)(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData , _In_ SIZE_T SrcDataSize @@ -67,7 +68,7 @@ namespace bgfx }; static const D3DCompiler s_d3dcompiler[] = - { // BK - the only different in interface is GetRequiresFlags at the end + { // BK - the only different method in interface is GetRequiresFlags at the end // of IID_ID3D11ShaderReflection47 (which is not used anyway). { "D3DCompiler_47.dll", { 0x8d536ca1, 0x0cca, 0x4956, { 0xa8, 0x37, 0x78, 0x69, 0x63, 0x75, 0x55, 0x84 } } }, { "D3DCompiler_46.dll", { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } } }, @@ -104,7 +105,13 @@ namespace bgfx continue; } - BX_TRACE("Loaded %s compiler.", compiler->fileName); + if (g_verbose) + { + char filePath[MAX_PATH]; + GetModuleFileNameA( (HMODULE)s_d3dcompilerdll, filePath, sizeof(filePath) ); + BX_TRACE("Loaded %s compiler (%s).", compiler->fileName, filePath); + } + return compiler; } @@ -536,7 +543,7 @@ namespace bgfx return true; } - bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool _firstPass) + static bool compile(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer, bool _firstPass) { const char* profile = _cmdLine.findOption('p', "profile"); if (NULL == profile) @@ -611,19 +618,24 @@ namespace bgfx { const char* log = (char*)errorMsg->GetBufferPointer(); - int32_t line = 0; + int32_t line = 0; int32_t column = 0; - int32_t start = 0; - int32_t end = INT32_MAX; + int32_t start = 0; + int32_t end = INT32_MAX; + + bool found = false + || 2 == sscanf(log, "(%u,%u):", &line, &column) + || 2 == sscanf(log, " :%u:%u: ", &line, &column) + ; - if (2 == sscanf(log, "(%u,%u):", &line, &column) + if (found && 0 != line) { start = bx::uint32_imax(1, line - 10); - end = start + 20; + end = start + 20; } - printCode(_code.c_str(), line, start, end); + printCode(_code.c_str(), line, start, end, column); fprintf(stderr, "Error: D3DCompile failed 0x%08x %s\n", (uint32_t)hr, log); errorMsg->Release(); return false; @@ -634,7 +646,7 @@ namespace bgfx uint16_t attrs[bgfx::Attrib::Count]; uint16_t size = 0; - if (_d3d == 9) + if (_version == 9) { if (!getReflectionDataD3D9(code, uniforms) ) { @@ -647,7 +659,7 @@ namespace bgfx UniformNameList unusedUniforms; if (!getReflectionDataD3D11(code, profile[0] == 'v', uniforms, numAttrs, attrs, size, unusedUniforms) ) { - fprintf(stderr, "Unable to get D3D11 reflection data.\n"); + fprintf(stderr, "Error: Unable to get D3D11 reflection data.\n"); goto error; } @@ -687,7 +699,7 @@ namespace bgfx } // recompile with the unused uniforms converted to statics - return compileHLSLShader(_cmdLine, _d3d, output.c_str(), _writer, false); + return compile(_cmdLine, _version, output.c_str(), _writer, false); } } @@ -742,7 +754,7 @@ namespace bgfx bx::write(_writer, nul); } - if (_d3d > 9) + if (_version > 9) { bx::write(_writer, numAttrs); bx::write(_writer, attrs, numAttrs*sizeof(uint16_t) ); @@ -783,16 +795,22 @@ namespace bgfx return result; } +} // namespace hlsl + + bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer) + { + return hlsl::compile(_cmdLine, _version, _code, _writer, true); + } + } // namespace bgfx #else namespace bgfx { - - bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _d3d, const std::string& _code, bx::WriterI* _writer, bool _firstPass) + bool compileHLSLShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer) { - BX_UNUSED(_cmdLine, _d3d, _code, _writer, _firstPass); + BX_UNUSED(_cmdLine, _version, _code, _writer); fprintf(stderr, "HLSL compiler is not supported on this platform.\n"); return false; } diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_pssl.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_pssl.cpp new file mode 100644 index 00000000000..a6a6461dbd2 --- /dev/null +++ b/3rdparty/bgfx/tools/shaderc/shaderc_pssl.cpp @@ -0,0 +1,17 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "shaderc.h" + +namespace bgfx +{ + bool compilePSSLShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer) + { + BX_UNUSED(_cmdLine, _version, _code, _writer); + fprintf(stderr, "PSSL compiler is not supported.\n"); + return false; + } + +} // namespace bgfx diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_spirv.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_spirv.cpp new file mode 100644 index 00000000000..768ec54fbca --- /dev/null +++ b/3rdparty/bgfx/tools/shaderc/shaderc_spirv.cpp @@ -0,0 +1,17 @@ +/* + * Copyright 2011-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "shaderc.h" + +namespace bgfx +{ + bool compileSPIRVShader(bx::CommandLine& _cmdLine, uint32_t _version, const std::string& _code, bx::WriterI* _writer) + { + BX_UNUSED(_cmdLine, _version, _code, _writer); + fprintf(stderr, "SPIR-V compiler is not supported.\n"); + return false; + } + +} // namespace bgfx diff --git a/3rdparty/bgfx/tools/texturec/texturec.cpp b/3rdparty/bgfx/tools/texturec/texturec.cpp index 0640d25e30c..e950ab82855 100644 --- a/3rdparty/bgfx/tools/texturec/texturec.cpp +++ b/3rdparty/bgfx/tools/texturec/texturec.cpp @@ -153,7 +153,7 @@ namespace bgfx case LCT_GREY: for (uint32_t ii = 0, num = width*height; ii < num; ++ii) { - uint16_t* rgba = (uint16_t*)out + ii*4; + uint16_t* rgba = (uint16_t*)out + ii; rgba[0] = bx::toHostEndian(rgba[0], false); } format = bgfx::TextureFormat::R16; @@ -163,12 +163,12 @@ namespace bgfx case LCT_GREY_ALPHA: for (uint32_t ii = 0, num = width*height; ii < num; ++ii) { - uint16_t* rgba = (uint16_t*)out + ii*4; + uint16_t* rgba = (uint16_t*)out + ii*2; rgba[0] = bx::toHostEndian(rgba[0], false); rgba[1] = bx::toHostEndian(rgba[1], false); } - format = bgfx::TextureFormat::R16; - bpp = 16; + format = bgfx::TextureFormat::RG16; + bpp = 32; break; case LCT_RGBA: @@ -207,19 +207,20 @@ namespace bgfx if (loaded) { - _imageContainer.m_data = *_out; - _imageContainer.m_size = width*height*bpp/8; - _imageContainer.m_offset = 0; - _imageContainer.m_width = width; - _imageContainer.m_height = height; - _imageContainer.m_depth = 1; - _imageContainer.m_format = format; - _imageContainer.m_numMips = 1; - _imageContainer.m_hasAlpha = true; - _imageContainer.m_cubeMap = false; - _imageContainer.m_ktx = false; - _imageContainer.m_ktxLE = false; - _imageContainer.m_srgb = false; + _imageContainer.m_data = *_out; + _imageContainer.m_size = width*height*bpp/8; + _imageContainer.m_offset = 0; + _imageContainer.m_width = width; + _imageContainer.m_height = height; + _imageContainer.m_depth = 1; + _imageContainer.m_numLayers = 1; + _imageContainer.m_format = format; + _imageContainer.m_numMips = 1; + _imageContainer.m_hasAlpha = true; + _imageContainer.m_cubeMap = false; + _imageContainer.m_ktx = false; + _imageContainer.m_ktxLE = false; + _imageContainer.m_srgb = false; } } @@ -662,10 +663,10 @@ int main(int _argc, const char* _argv[]) { const uint32_t offset = (yy*mip.m_width + xx) * 4; float* inout = &rgba[offset]; - inout[0] = inout[0] * 2.0f/255.0f - 1.0f; - inout[1] = inout[1] * 2.0f/255.0f - 1.0f; - inout[2] = inout[2] * 2.0f/255.0f - 1.0f; - inout[3] = inout[3] * 2.0f/255.0f - 1.0f; + inout[0] = inout[0] * 2.0f - 1.0f; + inout[1] = inout[1] * 2.0f - 1.0f; + inout[2] = inout[2] * 2.0f - 1.0f; + inout[3] = inout[3] * 2.0f - 1.0f; } } } @@ -852,6 +853,11 @@ int main(int _argc, const char* _argv[]) imageFree(output); } + else + { + help("No output generated."); + return EXIT_FAILURE; + } } else { diff --git a/3rdparty/bx/include/bx/bx.h b/3rdparty/bx/include/bx/bx.h index 80e9b765e10..c9419b39357 100644 --- a/3rdparty/bx/include/bx/bx.h +++ b/3rdparty/bx/include/bx/bx.h @@ -82,6 +82,6 @@ namespace bx } // namespace bx // Annoying C++0x stuff.. -namespace std { namespace tr1 {}; using namespace tr1; } +//namespace std { namespace tr1 {}; using namespace tr1; } #endif // BX_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/commandline.h b/3rdparty/bx/include/bx/commandline.h index 2106b87ed5a..d35843f8972 100644 --- a/3rdparty/bx/include/bx/commandline.h +++ b/3rdparty/bx/include/bx/commandline.h @@ -22,25 +22,31 @@ namespace bx const char* findOption(const char* _long, const char* _default) const { - const char* result = find('\0', _long, 1); + const char* result = find(0, '\0', _long, 1); return result == NULL ? _default : result; } const char* findOption(const char _short, const char* _long, const char* _default) const { - const char* result = find(_short, _long, 1); + const char* result = find(0, _short, _long, 1); return result == NULL ? _default : result; } const char* findOption(const char* _long, int _numParams = 1) const { - const char* result = find('\0', _long, _numParams); + const char* result = find(0, '\0', _long, _numParams); return result; } const char* findOption(const char _short, const char* _long = NULL, int _numParams = 1) const { - const char* result = find(_short, _long, _numParams); + const char* result = find(0, _short, _long, _numParams); + return result; + } + + const char* findOption(int _skip, const char _short, const char* _long = NULL, int _numParams = 1) const + { + const char* result = find(_skip, _short, _long, _numParams); return result; } @@ -132,7 +138,7 @@ namespace bx } private: - const char* find(const char _short, const char* _long, int _numParams) const + const char* find(int _skip, const char _short, const char* _long, int _numParams) const { for (int ii = 0; ii < m_argc; ++ii) { @@ -144,34 +150,46 @@ namespace bx { if (1 == strlen(arg) ) { - if (0 == _numParams) - { - return ""; - } - else if (ii+_numParams < m_argc - && '-' != *m_argv[ii+1] ) + if (0 == _skip) { - return m_argv[ii+1]; + if (0 == _numParams) + { + return ""; + } + else if (ii+_numParams < m_argc + && '-' != *m_argv[ii+1] ) + { + return m_argv[ii+1]; + } + + return NULL; } - return NULL; + --_skip; + ii += _numParams; } } else if (NULL != _long && '-' == *arg && 0 == stricmp(arg+1, _long) ) { - if (0 == _numParams) + if (0 == _skip) { - return ""; - } - else if (ii+_numParams < m_argc - && '-' != *m_argv[ii+1] ) - { - return m_argv[ii+1]; + if (0 == _numParams) + { + return ""; + } + else if (ii+_numParams < m_argc + && '-' != *m_argv[ii+1] ) + { + return m_argv[ii+1]; + } + + return NULL; } - return NULL; + --_skip; + ii += _numParams; } } } diff --git a/3rdparty/bx/include/bx/config.h b/3rdparty/bx/include/bx/config.h index 59917706b43..43c08ec0f24 100644 --- a/3rdparty/bx/include/bx/config.h +++ b/3rdparty/bx/include/bx/config.h @@ -28,6 +28,7 @@ # define BX_CONFIG_CRT_PROCESS !(0 \ || BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_NACL \ + || BX_PLATFORM_PS4 \ || BX_PLATFORM_WINRT \ || BX_PLATFORM_XBOXONE \ ) diff --git a/3rdparty/bx/include/bx/crtimpl.h b/3rdparty/bx/include/bx/crtimpl.h index 71b9e61e1c6..dff0120f71c 100644 --- a/3rdparty/bx/include/bx/crtimpl.h +++ b/3rdparty/bx/include/bx/crtimpl.h @@ -82,6 +82,23 @@ namespace bx #endif // BX_CONFIG_ALLOCATOR_CRT #if BX_CONFIG_CRT_FILE_READER_WRITER + +# if BX_CRT_MSVC +# define fseeko64 _fseeki64 +# define ftello64 _ftelli64 +# elif 0 \ + || BX_PLATFORM_ANDROID \ + || BX_PLATFORM_BSD \ + || BX_PLATFORM_IOS \ + || BX_PLATFORM_OSX \ + || BX_PLATFORM_QNX +# define fseeko64 fseeko +# define ftello64 ftello +# elif BX_PLATFORM_PS4 +# define fseeko64 fseek +# define ftello64 ftell +# endif // BX_ + class CrtFileReader : public FileReaderI { public: @@ -126,7 +143,15 @@ namespace bx 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."); + if (0 != feof(m_file) ) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_EOF, "CrtFileWriter: EOF."); + } + else if (0 != ferror(m_file) ) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "CrtFileWriter: read error."); + } + return size >= 0 ? size : 0; } @@ -240,6 +265,15 @@ namespace bx int32_t size = (int32_t)fread(_data, 1, _size, m_file); if (size != _size) { + if (0 != feof(m_file) ) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_EOF, "CrtFileWriter: EOF."); + } + else if (0 != ferror(m_file) ) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "CrtFileWriter: read error."); + } + return size >= 0 ? size : 0; } @@ -291,6 +325,11 @@ namespace bx int32_t size = (int32_t)fwrite(_data, 1, _size, m_file); if (size != _size) { + if (0 != ferror(m_file) ) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "CrtFileWriter: write error."); + } + return size >= 0 ? size : 0; } diff --git a/3rdparty/bx/include/bx/error.h b/3rdparty/bx/include/bx/error.h index d98a111f5af..da1b8329b6f 100644 --- a/3rdparty/bx/include/bx/error.h +++ b/3rdparty/bx/include/bx/error.h @@ -72,11 +72,16 @@ namespace bx return result; } - bool operator==(ErrorResult _rhs) const + bool operator==(const ErrorResult& _rhs) const { return _rhs.code == m_code; } + bool operator!=(const ErrorResult& _rhs) const + { + return _rhs.code != m_code; + } + private: const char* m_msg; uint32_t m_code; diff --git a/3rdparty/bx/include/bx/handlealloc.h b/3rdparty/bx/include/bx/handlealloc.h index aad39cdd6f3..bc8b42f47d4 100644 --- a/3rdparty/bx/include/bx/handlealloc.h +++ b/3rdparty/bx/include/bx/handlealloc.h @@ -8,9 +8,11 @@ #include "bx.h" #include "allocator.h" +#include "uint32_t.h" namespace bx { + /// class HandleAlloc { public: @@ -127,6 +129,7 @@ namespace bx BX_FREE(_allocator, _handleAlloc); } + /// template <uint16_t MaxHandlesT> class HandleAllocT : public HandleAlloc { @@ -144,6 +147,7 @@ namespace bx uint16_t m_padding[2*MaxHandlesT]; }; + /// template <uint16_t MaxHandlesT> class HandleListT { @@ -327,6 +331,7 @@ namespace bx Link m_links[MaxHandlesT]; }; + /// template <uint16_t MaxHandlesT> class HandleAllocLruT { @@ -422,6 +427,319 @@ namespace bx HandleAllocT<MaxHandlesT> m_alloc; }; + /// + template <uint32_t MaxCapacityT, typename KeyT = uint32_t> + class HandleHashMapT + { + public: + static const uint16_t invalid = UINT16_MAX; + + HandleHashMapT() + : m_maxCapacity(MaxCapacityT) + { + reset(); + } + + ~HandleHashMapT() + { + } + + bool insert(KeyT _key, uint16_t _handle) + { + if (invalid == _handle) + { + return false; + } + + const KeyT hash = mix(_key); + const uint32_t firstIdx = hash % MaxCapacityT; + uint32_t idx = firstIdx; + do + { + if (m_handle[idx] == invalid) + { + m_key[idx] = _key; + m_handle[idx] = _handle; + ++m_numElements; + return true; + } + + if (m_key[idx] == _key) + { + return false; + } + + idx = (idx + 1) % MaxCapacityT; + + } while (idx != firstIdx); + + return false; + } + + bool removeByKey(KeyT _key) + { + uint32_t idx = findIndex(_key); + if (UINT32_MAX != idx) + { + removeIndex(idx); + return true; + } + + return false; + } + + bool removeByHandle(uint16_t _handle) + { + if (invalid != _handle) + { + for (uint32_t idx = 0; idx < MaxCapacityT; ++idx) + { + if (m_handle[idx] == _handle) + { + removeIndex(idx); + } + } + } + + return false; + } + + uint16_t find(KeyT _key) const + { + uint32_t idx = findIndex(_key); + if (UINT32_MAX != idx) + { + return m_handle[idx]; + } + + return invalid; + } + + void reset() + { + memset(m_handle, 0xff, sizeof(m_handle) ); + m_numElements = 0; + } + + uint32_t getNumElements() const + { + return m_numElements; + } + + uint32_t getMaxCapacity() const + { + return m_maxCapacity; + } + + struct Iterator + { + uint16_t handle; + + private: + friend class HandleHashMapT<MaxCapacityT, KeyT>; + uint32_t pos; + uint32_t num; + }; + + Iterator first() const + { + Iterator it; + it.handle = invalid; + it.pos = 0; + it.num = m_numElements; + + if (0 == it.num) + { + return it; + } + + ++it.num; + next(it); + return it; + } + + bool next(Iterator& _it) const + { + if (0 == _it.num) + { + return false; + } + + for ( + ;_it.pos < MaxCapacityT && invalid == m_handle[_it.pos] + ; ++_it.pos + ); + _it.handle = m_handle[_it.pos]; + ++_it.pos; + --_it.num; + return true; + } + + private: + uint32_t findIndex(KeyT _key) const + { + const KeyT hash = mix(_key); + + const uint32_t firstIdx = hash % MaxCapacityT; + uint32_t idx = firstIdx; + do + { + if (m_handle[idx] == invalid) + { + return UINT32_MAX; + } + + if (m_key[idx] == _key) + { + return idx; + } + + idx = (idx + 1) % MaxCapacityT; + + } while (idx != firstIdx); + + return UINT32_MAX; + } + + void removeIndex(uint32_t _idx) + { + m_handle[_idx] = invalid; + --m_numElements; + + for (uint32_t idx = (_idx + 1) % MaxCapacityT + ; m_handle[idx] != invalid + ; idx = (idx + 1) % MaxCapacityT) + { + if (m_handle[idx] != invalid) + { + const KeyT key = m_key[idx]; + if (idx != findIndex(key) ) + { + const uint16_t handle = m_handle[idx]; + m_handle[idx] = invalid; + --m_numElements; + insert(key, handle); + } + } + } + } + + uint32_t mix(uint32_t _x) const + { + const uint32_t tmp0 = uint32_mul(_x, UINT32_C(2246822519) ); + const uint32_t tmp1 = uint32_rol(tmp0, 13); + const uint32_t result = uint32_mul(tmp1, UINT32_C(2654435761) ); + return result; + } + + uint64_t mix(uint64_t _x) const + { + const uint64_t tmp0 = uint64_mul(_x, UINT64_C(14029467366897019727) ); + const uint64_t tmp1 = uint64_rol(tmp0, 31); + const uint64_t result = uint64_mul(tmp1, UINT64_C(11400714785074694791) ); + return result; + } + + uint32_t m_maxCapacity; + uint32_t m_numElements; + + KeyT m_key[MaxCapacityT]; + uint16_t m_handle[MaxCapacityT]; + }; + + /// + template <uint16_t MaxHandlesT, typename KeyT = uint32_t> + class HandleHashMapAllocT + { + public: + static const uint16_t invalid = UINT16_MAX; + + HandleHashMapAllocT() + { + reset(); + } + + ~HandleHashMapAllocT() + { + } + + uint16_t alloc(KeyT _key) + { + uint16_t handle = m_alloc.alloc(); + if (invalid == handle) + { + return invalid; + } + + bool ok = m_table.insert(_key, handle); + if (!ok) + { + m_alloc.free(handle); + return invalid; + } + + return handle; + } + + void free(KeyT _key) + { + uint16_t handle = m_table.find(_key); + if (invalid == handle) + { + return; + } + + m_table.removeByKey(_key); + m_alloc.free(handle); + } + + void free(uint16_t _handle) + { + m_table.removeByHandle(_handle); + m_alloc.free(_handle); + } + + uint16_t find(KeyT _key) const + { + return m_table.find(_key); + } + + const uint16_t* getHandles() const + { + return m_alloc.getHandles(); + } + + uint16_t getHandleAt(uint16_t _at) const + { + return m_alloc.getHandleAt(_at); + } + + uint16_t getNumHandles() const + { + return m_alloc.getNumHandles(); + } + + uint16_t getMaxHandles() const + { + return m_alloc.getMaxHandles(); + } + + bool isValid(uint16_t _handle) const + { + return m_alloc.isValid(_handle); + } + + void reset() + { + m_table.reset(); + m_alloc.reset(); + } + + private: + HandleHashMapT<MaxHandlesT+MaxHandlesT/2, KeyT> m_table; + HandleAllocT<MaxHandlesT> m_alloc; + }; + } // namespace bx #endif // BX_HANDLE_ALLOC_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/hash.h b/3rdparty/bx/include/bx/hash.h index 4250115622f..6e2f0849309 100644 --- a/3rdparty/bx/include/bx/hash.h +++ b/3rdparty/bx/include/bx/hash.h @@ -162,6 +162,7 @@ namespace bx template <typename Ty> inline uint32_t hashMurmur2A(const Ty& _data) { + BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); return hashMurmur2A(&_data, sizeof(Ty) ); } diff --git a/3rdparty/bx/include/bx/macros.h b/3rdparty/bx/include/bx/macros.h index 90a0ca8c132..d565fcad103 100644 --- a/3rdparty/bx/include/bx/macros.h +++ b/3rdparty/bx/include/bx/macros.h @@ -7,6 +7,7 @@ #define BX_MACROS_H_HEADER_GUARD #include "bx.h" +#include <type_traits> /// #if BX_COMPILER_MSVC @@ -180,12 +181,10 @@ #endif // BX_COMPILER_ /// -#if BX_COMPILER_GCC && defined(__is_pod) -# define BX_TYPE_IS_POD(t) __is_pod(t) -#elif BX_COMPILER_MSVC +#if BX_COMPILER_MSVC # define BX_TYPE_IS_POD(t) (!__is_class(t) || __is_pod(t)) #else -# define BX_TYPE_IS_POD(t) false +# define BX_TYPE_IS_POD(t) std::is_pod<t>::value #endif /// #define BX_CLASS_NO_DEFAULT_CTOR(_class) \ diff --git a/3rdparty/bx/include/bx/os.h b/3rdparty/bx/include/bx/os.h index 39505d73989..58c315af7c8 100644 --- a/3rdparty/bx/include/bx/os.h +++ b/3rdparty/bx/include/bx/os.h @@ -49,7 +49,7 @@ # elif BX_PLATFORM_OSX # include <mach/mach.h> // mach_task_basic_info # elif BX_PLATFORM_HURD -# include <unistd.h> // getpid +# include <pthread/pthread.h> // pthread_self # elif BX_PLATFORM_ANDROID # include "debug.h" // getTid is not implemented... # endif // BX_PLATFORM_ANDROID @@ -222,6 +222,36 @@ namespace bx #endif // BX_PLATFORM_ } + inline bool getenv(const char* _name, char* _out, uint32_t* _inOutSize) + { +#if BX_PLATFORM_WINDOWS + DWORD len = ::GetEnvironmentVariableA(_name, _out, *_inOutSize); + bool result = len != 0 && len < *_inOutSize; + *_inOutSize = len; + return result; +#elif BX_PLATFORM_PS4 \ + || BX_PLATFORM_XBOXONE \ + || BX_PLATFORM_WINRT + BX_UNUSED(_name, _out, _inOutSize); + return false; +#else + const char* ptr = ::getenv(_name); + uint32_t len = 0; + if (NULL != ptr) + { + len = (uint32_t)strlen(ptr); + } + bool result = len != 0 && len < *_inOutSize; + if (len < *_inOutSize) + { + strcpy(_out, ptr); + } + + *_inOutSize = len; + return result; +#endif // BX_PLATFORM_ + } + inline void setenv(const char* _name, const char* _value) { #if BX_PLATFORM_WINDOWS diff --git a/3rdparty/bx/include/bx/readerwriter.h b/3rdparty/bx/include/bx/readerwriter.h index 47c5899d3f1..ee6897b8253 100644 --- a/3rdparty/bx/include/bx/readerwriter.h +++ b/3rdparty/bx/include/bx/readerwriter.h @@ -16,17 +16,10 @@ #include "error.h" #include "uint32_t.h" -#if BX_CRT_MSVC -# define fseeko64 _fseeki64 -# define ftello64 _ftelli64 -#elif BX_PLATFORM_ANDROID || BX_PLATFORM_BSD || BX_PLATFORM_IOS || BX_PLATFORM_OSX || BX_PLATFORM_QNX -# define fseeko64 fseeko -# define ftello64 ftello -#endif // BX_ - BX_ERROR_RESULT(BX_ERROR_READERWRITER_OPEN, BX_MAKEFOURCC('R', 'W', 0, 1) ); BX_ERROR_RESULT(BX_ERROR_READERWRITER_READ, BX_MAKEFOURCC('R', 'W', 0, 2) ); BX_ERROR_RESULT(BX_ERROR_READERWRITER_WRITE, BX_MAKEFOURCC('R', 'W', 0, 3) ); +BX_ERROR_RESULT(BX_ERROR_READERWRITER_EOF, BX_MAKEFOURCC('R', 'W', 0, 4) ); namespace bx { diff --git a/3rdparty/bx/include/bx/simd_ni.inl b/3rdparty/bx/include/bx/simd_ni.inl index cab10861e5e..95767f25b95 100644 --- a/3rdparty/bx/include/bx/simd_ni.inl +++ b/3rdparty/bx/include/bx/simd_ni.inl @@ -214,7 +214,7 @@ namespace bx { const Ty tmp1 = simd_div(_a, result); const Ty tmp2 = simd_add(tmp1, result); - result = simd_mul(tmp2, half); + result = simd_mul(tmp2, half); } return result; @@ -528,11 +528,11 @@ namespace bx template<typename Ty> BX_SIMD_INLINE bool simd_test_any_ni(Ty _a) { - const Ty mask = simd_sra(_a, 31); - const Ty zwxy = simd_swiz_zwxy(mask); - const Ty tmp0 = simd_or(mask, zwxy); - const Ty tmp1 = simd_swiz_yyyy(tmp0); - const Ty tmp2 = simd_or(tmp0, tmp1); + const Ty mask = simd_sra(_a, 31); + const Ty zwxy = simd_swiz_zwxy(mask); + const Ty tmp0 = simd_or(mask, zwxy); + const Ty tmp1 = simd_swiz_yyyy(tmp0); + const Ty tmp2 = simd_or(tmp0, tmp1); int res; simd_stx(&res, tmp2); return 0 != res; @@ -541,13 +541,13 @@ namespace bx template<typename Ty> BX_SIMD_INLINE bool simd_test_all_ni(Ty _a) { - const Ty bits = simd_sra(_a, 31); - const Ty m1248 = simd_ild<Ty>(1, 2, 4, 8); - const Ty mask = simd_and(bits, m1248); - const Ty zwxy = simd_swiz_zwxy(mask); - const Ty tmp0 = simd_or(mask, zwxy); - const Ty tmp1 = simd_swiz_yyyy(tmp0); - const Ty tmp2 = simd_or(tmp0, tmp1); + const Ty bits = simd_sra(_a, 31); + const Ty m1248 = simd_ild<Ty>(1, 2, 4, 8); + const Ty mask = simd_and(bits, m1248); + const Ty zwxy = simd_swiz_zwxy(mask); + const Ty tmp0 = simd_or(mask, zwxy); + const Ty tmp1 = simd_swiz_yyyy(tmp0); + const Ty tmp2 = simd_or(tmp0, tmp1); int res; simd_stx(&res, tmp2); return 0xf == res; diff --git a/3rdparty/bx/include/bx/string.h b/3rdparty/bx/include/bx/string.h index 1bd322528b3..ea21ff37f07 100644 --- a/3rdparty/bx/include/bx/string.h +++ b/3rdparty/bx/include/bx/string.h @@ -14,6 +14,9 @@ #include <string.h> #include <wchar.h> // wchar_t +#include <bx/allocator.h> +#include <bx/hash.h> + #ifndef va_copy # define va_copy(_a, _b) (_a) = (_b) #endif // va_copy @@ -40,9 +43,8 @@ namespace bx /// inline size_t strnlen(const char* _str, size_t _max) { - const char* end = _str + _max; const char* ptr; - for (ptr = _str; ptr < end && *ptr != '\0'; ++ptr) {}; + for (ptr = _str; 0 < _max && *ptr != '\0'; ++ptr, --_max) {}; return ptr - _str; } @@ -528,6 +530,153 @@ namespace bx return(dlen + (s - _src)); /* count does not include NUL */ } + /// Non-zero-terminated string view. + class StringView + { + public: + StringView() + { + clear(); + } + + StringView(const StringView& _rhs) + { + set(_rhs.m_ptr, _rhs.m_len); + } + + StringView& operator=(const StringView& _rhs) + { + set(_rhs.m_ptr, _rhs.m_len); + return *this; + } + + StringView(const char* _ptr, uint32_t _len = UINT32_MAX) + { + set(_ptr, _len); + } + + void set(const char* _ptr, uint32_t _len = UINT32_MAX) + { + clear(); + + if (NULL != _ptr) + { + uint32_t len = uint32_t(strnlen(_ptr, _len) ); + if (0 != len) + { + m_len = len; + m_ptr = _ptr; + } + } + } + + void clear() + { + m_ptr = ""; + m_len = 0; + } + + const char* getPtr() const + { + return m_ptr; + } + + const char* getTerm() const + { + return m_ptr + m_len; + } + + bool isEmpty() const + { + return 0 == m_len; + } + + uint32_t getLength() const + { + return m_len; + } + + protected: + friend uint32_t hashMurmur2A(const StringView& _data); + + const char* m_ptr; + uint32_t m_len; + }; + + inline uint32_t hashMurmur2A(const StringView& _data) + { + return hashMurmur2A(_data.m_ptr, _data.m_len); + } + + inline uint32_t hashMurmur2A(const char* _data) + { + return hashMurmur2A(StringView(_data) ); + } + + /// ASCII string + template<bx::AllocatorI** AllocatorT> + class StringT : public StringView + { + public: + StringT() + : StringView("", 0) + { + } + + StringT(const StringT<AllocatorT>& _rhs) + { + set(_rhs.m_ptr, _rhs.m_len); + } + + StringT<AllocatorT>& operator=(const StringT<AllocatorT>& _rhs) + { + set(_rhs.m_ptr, _rhs.m_len); + return *this; + } + + StringT(const char* _ptr, uint32_t _len = UINT32_MAX) + { + set(_ptr, _len); + } + + StringT(const StringView& _rhs) + { + set(_rhs.getPtr(), _rhs.getLength() ); + } + + ~StringT() + { + clear(); + } + + void set(const char* _ptr, uint32_t _len = UINT32_MAX) + { + clear(); + + if (0 != _len) + { + uint32_t len = uint32_t(strnlen(_ptr, _len) ); + m_len = len; + char* ptr = (char*)BX_ALLOC(*AllocatorT, len+1); + + memcpy(ptr, _ptr, len); + ptr[len] = '\0'; + + *const_cast<char**>(&m_ptr) = ptr; + } + } + + void clear() + { + if (0 != m_len) + { + BX_FREE(*AllocatorT, const_cast<char*>(m_ptr) ); + + StringView::clear(); + } + } + }; + } // namespace bx #endif // BX_STRING_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/uint32_t.h b/3rdparty/bx/include/bx/uint32_t.h index 50f8e097a22..2f78ac3f34a 100644 --- a/3rdparty/bx/include/bx/uint32_t.h +++ b/3rdparty/bx/include/bx/uint32_t.h @@ -263,11 +263,21 @@ namespace bx return _a > _b ? _b : _a; } + inline uint32_t uint32_min(uint32_t _a, uint32_t _b, uint32_t _c) + { + return uint32_min(_a, uint32_min(_b, _c) ); + } + inline uint32_t uint32_max(uint32_t _a, uint32_t _b) { return _a > _b ? _a : _b; } + inline uint32_t uint32_max(uint32_t _a, uint32_t _b, uint32_t _c) + { + return uint32_max(_a, uint32_max(_b, _c) ); + } + inline uint32_t uint32_clamp(uint32_t _a, uint32_t _min, uint32_t _max) { const uint32_t tmp = uint32_max(_a, _min); @@ -692,6 +702,46 @@ namespace bx #endif // BX_COMPILER_ } + inline uint64_t uint64_sll(uint64_t _a, int _sa) + { + return _a << _sa; + } + + inline uint64_t uint64_srl(uint64_t _a, int _sa) + { + return _a >> _sa; + } + + inline uint64_t uint64_sra(uint64_t _a, int _sa) + { + return ( (int64_t)_a) >> _sa; + } + + inline uint64_t uint64_rol(uint64_t _a, int _sa) + { + return ( _a << _sa) | (_a >> (32-_sa) ); + } + + inline uint64_t uint64_ror(uint64_t _a, int _sa) + { + return ( _a >> _sa) | (_a << (32-_sa) ); + } + + inline uint64_t uint64_add(uint64_t _a, uint64_t _b) + { + return _a + _b; + } + + inline uint64_t uint64_sub(uint64_t _a, uint64_t _b) + { + return _a - _b; + } + + inline uint64_t uint64_mul(uint64_t _a, uint64_t _b) + { + return _a * _b; + } + /// Greatest common divisor. inline uint32_t uint32_gcd(uint32_t _a, uint32_t _b) { diff --git a/3rdparty/bx/include/compat/freebsd/dirent.h b/3rdparty/bx/include/compat/freebsd/dirent.h new file mode 100644 index 00000000000..b4f586b1890 --- /dev/null +++ b/3rdparty/bx/include/compat/freebsd/dirent.h @@ -0,0 +1 @@ +#include <sys/dirent.h> diff --git a/3rdparty/bx/scripts/genie.lua b/3rdparty/bx/scripts/genie.lua index fdde771d60d..edc86a7823b 100644 --- a/3rdparty/bx/scripts/genie.lua +++ b/3rdparty/bx/scripts/genie.lua @@ -49,8 +49,64 @@ project "bx.test" } files { - path.join(BX_DIR, "tests/**.cpp"), - path.join(BX_DIR, "tests/**.H"), + path.join(BX_DIR, "tests/*_test.cpp"), + path.join(BX_DIR, "tests/*_test.H"), + path.join(BX_DIR, "tests/dbg.*"), + } + + configuration { "vs* or mingw*" } + links { + "psapi", + } + + configuration { "android*" } + targetextension ".so" + linkoptions { + "-shared", + } + + configuration { "nacl or nacl-arm" } + targetextension ".nexe" + links { + "ppapi", + "pthread", + } + + configuration { "pnacl" } + targetextension ".pexe" + links { + "ppapi", + "pthread", + } + + configuration { "linux-*" } + links { + "pthread", + } + + configuration { "osx" } + links { + "Cocoa.framework", + } + + configuration {} + + strip() + +project "bx.bench" + kind "ConsoleApp" + + debugdir (path.join(BX_DIR, "tests")) + + includedirs { + path.join(BX_DIR, "include"), + BX_THIRD_PARTY_DIR, + } + + files { + path.join(BX_DIR, "tests/*_bench.cpp"), + path.join(BX_DIR, "tests/*_bench.h"), + path.join(BX_DIR, "tests/dbg.*"), } configuration { "vs* or mingw*" } diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua index 59795b2be9d..fced6542b9a 100644 --- a/3rdparty/bx/scripts/toolchain.lua +++ b/3rdparty/bx/scripts/toolchain.lua @@ -20,12 +20,13 @@ function toolchain(_buildDir, _libDir) { "freebsd", "FreeBSD" }, { "linux-gcc", "Linux (GCC compiler)" }, { "linux-gcc-afl", "Linux (GCC + AFL fuzzer)" }, - { "linux-gcc-5", "Linux (GCC-5 compiler)" }, + { "linux-gcc-6", "Linux (GCC-6 compiler)" }, { "linux-clang", "Linux (Clang compiler)" }, { "linux-clang-afl", "Linux (Clang + AFL fuzzer)" }, { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" }, { "linux-arm-gcc", "Linux (ARM, GCC compiler)" }, { "ios-arm", "iOS - ARM" }, + { "ios-arm64", "iOS - ARM64" }, { "ios-simulator", "iOS - Simulator" }, { "tvos-arm64", "tvOS - ARM64" }, { "tvos-simulator", "tvOS - Simulator" }, @@ -36,7 +37,7 @@ function toolchain(_buildDir, _libDir) { "netbsd", "NetBSD" }, { "osx", "OSX" }, { "pnacl", "Native Client - PNaCl" }, - { "ps4", "PS4" }, + { "orbis", "Orbis" }, { "qnx-arm", "QNX/Blackberry - ARM" }, { "rpi", "RaspberryPi" }, }, @@ -58,6 +59,7 @@ function toolchain(_buildDir, _libDir) { "winstore81", "Windows Store 8.1" }, { "winstore82", "Universal Windows App" }, { "durango", "Durango" }, + { "orbis", "Orbis" }, }, } @@ -195,11 +197,12 @@ function toolchain(_buildDir, _libDir) elseif "freebsd" == _OPTIONS["gcc"] then location (path.join(_buildDir, "projects", _ACTION .. "-freebsd")) - elseif "ios-arm" == _OPTIONS["gcc"] then + elseif "ios-arm" == _OPTIONS["gcc"] + or "ios-arm64" == _OPTIONS["gcc"] then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" premake.gcc.ar = "ar" - location (path.join(_buildDir, "projects", _ACTION .. "-ios-arm")) + location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"])) elseif "ios-simulator" == _OPTIONS["gcc"] then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" @@ -228,9 +231,9 @@ function toolchain(_buildDir, _libDir) premake.gcc.ar = "ar" location (path.join(_buildDir, "projects", _ACTION .. "-linux")) - elseif "linux-gcc-5" == _OPTIONS["gcc"] then - premake.gcc.cc = "gcc-5" - premake.gcc.cxx = "g++-5" + elseif "linux-gcc-6" == _OPTIONS["gcc"] then + premake.gcc.cc = "gcc-6" + premake.gcc.cxx = "g++-6" premake.gcc.ar = "ar" location (path.join(_buildDir, "projects", _ACTION .. "-linux")) @@ -356,18 +359,18 @@ function toolchain(_buildDir, _libDir) premake.gcc.ar = naclToolchain .. "ar" location (path.join(_buildDir, "projects", _ACTION .. "-pnacl")) - elseif "ps4" == _OPTIONS["gcc"] then + elseif "orbis" == _OPTIONS["gcc"] then - if not os.getenv("PS4_SDK_ROOT") then - print("Set PS4_SDK_ROOT enviroment variable.") + if not os.getenv("SCE_ORBIS_SDK_DIR") then + print("Set SCE_ORBIS_SDK_DIR enviroment variable.") end - ps4Toolchain = "$(PS4_SDK_ROOT)/host_tools/bin/orbis-" + orbisToolchain = "$(SCE_ORBIS_SDK_DIR)/host_tools/bin/orbis-" - premake.gcc.cc = ps4Toolchain .. "clang" - premake.gcc.cxx = ps4Toolchain .. "clang++" - premake.gcc.ar = ps4Toolchain .. "ar" - location (path.join(_buildDir, "projects", _ACTION .. "-ps4")) + premake.gcc.cc = orbisToolchain .. "clang" + premake.gcc.cxx = orbisToolchain .. "clang++" + premake.gcc.ar = orbisToolchain .. "ar" + location (path.join(_buildDir, "projects", _ACTION .. "-orbis")) elseif "qnx-arm" == _OPTIONS["gcc"] then @@ -431,6 +434,15 @@ function toolchain(_buildDir, _libDir) premake.vstudio.storeapp = "durango" platforms { "Durango" } location (path.join(_buildDir, "projects", _ACTION .. "-durango")) + elseif "orbis" == _OPTIONS["vs"] then + + if not os.getenv("SCE_ORBIS_SDK_DIR") then + print("Set SCE_ORBIS_SDK_DIR enviroment variable.") + end + + platforms { "Orbis" } + location (path.join(_buildDir, "projects", _ACTION .. "-orbis")) + end elseif ("vs2012-xp") == _OPTIONS["vs"] then @@ -485,6 +497,11 @@ function toolchain(_buildDir, _libDir) "__STDC_CONSTANT_MACROS", } + configuration { "qbs" } + flags { + "ExtraWarnings", + } + configuration { "Debug" } targetsuffix "Debug" @@ -500,7 +517,7 @@ function toolchain(_buildDir, _libDir) "EnableSSE2", } - configuration { "vs*" } + configuration { "vs*", "not orbis" } includedirs { path.join(bxDir, "include/compat/msvc") } defines { "WIN32", @@ -637,7 +654,7 @@ function toolchain(_buildDir, _libDir) configuration { "linux-clang" } - configuration { "linux-gcc-5" } + configuration { "linux-gcc-6" } buildoptions { -- "-fno-omit-frame-pointer", -- "-fsanitize=address", @@ -1056,8 +1073,26 @@ function toolchain(_buildDir, _libDir) objdir (path.join(_buildDir, "ios-arm/obj")) libdirs { path.join(_libDir, "lib/ios-arm") } linkoptions { - "-miphoneos-version-min=7.0", "-arch armv7", + } + buildoptions { + "-arch armv7", + } + + configuration { "ios-arm64" } + targetdir (path.join(_buildDir, "ios-arm64/bin")) + objdir (path.join(_buildDir, "ios-arm64/obj")) + libdirs { path.join(_libDir, "lib/ios-arm64") } + linkoptions { + "-arch arm64", + } + buildoptions { + "-arch arm64", + } + + configuration { "ios-arm*" } + linkoptions { + "-miphoneos-version-min=7.0", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk", "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system", "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks", @@ -1065,7 +1100,6 @@ function toolchain(_buildDir, _libDir) } buildoptions { "-miphoneos-version-min=7.0", - "-arch armv7", "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk", } @@ -1138,14 +1172,14 @@ function toolchain(_buildDir, _libDir) "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk", } - configuration { "ps4" } - targetdir (path.join(_buildDir, "ps4/bin")) - objdir (path.join(_buildDir, "ps4/obj")) - libdirs { path.join(_libDir, "lib/ps4") } + configuration { "orbis" } + targetdir (path.join(_buildDir, "orbis/bin")) + objdir (path.join(_buildDir, "orbis/obj")) + libdirs { path.join(_libDir, "lib/orbis") } includedirs { path.join(bxDir, "include/compat/freebsd"), - "$(PS4_SDK_ROOT)/target/include", - "$(PS4_SDK_ROOT)/target/include_common", + "$(SCE_ORBIS_SDK_DIR)/target/include", + "$(SCE_ORBIS_SDK_DIR)/target/include_common", } buildoptions { } diff --git a/3rdparty/bx/tests/fpumath.cpp b/3rdparty/bx/tests/fpumath_test.cpp index 8f98ea28365..8f98ea28365 100644 --- a/3rdparty/bx/tests/fpumath.cpp +++ b/3rdparty/bx/tests/fpumath_test.cpp diff --git a/3rdparty/bx/tests/handle.cpp b/3rdparty/bx/tests/handle.cpp deleted file mode 100644 index b5b7c1894b7..00000000000 --- a/3rdparty/bx/tests/handle.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2010-2016 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bx#license-bsd-2-clause - */ - -#include "test.h" -#include <bx/handlealloc.h> - -TEST(HandleListT) -{ - bx::HandleListT<32> list; - - list.pushBack(16); - CHECK(list.getFront() == 16); - CHECK(list.getBack() == 16); - - list.pushFront(7); - CHECK(list.getFront() == 7); - CHECK(list.getBack() == 16); - - uint16_t expected0[] = { 15, 31, 7, 16, 17, 11, 13 }; - list.pushBack(17); - list.pushBack(11); - list.pushBack(13); - list.pushFront(31); - list.pushFront(15); - uint16_t count = 0; - for (uint16_t it = list.getFront(); it != UINT16_MAX; it = list.getNext(it), ++count) - { - CHECK(it == expected0[count]); - } - CHECK(count == BX_COUNTOF(expected0) ); - - list.remove(17); - list.remove(31); - list.remove(16); - list.pushBack(16); - uint16_t expected1[] = { 15, 7, 11, 13, 16 }; - count = 0; - for (uint16_t it = list.getFront(); it != UINT16_MAX; it = list.getNext(it), ++count) - { - CHECK(it == expected1[count]); - } - CHECK(count == BX_COUNTOF(expected1) ); - - list.popBack(); - list.popFront(); - list.popBack(); - list.popBack(); - - CHECK(list.getFront() == 7); - CHECK(list.getBack() == 7); - - list.popBack(); - CHECK(list.getFront() == UINT16_MAX); - CHECK(list.getBack() == UINT16_MAX); -} - -TEST(HandleAllocLruT) -{ - bx::HandleAllocLruT<16> lru; - - uint16_t handle[4] = - { - lru.alloc(), - lru.alloc(), - lru.alloc(), - lru.alloc(), - }; - - lru.touch(handle[1]); - - uint16_t expected0[] = { handle[1], handle[3], handle[2], handle[0] }; - uint16_t count = 0; - for (uint16_t it = lru.getFront(); it != UINT16_MAX; it = lru.getNext(it), ++count) - { - CHECK(it == expected0[count]); - } -} diff --git a/3rdparty/bx/tests/handle_bench.cpp b/3rdparty/bx/tests/handle_bench.cpp new file mode 100644 index 00000000000..1b1032bb226 --- /dev/null +++ b/3rdparty/bx/tests/handle_bench.cpp @@ -0,0 +1,103 @@ +#include <bx/bx.h> +#include <bx/timer.h> +#include <bx/handlealloc.h> +#include <bx/maputil.h> + +#include <tinystl/allocator.h> +#include <tinystl/unordered_map.h> + +#include <unordered_map> + +#include <stdio.h> +#include <assert.h> + +int main() +{ + const uint32_t numElements = 4<<10; + const uint32_t numIterations = 16; + + // + { + int64_t elapsed = -bx::getHPCounter(); + + for (uint32_t ii = 0; ii < numIterations; ++ii) + { + typedef tinystl::unordered_map<uint64_t, uint16_t> TinyStlUnorderedMap; + TinyStlUnorderedMap map; +// map.reserve(numElements); + for (uint32_t jj = 0; jj < numElements; ++jj) + { + tinystl::pair<TinyStlUnorderedMap::iterator, bool> ok = map.insert(tinystl::make_pair(uint64_t(jj), uint16_t(jj) ) ); + assert(ok.second); + } + + for (uint32_t jj = 0; jj < numElements; ++jj) + { + bool ok = bx::mapRemove(map, uint64_t(jj) ); + assert(ok); + } + + assert(map.size() == 0); + } + + elapsed += bx::getHPCounter(); + printf(" TinyStl: %15f\n", double(elapsed) ); + } + + /// + { + int64_t elapsed = -bx::getHPCounter(); + + for (uint32_t ii = 0; ii < numIterations; ++ii) + { + typedef std::unordered_map<uint64_t, uint16_t> StdUnorderedMap; + StdUnorderedMap map; +// map.reserve(numElements); + for (uint32_t jj = 0; jj < numElements; ++jj) + { + std::pair<StdUnorderedMap::iterator, bool> ok = map.insert(std::make_pair(uint64_t(jj), uint16_t(jj) ) ); + assert(ok.second); + } + + for (uint32_t jj = 0; jj < numElements; ++jj) + { + bool ok = bx::mapRemove(map, uint64_t(jj) ); + assert(ok); + } + + assert(map.size() == 0); + } + + elapsed += bx::getHPCounter(); + printf(" STL: %15f\n", double(elapsed) ); + } + + /// + { + int64_t elapsed = -bx::getHPCounter(); + + for (uint32_t ii = 0; ii < numIterations; ++ii) + { + typedef bx::HandleHashMapT<numElements+numElements/2, uint64_t> HandleHashMap; + HandleHashMap map; + for (uint32_t jj = 0; jj < numElements; ++jj) + { + bool ok = map.insert(jj, uint16_t(jj) ); + assert(ok); + } + + for (uint32_t jj = 0; jj < numElements; ++jj) + { + bool ok = map.removeByKey(uint64_t(jj) ); + assert(ok); + } + + assert(map.getNumElements() == 0); + } + + elapsed += bx::getHPCounter(); + printf("HandleHashMap: %15f\n", double(elapsed) ); + } + + return EXIT_SUCCESS; +} diff --git a/3rdparty/bx/tests/handle_test.cpp b/3rdparty/bx/tests/handle_test.cpp new file mode 100644 index 00000000000..29019e318cf --- /dev/null +++ b/3rdparty/bx/tests/handle_test.cpp @@ -0,0 +1,119 @@ +/* + * Copyright 2010-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause + */ + +#include "test.h" +#include <bx/handlealloc.h> +#include <bx/string.h> + +TEST_CASE("HandleListT", "") +{ + bx::HandleListT<32> list; + + list.pushBack(16); + REQUIRE(list.getFront() == 16); + REQUIRE(list.getBack() == 16); + + list.pushFront(7); + REQUIRE(list.getFront() == 7); + REQUIRE(list.getBack() == 16); + + uint16_t expected0[] = { 15, 31, 7, 16, 17, 11, 13 }; + list.pushBack(17); + list.pushBack(11); + list.pushBack(13); + list.pushFront(31); + list.pushFront(15); + uint16_t count = 0; + for (uint16_t it = list.getFront(); it != UINT16_MAX; it = list.getNext(it), ++count) + { + REQUIRE(it == expected0[count]); + } + REQUIRE(count == BX_COUNTOF(expected0) ); + + list.remove(17); + list.remove(31); + list.remove(16); + list.pushBack(16); + uint16_t expected1[] = { 15, 7, 11, 13, 16 }; + count = 0; + for (uint16_t it = list.getFront(); it != UINT16_MAX; it = list.getNext(it), ++count) + { + REQUIRE(it == expected1[count]); + } + REQUIRE(count == BX_COUNTOF(expected1) ); + + list.popBack(); + list.popFront(); + list.popBack(); + list.popBack(); + + REQUIRE(list.getFront() == 7); + REQUIRE(list.getBack() == 7); + + list.popBack(); + REQUIRE(list.getFront() == UINT16_MAX); + REQUIRE(list.getBack() == UINT16_MAX); +} + +TEST_CASE("HandleAllocLruT", "") +{ + bx::HandleAllocLruT<16> lru; + + uint16_t handle[4] = + { + lru.alloc(), + lru.alloc(), + lru.alloc(), + lru.alloc(), + }; + + lru.touch(handle[1]); + + uint16_t expected0[] = { handle[1], handle[3], handle[2], handle[0] }; + uint16_t count = 0; + for (uint16_t it = lru.getFront(); it != UINT16_MAX; it = lru.getNext(it), ++count) + { + REQUIRE(it == expected0[count]); + } +} + +TEST_CASE("HandleHashTable", "") +{ + typedef bx::HandleHashMapT<512> HashMap; + + HashMap hm; + + REQUIRE(512 == hm.getMaxCapacity() ); + + bx::StringView sv0("test0"); + + bool ok = hm.insert(bx::hashMurmur2A(sv0), 0); + REQUIRE(ok); + + ok = hm.insert(bx::hashMurmur2A(sv0), 0); + REQUIRE(!ok); + REQUIRE(1 == hm.getNumElements() ); + + bx::StringView sv1("test1"); + + ok = hm.insert(bx::hashMurmur2A(sv1), 0); + REQUIRE(ok); + REQUIRE(2 == hm.getNumElements() ); + + hm.removeByHandle(0); + REQUIRE(0 == hm.getNumElements() ); + + ok = hm.insert(bx::hashMurmur2A(sv0), 0); + REQUIRE(ok); + + hm.removeByKey(bx::hashMurmur2A(sv0) ); + REQUIRE(0 == hm.getNumElements() ); + + for (uint32_t ii = 0, num = hm.getMaxCapacity(); ii < num; ++ii) + { + ok = hm.insert(ii, uint16_t(ii) ); + REQUIRE(ok); + } +} diff --git a/3rdparty/bx/tests/macros.cpp b/3rdparty/bx/tests/macros_test.cpp index 321bc67e27b..321bc67e27b 100644 --- a/3rdparty/bx/tests/macros.cpp +++ b/3rdparty/bx/tests/macros_test.cpp diff --git a/3rdparty/bx/tests/main.cpp b/3rdparty/bx/tests/main_test.cpp index f6aaa90d538..f6aaa90d538 100644 --- a/3rdparty/bx/tests/main.cpp +++ b/3rdparty/bx/tests/main_test.cpp diff --git a/3rdparty/bx/tests/misc.cpp b/3rdparty/bx/tests/misc_test.cpp index aec1067a022..aec1067a022 100644 --- a/3rdparty/bx/tests/misc.cpp +++ b/3rdparty/bx/tests/misc_test.cpp diff --git a/3rdparty/bx/tests/simd_t.cpp b/3rdparty/bx/tests/simd_test.cpp index 0edf3030625..f40b009388f 100644 --- a/3rdparty/bx/tests/simd_t.cpp +++ b/3rdparty/bx/tests/simd_test.cpp @@ -8,6 +8,12 @@ #include <bx/fpumath.h> #include <string.h> +#if 0 +# define SIMD_DBG DBG +#else +# define SIMD_DBG(_fmt, ...) BX_UNUSED(__VA_ARGS__); +#endif // 0 + using namespace bx; union simd_cast @@ -22,13 +28,13 @@ union simd_cast void simd_check_bool(const char* _str, bool _a, bool _0) { - DBG("%s %d == %d" + SIMD_DBG("%s %d == %d" , _str , _a , _0 ); - CHECK_EQUAL(_a, _0); + REQUIRE(_a == _0); } void simd_check_int32( @@ -41,16 +47,16 @@ void simd_check_int32( ) { simd_cast c; c.simd128 = _a; - DBG("%s (%d, %d, %d, %d) == (%d, %d, %d, %d)" + SIMD_DBG("%s (%d, %d, %d, %d) == (%d, %d, %d, %d)" , _str , c.i[0], c.i[1], c.i[2], c.i[3] , _0, _1, _2, _3 ); - CHECK_EQUAL(c.i[0], _0); - CHECK_EQUAL(c.i[1], _1); - CHECK_EQUAL(c.i[2], _2); - CHECK_EQUAL(c.i[3], _3); + REQUIRE(c.i[0] == _0); + REQUIRE(c.i[1] == _1); + REQUIRE(c.i[2] == _2); + REQUIRE(c.i[3] == _3); } #if 0 @@ -68,20 +74,20 @@ void simd_check_int32( ) { simd_cast c; c.simd256 = _a; - DBG("%s (%d, %d, %d, %d, %d, %d, %d, %d) == (%d, %d, %d, %d, %d, %d, %d, %d)" + SIMD_DBG("%s (%d, %d, %d, %d, %d, %d, %d, %d) == (%d, %d, %d, %d, %d, %d, %d, %d)" , _str , c.i[0], c.i[1], c.i[2], c.i[3], c.i[4], c.i[5], c.i[6], c.i[7] , _0, _1, _2, _3, _4, _5, _6, _7 ); - CHECK_EQUAL(c.i[0], _0); - CHECK_EQUAL(c.i[1], _1); - CHECK_EQUAL(c.i[2], _2); - CHECK_EQUAL(c.i[3], _3); - CHECK_EQUAL(c.i[4], _4); - CHECK_EQUAL(c.i[5], _5); - CHECK_EQUAL(c.i[6], _6); - CHECK_EQUAL(c.i[7], _7); + REQUIRE(c.i[0] == _0); + REQUIRE(c.i[1] == _1); + REQUIRE(c.i[2] == _2); + REQUIRE(c.i[3] == _3); + REQUIRE(c.i[4] == _4); + REQUIRE(c.i[5] == _5); + REQUIRE(c.i[6] == _6); + REQUIRE(c.i[7] == _7); } #endif // 0 @@ -96,16 +102,16 @@ void simd_check_uint32( { simd_cast c; c.simd128 = _a; - DBG("%s (0x%08x, 0x%08x, 0x%08x, 0x%08x) == (0x%08x, 0x%08x, 0x%08x, 0x%08x)" + SIMD_DBG("%s (0x%08x, 0x%08x, 0x%08x, 0x%08x) == (0x%08x, 0x%08x, 0x%08x, 0x%08x)" , _str , c.ui[0], c.ui[1], c.ui[2], c.ui[3] , _0, _1, _2, _3 ); - CHECK_EQUAL(c.ui[0], _0); - CHECK_EQUAL(c.ui[1], _1); - CHECK_EQUAL(c.ui[2], _2); - CHECK_EQUAL(c.ui[3], _3); + REQUIRE(c.ui[0] == _0); + REQUIRE(c.ui[1] == _1); + REQUIRE(c.ui[2] == _2); + REQUIRE(c.ui[3] == _3); } #if 0 @@ -124,20 +130,20 @@ void simd_check_uint32( { simd_cast c; c.simd256 = _a; - DBG("%s (0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x) == (0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x)" + SIMD_DBG("%s (0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x) == (0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x)" , _str , c.ui[0], c.ui[1], c.ui[2], c.ui[3], c.ui[4], c.ui[5], c.ui[6], c.ui[7] , _0, _1, _2, _3, _4, _5, _6, _7 ); - CHECK_EQUAL(c.ui[0], _0); - CHECK_EQUAL(c.ui[1], _1); - CHECK_EQUAL(c.ui[2], _2); - CHECK_EQUAL(c.ui[3], _3); - CHECK_EQUAL(c.ui[4], _4); - CHECK_EQUAL(c.ui[5], _5); - CHECK_EQUAL(c.ui[6], _6); - CHECK_EQUAL(c.ui[7], _7); + REQUIRE(c.ui[0] == _0); + REQUIRE(c.ui[1] == _1); + REQUIRE(c.ui[2] == _2); + REQUIRE(c.ui[3] == _3); + REQUIRE(c.ui[4] == _4); + REQUIRE(c.ui[5] == _5); + REQUIRE(c.ui[6] == _6); + REQUIRE(c.ui[7] == _7); } #endif // 0 @@ -152,7 +158,7 @@ void simd_check_float( { simd_cast c; c.simd128 = _a; - DBG("%s (%f, %f, %f, %f) == (%f, %f, %f, %f)" + SIMD_DBG("%s (%f, %f, %f, %f) == (%f, %f, %f, %f)" , _str , c.f[0], c.f[1], c.f[2], c.f[3] , _0, _1, _2, _3 @@ -180,7 +186,7 @@ void simd_check_float( { simd_cast c; c.simd256 = _a; - DBG("%s (%f, %f, %f, %f, %f, %f, %f, %f) == (%f, %f, %f, %f, %f, %f, %f, %f)" + SIMD_DBG("%s (%f, %f, %f, %f, %f, %f, %f, %f) == (%f, %f, %f, %f, %f, %f, %f, %f)" , _str , c.f[0], c.f[1], c.f[2], c.f[3], c.f[4], c.f[5], c.f[6], c.f[7] , _0, _1, _2, _3, _4, _5, _6, _7 @@ -202,12 +208,12 @@ void simd_check_string(const char* _str, bx::simd128_t _a) simd_cast c; c.simd128 = _a; const char test[5] = { c.c[0], c.c[4], c.c[8], c.c[12], '\0' }; - DBG("%s %s", _str, test); + SIMD_DBG("%s %s", _str, test); CHECK(0 == strcmp(_str, test) ); } -TEST(simd_swizzle) +TEST_CASE("simd_swizzle", "") { const simd128_t xyzw = simd_ild(0x78787878, 0x79797979, 0x7a7a7a7a, 0x77777777); @@ -227,7 +233,7 @@ TEST(simd_swizzle) #undef ELEMx } -TEST(simd_shuffle) +TEST_CASE("simd_shuffle", "") { const simd128_t xyzw = simd_ild(0x78787878, 0x79797979, 0x7a7a7a7a, 0x77777777); const simd128_t ABCD = simd_ild(0x41414141, 0x42424242, 0x43434343, 0x44444444); @@ -242,7 +248,7 @@ TEST(simd_shuffle) simd_check_string("CzDw", simd_shuf_CzDw(xyzw, ABCD) ); } -TEST(simd_compare) +TEST_CASE("simd_compare", "") { simd_check_uint32("cmpeq" , simd_cmpeq(simd_ld(1.0f, 2.0f, 3.0f, 4.0f), simd_ld(0.0f, 2.0f, 0.0f, 3.0f) ) @@ -285,7 +291,7 @@ TEST(simd_compare) ); } -TEST(simd_test) +TEST_CASE("simd_test", "") { simd_check_bool("test_any_xyzw" , simd_test_any_xyzw(simd_ild(0xffffffff, 0, 0, 0) ) @@ -313,7 +319,7 @@ TEST(simd_test) ); } -TEST(simd_load) +TEST_CASE("simd_load", "") { simd_check_float("ld" , simd_ld(0.0f, 1.0f, 2.0f, 3.0f) @@ -353,7 +359,7 @@ TEST(simd_load) ); } -TEST(simd_arithmetic) +TEST_CASE("simd_arithmetic", "") { simd_check_float("madd" , simd_madd(simd_ld(0.0f, 1.0f, 2.0f, 3.0f), simd_ld(4.0f, 5.0f, 6.0f, 7.0f), simd_ld(8.0f, 9.0f, 10.0f, 11.0f) ) @@ -366,7 +372,7 @@ TEST(simd_arithmetic) ); } -TEST(simd_sqrt) +TEST_CASE("simd_sqrt", "") { simd_check_float("simd_sqrt" , simd_sqrt(simd_ld(1.0f, 16.0f, 65536.0f, 123456.0f) ) @@ -384,7 +390,7 @@ TEST(simd_sqrt) ); } -TEST(float4) +TEST_CASE("float4", "") { const simd128_t isplat = simd_isplat(0x80000001); simd_check_uint32("sll" diff --git a/3rdparty/bx/tests/string_test.cpp b/3rdparty/bx/tests/string_test.cpp new file mode 100644 index 00000000000..3d98e38b2e8 --- /dev/null +++ b/3rdparty/bx/tests/string_test.cpp @@ -0,0 +1,41 @@ +/* + * Copyright 2010-2016 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause + */ + +#include "test.h" +#include <bx/string.h> +#include <bx/crtimpl.h> +#include <bx/handlealloc.h> + +bx::AllocatorI* g_allocator; + +TEST_CASE("strnlen", "") +{ + const char* test = "test"; + + REQUIRE(0 == bx::strnlen(test, 0) ); + REQUIRE(2 == bx::strnlen(test, 2) ); + REQUIRE(4 == bx::strnlen(test, UINT32_MAX) ); +} + +TEST_CASE("StringView", "") +{ + bx::StringView sv("test"); + REQUIRE(4 == sv.getLength() ); + + bx::CrtAllocator crt; + g_allocator = &crt; + + typedef bx::StringT<&g_allocator> String; + + String st(sv); + REQUIRE(4 == st.getLength() ); + + st.clear(); + REQUIRE(0 == st.getLength() ); + REQUIRE(4 == sv.getLength() ); + + sv.clear(); + REQUIRE(0 == sv.getLength() ); +} diff --git a/3rdparty/bx/tests/thread.cpp b/3rdparty/bx/tests/thread_test.cpp index f0ee772aeba..f0ee772aeba 100644 --- a/3rdparty/bx/tests/thread.cpp +++ b/3rdparty/bx/tests/thread_test.cpp diff --git a/3rdparty/bx/tests/tokenizecmd.cpp b/3rdparty/bx/tests/tokenizecmd_test.cpp index 32e927bec1f..32e927bec1f 100644 --- a/3rdparty/bx/tests/tokenizecmd.cpp +++ b/3rdparty/bx/tests/tokenizecmd_test.cpp diff --git a/3rdparty/bx/tests/uint32_t.cpp b/3rdparty/bx/tests/uint32_test.cpp index 3fe0044d67c..3fe0044d67c 100644 --- a/3rdparty/bx/tests/uint32_t.cpp +++ b/3rdparty/bx/tests/uint32_test.cpp diff --git a/3rdparty/bx/tests/unordered_map_nonpod.cpp b/3rdparty/bx/tests/unordered_map_nonpod_test.cpp index 96aa55e416c..96aa55e416c 100644 --- a/3rdparty/bx/tests/unordered_map_nonpod.cpp +++ b/3rdparty/bx/tests/unordered_map_nonpod_test.cpp diff --git a/3rdparty/bx/tests/unordered_set_copyctor.cpp b/3rdparty/bx/tests/unordered_set_copyctor_test.cpp index 3e88304f912..3e88304f912 100644 --- a/3rdparty/bx/tests/unordered_set_copyctor.cpp +++ b/3rdparty/bx/tests/unordered_set_copyctor_test.cpp diff --git a/3rdparty/bx/tests/unordered_set_pod.cpp b/3rdparty/bx/tests/unordered_set_pod_test.cpp index a9d8867fd2f..a9d8867fd2f 100644 --- a/3rdparty/bx/tests/unordered_set_pod.cpp +++ b/3rdparty/bx/tests/unordered_set_pod_test.cpp diff --git a/3rdparty/bx/tests/vector_complex.cpp b/3rdparty/bx/tests/vector_complex_test.cpp index 8deaa3fd3ff..8deaa3fd3ff 100644 --- a/3rdparty/bx/tests/vector_complex.cpp +++ b/3rdparty/bx/tests/vector_complex_test.cpp diff --git a/3rdparty/bx/tests/vector_header.cpp b/3rdparty/bx/tests/vector_header_test.cpp index 4822104dbc9..4822104dbc9 100644 --- a/3rdparty/bx/tests/vector_header.cpp +++ b/3rdparty/bx/tests/vector_header_test.cpp diff --git a/3rdparty/bx/tests/vector_nocopy.cpp b/3rdparty/bx/tests/vector_nocopy_test.cpp index 960762f8c16..960762f8c16 100644 --- a/3rdparty/bx/tests/vector_nocopy.cpp +++ b/3rdparty/bx/tests/vector_nocopy_test.cpp diff --git a/3rdparty/bx/tests/vector_nodefault.cpp b/3rdparty/bx/tests/vector_nodefault_test.cpp index 1340b0c0b3d..1340b0c0b3d 100644 --- a/3rdparty/bx/tests/vector_nodefault.cpp +++ b/3rdparty/bx/tests/vector_nodefault_test.cpp diff --git a/3rdparty/bx/tests/vector_primitive.cpp b/3rdparty/bx/tests/vector_primitive_test.cpp index 06fd8fd55db..06fd8fd55db 100644 --- a/3rdparty/bx/tests/vector_primitive.cpp +++ b/3rdparty/bx/tests/vector_primitive_test.cpp diff --git a/3rdparty/bx/tests/vector_shrinktofit.cpp b/3rdparty/bx/tests/vector_shrinktofit_test.cpp index cac2a0d9311..cac2a0d9311 100644 --- a/3rdparty/bx/tests/vector_shrinktofit.cpp +++ b/3rdparty/bx/tests/vector_shrinktofit_test.cpp diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie Binary files differindex 80d02527821..6b8fe9f8c00 100755 --- 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 54880325a2b..171d83e25ec 100755 --- 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 867d651dd02..dd19ec0a432 100644 --- a/3rdparty/bx/tools/bin/windows/genie.exe +++ b/3rdparty/bx/tools/bin/windows/genie.exe diff --git a/3rdparty/lua/src/Makefile b/3rdparty/lua/src/Makefile index d71c75c8732..c5b8a1afb41 100644 --- a/3rdparty/lua/src/Makefile +++ b/3rdparty/lua/src/Makefile @@ -6,8 +6,8 @@ # Your platform. See PLATS for possible values. PLAT= none -CC= gcc -std=gnu99 -CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) +CC= g++ -std=gnu99 +CFLAGS= -console -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) LIBS= -lm $(SYSLIBS) $(MYLIBS) @@ -114,7 +114,7 @@ macosx: mingw: $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \ - "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ + "AR=$(CC) -lstdc++ -o" "RANLIB=strip --strip-unneeded" \ "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe $(MAKE) "LUAC_T=luac.exe" luac.exe diff --git a/3rdparty/lua/src/lstrlib.c b/3rdparty/lua/src/lstrlib.c index 12264f88105..8ecf43f32b8 100644 --- a/3rdparty/lua/src/lstrlib.c +++ b/3rdparty/lua/src/lstrlib.c @@ -933,7 +933,7 @@ static void addquoted (luaL_Buffer *b, const char *s, size_t len) { static void checkdp (char *buff, int nb) { if (memchr(buff, '.', nb) == NULL) { /* no dot? */ char point = lua_getlocaledecpoint(); /* try locale point */ - char *ppoint = memchr(buff, point, nb); + char *ppoint = (char*)memchr(buff, point, nb); if (ppoint) *ppoint = '.'; /* change it to a dot */ } } diff --git a/bgfx/shaders/glsl/chains/blurs/fs_smart-blur.bin b/bgfx/shaders/essl/chains/blurs/fs_smart-blur.bin Binary files differindex 442d5cdadf1..a4c15606155 100644 --- a/bgfx/shaders/glsl/chains/blurs/fs_smart-blur.bin +++ b/bgfx/shaders/essl/chains/blurs/fs_smart-blur.bin diff --git a/bgfx/shaders/glsl/chains/blurs/vs_smart-blur.bin b/bgfx/shaders/essl/chains/blurs/vs_smart-blur.bin Binary files differindex c034943e250..2d62e84953e 100644 --- a/bgfx/shaders/glsl/chains/blurs/vs_smart-blur.bin +++ b/bgfx/shaders/essl/chains/blurs/vs_smart-blur.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom-deluxe.bin b/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom-deluxe.bin Binary files differindex 0a54f384293..166388d7a7c 100644 --- a/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom-deluxe.bin +++ b/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom-deluxe.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom.bin b/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom.bin Binary files differindex 7e03c559853..20ffe658385 100644 --- a/bgfx/shaders/glsl/chains/crt-geom/fs_crt-geom.bin +++ b/bgfx/shaders/essl/chains/crt-geom/fs_crt-geom.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_gaussx.bin b/bgfx/shaders/essl/chains/crt-geom/fs_gaussx.bin Binary files differindex d83c7dea15d..691c710fd68 100644 --- a/bgfx/shaders/glsl/chains/crt-geom/fs_gaussx.bin +++ b/bgfx/shaders/essl/chains/crt-geom/fs_gaussx.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_gaussy.bin b/bgfx/shaders/essl/chains/crt-geom/fs_gaussy.bin Binary files differindex 0ab1151bba8..988fc387f7d 100644 --- a/bgfx/shaders/glsl/chains/crt-geom/fs_gaussy.bin +++ b/bgfx/shaders/essl/chains/crt-geom/fs_gaussy.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_apply.bin b/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_apply.bin Binary files differindex 5de0143b200..becc53dbbe3 100644 --- a/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_apply.bin +++ b/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_apply.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_update.bin b/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_update.bin Binary files differindex 50034bc156c..7e5f4e96765 100644 --- a/bgfx/shaders/glsl/chains/crt-geom/fs_phosphor_update.bin +++ b/bgfx/shaders/essl/chains/crt-geom/fs_phosphor_update.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/vs_crt-geom.bin b/bgfx/shaders/essl/chains/crt-geom/vs_crt-geom.bin Binary files differindex 4abb00b0de8..d245ebe9b2a 100644 --- a/bgfx/shaders/glsl/chains/crt-geom/vs_crt-geom.bin +++ b/bgfx/shaders/essl/chains/crt-geom/vs_crt-geom.bin diff --git a/bgfx/shaders/essl/chains/crt-geom/vs_gaussx.bin b/bgfx/shaders/essl/chains/crt-geom/vs_gaussx.bin Binary files differnew file mode 100644 index 00000000000..f6c00846bc4 --- /dev/null +++ b/bgfx/shaders/essl/chains/crt-geom/vs_gaussx.bin diff --git a/bgfx/shaders/essl/chains/crt-geom/vs_gaussy.bin b/bgfx/shaders/essl/chains/crt-geom/vs_gaussy.bin Binary files differnew file mode 100644 index 00000000000..38d918884fb --- /dev/null +++ b/bgfx/shaders/essl/chains/crt-geom/vs_gaussy.bin diff --git a/bgfx/shaders/essl/chains/crt-geom/vs_phosphor_apply.bin b/bgfx/shaders/essl/chains/crt-geom/vs_phosphor_apply.bin Binary files differnew file mode 100644 index 00000000000..73a140fcc40 --- /dev/null +++ b/bgfx/shaders/essl/chains/crt-geom/vs_phosphor_apply.bin diff --git a/bgfx/shaders/essl/chains/crt-geom/vs_phosphor_update.bin b/bgfx/shaders/essl/chains/crt-geom/vs_phosphor_update.bin Binary files differnew file mode 100644 index 00000000000..73a140fcc40 --- /dev/null +++ b/bgfx/shaders/essl/chains/crt-geom/vs_phosphor_update.bin diff --git a/bgfx/shaders/glsl/chains/crt/fs_crt-caligari.bin b/bgfx/shaders/essl/chains/crt/fs_crt-caligari.bin Binary files differindex 0f84a90df98..523acc795ef 100644 --- a/bgfx/shaders/glsl/chains/crt/fs_crt-caligari.bin +++ b/bgfx/shaders/essl/chains/crt/fs_crt-caligari.bin diff --git a/bgfx/shaders/essl/chains/crt/vs_crt-caligari.bin b/bgfx/shaders/essl/chains/crt/vs_crt-caligari.bin Binary files differnew file mode 100644 index 00000000000..7e262c17691 --- /dev/null +++ b/bgfx/shaders/essl/chains/crt/vs_crt-caligari.bin diff --git a/bgfx/shaders/essl/chains/default/fs_blit.bin b/bgfx/shaders/essl/chains/default/fs_blit.bin Binary files differnew file mode 100644 index 00000000000..22e2f0c23d0 --- /dev/null +++ b/bgfx/shaders/essl/chains/default/fs_blit.bin diff --git a/bgfx/shaders/essl/chains/default/vs_blit.bin b/bgfx/shaders/essl/chains/default/vs_blit.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/default/vs_blit.bin diff --git a/bgfx/shaders/glsl/chains/eagle/fs_eagle.bin b/bgfx/shaders/essl/chains/eagle/fs_eagle.bin Binary files differindex 1c640de9db8..76ba019d544 100644 --- a/bgfx/shaders/glsl/chains/eagle/fs_eagle.bin +++ b/bgfx/shaders/essl/chains/eagle/fs_eagle.bin diff --git a/bgfx/shaders/glsl/chains/eagle/vs_eagle.bin b/bgfx/shaders/essl/chains/eagle/vs_eagle.bin Binary files differindex d5eccb4c173..a67ebb5a044 100644 --- a/bgfx/shaders/glsl/chains/eagle/vs_eagle.bin +++ b/bgfx/shaders/essl/chains/eagle/vs_eagle.bin diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_color.bin b/bgfx/shaders/essl/chains/hlsl/fs_color.bin Binary files differindex fc0baf998d5..a0379220e9c 100644 --- a/bgfx/shaders/glsl/chains/hlsl/fs_color.bin +++ b/bgfx/shaders/essl/chains/hlsl/fs_color.bin diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_deconverge.bin b/bgfx/shaders/essl/chains/hlsl/fs_deconverge.bin Binary files differindex 96136e77f17..855f8019b5c 100644 --- a/bgfx/shaders/glsl/chains/hlsl/fs_deconverge.bin +++ b/bgfx/shaders/essl/chains/hlsl/fs_deconverge.bin diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_defocus.bin b/bgfx/shaders/essl/chains/hlsl/fs_defocus.bin Binary files differindex 238e85969c2..ce6684682f7 100644 --- a/bgfx/shaders/glsl/chains/hlsl/fs_defocus.bin +++ b/bgfx/shaders/essl/chains/hlsl/fs_defocus.bin diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_distortion.bin b/bgfx/shaders/essl/chains/hlsl/fs_distortion.bin Binary files differindex 4046b407a05..6142d1c9568 100644 --- a/bgfx/shaders/glsl/chains/hlsl/fs_distortion.bin +++ b/bgfx/shaders/essl/chains/hlsl/fs_distortion.bin diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_ntsc_decode.bin b/bgfx/shaders/essl/chains/hlsl/fs_ntsc_decode.bin Binary files differindex 9bb6f3b1db8..d1e69f5e0e3 100644 --- a/bgfx/shaders/glsl/chains/hlsl/fs_ntsc_decode.bin +++ b/bgfx/shaders/essl/chains/hlsl/fs_ntsc_decode.bin diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_ntsc_encode.bin b/bgfx/shaders/essl/chains/hlsl/fs_ntsc_encode.bin Binary files differindex 2f316b21936..539db74272f 100644 --- a/bgfx/shaders/glsl/chains/hlsl/fs_ntsc_encode.bin +++ b/bgfx/shaders/essl/chains/hlsl/fs_ntsc_encode.bin diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_phosphor.bin b/bgfx/shaders/essl/chains/hlsl/fs_phosphor.bin Binary files differindex 3f69ea62056..067b1581379 100644 --- a/bgfx/shaders/glsl/chains/hlsl/fs_phosphor.bin +++ b/bgfx/shaders/essl/chains/hlsl/fs_phosphor.bin diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_post.bin b/bgfx/shaders/essl/chains/hlsl/fs_post.bin Binary files differindex 887cf531e21..3f4b0d6397c 100644 --- a/bgfx/shaders/glsl/chains/hlsl/fs_post.bin +++ b/bgfx/shaders/essl/chains/hlsl/fs_post.bin diff --git a/bgfx/shaders/essl/chains/hlsl/fs_prescale.bin b/bgfx/shaders/essl/chains/hlsl/fs_prescale.bin Binary files differnew file mode 100644 index 00000000000..22e2f0c23d0 --- /dev/null +++ b/bgfx/shaders/essl/chains/hlsl/fs_prescale.bin diff --git a/bgfx/shaders/essl/chains/hlsl/vs_color.bin b/bgfx/shaders/essl/chains/hlsl/vs_color.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/hlsl/vs_color.bin diff --git a/bgfx/shaders/glsl/chains/hlsl/vs_deconverge.bin b/bgfx/shaders/essl/chains/hlsl/vs_deconverge.bin Binary files differindex 2398d71b227..08aeca09e23 100644 --- a/bgfx/shaders/glsl/chains/hlsl/vs_deconverge.bin +++ b/bgfx/shaders/essl/chains/hlsl/vs_deconverge.bin diff --git a/bgfx/shaders/essl/chains/hlsl/vs_defocus.bin b/bgfx/shaders/essl/chains/hlsl/vs_defocus.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/hlsl/vs_defocus.bin diff --git a/bgfx/shaders/essl/chains/hlsl/vs_distortion.bin b/bgfx/shaders/essl/chains/hlsl/vs_distortion.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/hlsl/vs_distortion.bin diff --git a/bgfx/shaders/essl/chains/hlsl/vs_ntsc_decode.bin b/bgfx/shaders/essl/chains/hlsl/vs_ntsc_decode.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/hlsl/vs_ntsc_decode.bin diff --git a/bgfx/shaders/essl/chains/hlsl/vs_ntsc_encode.bin b/bgfx/shaders/essl/chains/hlsl/vs_ntsc_encode.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/hlsl/vs_ntsc_encode.bin diff --git a/bgfx/shaders/essl/chains/hlsl/vs_phosphor.bin b/bgfx/shaders/essl/chains/hlsl/vs_phosphor.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/hlsl/vs_phosphor.bin diff --git a/bgfx/shaders/essl/chains/hlsl/vs_post.bin b/bgfx/shaders/essl/chains/hlsl/vs_post.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/hlsl/vs_post.bin diff --git a/bgfx/shaders/essl/chains/hlsl/vs_prescale.bin b/bgfx/shaders/essl/chains/hlsl/vs_prescale.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/hlsl/vs_prescale.bin diff --git a/bgfx/shaders/glsl/chains/hqx/fs_hq2x.bin b/bgfx/shaders/essl/chains/hqx/fs_hq2x.bin Binary files differindex 7f3b9f36263..2b008d10a52 100644 --- a/bgfx/shaders/glsl/chains/hqx/fs_hq2x.bin +++ b/bgfx/shaders/essl/chains/hqx/fs_hq2x.bin diff --git a/bgfx/shaders/glsl/chains/hqx/fs_hq3x.bin b/bgfx/shaders/essl/chains/hqx/fs_hq3x.bin Binary files differindex b74aea5e0af..7494371f7eb 100644 --- a/bgfx/shaders/glsl/chains/hqx/fs_hq3x.bin +++ b/bgfx/shaders/essl/chains/hqx/fs_hq3x.bin diff --git a/bgfx/shaders/glsl/chains/hqx/fs_hq4x.bin b/bgfx/shaders/essl/chains/hqx/fs_hq4x.bin Binary files differindex 86a90e7fa48..c215c28b740 100644 --- a/bgfx/shaders/glsl/chains/hqx/fs_hq4x.bin +++ b/bgfx/shaders/essl/chains/hqx/fs_hq4x.bin diff --git a/bgfx/shaders/glsl/chains/hqx/vs_hq2x.bin b/bgfx/shaders/essl/chains/hqx/vs_hq2x.bin Binary files differindex 789e990106d..413d1e8bd20 100644 --- a/bgfx/shaders/glsl/chains/hqx/vs_hq2x.bin +++ b/bgfx/shaders/essl/chains/hqx/vs_hq2x.bin diff --git a/bgfx/shaders/glsl/chains/hqx/vs_hq3x.bin b/bgfx/shaders/essl/chains/hqx/vs_hq3x.bin Binary files differindex 789e990106d..413d1e8bd20 100644 --- a/bgfx/shaders/glsl/chains/hqx/vs_hq3x.bin +++ b/bgfx/shaders/essl/chains/hqx/vs_hq3x.bin diff --git a/bgfx/shaders/glsl/chains/hqx/vs_hq4x.bin b/bgfx/shaders/essl/chains/hqx/vs_hq4x.bin Binary files differindex 789e990106d..413d1e8bd20 100644 --- a/bgfx/shaders/glsl/chains/hqx/vs_hq4x.bin +++ b/bgfx/shaders/essl/chains/hqx/vs_hq4x.bin diff --git a/bgfx/shaders/essl/chains/misc/fs_blit.bin b/bgfx/shaders/essl/chains/misc/fs_blit.bin Binary files differnew file mode 100644 index 00000000000..22e2f0c23d0 --- /dev/null +++ b/bgfx/shaders/essl/chains/misc/fs_blit.bin diff --git a/bgfx/shaders/glsl/chains/misc/fs_bob-and-ghost-deinterlace.bin b/bgfx/shaders/essl/chains/misc/fs_bob-and-ghost-deinterlace.bin Binary files differindex d8a1d3f3c6d..b2433cfdb67 100644 --- a/bgfx/shaders/glsl/chains/misc/fs_bob-and-ghost-deinterlace.bin +++ b/bgfx/shaders/essl/chains/misc/fs_bob-and-ghost-deinterlace.bin diff --git a/bgfx/shaders/glsl/chains/misc/fs_deposterize-pass0.bin b/bgfx/shaders/essl/chains/misc/fs_deposterize-pass0.bin Binary files differindex c7188eec839..a7ef07b90c7 100644 --- a/bgfx/shaders/glsl/chains/misc/fs_deposterize-pass0.bin +++ b/bgfx/shaders/essl/chains/misc/fs_deposterize-pass0.bin diff --git a/bgfx/shaders/glsl/chains/misc/fs_deposterize-pass1.bin b/bgfx/shaders/essl/chains/misc/fs_deposterize-pass1.bin Binary files differindex 68a47c3243f..08c29573029 100644 --- a/bgfx/shaders/glsl/chains/misc/fs_deposterize-pass1.bin +++ b/bgfx/shaders/essl/chains/misc/fs_deposterize-pass1.bin diff --git a/bgfx/shaders/glsl/chains/misc/fs_saturation.bin b/bgfx/shaders/essl/chains/misc/fs_saturation.bin Binary files differindex 4a3f80b56b9..2f6160fe747 100644 --- a/bgfx/shaders/glsl/chains/misc/fs_saturation.bin +++ b/bgfx/shaders/essl/chains/misc/fs_saturation.bin diff --git a/bgfx/shaders/essl/chains/misc/vs_blit.bin b/bgfx/shaders/essl/chains/misc/vs_blit.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/misc/vs_blit.bin diff --git a/bgfx/shaders/essl/chains/misc/vs_bob-and-ghost-deinterlace.bin b/bgfx/shaders/essl/chains/misc/vs_bob-and-ghost-deinterlace.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/misc/vs_bob-and-ghost-deinterlace.bin diff --git a/bgfx/shaders/glsl/chains/misc/vs_deposterize-pass0.bin b/bgfx/shaders/essl/chains/misc/vs_deposterize-pass0.bin Binary files differindex e6cfefbd74f..b39bc67dfb4 100644 --- a/bgfx/shaders/glsl/chains/misc/vs_deposterize-pass0.bin +++ b/bgfx/shaders/essl/chains/misc/vs_deposterize-pass0.bin diff --git a/bgfx/shaders/glsl/chains/misc/vs_deposterize-pass1.bin b/bgfx/shaders/essl/chains/misc/vs_deposterize-pass1.bin Binary files differindex af4ba2d7538..893fee943b1 100644 --- a/bgfx/shaders/glsl/chains/misc/vs_deposterize-pass1.bin +++ b/bgfx/shaders/essl/chains/misc/vs_deposterize-pass1.bin diff --git a/bgfx/shaders/essl/chains/misc/vs_saturation.bin b/bgfx/shaders/essl/chains/misc/vs_saturation.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/misc/vs_saturation.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/fs_gaussian.bin b/bgfx/shaders/essl/chains/pillarbox_left_horizontal/fs_gaussian.bin Binary files differindex eba13b8fcf5..34b997772e7 100644 --- a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/fs_gaussian.bin +++ b/bgfx/shaders/essl/chains/pillarbox_left_horizontal/fs_gaussian.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/fs_offset_sat.bin b/bgfx/shaders/essl/chains/pillarbox_left_horizontal/fs_offset_sat.bin Binary files differindex 4a3f80b56b9..2f6160fe747 100644 --- a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/fs_offset_sat.bin +++ b/bgfx/shaders/essl/chains/pillarbox_left_horizontal/fs_offset_sat.bin diff --git a/bgfx/shaders/essl/chains/pillarbox_left_horizontal/vs_gaussian.bin b/bgfx/shaders/essl/chains/pillarbox_left_horizontal/vs_gaussian.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/pillarbox_left_horizontal/vs_gaussian.bin diff --git a/bgfx/shaders/essl/chains/pillarbox_left_horizontal/vs_offset_sat.bin b/bgfx/shaders/essl/chains/pillarbox_left_horizontal/vs_offset_sat.bin Binary files differnew file mode 100644 index 00000000000..42326d4324e --- /dev/null +++ b/bgfx/shaders/essl/chains/pillarbox_left_horizontal/vs_offset_sat.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/fs_gaussian.bin b/bgfx/shaders/essl/chains/pillarbox_left_vertical/fs_gaussian.bin Binary files differindex eba13b8fcf5..34b997772e7 100644 --- a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/fs_gaussian.bin +++ b/bgfx/shaders/essl/chains/pillarbox_left_vertical/fs_gaussian.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/fs_offset_sat.bin b/bgfx/shaders/essl/chains/pillarbox_left_vertical/fs_offset_sat.bin Binary files differindex 4a3f80b56b9..2f6160fe747 100644 --- a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/fs_offset_sat.bin +++ b/bgfx/shaders/essl/chains/pillarbox_left_vertical/fs_offset_sat.bin diff --git a/bgfx/shaders/essl/chains/pillarbox_left_vertical/vs_gaussian.bin b/bgfx/shaders/essl/chains/pillarbox_left_vertical/vs_gaussian.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/pillarbox_left_vertical/vs_gaussian.bin diff --git a/bgfx/shaders/essl/chains/pillarbox_left_vertical/vs_offset_sat.bin b/bgfx/shaders/essl/chains/pillarbox_left_vertical/vs_offset_sat.bin Binary files differnew file mode 100644 index 00000000000..dbce619ef26 --- /dev/null +++ b/bgfx/shaders/essl/chains/pillarbox_left_vertical/vs_offset_sat.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/fs_gaussian.bin b/bgfx/shaders/essl/chains/pillarbox_right_horizontal/fs_gaussian.bin Binary files differindex eba13b8fcf5..34b997772e7 100644 --- a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/fs_gaussian.bin +++ b/bgfx/shaders/essl/chains/pillarbox_right_horizontal/fs_gaussian.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/fs_offset_sat.bin b/bgfx/shaders/essl/chains/pillarbox_right_horizontal/fs_offset_sat.bin Binary files differindex 4a3f80b56b9..2f6160fe747 100644 --- a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/fs_offset_sat.bin +++ b/bgfx/shaders/essl/chains/pillarbox_right_horizontal/fs_offset_sat.bin diff --git a/bgfx/shaders/essl/chains/pillarbox_right_horizontal/vs_gaussian.bin b/bgfx/shaders/essl/chains/pillarbox_right_horizontal/vs_gaussian.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/pillarbox_right_horizontal/vs_gaussian.bin diff --git a/bgfx/shaders/essl/chains/pillarbox_right_horizontal/vs_offset_sat.bin b/bgfx/shaders/essl/chains/pillarbox_right_horizontal/vs_offset_sat.bin Binary files differnew file mode 100644 index 00000000000..1e806909f59 --- /dev/null +++ b/bgfx/shaders/essl/chains/pillarbox_right_horizontal/vs_offset_sat.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/fs_gaussian.bin b/bgfx/shaders/essl/chains/pillarbox_right_vertical/fs_gaussian.bin Binary files differindex eba13b8fcf5..34b997772e7 100644 --- a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/fs_gaussian.bin +++ b/bgfx/shaders/essl/chains/pillarbox_right_vertical/fs_gaussian.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/fs_offset_sat.bin b/bgfx/shaders/essl/chains/pillarbox_right_vertical/fs_offset_sat.bin Binary files differindex 4a3f80b56b9..2f6160fe747 100644 --- a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/fs_offset_sat.bin +++ b/bgfx/shaders/essl/chains/pillarbox_right_vertical/fs_offset_sat.bin diff --git a/bgfx/shaders/essl/chains/pillarbox_right_vertical/vs_gaussian.bin b/bgfx/shaders/essl/chains/pillarbox_right_vertical/vs_gaussian.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/pillarbox_right_vertical/vs_gaussian.bin diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/vs_offset_sat.bin b/bgfx/shaders/essl/chains/pillarbox_right_vertical/vs_offset_sat.bin Binary files differindex 3b5a651f2e7..c0f4dfa5a88 100644 --- a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/vs_offset_sat.bin +++ b/bgfx/shaders/essl/chains/pillarbox_right_vertical/vs_offset_sat.bin diff --git a/bgfx/shaders/essl/chains/unfiltered/fs_blit.bin b/bgfx/shaders/essl/chains/unfiltered/fs_blit.bin Binary files differnew file mode 100644 index 00000000000..22e2f0c23d0 --- /dev/null +++ b/bgfx/shaders/essl/chains/unfiltered/fs_blit.bin diff --git a/bgfx/shaders/essl/chains/unfiltered/vs_blit.bin b/bgfx/shaders/essl/chains/unfiltered/vs_blit.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/unfiltered/vs_blit.bin diff --git a/bgfx/shaders/glsl/chains/warp/fs_dilation-horizontal-fast.bin b/bgfx/shaders/essl/chains/warp/fs_dilation-horizontal-fast.bin Binary files differindex f5c958c3a24..734573098cc 100644 --- a/bgfx/shaders/glsl/chains/warp/fs_dilation-horizontal-fast.bin +++ b/bgfx/shaders/essl/chains/warp/fs_dilation-horizontal-fast.bin diff --git a/bgfx/shaders/essl/chains/warp/vs_dilation-horizontal-fast.bin b/bgfx/shaders/essl/chains/warp/vs_dilation-horizontal-fast.bin Binary files differnew file mode 100644 index 00000000000..66384640a3b --- /dev/null +++ b/bgfx/shaders/essl/chains/warp/vs_dilation-horizontal-fast.bin diff --git a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv1-noblend.bin b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv1-noblend.bin Binary files differindex e4fa0a459fd..2a18147115f 100644 --- a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv1-noblend.bin +++ b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv1-noblend.bin diff --git a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-3d.bin b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv2-3d.bin Binary files differindex 5e23d658855..9643a265714 100644 --- a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-3d.bin +++ b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv2-3d.bin diff --git a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-fast.bin b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv2-fast.bin Binary files differindex a7b48e65fc8..fb0ee7104e3 100644 --- a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-fast.bin +++ b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv2-fast.bin diff --git a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-noblend.bin b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv2-noblend.bin Binary files differindex f404bb3847c..b4875edd7c6 100644 --- a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2-noblend.bin +++ b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv2-noblend.bin diff --git a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2.bin b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv2.bin Binary files differindex b1e84120d4d..c5dcd103244 100644 --- a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv2.bin +++ b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv2.bin diff --git a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv3-noblend.bin b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv3-noblend.bin Binary files differindex f8cbc73f326..8ef2d000e2b 100644 --- a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv3-noblend.bin +++ b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv3-noblend.bin diff --git a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv3.bin b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv3.bin Binary files differindex 9eeb127cdf9..e2d807898a8 100644 --- a/bgfx/shaders/glsl/chains/xbr/fs_xbr-lv3.bin +++ b/bgfx/shaders/essl/chains/xbr/fs_xbr-lv3.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin Binary files differindex 26a3506b7cb..f9c7ad41d1d 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin Binary files differnew file mode 100644 index 00000000000..ce19da70ec3 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin Binary files differnew file mode 100644 index 00000000000..37b5ee12682 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin Binary files differindex c8900a657ea..6585387ce7a 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin Binary files differnew file mode 100644 index 00000000000..02aba5a0cba --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin Binary files differnew file mode 100644 index 00000000000..d645bdf002c --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin Binary files differindex e2254725353..1914c61410f 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin Binary files differnew file mode 100644 index 00000000000..ce19da70ec3 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin Binary files differnew file mode 100644 index 00000000000..b5e7f16543d --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin Binary files differindex d855fb47c25..a98de1025c7 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin Binary files differnew file mode 100644 index 00000000000..82036f8a21f --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin Binary files differnew file mode 100644 index 00000000000..b2fec3f1fb6 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin Binary files differindex 2652cdee73e..9409cfb2a61 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass0.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-pass0.bin Binary files differindex f2b5b97387a..ac71cdeef2c 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-pass0.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-pass1.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-pass1.bin Binary files differnew file mode 100644 index 00000000000..900a4e701a5 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass2.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-pass2.bin Binary files differindex 3d66ef7f690..f1995dd122c 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass2.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/fs_super-xbr-pass2.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin Binary files differindex 289f01ddd34..d4df7ec9ee3 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin Binary files differindex 289f01ddd34..d4df7ec9ee3 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin Binary files differindex 289f01ddd34..d4df7ec9ee3 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass0.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-pass0.bin Binary files differindex 061a6627b32..39c4b239b8a 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-pass0.bin diff --git a/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-pass1.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-pass1.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass2.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-pass2.bin Binary files differindex 289f01ddd34..d4df7ec9ee3 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass2.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-pass2.bin diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass3.bin b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-pass3.bin Binary files differindex 289f01ddd34..d4df7ec9ee3 100644 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass3.bin +++ b/bgfx/shaders/essl/chains/xbr/super-xbr/vs_super-xbr-pass3.bin diff --git a/bgfx/shaders/essl/chains/xbr/vs_xbr-lv1-noblend.bin b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv1-noblend.bin Binary files differnew file mode 100644 index 00000000000..5769d6ff5d8 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv1-noblend.bin diff --git a/bgfx/shaders/essl/chains/xbr/vs_xbr-lv2-3d.bin b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv2-3d.bin Binary files differnew file mode 100644 index 00000000000..185547625c4 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv2-3d.bin diff --git a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-fast.bin b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv2-fast.bin Binary files differindex c034943e250..2d62e84953e 100644 --- a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-fast.bin +++ b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv2-fast.bin diff --git a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-noblend.bin b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv2-noblend.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-noblend.bin +++ b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv2-noblend.bin diff --git a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2.bin b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv2.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2.bin +++ b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv2.bin diff --git a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv3-noblend.bin b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv3-noblend.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv3-noblend.bin +++ b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv3-noblend.bin diff --git a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv3.bin b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv3.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv3.bin +++ b/bgfx/shaders/essl/chains/xbr/vs_xbr-lv3.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-sharp.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-sharp.bin Binary files differindex d84b3236975..07cc94a825f 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-sharp.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-sharp.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2-gamma.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2-gamma.bin Binary files differindex df01409e7ea..d76f9820389 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2-gamma.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2-gamma.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2.bin Binary files differindex 79d573d3085..3bc5c076820 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4-gamma.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4-gamma.bin Binary files differindex 924c586a750..d43108803f4 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4-gamma.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4-gamma.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4.bin Binary files differindex 20eb843b5ae..b56fb7f7b45 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4b.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4b.bin Binary files differindex 286f94e019c..7c32cfef709 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4b.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4b.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v5-gamma.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v5-gamma.bin Binary files differindex 42788a3d40c..ca0c4c91c71 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v5-gamma.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v5-gamma.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid.bin Binary files differindex b9c800b73ef..4363644e3a5 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/fs_2xbr-hybrid.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-sharp.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-sharp.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-sharp.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-sharp.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2-gamma.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2-gamma.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2-gamma.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2-gamma.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4-gamma.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4-gamma.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4-gamma.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4-gamma.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4b.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4b.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4b.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4b.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v5-gamma.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v5-gamma.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v5-gamma.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v5-gamma.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid.bin b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-hybrid/vs_2xbr-hybrid.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-a-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-a-pass0.bin Binary files differindex 0021e9a700e..dba31ac29cb 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-a-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-a-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass0.bin Binary files differindex 4e2d3470812..df193d6dc41 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass1.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass1.bin Binary files differindex 9483a864100..736852f06b3 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass1.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-b-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-b-pass0.bin Binary files differindex e07c6914544..781d845f6bb 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-b-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-b-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-c-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-c-pass0.bin Binary files differindex 81460e54d9d..2788c66aaee 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-c-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-c-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-d-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-d-pass0.bin Binary files differindex 57b6d8e8300..1695f2c7e1a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-d-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-d-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-noblend-pass1.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-noblend-pass1.bin Binary files differindex bfcb3e7b1a5..7f285bb36d9 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-noblend-pass1.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-noblend-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-pass1.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-pass1.bin Binary files differindex 0e1d66c1644..4421f9fd736 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-pass1.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-a-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-a-pass0.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-a-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-a-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass0.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass1.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass1.bin Binary files differindex b0346c82ec3..e19250609ee 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass1.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-b-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-b-pass0.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-b-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-b-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-c-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-c-pass0.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-c-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-c-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-d-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-d-pass0.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-d-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-d-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-noblend-pass1.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-noblend-pass1.bin Binary files differindex b0346c82ec3..e19250609ee 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-noblend-pass1.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-noblend-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-pass1.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-pass1.bin Binary files differindex b0346c82ec3..e19250609ee 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-pass1.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass0.bin Binary files differindex ef27a84cdc1..4582d6f5e1b 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass1.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass1.bin Binary files differindex dfd83d4fd38..24e46c52d0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass1.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass0.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass0.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass0.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass0.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass1.bin b/bgfx/shaders/essl/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass1.bin Binary files differindex daf1ea4b5de..0b3b52cd27d 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass1.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass1.bin b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass1.bin Binary files differindex e288d693dbc..8a4c94597f2 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass1.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass2.bin b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass2.bin Binary files differindex 09fe6dd9e27..091d42e9d3e 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass2.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass2.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass3.bin b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass3.bin Binary files differindex 9310fb7efe7..97b44e39b56 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass3.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass3.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass4.bin b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass4.bin Binary files differindex 836308b88e2..8b8020487b8 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass4.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass4.bin diff --git a/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass1.bin b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass1.bin Binary files differnew file mode 100644 index 00000000000..1f70fb1d7da --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass1.bin diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass2.bin b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass2.bin Binary files differindex d8d081a91d0..dd851ddde0a 100644 --- a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass2.bin +++ b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass2.bin diff --git a/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass3.bin b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass3.bin Binary files differnew file mode 100644 index 00000000000..9f5f41320c0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass3.bin diff --git a/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass4.bin b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass4.bin Binary files differnew file mode 100644 index 00000000000..9f5f41320c0 --- /dev/null +++ b/bgfx/shaders/essl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass4.bin diff --git a/bgfx/shaders/essl/fs_gui.bin b/bgfx/shaders/essl/fs_gui.bin Binary files differnew file mode 100644 index 00000000000..22e2f0c23d0 --- /dev/null +++ b/bgfx/shaders/essl/fs_gui.bin diff --git a/bgfx/shaders/essl/fs_screen.bin b/bgfx/shaders/essl/fs_screen.bin Binary files differnew file mode 100644 index 00000000000..22e2f0c23d0 --- /dev/null +++ b/bgfx/shaders/essl/fs_screen.bin diff --git a/bgfx/shaders/essl/vs_gui.bin b/bgfx/shaders/essl/vs_gui.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/vs_gui.bin diff --git a/bgfx/shaders/essl/vs_screen.bin b/bgfx/shaders/essl/vs_screen.bin Binary files differnew file mode 100644 index 00000000000..9dd618de8a0 --- /dev/null +++ b/bgfx/shaders/essl/vs_screen.bin diff --git a/bgfx/shaders/glsl/chains/crt-geom/vs_gaussx.bin b/bgfx/shaders/glsl/chains/crt-geom/vs_gaussx.bin Binary files differdeleted file mode 100644 index ebf8e8e4e87..00000000000 --- a/bgfx/shaders/glsl/chains/crt-geom/vs_gaussx.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/crt-geom/vs_gaussy.bin b/bgfx/shaders/glsl/chains/crt-geom/vs_gaussy.bin Binary files differdeleted file mode 100644 index 3461941df07..00000000000 --- a/bgfx/shaders/glsl/chains/crt-geom/vs_gaussy.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/crt-geom/vs_phosphor_apply.bin b/bgfx/shaders/glsl/chains/crt-geom/vs_phosphor_apply.bin Binary files differdeleted file mode 100644 index a02931f846e..00000000000 --- a/bgfx/shaders/glsl/chains/crt-geom/vs_phosphor_apply.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/crt-geom/vs_phosphor_update.bin b/bgfx/shaders/glsl/chains/crt-geom/vs_phosphor_update.bin Binary files differdeleted file mode 100644 index a02931f846e..00000000000 --- a/bgfx/shaders/glsl/chains/crt-geom/vs_phosphor_update.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/crt/vs_crt-caligari.bin b/bgfx/shaders/glsl/chains/crt/vs_crt-caligari.bin Binary files differdeleted file mode 100644 index de8e1df2d6b..00000000000 --- a/bgfx/shaders/glsl/chains/crt/vs_crt-caligari.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/default/fs_blit.bin b/bgfx/shaders/glsl/chains/default/fs_blit.bin Binary files differdeleted file mode 100644 index db0fe2b487b..00000000000 --- a/bgfx/shaders/glsl/chains/default/fs_blit.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/default/vs_blit.bin b/bgfx/shaders/glsl/chains/default/vs_blit.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/default/vs_blit.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/hlsl/fs_prescale.bin b/bgfx/shaders/glsl/chains/hlsl/fs_prescale.bin Binary files differdeleted file mode 100644 index db0fe2b487b..00000000000 --- a/bgfx/shaders/glsl/chains/hlsl/fs_prescale.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/hlsl/vs_color.bin b/bgfx/shaders/glsl/chains/hlsl/vs_color.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/hlsl/vs_color.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/hlsl/vs_defocus.bin b/bgfx/shaders/glsl/chains/hlsl/vs_defocus.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/hlsl/vs_defocus.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/hlsl/vs_distortion.bin b/bgfx/shaders/glsl/chains/hlsl/vs_distortion.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/hlsl/vs_distortion.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/hlsl/vs_ntsc_decode.bin b/bgfx/shaders/glsl/chains/hlsl/vs_ntsc_decode.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/hlsl/vs_ntsc_decode.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/hlsl/vs_ntsc_encode.bin b/bgfx/shaders/glsl/chains/hlsl/vs_ntsc_encode.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/hlsl/vs_ntsc_encode.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/hlsl/vs_phosphor.bin b/bgfx/shaders/glsl/chains/hlsl/vs_phosphor.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/hlsl/vs_phosphor.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/hlsl/vs_post.bin b/bgfx/shaders/glsl/chains/hlsl/vs_post.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/hlsl/vs_post.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/hlsl/vs_prescale.bin b/bgfx/shaders/glsl/chains/hlsl/vs_prescale.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/hlsl/vs_prescale.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/misc/fs_blit.bin b/bgfx/shaders/glsl/chains/misc/fs_blit.bin Binary files differdeleted file mode 100644 index db0fe2b487b..00000000000 --- a/bgfx/shaders/glsl/chains/misc/fs_blit.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/misc/vs_blit.bin b/bgfx/shaders/glsl/chains/misc/vs_blit.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/misc/vs_blit.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/misc/vs_bob-and-ghost-deinterlace.bin b/bgfx/shaders/glsl/chains/misc/vs_bob-and-ghost-deinterlace.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/misc/vs_bob-and-ghost-deinterlace.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/misc/vs_saturation.bin b/bgfx/shaders/glsl/chains/misc/vs_saturation.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/misc/vs_saturation.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/vs_gaussian.bin b/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/vs_gaussian.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/vs_gaussian.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/vs_offset_sat.bin b/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/vs_offset_sat.bin Binary files differdeleted file mode 100644 index 061d861b6ed..00000000000 --- a/bgfx/shaders/glsl/chains/pillarbox_left_horizontal/vs_offset_sat.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/vs_gaussian.bin b/bgfx/shaders/glsl/chains/pillarbox_left_vertical/vs_gaussian.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/vs_gaussian.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/vs_offset_sat.bin b/bgfx/shaders/glsl/chains/pillarbox_left_vertical/vs_offset_sat.bin Binary files differdeleted file mode 100644 index de0d4115e79..00000000000 --- a/bgfx/shaders/glsl/chains/pillarbox_left_vertical/vs_offset_sat.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/vs_gaussian.bin b/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/vs_gaussian.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/vs_gaussian.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/vs_offset_sat.bin b/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/vs_offset_sat.bin Binary files differdeleted file mode 100644 index c25635af5a8..00000000000 --- a/bgfx/shaders/glsl/chains/pillarbox_right_horizontal/vs_offset_sat.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/vs_gaussian.bin b/bgfx/shaders/glsl/chains/pillarbox_right_vertical/vs_gaussian.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/pillarbox_right_vertical/vs_gaussian.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/unfiltered/fs_blit.bin b/bgfx/shaders/glsl/chains/unfiltered/fs_blit.bin Binary files differdeleted file mode 100644 index db0fe2b487b..00000000000 --- a/bgfx/shaders/glsl/chains/unfiltered/fs_blit.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/unfiltered/vs_blit.bin b/bgfx/shaders/glsl/chains/unfiltered/vs_blit.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/unfiltered/vs_blit.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/warp/vs_dilation-horizontal-fast.bin b/bgfx/shaders/glsl/chains/warp/vs_dilation-horizontal-fast.bin Binary files differdeleted file mode 100644 index aa75b840f57..00000000000 --- a/bgfx/shaders/glsl/chains/warp/vs_dilation-horizontal-fast.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin Binary files differdeleted file mode 100644 index c7894d1d0e8..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin Binary files differdeleted file mode 100644 index 8f61bc0c5e3..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin Binary files differdeleted file mode 100644 index 82be16250c1..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin Binary files differdeleted file mode 100644 index bf6c4a886f6..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin Binary files differdeleted file mode 100644 index c7894d1d0e8..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin Binary files differdeleted file mode 100644 index 1c1d4030496..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin Binary files differdeleted file mode 100644 index 66054016ff4..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin Binary files differdeleted file mode 100644 index 43fc6074d13..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass1.bin Binary files differdeleted file mode 100644 index a78563e0ceb..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/fs_super-xbr-pass1.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass1.bin b/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass1.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/super-xbr/vs_super-xbr-pass1.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv1-noblend.bin b/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv1-noblend.bin Binary files differdeleted file mode 100644 index 93b681dd926..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv1-noblend.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-3d.bin b/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-3d.bin Binary files differdeleted file mode 100644 index d0293824b94..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/vs_xbr-lv2-3d.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass1.bin b/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass1.bin Binary files differdeleted file mode 100644 index 930652f50c0..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass1.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass3.bin b/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass3.bin Binary files differdeleted file mode 100644 index 3d3962b3901..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass3.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass4.bin b/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass4.bin Binary files differdeleted file mode 100644 index 3d3962b3901..00000000000 --- a/bgfx/shaders/glsl/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass4.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/fs_gui.bin b/bgfx/shaders/glsl/fs_gui.bin Binary files differdeleted file mode 100644 index db0fe2b487b..00000000000 --- a/bgfx/shaders/glsl/fs_gui.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/fs_screen.bin b/bgfx/shaders/glsl/fs_screen.bin Binary files differdeleted file mode 100644 index db0fe2b487b..00000000000 --- a/bgfx/shaders/glsl/fs_screen.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/vs_gui.bin b/bgfx/shaders/glsl/vs_gui.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/vs_gui.bin +++ /dev/null diff --git a/bgfx/shaders/glsl/vs_screen.bin b/bgfx/shaders/glsl/vs_screen.bin Binary files differdeleted file mode 100644 index af6c9349f41..00000000000 --- a/bgfx/shaders/glsl/vs_screen.bin +++ /dev/null diff --git a/bgfx/shaders/metal/chains/blurs/fs_smart-blur.bin b/bgfx/shaders/metal/chains/blurs/fs_smart-blur.bin Binary files differindex 581ef2f75cc..33f249ae102 100644 --- a/bgfx/shaders/metal/chains/blurs/fs_smart-blur.bin +++ b/bgfx/shaders/metal/chains/blurs/fs_smart-blur.bin diff --git a/bgfx/shaders/metal/chains/blurs/vs_smart-blur.bin b/bgfx/shaders/metal/chains/blurs/vs_smart-blur.bin Binary files differindex 4bd75b98140..847fc062151 100644 --- a/bgfx/shaders/metal/chains/blurs/vs_smart-blur.bin +++ b/bgfx/shaders/metal/chains/blurs/vs_smart-blur.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom-deluxe.bin b/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom-deluxe.bin Binary files differindex 9b916b93043..cbd4e462bda 100644 --- a/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom-deluxe.bin +++ b/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom-deluxe.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom.bin b/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom.bin Binary files differindex cff6b7e6b6c..c2b707d477b 100644 --- a/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom.bin +++ b/bgfx/shaders/metal/chains/crt-geom/fs_crt-geom.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/fs_gaussx.bin b/bgfx/shaders/metal/chains/crt-geom/fs_gaussx.bin Binary files differindex 20840efaf16..dc2aff5a6b3 100644 --- a/bgfx/shaders/metal/chains/crt-geom/fs_gaussx.bin +++ b/bgfx/shaders/metal/chains/crt-geom/fs_gaussx.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/fs_gaussy.bin b/bgfx/shaders/metal/chains/crt-geom/fs_gaussy.bin Binary files differindex b2487180322..bcfcaf25bac 100644 --- a/bgfx/shaders/metal/chains/crt-geom/fs_gaussy.bin +++ b/bgfx/shaders/metal/chains/crt-geom/fs_gaussy.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_apply.bin b/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_apply.bin Binary files differindex 2714075cdeb..b2e2295316c 100644 --- a/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_apply.bin +++ b/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_apply.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_update.bin b/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_update.bin Binary files differindex 9460ce0f08e..88acb97f1dd 100644 --- a/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_update.bin +++ b/bgfx/shaders/metal/chains/crt-geom/fs_phosphor_update.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/vs_crt-geom.bin b/bgfx/shaders/metal/chains/crt-geom/vs_crt-geom.bin Binary files differindex f7d1102e36b..efd56e2e06f 100644 --- a/bgfx/shaders/metal/chains/crt-geom/vs_crt-geom.bin +++ b/bgfx/shaders/metal/chains/crt-geom/vs_crt-geom.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/vs_gaussx.bin b/bgfx/shaders/metal/chains/crt-geom/vs_gaussx.bin Binary files differindex 35c8a2f643d..14d125203f5 100644 --- a/bgfx/shaders/metal/chains/crt-geom/vs_gaussx.bin +++ b/bgfx/shaders/metal/chains/crt-geom/vs_gaussx.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/vs_gaussy.bin b/bgfx/shaders/metal/chains/crt-geom/vs_gaussy.bin Binary files differindex 1f488205a1a..5be00b0ed26 100644 --- a/bgfx/shaders/metal/chains/crt-geom/vs_gaussy.bin +++ b/bgfx/shaders/metal/chains/crt-geom/vs_gaussy.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/vs_phosphor_apply.bin b/bgfx/shaders/metal/chains/crt-geom/vs_phosphor_apply.bin Binary files differindex b1ba0bf8201..47a60a545c9 100644 --- a/bgfx/shaders/metal/chains/crt-geom/vs_phosphor_apply.bin +++ b/bgfx/shaders/metal/chains/crt-geom/vs_phosphor_apply.bin diff --git a/bgfx/shaders/metal/chains/crt-geom/vs_phosphor_update.bin b/bgfx/shaders/metal/chains/crt-geom/vs_phosphor_update.bin Binary files differindex b1ba0bf8201..47a60a545c9 100644 --- a/bgfx/shaders/metal/chains/crt-geom/vs_phosphor_update.bin +++ b/bgfx/shaders/metal/chains/crt-geom/vs_phosphor_update.bin diff --git a/bgfx/shaders/metal/chains/crt/fs_crt-caligari.bin b/bgfx/shaders/metal/chains/crt/fs_crt-caligari.bin Binary files differindex 212ad376c6b..22ba0e877d7 100644 --- a/bgfx/shaders/metal/chains/crt/fs_crt-caligari.bin +++ b/bgfx/shaders/metal/chains/crt/fs_crt-caligari.bin diff --git a/bgfx/shaders/metal/chains/crt/vs_crt-caligari.bin b/bgfx/shaders/metal/chains/crt/vs_crt-caligari.bin Binary files differindex dec99f5b2b1..0662a0e5659 100644 --- a/bgfx/shaders/metal/chains/crt/vs_crt-caligari.bin +++ b/bgfx/shaders/metal/chains/crt/vs_crt-caligari.bin diff --git a/bgfx/shaders/metal/chains/default/fs_blit.bin b/bgfx/shaders/metal/chains/default/fs_blit.bin Binary files differindex 6a3da392480..888f658c50d 100644 --- a/bgfx/shaders/metal/chains/default/fs_blit.bin +++ b/bgfx/shaders/metal/chains/default/fs_blit.bin diff --git a/bgfx/shaders/metal/chains/default/vs_blit.bin b/bgfx/shaders/metal/chains/default/vs_blit.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/default/vs_blit.bin +++ b/bgfx/shaders/metal/chains/default/vs_blit.bin diff --git a/bgfx/shaders/metal/chains/eagle/fs_eagle.bin b/bgfx/shaders/metal/chains/eagle/fs_eagle.bin Binary files differindex 2d70baf9545..f17c67885ce 100644 --- a/bgfx/shaders/metal/chains/eagle/fs_eagle.bin +++ b/bgfx/shaders/metal/chains/eagle/fs_eagle.bin diff --git a/bgfx/shaders/metal/chains/eagle/vs_eagle.bin b/bgfx/shaders/metal/chains/eagle/vs_eagle.bin Binary files differindex 268549ac9d2..a6908bba3b7 100644 --- a/bgfx/shaders/metal/chains/eagle/vs_eagle.bin +++ b/bgfx/shaders/metal/chains/eagle/vs_eagle.bin diff --git a/bgfx/shaders/metal/chains/hlsl/fs_color.bin b/bgfx/shaders/metal/chains/hlsl/fs_color.bin Binary files differindex 41355632c6d..5e9ae7db297 100644 --- a/bgfx/shaders/metal/chains/hlsl/fs_color.bin +++ b/bgfx/shaders/metal/chains/hlsl/fs_color.bin diff --git a/bgfx/shaders/metal/chains/hlsl/fs_deconverge.bin b/bgfx/shaders/metal/chains/hlsl/fs_deconverge.bin Binary files differindex ff76a618ee1..bf099f55d18 100644 --- a/bgfx/shaders/metal/chains/hlsl/fs_deconverge.bin +++ b/bgfx/shaders/metal/chains/hlsl/fs_deconverge.bin diff --git a/bgfx/shaders/metal/chains/hlsl/fs_defocus.bin b/bgfx/shaders/metal/chains/hlsl/fs_defocus.bin Binary files differindex 90bf785e554..a448d9a9919 100644 --- a/bgfx/shaders/metal/chains/hlsl/fs_defocus.bin +++ b/bgfx/shaders/metal/chains/hlsl/fs_defocus.bin diff --git a/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin b/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin Binary files differindex b36016564a2..11e288fe6a4 100644 --- a/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin +++ b/bgfx/shaders/metal/chains/hlsl/fs_distortion.bin diff --git a/bgfx/shaders/metal/chains/hlsl/fs_ntsc_decode.bin b/bgfx/shaders/metal/chains/hlsl/fs_ntsc_decode.bin Binary files differindex 1436bc4707c..c5fbfe10815 100644 --- a/bgfx/shaders/metal/chains/hlsl/fs_ntsc_decode.bin +++ b/bgfx/shaders/metal/chains/hlsl/fs_ntsc_decode.bin diff --git a/bgfx/shaders/metal/chains/hlsl/fs_ntsc_encode.bin b/bgfx/shaders/metal/chains/hlsl/fs_ntsc_encode.bin Binary files differindex f961d2c9ab6..543dcb17be6 100644 --- a/bgfx/shaders/metal/chains/hlsl/fs_ntsc_encode.bin +++ b/bgfx/shaders/metal/chains/hlsl/fs_ntsc_encode.bin diff --git a/bgfx/shaders/metal/chains/hlsl/fs_phosphor.bin b/bgfx/shaders/metal/chains/hlsl/fs_phosphor.bin Binary files differindex 704d6aacf61..493489ef17a 100644 --- a/bgfx/shaders/metal/chains/hlsl/fs_phosphor.bin +++ b/bgfx/shaders/metal/chains/hlsl/fs_phosphor.bin diff --git a/bgfx/shaders/metal/chains/hlsl/fs_post.bin b/bgfx/shaders/metal/chains/hlsl/fs_post.bin Binary files differindex b6c6bd79b8e..d8b998e82be 100644 --- a/bgfx/shaders/metal/chains/hlsl/fs_post.bin +++ b/bgfx/shaders/metal/chains/hlsl/fs_post.bin diff --git a/bgfx/shaders/metal/chains/hlsl/fs_prescale.bin b/bgfx/shaders/metal/chains/hlsl/fs_prescale.bin Binary files differindex 6a3da392480..888f658c50d 100644 --- a/bgfx/shaders/metal/chains/hlsl/fs_prescale.bin +++ b/bgfx/shaders/metal/chains/hlsl/fs_prescale.bin diff --git a/bgfx/shaders/metal/chains/hlsl/vs_color.bin b/bgfx/shaders/metal/chains/hlsl/vs_color.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/hlsl/vs_color.bin +++ b/bgfx/shaders/metal/chains/hlsl/vs_color.bin diff --git a/bgfx/shaders/metal/chains/hlsl/vs_deconverge.bin b/bgfx/shaders/metal/chains/hlsl/vs_deconverge.bin Binary files differindex b1b64cf68fa..7fe554f75ad 100644 --- a/bgfx/shaders/metal/chains/hlsl/vs_deconverge.bin +++ b/bgfx/shaders/metal/chains/hlsl/vs_deconverge.bin diff --git a/bgfx/shaders/metal/chains/hlsl/vs_defocus.bin b/bgfx/shaders/metal/chains/hlsl/vs_defocus.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/hlsl/vs_defocus.bin +++ b/bgfx/shaders/metal/chains/hlsl/vs_defocus.bin diff --git a/bgfx/shaders/metal/chains/hlsl/vs_distortion.bin b/bgfx/shaders/metal/chains/hlsl/vs_distortion.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/hlsl/vs_distortion.bin +++ b/bgfx/shaders/metal/chains/hlsl/vs_distortion.bin diff --git a/bgfx/shaders/metal/chains/hlsl/vs_ntsc_decode.bin b/bgfx/shaders/metal/chains/hlsl/vs_ntsc_decode.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/hlsl/vs_ntsc_decode.bin +++ b/bgfx/shaders/metal/chains/hlsl/vs_ntsc_decode.bin diff --git a/bgfx/shaders/metal/chains/hlsl/vs_ntsc_encode.bin b/bgfx/shaders/metal/chains/hlsl/vs_ntsc_encode.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/hlsl/vs_ntsc_encode.bin +++ b/bgfx/shaders/metal/chains/hlsl/vs_ntsc_encode.bin diff --git a/bgfx/shaders/metal/chains/hlsl/vs_phosphor.bin b/bgfx/shaders/metal/chains/hlsl/vs_phosphor.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/hlsl/vs_phosphor.bin +++ b/bgfx/shaders/metal/chains/hlsl/vs_phosphor.bin diff --git a/bgfx/shaders/metal/chains/hlsl/vs_post.bin b/bgfx/shaders/metal/chains/hlsl/vs_post.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/hlsl/vs_post.bin +++ b/bgfx/shaders/metal/chains/hlsl/vs_post.bin diff --git a/bgfx/shaders/metal/chains/hlsl/vs_prescale.bin b/bgfx/shaders/metal/chains/hlsl/vs_prescale.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/hlsl/vs_prescale.bin +++ b/bgfx/shaders/metal/chains/hlsl/vs_prescale.bin diff --git a/bgfx/shaders/metal/chains/hqx/fs_hq2x.bin b/bgfx/shaders/metal/chains/hqx/fs_hq2x.bin Binary files differindex 434944fc7f3..5049a064e8c 100644 --- a/bgfx/shaders/metal/chains/hqx/fs_hq2x.bin +++ b/bgfx/shaders/metal/chains/hqx/fs_hq2x.bin diff --git a/bgfx/shaders/metal/chains/hqx/fs_hq3x.bin b/bgfx/shaders/metal/chains/hqx/fs_hq3x.bin Binary files differindex 38ae9cf1aa5..e387cb7e95b 100644 --- a/bgfx/shaders/metal/chains/hqx/fs_hq3x.bin +++ b/bgfx/shaders/metal/chains/hqx/fs_hq3x.bin diff --git a/bgfx/shaders/metal/chains/hqx/fs_hq4x.bin b/bgfx/shaders/metal/chains/hqx/fs_hq4x.bin Binary files differindex 5e417d94af9..ead24893d7a 100644 --- a/bgfx/shaders/metal/chains/hqx/fs_hq4x.bin +++ b/bgfx/shaders/metal/chains/hqx/fs_hq4x.bin diff --git a/bgfx/shaders/metal/chains/hqx/vs_hq2x.bin b/bgfx/shaders/metal/chains/hqx/vs_hq2x.bin Binary files differindex d7332288c05..e97c5130f6e 100644 --- a/bgfx/shaders/metal/chains/hqx/vs_hq2x.bin +++ b/bgfx/shaders/metal/chains/hqx/vs_hq2x.bin diff --git a/bgfx/shaders/metal/chains/hqx/vs_hq3x.bin b/bgfx/shaders/metal/chains/hqx/vs_hq3x.bin Binary files differindex d7332288c05..e97c5130f6e 100644 --- a/bgfx/shaders/metal/chains/hqx/vs_hq3x.bin +++ b/bgfx/shaders/metal/chains/hqx/vs_hq3x.bin diff --git a/bgfx/shaders/metal/chains/hqx/vs_hq4x.bin b/bgfx/shaders/metal/chains/hqx/vs_hq4x.bin Binary files differindex d7332288c05..e97c5130f6e 100644 --- a/bgfx/shaders/metal/chains/hqx/vs_hq4x.bin +++ b/bgfx/shaders/metal/chains/hqx/vs_hq4x.bin diff --git a/bgfx/shaders/metal/chains/misc/fs_blit.bin b/bgfx/shaders/metal/chains/misc/fs_blit.bin Binary files differindex 6a3da392480..888f658c50d 100644 --- a/bgfx/shaders/metal/chains/misc/fs_blit.bin +++ b/bgfx/shaders/metal/chains/misc/fs_blit.bin diff --git a/bgfx/shaders/metal/chains/misc/fs_bob-and-ghost-deinterlace.bin b/bgfx/shaders/metal/chains/misc/fs_bob-and-ghost-deinterlace.bin Binary files differindex d8c81a9a23c..34b62561d35 100644 --- a/bgfx/shaders/metal/chains/misc/fs_bob-and-ghost-deinterlace.bin +++ b/bgfx/shaders/metal/chains/misc/fs_bob-and-ghost-deinterlace.bin diff --git a/bgfx/shaders/metal/chains/misc/fs_deposterize-pass0.bin b/bgfx/shaders/metal/chains/misc/fs_deposterize-pass0.bin Binary files differindex e33c9cc3f2d..80d12cd15ac 100644 --- a/bgfx/shaders/metal/chains/misc/fs_deposterize-pass0.bin +++ b/bgfx/shaders/metal/chains/misc/fs_deposterize-pass0.bin diff --git a/bgfx/shaders/metal/chains/misc/fs_deposterize-pass1.bin b/bgfx/shaders/metal/chains/misc/fs_deposterize-pass1.bin Binary files differindex a724de4ed3e..698523fe624 100644 --- a/bgfx/shaders/metal/chains/misc/fs_deposterize-pass1.bin +++ b/bgfx/shaders/metal/chains/misc/fs_deposterize-pass1.bin diff --git a/bgfx/shaders/metal/chains/misc/fs_saturation.bin b/bgfx/shaders/metal/chains/misc/fs_saturation.bin Binary files differindex de6ec5972af..c650d799650 100644 --- a/bgfx/shaders/metal/chains/misc/fs_saturation.bin +++ b/bgfx/shaders/metal/chains/misc/fs_saturation.bin diff --git a/bgfx/shaders/metal/chains/misc/vs_blit.bin b/bgfx/shaders/metal/chains/misc/vs_blit.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/misc/vs_blit.bin +++ b/bgfx/shaders/metal/chains/misc/vs_blit.bin diff --git a/bgfx/shaders/metal/chains/misc/vs_bob-and-ghost-deinterlace.bin b/bgfx/shaders/metal/chains/misc/vs_bob-and-ghost-deinterlace.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/misc/vs_bob-and-ghost-deinterlace.bin +++ b/bgfx/shaders/metal/chains/misc/vs_bob-and-ghost-deinterlace.bin diff --git a/bgfx/shaders/metal/chains/misc/vs_deposterize-pass0.bin b/bgfx/shaders/metal/chains/misc/vs_deposterize-pass0.bin Binary files differindex 45cb2ff444d..fa5756641d2 100644 --- a/bgfx/shaders/metal/chains/misc/vs_deposterize-pass0.bin +++ b/bgfx/shaders/metal/chains/misc/vs_deposterize-pass0.bin diff --git a/bgfx/shaders/metal/chains/misc/vs_deposterize-pass1.bin b/bgfx/shaders/metal/chains/misc/vs_deposterize-pass1.bin Binary files differindex abf0c3febb1..941de917fa5 100644 --- a/bgfx/shaders/metal/chains/misc/vs_deposterize-pass1.bin +++ b/bgfx/shaders/metal/chains/misc/vs_deposterize-pass1.bin diff --git a/bgfx/shaders/metal/chains/misc/vs_saturation.bin b/bgfx/shaders/metal/chains/misc/vs_saturation.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/misc/vs_saturation.bin +++ b/bgfx/shaders/metal/chains/misc/vs_saturation.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_gaussian.bin b/bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_gaussian.bin Binary files differindex 173ce9333e4..ff8638bdc5e 100644 --- a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_gaussian.bin +++ b/bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_gaussian.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_offset_sat.bin b/bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_offset_sat.bin Binary files differindex de6ec5972af..c650d799650 100644 --- a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_offset_sat.bin +++ b/bgfx/shaders/metal/chains/pillarbox_left_horizontal/fs_offset_sat.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_gaussian.bin b/bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_gaussian.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_gaussian.bin +++ b/bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_gaussian.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_offset_sat.bin b/bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_offset_sat.bin Binary files differindex 79234729f36..c5db3f28e19 100644 --- a/bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_offset_sat.bin +++ b/bgfx/shaders/metal/chains/pillarbox_left_horizontal/vs_offset_sat.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_gaussian.bin b/bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_gaussian.bin Binary files differindex 173ce9333e4..ff8638bdc5e 100644 --- a/bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_gaussian.bin +++ b/bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_gaussian.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_offset_sat.bin b/bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_offset_sat.bin Binary files differindex de6ec5972af..c650d799650 100644 --- a/bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_offset_sat.bin +++ b/bgfx/shaders/metal/chains/pillarbox_left_vertical/fs_offset_sat.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_gaussian.bin b/bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_gaussian.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_gaussian.bin +++ b/bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_gaussian.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_offset_sat.bin b/bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_offset_sat.bin Binary files differindex f9567cc2d50..08b4205fbd6 100644 --- a/bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_offset_sat.bin +++ b/bgfx/shaders/metal/chains/pillarbox_left_vertical/vs_offset_sat.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_gaussian.bin b/bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_gaussian.bin Binary files differindex 173ce9333e4..ff8638bdc5e 100644 --- a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_gaussian.bin +++ b/bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_gaussian.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_offset_sat.bin b/bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_offset_sat.bin Binary files differindex de6ec5972af..c650d799650 100644 --- a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_offset_sat.bin +++ b/bgfx/shaders/metal/chains/pillarbox_right_horizontal/fs_offset_sat.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_gaussian.bin b/bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_gaussian.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_gaussian.bin +++ b/bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_gaussian.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_offset_sat.bin b/bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_offset_sat.bin Binary files differindex efd3de32003..62759467e29 100644 --- a/bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_offset_sat.bin +++ b/bgfx/shaders/metal/chains/pillarbox_right_horizontal/vs_offset_sat.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_gaussian.bin b/bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_gaussian.bin Binary files differindex 173ce9333e4..ff8638bdc5e 100644 --- a/bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_gaussian.bin +++ b/bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_gaussian.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_offset_sat.bin b/bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_offset_sat.bin Binary files differindex de6ec5972af..c650d799650 100644 --- a/bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_offset_sat.bin +++ b/bgfx/shaders/metal/chains/pillarbox_right_vertical/fs_offset_sat.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_gaussian.bin b/bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_gaussian.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_gaussian.bin +++ b/bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_gaussian.bin diff --git a/bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_offset_sat.bin b/bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_offset_sat.bin Binary files differindex 5fdb790c191..89396996889 100644 --- a/bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_offset_sat.bin +++ b/bgfx/shaders/metal/chains/pillarbox_right_vertical/vs_offset_sat.bin diff --git a/bgfx/shaders/metal/chains/unfiltered/fs_blit.bin b/bgfx/shaders/metal/chains/unfiltered/fs_blit.bin Binary files differindex 6a3da392480..888f658c50d 100644 --- a/bgfx/shaders/metal/chains/unfiltered/fs_blit.bin +++ b/bgfx/shaders/metal/chains/unfiltered/fs_blit.bin diff --git a/bgfx/shaders/metal/chains/unfiltered/vs_blit.bin b/bgfx/shaders/metal/chains/unfiltered/vs_blit.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/unfiltered/vs_blit.bin +++ b/bgfx/shaders/metal/chains/unfiltered/vs_blit.bin diff --git a/bgfx/shaders/metal/chains/warp/fs_dilation-horizontal-fast.bin b/bgfx/shaders/metal/chains/warp/fs_dilation-horizontal-fast.bin Binary files differindex cc7a76e66aa..f3f7851b8dc 100644 --- a/bgfx/shaders/metal/chains/warp/fs_dilation-horizontal-fast.bin +++ b/bgfx/shaders/metal/chains/warp/fs_dilation-horizontal-fast.bin diff --git a/bgfx/shaders/metal/chains/warp/vs_dilation-horizontal-fast.bin b/bgfx/shaders/metal/chains/warp/vs_dilation-horizontal-fast.bin Binary files differindex decac68eaf2..f55a5b4c03a 100644 --- a/bgfx/shaders/metal/chains/warp/vs_dilation-horizontal-fast.bin +++ b/bgfx/shaders/metal/chains/warp/vs_dilation-horizontal-fast.bin diff --git a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv1-noblend.bin b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv1-noblend.bin Binary files differindex e3478fe89b7..d2e6f6ed410 100644 --- a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv1-noblend.bin +++ b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv1-noblend.bin diff --git a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-3d.bin b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-3d.bin Binary files differindex d75cfa36ae6..7be6c04902b 100644 --- a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-3d.bin +++ b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-3d.bin diff --git a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-fast.bin b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-fast.bin Binary files differindex c773ee30579..e01aa0b16ff 100644 --- a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-fast.bin +++ b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-fast.bin diff --git a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-noblend.bin b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-noblend.bin Binary files differindex 091187d7a45..92334de2827 100644 --- a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-noblend.bin +++ b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2-noblend.bin diff --git a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2.bin b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2.bin Binary files differindex 17ed3b98257..344007ee4f4 100644 --- a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2.bin +++ b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv2.bin diff --git a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv3-noblend.bin b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv3-noblend.bin Binary files differindex 1f336dae013..cf9e2ce7bd9 100644 --- a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv3-noblend.bin +++ b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv3-noblend.bin diff --git a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv3.bin b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv3.bin Binary files differindex 64cfb6ed994..810152a00d7 100644 --- a/bgfx/shaders/metal/chains/xbr/fs_xbr-lv3.bin +++ b/bgfx/shaders/metal/chains/xbr/fs_xbr-lv3.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin Binary files differindex 999ab79ad37..1d5f1deff15 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_custom-jinc2-sharper.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin Binary files differindex 0d231ef85fa..78d01370164 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin Binary files differindex f2e63cf659f..6b56b9e9f03 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin Binary files differindex 5b35b08f29d..cdf9013feb9 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-2xbr-3d-pass2.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin Binary files differindex f0929f4c7c0..a69aa60a56d 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin Binary files differindex 89776463420..c90d82b25d7 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin Binary files differindex f896d5e76a4..a46cabc38b1 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass1f.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin Binary files differindex 0d231ef85fa..78d01370164 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass2.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin Binary files differindex 57c6d656e1d..283c7afe115 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin Binary files differindex 8085924f05a..3ccddd54f96 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-4xbr-3d-pass3f.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin Binary files differindex bef91b392f0..23f0067d096 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin Binary files differindex 057237ba0b6..40594966632 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin Binary files differindex 3699abfcb15..c66069ffcc9 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-fast-pass2.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass0.bin Binary files differindex 27effe92acf..03353f03076 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass1.bin Binary files differindex 5a8c8ade818..2b5e3721534 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass2.bin Binary files differindex f0233e0a125..e6560ed1508 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass2.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/fs_super-xbr-pass2.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_custom-jinc2-sharper.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin Binary files differindex 733645f988d..7d3dce4fd2d 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-2xbr-3d-pass2.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin Binary files differindex 733645f988d..7d3dce4fd2d 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass1f.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass2.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin Binary files differindex 733645f988d..7d3dce4fd2d 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-4xbr-3d-pass3f.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-fast-pass2.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass0.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass0.bin Binary files differindex 88af9111c90..3ae6cc81c84 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass1.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass1.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass2.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass2.bin Binary files differindex 733645f988d..7d3dce4fd2d 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass2.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass2.bin diff --git a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass3.bin b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass3.bin Binary files differindex 733645f988d..7d3dce4fd2d 100644 --- a/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass3.bin +++ b/bgfx/shaders/metal/chains/xbr/super-xbr/vs_super-xbr-pass3.bin diff --git a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv1-noblend.bin b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv1-noblend.bin Binary files differindex da9289ef365..a0eead9970c 100644 --- a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv1-noblend.bin +++ b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv1-noblend.bin diff --git a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-3d.bin b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-3d.bin Binary files differindex ac61b8453f0..14c83be3702 100644 --- a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-3d.bin +++ b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-3d.bin diff --git a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-fast.bin b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-fast.bin Binary files differindex 4bd75b98140..847fc062151 100644 --- a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-fast.bin +++ b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-fast.bin diff --git a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-noblend.bin b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-noblend.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-noblend.bin +++ b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2-noblend.bin diff --git a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2.bin b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2.bin +++ b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv2.bin diff --git a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv3-noblend.bin b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv3-noblend.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv3-noblend.bin +++ b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv3-noblend.bin diff --git a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv3.bin b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv3.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/vs_xbr-lv3.bin +++ b/bgfx/shaders/metal/chains/xbr/vs_xbr-lv3.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-sharp.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-sharp.bin Binary files differindex da4e73e073f..b7d6433484c 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-sharp.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-sharp.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2-gamma.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2-gamma.bin Binary files differindex ce8fb5c9af7..052b0999ea6 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2-gamma.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2-gamma.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2.bin Binary files differindex 46f7705b510..dadc8bf5cd9 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v2.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4-gamma.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4-gamma.bin Binary files differindex f3181814f10..ae26020624e 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4-gamma.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4-gamma.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4.bin Binary files differindex 1816d716785..cf53c693077 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4b.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4b.bin Binary files differindex cb44c5354fa..7e2ba3ab18a 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4b.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v4b.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v5-gamma.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v5-gamma.bin Binary files differindex 4ac54dc804f..d2f63ccf7d8 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v5-gamma.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid-v5-gamma.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid.bin Binary files differindex 7416db18edc..a6c08d4aeae 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/fs_2xbr-hybrid.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-sharp.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-sharp.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-sharp.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-sharp.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2-gamma.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2-gamma.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2-gamma.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2-gamma.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v2.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4-gamma.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4-gamma.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4-gamma.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4-gamma.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4b.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4b.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4b.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v4b.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v5-gamma.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v5-gamma.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v5-gamma.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid-v5-gamma.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid.bin b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-hybrid/vs_2xbr-hybrid.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-a-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-a-pass0.bin Binary files differindex f6122c970c4..8569761dacd 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-a-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-a-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass0.bin Binary files differindex 1c9652688c6..ae79da8184d 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass1.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass1.bin Binary files differindex 665fec3186e..e8c3b6b2ab8 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-accuracy-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-b-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-b-pass0.bin Binary files differindex 896071a63cd..15959c2295f 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-b-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-b-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-c-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-c-pass0.bin Binary files differindex 49ade63740b..f9f7eae6851 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-c-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-c-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-d-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-d-pass0.bin Binary files differindex 453fce0f89b..5aa0dd111ac 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-d-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-d-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-noblend-pass1.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-noblend-pass1.bin Binary files differindex 684131e13c7..c84a40efed2 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-noblend-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-noblend-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-pass1.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-pass1.bin Binary files differindex e2deee8aee3..2541e898679 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/fs_xbr-lv2-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-a-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-a-pass0.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-a-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-a-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass0.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass1.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass1.bin Binary files differindex fc154cbf793..9834a6ca5a6 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-accuracy-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-b-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-b-pass0.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-b-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-b-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-c-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-c-pass0.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-c-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-c-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-d-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-d-pass0.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-d-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-d-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-noblend-pass1.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-noblend-pass1.bin Binary files differindex fc154cbf793..9834a6ca5a6 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-noblend-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-noblend-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-pass1.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-pass1.bin Binary files differindex fc154cbf793..9834a6ca5a6 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv2-multipass/vs_xbr-lv2-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass0.bin Binary files differindex f291cdbff41..70dce4c0ede 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass1.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass1.bin Binary files differindex b8a55e3f1b2..cf4a4429139 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/fs_xbr-lv3-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass0.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass0.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass0.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass0.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass1.bin b/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass1.bin Binary files differindex 97972ff4759..ef0a4a29173 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-lv3-multipass/vs_xbr-lv3-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass1.bin b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass1.bin Binary files differindex 6a12b320a2d..46f9bc9e43c 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass2.bin b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass2.bin Binary files differindex 4fc88cb5537..07fd33eae19 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass2.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass2.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass3.bin b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass3.bin Binary files differindex 4ac8e8ff6ee..fa133df6349 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass3.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass3.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass4.bin b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass4.bin Binary files differindex edfa341b54c..eef107caa8f 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass4.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/fs_xbr-mlv4-pass4.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass1.bin b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass1.bin Binary files differindex 79448501cb2..e511761c526 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass1.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass1.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass2.bin b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass2.bin Binary files differindex f39ca902371..5ee70a6a5ff 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass2.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass2.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass3.bin b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass3.bin Binary files differindex 5d97f29fdba..6274ae9397d 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass3.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass3.bin diff --git a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass4.bin b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass4.bin Binary files differindex 5d97f29fdba..6274ae9397d 100644 --- a/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass4.bin +++ b/bgfx/shaders/metal/chains/xbr/xbr-mlv4-multipass/vs_xbr-mlv4-pass4.bin diff --git a/bgfx/shaders/metal/fs_gui.bin b/bgfx/shaders/metal/fs_gui.bin Binary files differindex 6a3da392480..888f658c50d 100644 --- a/bgfx/shaders/metal/fs_gui.bin +++ b/bgfx/shaders/metal/fs_gui.bin diff --git a/bgfx/shaders/metal/fs_screen.bin b/bgfx/shaders/metal/fs_screen.bin Binary files differindex 6a3da392480..888f658c50d 100644 --- a/bgfx/shaders/metal/fs_screen.bin +++ b/bgfx/shaders/metal/fs_screen.bin diff --git a/bgfx/shaders/metal/vs_gui.bin b/bgfx/shaders/metal/vs_gui.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/vs_gui.bin +++ b/bgfx/shaders/metal/vs_gui.bin diff --git a/bgfx/shaders/metal/vs_screen.bin b/bgfx/shaders/metal/vs_screen.bin Binary files differindex 122b7dee5c3..2d32724af20 100644 --- a/bgfx/shaders/metal/vs_screen.bin +++ b/bgfx/shaders/metal/vs_screen.bin @@ -1619,9 +1619,11 @@ bgfx-tools: shaders: bgfx-tools -$(call MKDIR,build/shaders/dx11) -$(call MKDIR,build/shaders/dx9) - -$(call MKDIR,build/shaders/gles) - -$(call MKDIR,build/shaders/glsl) + -$(call MKDIR,build/shaders/pssl) -$(call MKDIR,build/shaders/metal) + -$(call MKDIR,build/shaders/essl) + -$(call MKDIR,build/shaders/glsl) + -$(call MKDIR,build/shaders/spirv) $(SILENT) $(MAKE) -C $(SRC)/osd/modules/render/bgfx/shaders rebuild CHAIN="$(CHAIN)" #------------------------------------------------- diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 598c8137b7a..db9b94d6adc 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -781,13 +781,15 @@ end MAME_DIR .. "3rdparty/bgfx/src/glcontext_ppapi.cpp", MAME_DIR .. "3rdparty/bgfx/src/glcontext_wgl.cpp", MAME_DIR .. "3rdparty/bgfx/src/image.cpp", + MAME_DIR .. "3rdparty/bgfx/src/hmd.cpp", MAME_DIR .. "3rdparty/bgfx/src/hmd_ovr.cpp", MAME_DIR .. "3rdparty/bgfx/src/hmd_openvr.cpp", MAME_DIR .. "3rdparty/bgfx/src/renderer_d3d12.cpp", MAME_DIR .. "3rdparty/bgfx/src/renderer_d3d11.cpp", MAME_DIR .. "3rdparty/bgfx/src/renderer_d3d9.cpp", MAME_DIR .. "3rdparty/bgfx/src/renderer_gl.cpp", - MAME_DIR .. "3rdparty/bgfx/src/renderer_null.cpp", + MAME_DIR .. "3rdparty/bgfx/src/renderer_gnm.cpp", + MAME_DIR .. "3rdparty/bgfx/src/renderer_noop.cpp", MAME_DIR .. "3rdparty/bgfx/src/renderer_vk.cpp", MAME_DIR .. "3rdparty/bgfx/src/debug_renderdoc.cpp", MAME_DIR .. "3rdparty/bgfx/src/shader.cpp", @@ -812,7 +814,6 @@ end MAME_DIR .. "3rdparty/bgfx/3rdparty/ib-compress/indexbufferdecompression.cpp", MAME_DIR .. "3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp", MAME_DIR .. "3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp", - MAME_DIR .. "3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_wm.cpp", } if _OPTIONS["targetos"]=="macosx" then files { diff --git a/src/mame/drivers/pcipc.cpp b/src/mame/drivers/pcipc.cpp index d9a751af7fe..290d3252989 100644 --- a/src/mame/drivers/pcipc.cpp +++ b/src/mame/drivers/pcipc.cpp @@ -193,7 +193,7 @@ WRITE8_MEMBER(pcipc_state::boot_state_w) } static MACHINE_CONFIG_START(pcipc, pcipc_state) - MCFG_CPU_ADD("maincpu", PENTIUM, 66000000) + MCFG_CPU_ADD("maincpu", PENTIUM, 90000000) MCFG_PCI_ROOT_ADD( ":pci") MCFG_I82439HX_ADD( ":pci:00.0", ":maincpu", 256*1024*1024) diff --git a/src/osd/modules/render/bgfx/shadermanager.cpp b/src/osd/modules/render/bgfx/shadermanager.cpp index 8471b360549..6e683b9d14c 100644 --- a/src/osd/modules/render/bgfx/shadermanager.cpp +++ b/src/osd/modules/render/bgfx/shadermanager.cpp @@ -44,6 +44,7 @@ bgfx::ShaderHandle shader_manager::load_shader(std::string name) std::string shader_path; switch (bgfx::getRendererType()) { + case bgfx::RendererType::Noop: case bgfx::RendererType::Direct3D9: shader_path = m_options.bgfx_path() + std::string("/shaders/dx9/"); break; @@ -53,16 +54,24 @@ bgfx::ShaderHandle shader_manager::load_shader(std::string name) shader_path = m_options.bgfx_path() + std::string("/shaders/dx11/"); break; - case bgfx::RendererType::OpenGL: - shader_path = m_options.bgfx_path() + std::string("/shaders/glsl/"); + case bgfx::RendererType::Gnm: + shader_path = m_options.bgfx_path() + std::string("/shaders/pssl/"); break; case bgfx::RendererType::Metal: shader_path = m_options.bgfx_path() + std::string("/shaders/metal/"); break; + case bgfx::RendererType::OpenGL: + shader_path = m_options.bgfx_path() + std::string("/shaders/glsl/"); + break; + case bgfx::RendererType::OpenGLES: - shader_path = m_options.bgfx_path() + std::string("/shaders/gles/"); + shader_path = m_options.bgfx_path() + std::string("/shaders/essl/"); + break; + + case bgfx::RendererType::Vulkan: + shader_path = m_options.bgfx_path() + std::string("/shaders/spirv/"); break; default: diff --git a/src/osd/modules/render/bgfx/shaders/shader.mk b/src/osd/modules/render/bgfx/shaders/shader.mk index 222730c824b..89c13a1b867 100644 --- a/src/osd/modules/render/bgfx/shaders/shader.mk +++ b/src/osd/modules/render/bgfx/shaders/shader.mk @@ -19,12 +19,14 @@ ifndef TARGET .PHONY: all all: @echo Usage: make TARGET=# [clean, all, rebuild] - @echo " TARGET=0 (hlsl - dx9)" - @echo " TARGET=1 (hlsl - dx11)" - @echo " TARGET=2 (glsl - nacl)" - @echo " TARGET=3 (glsl - android)" - @echo " TARGET=4 (glsl - linux)" - @echo " TARGET=5 (metal - OSX/iOS)" + @echo " TARGET=0 (hlsl - d3d9)" + @echo " TARGET=1 (hlsl - d3d11)" + @echo " TARGET=2 (essl - nacl)" + @echo " TARGET=3 (essl - android)" + @echo " TARGET=4 (glsl)" + @echo " TARGET=5 (metal)" + @echo " TARGET=6 (pssl)" + @echo " TARGET=7 (spriv)" @echo " VERBOSE=1 show build commands." else @@ -42,13 +44,13 @@ else ifeq ($(TARGET), 2) VS_FLAGS=--platform nacl FS_FLAGS=--platform nacl -SHADER_PATH=shaders/gles/$(SHADERS_DIR) +SHADER_PATH=shaders/essl/$(SHADERS_DIR) else ifeq ($(TARGET), 3) VS_FLAGS=--platform android FS_FLAGS=--platform android CS_FLAGS=--platform android -SHADER_PATH=shaders/gles/$(SHADERS_DIR) +SHADER_PATH=shaders/essl/$(SHADERS_DIR) else ifeq ($(TARGET), 4) VS_FLAGS=--platform linux -p 120 @@ -61,6 +63,20 @@ VS_FLAGS=--platform osx -p metal FS_FLAGS=--platform osx -p metal CS_FLAGS=--platform osx -p metal SHADER_PATH=shaders/metal/$(SHADERS_DIR) +else +ifeq ($(TARGET), 6) +VS_FLAGS=--platform orbis -p pssl +FS_FLAGS=--platform orbis -p pssl +CS_FLAGS=--platform orbis -p pssl +SHADER_PATH=shaders/pssl/$(SHADERS_DIR) +else +ifeq ($(TARGET), 7) +VS_FLAGS=--platform linux -p spirv +FS_FLAGS=--platform linux -p spirv +CS_FLAGS=--platform linux -p spirv +SHADER_PATH=shaders/spirv/$(SHADERS_DIR) +endif +endif endif endif endif @@ -109,17 +125,17 @@ endif $(BUILD_INTERMEDIATE_DIR)/vs_%.bin : $(SHADERS_DIR)vs_%.sc @echo [$(<)] - $(SILENT) $(SHADERC) -f $(<) -o $(@) --type vertex $(VS_FLAGS) --depends --disasm + $(SILENT) $(SHADERC) $(VS_FLAGS) --type vertex --depends -o $(@) -f $(<) --disasm $(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F) $(BUILD_INTERMEDIATE_DIR)/fs_%.bin : $(SHADERS_DIR)fs_%.sc @echo [$(<)] - $(SILENT) $(SHADERC) -f $(<) -o $(@) --type fragment $(FS_FLAGS) --depends --disasm + $(SILENT) $(SHADERC) $(FS_FLAGS) --type fragment --depends -o $(@) -f $(<) --disasm $(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F) $(BUILD_INTERMEDIATE_DIR)/cs_%.bin : $(SHADERS_DIR)cs_%.sc @echo [$(<)] - $(SILENT) $(SHADERC) -f $(<) -o $(@) --type compute $(CS_FLAGS) --depends --disasm + $(SILENT) $(SHADERC) $(CS_FLAGS) --type compute --depends -o $(@) -f $(<) --disasm $(SILENT) cp $(@) $(BUILD_OUTPUT_DIR)/$(@F) .PHONY: all |