[3PP] Updated: Half, Xbyak, SDL2
This commit is contained in:
parent
1c4527c1e7
commit
c42a54ddec
|
@ -899,11 +899,9 @@ void TraceViewer::DrawVertexFetcher(Shader* shader,
|
||||||
} break;
|
} break;
|
||||||
case xenos::VertexFormat::k_16_16_FLOAT: {
|
case xenos::VertexFormat::k_16_16_FLOAT: {
|
||||||
auto e0 = LOADEL(uint32_t, 0);
|
auto e0 = LOADEL(uint32_t, 0);
|
||||||
ImGui::Text("%.2f",
|
ImGui::Text("%.2f", half_float::detail::uint16((e0 >> 16) & 0xFFFF));
|
||||||
half_float::detail::half2float((e0 >> 16) & 0xFFFF));
|
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::Text("%.2f",
|
ImGui::Text("%.2f", half_float::detail::uint16((e0 >> 0) & 0xFFFF));
|
||||||
half_float::detail::half2float((e0 >> 0) & 0xFFFF));
|
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
} break;
|
} break;
|
||||||
case xenos::VertexFormat::k_32_32:
|
case xenos::VertexFormat::k_32_32:
|
||||||
|
@ -974,17 +972,13 @@ void TraceViewer::DrawVertexFetcher(Shader* shader,
|
||||||
case xenos::VertexFormat::k_16_16_16_16_FLOAT: {
|
case xenos::VertexFormat::k_16_16_16_16_FLOAT: {
|
||||||
auto e0 = LOADEL(uint32_t, 0);
|
auto e0 = LOADEL(uint32_t, 0);
|
||||||
auto e1 = LOADEL(uint32_t, 1);
|
auto e1 = LOADEL(uint32_t, 1);
|
||||||
ImGui::Text("%.2f",
|
ImGui::Text("%.2f", half_float::detail::uint16((e0 >> 16) & 0xFFFF));
|
||||||
half_float::detail::half2float((e0 >> 16) & 0xFFFF));
|
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::Text("%.2f",
|
ImGui::Text("%.2f", half_float::detail::uint16((e0 >> 0) & 0xFFFF));
|
||||||
half_float::detail::half2float((e0 >> 0) & 0xFFFF));
|
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::Text("%.2f",
|
ImGui::Text("%.2f", half_float::detail::uint16((e1 >> 16) & 0xFFFF));
|
||||||
half_float::detail::half2float((e1 >> 16) & 0xFFFF));
|
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::Text("%.2f",
|
ImGui::Text("%.2f", half_float::detail::uint16((e1 >> 0) & 0xFFFF));
|
||||||
half_float::detail::half2float((e1 >> 0) & 0xFFFF));
|
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
} break;
|
} break;
|
||||||
case xenos::VertexFormat::k_32_32_32_32_FLOAT:
|
case xenos::VertexFormat::k_32_32_32_32_FLOAT:
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 859844eae358447be8d66e6da59b6fb3df0ed778
|
Subproject commit 79ec168f3c1e2fe27335cb8886439f7ef676fb49
|
|
@ -139,12 +139,11 @@ project("SDL2")
|
||||||
"SDL2/src/hidapi/hidapi/hidapi.h",
|
"SDL2/src/hidapi/hidapi/hidapi.h",
|
||||||
"SDL2/src/hidapi/SDL_hidapi_c.h",
|
"SDL2/src/hidapi/SDL_hidapi_c.h",
|
||||||
"SDL2/src/joystick/controller_type.h",
|
"SDL2/src/joystick/controller_type.h",
|
||||||
"SDL2/src/joystick/SDL_steam_virtual_gamepad.h",
|
|
||||||
"SDL2/src/joystick/hidapi/SDL_hidapijoystick_c.h",
|
"SDL2/src/joystick/hidapi/SDL_hidapijoystick_c.h",
|
||||||
"SDL2/src/joystick/hidapi/SDL_hidapi_rumble.h",
|
"SDL2/src/joystick/hidapi/SDL_hidapi_rumble.h",
|
||||||
"SDL2/src/joystick/hidapi/SDL_hidapi_nintendo.h",
|
|
||||||
"SDL2/src/joystick/SDL_gamecontrollerdb.h",
|
"SDL2/src/joystick/SDL_gamecontrollerdb.h",
|
||||||
"SDL2/src/joystick/SDL_joystick_c.h",
|
"SDL2/src/joystick/SDL_joystick_c.h",
|
||||||
|
"SDL2/src/joystick/SDL_steam_virtual_gamepad.h",
|
||||||
"SDL2/src/joystick/SDL_sysjoystick.h",
|
"SDL2/src/joystick/SDL_sysjoystick.h",
|
||||||
"SDL2/src/joystick/usb_ids.h",
|
"SDL2/src/joystick/usb_ids.h",
|
||||||
"SDL2/src/joystick/virtual/SDL_virtualjoystick_c.h",
|
"SDL2/src/joystick/virtual/SDL_virtualjoystick_c.h",
|
||||||
|
@ -202,7 +201,6 @@ project("SDL2")
|
||||||
"SDL2/src/video/khronos/vulkan/vk_platform.h",
|
"SDL2/src/video/khronos/vulkan/vk_platform.h",
|
||||||
"SDL2/src/video/khronos/vulkan/vk_sdk_platform.h",
|
"SDL2/src/video/khronos/vulkan/vk_sdk_platform.h",
|
||||||
"SDL2/src/video/khronos/vulkan/vulkan.h",
|
"SDL2/src/video/khronos/vulkan/vulkan.h",
|
||||||
"SDL2/src/video/khronos/vulkan/vulkan.hpp",
|
|
||||||
"SDL2/src/video/khronos/vulkan/vulkan_android.h",
|
"SDL2/src/video/khronos/vulkan/vulkan_android.h",
|
||||||
"SDL2/src/video/khronos/vulkan/vulkan_beta.h",
|
"SDL2/src/video/khronos/vulkan/vulkan_beta.h",
|
||||||
"SDL2/src/video/khronos/vulkan/vulkan_core.h",
|
"SDL2/src/video/khronos/vulkan/vulkan_core.h",
|
||||||
|
@ -242,13 +240,18 @@ project("SDL2")
|
||||||
"SDL2/src/video/windows/SDL_windowsopengl.h",
|
"SDL2/src/video/windows/SDL_windowsopengl.h",
|
||||||
"SDL2/src/video/windows/SDL_windowsopengles.h",
|
"SDL2/src/video/windows/SDL_windowsopengles.h",
|
||||||
"SDL2/src/video/windows/SDL_windowsshape.h",
|
"SDL2/src/video/windows/SDL_windowsshape.h",
|
||||||
"SDL2/src/video/windows/SDL_windowstaskdialog.h",
|
|
||||||
"SDL2/src/video/windows/SDL_windowsvideo.h",
|
"SDL2/src/video/windows/SDL_windowsvideo.h",
|
||||||
"SDL2/src/video/windows/SDL_windowsvulkan.h",
|
"SDL2/src/video/windows/SDL_windowsvulkan.h",
|
||||||
"SDL2/src/video/windows/SDL_windowswindow.h",
|
"SDL2/src/video/windows/SDL_windowswindow.h",
|
||||||
"SDL2/src/video/windows/wmmsg.h",
|
"SDL2/src/video/windows/wmmsg.h",
|
||||||
"SDL2/src/video/yuv2rgb/yuv_rgb.h",
|
"SDL2/src/video/yuv2rgb/yuv_rgb.h",
|
||||||
|
"SDL2/src/video/yuv2rgb/yuv_rgb_common.h",
|
||||||
|
"SDL2/src/video/yuv2rgb/yuv_rgb_internal.h",
|
||||||
|
"SDL2/src/video/yuv2rgb/yuv_rgb_lsx.h",
|
||||||
|
"SDL2/src/video/yuv2rgb/yuv_rgb_lsx_func.h",
|
||||||
|
"SDL2/src/video/yuv2rgb/yuv_rgb_sse.h",
|
||||||
"SDL2/src/video/yuv2rgb/yuv_rgb_sse_func.h",
|
"SDL2/src/video/yuv2rgb/yuv_rgb_sse_func.h",
|
||||||
|
"SDL2/src/video/yuv2rgb/yuv_rgb_std.h",
|
||||||
"SDL2/src/video/yuv2rgb/yuv_rgb_std_func.h",
|
"SDL2/src/video/yuv2rgb/yuv_rgb_std_func.h",
|
||||||
|
|
||||||
"SDL2/src/atomic/SDL_atomic.c",
|
"SDL2/src/atomic/SDL_atomic.c",
|
||||||
|
@ -290,7 +293,6 @@ project("SDL2")
|
||||||
"SDL2/src/haptic/windows/SDL_xinputhaptic.c",
|
"SDL2/src/haptic/windows/SDL_xinputhaptic.c",
|
||||||
"SDL2/src/hidapi/SDL_hidapi.c",
|
"SDL2/src/hidapi/SDL_hidapi.c",
|
||||||
"SDL2/src/joystick/controller_type.c",
|
"SDL2/src/joystick/controller_type.c",
|
||||||
"SDL2/src/joystick/SDL_steam_virtual_gamepad.c",
|
|
||||||
"SDL2/src/joystick/dummy/SDL_sysjoystick.c",
|
"SDL2/src/joystick/dummy/SDL_sysjoystick.c",
|
||||||
"SDL2/src/joystick/hidapi/SDL_hidapijoystick.c",
|
"SDL2/src/joystick/hidapi/SDL_hidapijoystick.c",
|
||||||
"SDL2/src/joystick/hidapi/SDL_hidapi_combined.c",
|
"SDL2/src/joystick/hidapi/SDL_hidapi_combined.c",
|
||||||
|
@ -311,6 +313,7 @@ project("SDL2")
|
||||||
"SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c",
|
"SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c",
|
||||||
"SDL2/src/joystick/SDL_gamecontroller.c",
|
"SDL2/src/joystick/SDL_gamecontroller.c",
|
||||||
"SDL2/src/joystick/SDL_joystick.c",
|
"SDL2/src/joystick/SDL_joystick.c",
|
||||||
|
"SDL2/src/joystick/SDL_steam_virtual_gamepad.c",
|
||||||
"SDL2/src/joystick/virtual/SDL_virtualjoystick.c",
|
"SDL2/src/joystick/virtual/SDL_virtualjoystick.c",
|
||||||
"SDL2/src/joystick/windows/SDL_dinputjoystick.c",
|
"SDL2/src/joystick/windows/SDL_dinputjoystick.c",
|
||||||
"SDL2/src/joystick/windows/SDL_rawinputjoystick.c",
|
"SDL2/src/joystick/windows/SDL_rawinputjoystick.c",
|
||||||
|
@ -432,4 +435,7 @@ project("SDL2")
|
||||||
"SDL2/src/video/windows/SDL_windowsvideo.c",
|
"SDL2/src/video/windows/SDL_windowsvideo.c",
|
||||||
"SDL2/src/video/windows/SDL_windowsvulkan.c",
|
"SDL2/src/video/windows/SDL_windowsvulkan.c",
|
||||||
"SDL2/src/video/windows/SDL_windowswindow.c",
|
"SDL2/src/video/windows/SDL_windowswindow.c",
|
||||||
|
"SDL2/src/video/yuv2rgb/yuv_rgb_lsx.c",
|
||||||
|
"SDL2/src/video/yuv2rgb/yuv_rgb_sse.c",
|
||||||
|
"SDL2/src/video/yuv2rgb/yuv_rgb_std.c",
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
The MIT License
|
The MIT License
|
||||||
|
|
||||||
Copyright (c) 2012-2013 Christian Rau
|
Copyright (c) 2012-2017 Christian Rau
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
HALF-PRECISION FLOATING POINT LIBRARY (Version 1.11.0)
|
HALF-PRECISION FLOATING POINT LIBRARY (Version 1.12.0)
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
|
|
||||||
This is a C++ header-only library to provide an IEEE 754 conformant 16-bit
|
This is a C++ header-only library to provide an IEEE 754 conformant 16-bit
|
||||||
|
@ -29,14 +29,15 @@ or when a feature should be explicitly disabled:
|
||||||
- Static assertions for extended compile-time checks (enabled for VC++ 2010,
|
- Static assertions for extended compile-time checks (enabled for VC++ 2010,
|
||||||
gcc 4.3, clang 2.9 and newer, overridable with 'HALF_ENABLE_CPP11_STATIC_ASSERT').
|
gcc 4.3, clang 2.9 and newer, overridable with 'HALF_ENABLE_CPP11_STATIC_ASSERT').
|
||||||
|
|
||||||
- Generalized constant expressions (enabled for gcc 4.6, clang 3.1 and newer,
|
- Generalized constant expressions (enabled for VC++ 2015, gcc 4.6, clang 3.1
|
||||||
overridable with 'HALF_ENABLE_CPP11_CONSTEXPR').
|
and newer, overridable with 'HALF_ENABLE_CPP11_CONSTEXPR').
|
||||||
|
|
||||||
- noexcept exception specifications (enabled for gcc 4.6, clang 3.0 and newer,
|
- noexcept exception specifications (enabled for VC++ 2015, gcc 4.6, clang 3.0
|
||||||
overridable with 'HALF_ENABLE_CPP11_NOEXCEPT').
|
and newer, overridable with 'HALF_ENABLE_CPP11_NOEXCEPT').
|
||||||
|
|
||||||
- User-defined literals for half-precision literals to work (enabled for
|
- User-defined literals for half-precision literals to work (enabled for
|
||||||
gcc 4.7, clang 3.1 and newer, overridable with 'HALF_ENABLE_CPP11_USER_LITERALS').
|
VC++ 2015, gcc 4.7, clang 3.1 and newer, overridable with
|
||||||
|
'HALF_ENABLE_CPP11_USER_LITERALS').
|
||||||
|
|
||||||
- Type traits and template meta-programming features from <type_traits>
|
- Type traits and template meta-programming features from <type_traits>
|
||||||
(enabled for VC++ 2010, libstdc++ 4.3, libc++ and newer, overridable with
|
(enabled for VC++ 2010, libstdc++ 4.3, libc++ and newer, overridable with
|
||||||
|
@ -53,7 +54,7 @@ or when a feature should be explicitly disabled:
|
||||||
- Hash functor 'std::hash' from <functional> (enabled for VC++ 2010,
|
- Hash functor 'std::hash' from <functional> (enabled for VC++ 2010,
|
||||||
libstdc++ 4.3, libc++ and newer, overridable with 'HALF_ENABLE_CPP11_HASH').
|
libstdc++ 4.3, libc++ and newer, overridable with 'HALF_ENABLE_CPP11_HASH').
|
||||||
|
|
||||||
The library has been tested successfully with Visual C++ 2005-2013, gcc 4.4-4.8
|
The library has been tested successfully with Visual C++ 2005-2015, gcc 4.4-4.8
|
||||||
and clang 3.1. Please contact me if you have any problems, suggestions or even
|
and clang 3.1. Please contact me if you have any problems, suggestions or even
|
||||||
just success testing it on other platforms.
|
just success testing it on other platforms.
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ Furthermore the library provides proper specializations for
|
||||||
the library also defines the 'HUGE_VALH' constant and maybe the 'FP_FAST_FMAH'
|
the library also defines the 'HUGE_VALH' constant and maybe the 'FP_FAST_FMAH'
|
||||||
symbol.
|
symbol.
|
||||||
|
|
||||||
CONVERSIONS
|
CONVERSIONS AND ROUNDING
|
||||||
|
|
||||||
The half is explicitly constructible/convertible from a single-precision float
|
The half is explicitly constructible/convertible from a single-precision float
|
||||||
argument. Thus it is also explicitly constructible/convertible from any type
|
argument. Thus it is also explicitly constructible/convertible from any type
|
||||||
|
@ -122,7 +123,7 @@ you can also directly assign float values to halfs.
|
||||||
|
|
||||||
In contrast to the float-to-half conversion, which reduces precision, the
|
In contrast to the float-to-half conversion, which reduces precision, the
|
||||||
conversion from half to float (and thus to any other type implicitly
|
conversion from half to float (and thus to any other type implicitly
|
||||||
convertible to float) is implicit, because all values represetable with
|
convertible from float) is implicit, because all values represetable with
|
||||||
half-precision are also representable with single-precision. This way the
|
half-precision are also representable with single-precision. This way the
|
||||||
half-to-float conversion behaves similar to the builtin float-to-double
|
half-to-float conversion behaves similar to the builtin float-to-double
|
||||||
conversion and all arithmetic expressions involving both half-precision and
|
conversion and all arithmetic expressions involving both half-precision and
|
||||||
|
@ -156,20 +157,23 @@ to 'std::numeric_limits<float>::round_style'):
|
||||||
In addition to changing the overall default rounding mode one can also use the
|
In addition to changing the overall default rounding mode one can also use the
|
||||||
'half_cast'. This converts between half and any built-in arithmetic type using
|
'half_cast'. This converts between half and any built-in arithmetic type using
|
||||||
a configurable rounding mode (or the default rounding mode if none is
|
a configurable rounding mode (or the default rounding mode if none is
|
||||||
specified). In addition to a configurable rounding mode, 'half_cast' has two
|
specified). In addition to a configurable rounding mode, 'half_cast' has
|
||||||
other differences to a mere 'static_cast': (1) Floating point types are
|
another big difference to a mere 'static_cast': Any conversions are performed
|
||||||
explicitly cast to float before being converted to half-precision and thus any
|
directly using the given rounding mode, without any intermediate conversion
|
||||||
warnings for narrowing conversions are suppressed. (2) Conversions to/from
|
to/from 'float'. This is especially relevant for conversions to integer types,
|
||||||
integer types are performed directly using the given rounding mode, without any
|
which don't necessarily truncate anymore. But also for conversions from
|
||||||
intermediate conversion to/from float.
|
'double' or 'long double' this may produce more precise results than a
|
||||||
|
pre-conversion to 'float' using the single-precision implementation's current
|
||||||
|
rounding mode would.
|
||||||
|
|
||||||
half a = half_cast<half>(4.2);
|
half a = half_cast<half>(4.2);
|
||||||
half b = half_cast<half,std::numeric_limits<float>::round_style>(4.2f);
|
half b = half_cast<half,std::numeric_limits<float>::round_style>(4.2f);
|
||||||
assert( half_cast<int, std::round_to_nearest>( 0.7_h ) == 1 );
|
assert( half_cast<int, std::round_to_nearest>( 0.7_h ) == 1 );
|
||||||
assert( half_cast<half,std::round_toward_zero>( 4097 ) == 4096.0_h );
|
assert( half_cast<half,std::round_toward_zero>( 4097 ) == 4096.0_h );
|
||||||
assert( half_cast<half,std::round_toward_infinity>( 4097 ) == 4100.0_h );
|
assert( half_cast<half,std::round_toward_infinity>( 4097 ) == 4100.0_h );
|
||||||
|
assert( half_cast<half,std::round_toward_infinity>( std::numeric_limits<double>::min() ) > 0.0_h );
|
||||||
|
|
||||||
When using round to nearest (either as default or thorugh 'half_cast') ties are
|
When using round to nearest (either as default or through 'half_cast') ties are
|
||||||
by default resolved by rounding them away from zero (and thus equal to the
|
by default resolved by rounding them away from zero (and thus equal to the
|
||||||
behaviour of the 'round' function). But by redefining the
|
behaviour of the 'round' function). But by redefining the
|
||||||
'HALF_ROUND_TIES_TO_EVEN' preprocessor symbol to 1 (before including half.hpp)
|
'HALF_ROUND_TIES_TO_EVEN' preprocessor symbol to 1 (before including half.hpp)
|
||||||
|
@ -207,9 +211,9 @@ implication is, that in the presence of rounding errors or over-/underflows
|
||||||
arithmetic expressions may produce different results when compared to
|
arithmetic expressions may produce different results when compared to
|
||||||
converting to half-precision after each individual operation:
|
converting to half-precision after each individual operation:
|
||||||
|
|
||||||
half a = (std::numeric_limits<half>::max() * 2.0_h) / 2.0_h; // a = MAX
|
half a = std::numeric_limits<half>::max() * 2.0_h / 2.0_h; // a = MAX
|
||||||
half b = std::numeric_limits<half>::max() * 2.0_h; // b = INF
|
half b = half(std::numeric_limits<half>::max() * 2.0_h) / 2.0_h; // b = INF
|
||||||
b /= 2.0_h; // b stays INF
|
assert( a != b );
|
||||||
|
|
||||||
But this should only be a problem in very few cases. One last word has to be
|
But this should only be a problem in very few cases. One last word has to be
|
||||||
said when talking about performance. Even with its efforts in reducing
|
said when talking about performance. Even with its efforts in reducing
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1 +1 @@
|
||||||
Subproject commit ccdf68421bc8eb85693f573080fc0a5faad862db
|
Subproject commit cf209c915b849141ed9821fea883fd04bcc34859
|
Loading…
Reference in New Issue